ConicBundle
Max, Min, Sort, Find

For several matrix classes, the comparison operators "</<=/>/>=/==/!=" are overloaded for matrix to matrix comparisons within the same matrix class and for matrix to scalar or scalar to matrix relations. They all work in the same elementwise sense; we explain this for the "<" relation on matrices A, B (of the same size) and scalar d:

• A < B returns a {0,1}-matrix C of the same type and size having C_ij= (A_ij < B_ij) for all ij
• A < d returns a {0,1}-matrix C of the same type and size as A having C_ij= (A_ij < d) for all ij
• d < A returns a {0,1}-matrix C of the same type and size as A having C_ij= (d < A_ij) for all ij

For (almost all) matrix classes the following routines are available for max and min, which we explain for max:

• maxrows(A): returns a row vector having in each column the maximum value of the respective column of A.
• maxcols(A): returns a column vector having in each row the maximum value of the respective row of A.
• max(A): returns the maximum value of all elements in the matrix A.
• max(A,iind): returns the maximum value and index iind so that max(A)=A(iind).
• max(A,iind,jind): returns the maximum value and an index pair so that max(A)=A(iind,jind).

A sorting of the values of a matrix A is returned in the form of an index vector ind, so that the vector A(ind) is sorted in nondecreasing order:

• ind=A.sortindex(), ind=sortindex(A), sortindex(A,ind): returns ind so that A(ind(0))<=A(ind(1))<=...<=A(ind(A.dim()-1))

Likewise, routines for finding elements in a matrix A return an Indexmatrix, that gives the indices to all elements satisfying the find condition:

• ind=A.find(), ind=find(A): the Indexmatrix ind gives the indices to all nonzero elements of A (for real values within a tolerance, that can be specified).
• ind=A.find_number(scalar), ind=rind_number(A,scalar): the Indexmatrix ind gives the indices to all elements of A whose value equals the scalar (within a tolerance that can be specified).