Functions | |
list | argmax (matrix M) |
Returns the position(s) in a matrix that belong to maximum values. | |
list | argmax (list L) |
Returns the position(s) in a list that belong to maximum values. | |
list | argmin (matrix M) |
Returns the position(s) in a matrix that belong to minimum values. | |
list | argmin (list L) |
Returns the position(s) in a list that belong to minimal values. | |
list | argtrue (matrix M) |
Returns the position(s) in a matrix where the entries are not equal to zero after casting to a scalar. | |
list | argtrue (list L, counter RetainStructure) |
Returns the position(s) in a list where the entries are not equal to zero after casting to a scalar. | |
list | max (matrix M) |
Returns the maximum value for each matrix row. | |
list | max (list L) |
Returns maximum value of a list. | |
list | min (matrix M) |
Returns the minimum value for each matrix row. | |
list | min (list L) |
Returns minimum value of a list. | |
list | sort (list lData, code pCode, counter bApply) |
Sorting of a list of numbers or strings. | |
list | sort (list lData, counter bAscend, counter bApply) |
Sorting of a list of numbers or strings. |
|
Returns the position(s) in a matrix that belong to maximum values.
finally produces Constant = [[1, 1], [2, 2], [3, 3]] argmin . |
|
Returns the position(s) in a list that belong to maximum values.
argmin . |
|
Returns the position(s) in a matrix that belong to minimum values.
![]() ![]() |
|
Returns the position(s) in a list that belong to minimal values.
argtrue argmin doesn't return a nested list. Each elementary sublist (i.e. not nested any more) gives one minimum value, e.g. ? argmin([ [ [1,2], [3,4] ], [ [0,9], [7,5,3,2,1], [4,3] ], [1,2,3,4] ]); The result will be Constant = [[1, 1, 1], [1, 2, 1], [2, 1, 1], [2, 2, 5], [2, 3, 2], [3, 1]] |
|
Returns the position(s) in a matrix where the entries are not equal to zero after casting to a scalar.
The code example produces M = (| 0 -3 1 5|, | 0 0 0 0|, | 0 8 6 0|) T = [[1, 2], [1, 3], [1, 4], [3, 2], [3, 3]] Constant = [-3, 1, 5, 8, 6] |
|
Returns the position(s) in a list where the entries are not equal to zero after casting to a scalar.
![]() ![]() RetainStructure is set these entries are kept. Here is an example: ? L = [ [0,-3,1,5], [0,0,0,0], [0,8,[1,0,3],0] ]; ? T2 = argtrue( L ); ? T1 = argtrue( L , 1); ? L(T2); The output will be L = [[0, -3, 1, 5], [0, 0, 0, 0], [0, 8, [1, 0, 3], 0]] T2 = [[[1, 2], [1, 3], [1, 4]], [[3, 2], [[3, 3, 1], [3, 3, 3]]]] T1 = [[[1, 2], [1, 3], [1, 4]], [], [[3, 2], [[3, 3, 1], [3, 3, 3]]]] Constant = [[-3, 1, 5], [8, [1, 3]]] |
|
Returns the maximum value for each matrix row.
min . |
|
Returns maximum value of a list.
min . |
|
Returns the minimum value for each matrix row.
min(min(M)); . |
|
Returns minimum value of a list.
L = [ [ [1,2], [3,4] ], [ [0,9], [7,5,3,2,1], [4,3] ], [ 1,2,3,4] ]; ? min( L ); // works // ? min( [ 1,2,3, [1,2] ] ); // not regular - doesn't work // ? min(min( L )); // not regular - doesn't work Constant = [[1, 3], [0, 1, 3], 1] . |
|
Sorting of a list of numbers or strings.
The following example sorts a list of vectors according their lengths, from the shortest to the longest.
SortFunc = { abs(_P(1)) < abs(_P(2)) } ?lVec = [VecE3(1,2,0), VecE3(0,1,0), VecE3(1,-1,0)]; ?lIdx = sort(lVec, SortFunc); ?lVec; Output:
lVec (3)=
|
|
Sorting of a list of numbers or strings.
?lData = [3,1,2]; ?lIdx = sort(lData); ?lData; Output:
lData (3)=
The list
?lData = [3,1,2]; ?lIdx = sort(lData, true, false); ?lData; ?lData(lIdx); Output:
lData (3)=
Here the sorting index list is returned, but the list itself is not reordered. Note that sort() also orders lists of strings and mixed lists of scalars and string. In the latter case, scalars are always regarded as 'smaller' than strings. |