  C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD # countfis or sum if array to work out if given time is between the value of two columns  » excel » countfis or sum if array to work out if given time is between the value of two columns

By : Konstantinos Daras
Date : November 22 2020, 10:56 AM
I hope this helps . If I understand correctly, you want a 0 or 1 for each of the times in row 10 that you can use a conditional format on to show red or nothing. In A10 try,
=COUNTIFS(\$A\$2:\$A\$5,"<"&A\$10, \$B\$2:\$B\$5,">"&A\$10) code : ## Swap rows or columns of a 2d array in O(1) time in c++

By : Thomas Wyrick
Date : March 29 2020, 07:55 AM
I hope this helps you . You can use an indirect array on both rows and columns. In other words to access an element i,j you use
code :
``````data[rowix[i]][colix[j]]
``````
``````data[i][j]
``````
``````template<int ROWS, int COLS, typename T>
struct Mat2d {
T data[ROWS][COLS];
int colix[COLS], rowix[ROWS];
Mat2d() {
for (int i=0; i<ROWS; i++) {
for (int j=0; j<COLS; j++) {
data[i][j] = T();
}
}
for (int i=0; i<ROWS; i++) rowix[i] = i;
for (int j=0; j<COLS; j++) colix[j] = j;
}
T& operator()(int i, int j) { return data[rowix[i]][colix[j]]; }
T operator()(int i, int j) const { return data[rowix[i]][colix[j]]; }
void swapRows(int i1, int i2) { std::swap(rowix[i1], rowix[i2]); }
void swapCols(int j1, int j2) { std::swap(colix[j1], colix[j2]); }
};
`````` ## OpenCL: 2-10x run time summing columns rather that rows of square array?

By : patafix
Date : March 29 2020, 07:55 AM
With these it helps This is a clear case of example of coalescence. It is not about how the index is used (in the rows or columns), but how the memory is accessed in the HW. Just a matter of following step by step how the real accesses are performed and in which order.
Lets analyze it properly:
code :
``````WI_0 will read 0, Gs, 2Gs, 3Gs, .... (k-1)Gs
WI_1 will read 1, Gs+1, 2Gs+1, 3Gs+1, .... (k-1)Gs+1
...
``````
``````First iteration: 0, 1, 2, 3 ... N-1  -> Groups into few memory access
Second iteration: Gs, Gs+1, Gs+2, ... Gs+N-1  ->  Groups into few memory access
...
``````
``````WI_0 will read 0, 1, 2, 3, .... (k-1)
WI_1 will read Gs, Gs+1, Gs+2, Gs+3, .... Gs+(k-1)
...
``````
``````First iteration: 0, Gs, 2Gs, 3Gs -> Scattered read, no grouping
Second iteration: 1, Gs+1, 2Gs+1, 3Gs+1 ->Scattered read, no grouping
...
`````` ## How to modify N columns of numpy array at the same time?

By : dopppler
Date : March 29 2020, 07:55 AM
I hope this helps . Use indexing:
Here is an example:
code :
``````>>> P[:, [0, 1, 3]] += 10
>>>
>>> P
array([[11, 12,  3, 18,  6],
[14, 15,  6, 14,  5],
[10,  8,  5, 13,  0]])
`````` ## how to compare 2 columns of a 2d array at a time with columns of another array in python

By : Fukuda
Date : March 29 2020, 07:55 AM
if array1[:2] == array2[:2]: compares all items from the index 0 to 2(2 is not included), and comes up with the same result as if array1 == array2 and array1 == array2:. Also, it is simpler.( to Wyatt for comment)
code :
``````def compare_columns(array1, array2):
if len(array1) != len(array2):
return False # If row numbers are not same, return false

for row_number in range(len(array1)):
if array1[row_number][:2] != array2[row_number][:2]:
return False # If the content is not equal, return false

return True # All of the content is equal, the return true

# For example, these are 2-dimensional arrays
array1 = [["1.1", "1.2", "Lord of the Day of Judgment!"],
["2.1", "2.2", "Lord of the Day of Judgment!"]]
array2 = [["1.1", "1.2", "مَالِكِ يَوْمِ الدِّينِ"],
["2.1", "2.2", "مَالِكِ يَوْمِ الدِّينِ"]]

array3 = []
if compare_columns(array1, array2):
array3.append('matches: {!r}'.format(array1))
print(array3)
``````
``````["matches: [['1.1', '1.2', 'Lord of the Day of Judgment!'], ['2.1', '2.2', 'Lord of the Day of Judgment!']]"]
``````
``````array1 = ["1stcolumn", "2ndColumn", "1-3rdColumn"]
array2 = ["1stcolumn", "2ndColumn", "2-3rdColumn"]
array3 = []
if array1 == array2 and array1 == array2:
array3.append('matches: {!r}'.format(array1))
print(array3)
``````
``````["matches: ['1stcolumn', '2ndColumn', '1-3rdColumn']"]
`````` ## Sort a range or array based on two columns that contain the date and time

By : RAB Guild
Date : March 29 2020, 07:55 AM
will be helpful for those in need Given your comment - you want to sort the written chunk - you have two methods available. One is to sort written data after writing, by using the Spreadsheet service's Range#sort(sortObject) method. The other is to sort the data before writing, using the JavaScript Array#sort(sortFunction()) method.
Currently, your sort code //regWeek.sort([{ column: 1, ascending: true }]); is attempting to sort a JavaScript array, using the sorting object expected by the Spreadsheet service. Thus, you can simply chain this .sort(...) call to your write call, as Range#setValues() returns the same Range, allowing repeated Range method calling (e.g. to set values, then apply formatting, etc.).
code :
``````ss.getRange(ss.getLastRow() + 1, 2, regWeek.length, regWeek.length)
.setValues(regWeek)
/* other "chainable" Range methods you want to apply to
the cells you just wrote to. */
.sort([{column: 1, ascending: true}, ...]);
``````
``````regWeek.sort(function (r1, r2) {
// r1 and r2 are elements in the regWeek array, i.e.
// they are each a row array if regWeek is an array of arrays:
// Sort ascending on the first column, which is index 0:
// if r1 = 1, r2 = 2, then 1 - 2 is -1, so r1 sorts before r2
return r1 - r2;
});
`````` 