UQTk: Uncertainty Quantification Toolkit 3.1.5
|
Header file for array tools. More...
Go to the source code of this file.
Functions | |
template<typename T > | |
void | array1Dto2D (Array1D< T > &arr_1d, Array2D< T > &arr) |
Store a given 1d array in a 2d array with a single second dimension. | |
template<typename T > | |
void | array2Dto1D (Array2D< T > &arr_2d, Array1D< T > &arr) |
Store a given 2d array with a single second dimension in a 1d array. | |
template<typename T > | |
void | paste (Array1D< T > &arr1, Array1D< T > &arr2, Array2D< T > &arr) |
Paste two 1d arrays of same size into a single 2d array with second dimension equal to two. | |
template<typename T > | |
void | generate_multigrid (Array2D< T > &multigrid, Array2D< T > &grid) |
Generates multigrid as a cartesian product of each column of grid. | |
void | paste (Array2D< double > &x, Array2D< double > &y, Array2D< double > &xy) |
Paste two 2D arrays next to each other (horizontal stack) | |
void | merge (Array2D< double > &x, Array2D< double > &y, Array2D< double > &xy) |
Merge 2d double arrays (vertical stack) | |
void | merge (Array1D< double > &x, Array1D< double > &y, Array1D< double > &xy) |
Merge 1d double arrays. | |
void | merge (Array1D< int > &x, Array1D< int > &y, Array1D< int > &xy) |
Merge 1d int arrays. | |
void | append (Array1D< double > &x, Array1D< double > &y) |
Append array y to array x in place (double format) | |
void | append (Array1D< int > &x, Array1D< int > &y) |
Append array y to array x in place (int format) | |
template<typename T > | |
void | transpose (Array2D< T > &x, Array2D< T > &xt) |
Transpose a 2d double or int array x and return the result in xt. | |
void | flatten (Array2D< double > &arr_2, Array1D< double > &arr_1) |
Unfold/flatten a 2d array into a 1d array (double format) | |
void | fold_1dto2d_rowfirst (Array1D< double > &x1, Array2D< double > &x2) |
Fold a 1d array into a 2d array (double format), row first. | |
void | fold_1dto2d_colfirst (Array1D< double > &x1, Array2D< double > &x2) |
Fold a 1d array into a 2d array (double format), column first. | |
void | swap (Array1D< double > &arr, int i, int j) |
Swap i-th and j-th elements of the array arr. | |
void | swap (Array2D< double > &arr, int i, int j) |
Swap i-th and j-th rows of the 2d array arr. | |
double | access (int nx, int ny, Array1D< double > &arr_1, int i, int j) |
Access element from 1D array 'arr_1'. | |
double | accessPythonHelper (int nx, int ny, Array1D< double > &arr_1, int i, int j) |
Function written exclusively for Pybind11 to be able to load in the function access. | |
template<typename T > | |
void | getRow (Array2D< T > &arr2d, int k, Array1D< T > &arr1d) |
Retrieves row 'k' from 2D array 'arr2d' and returns it in 1D array 'arr1d'. | |
template<typename T > | |
void | getCol (Array2D< T > &arr2d, int k, Array1D< T > &arr1d) |
Retrieves column 'k' from 2D array 'arr2d' and returns it in 1D array 'arr1d'. | |
template<typename T > | |
void | addVal (int n, T *arr1d, T val) |
Adds 'val' to the first n elements of an array pointer (double or int) | |
template<typename T > | |
void | addVal (Array1D< T > &arr1d, T val) |
Adds 'val' to all elements of 1D array arr1d (double or int) | |
template<typename T > | |
void | addVal (Array2D< T > &arr2d, T val) |
Adds 'val' to all elements of 2D array arr2d (double or int) | |
template<typename T > | |
void | subVector (Array1D< T > &vector, Array1D< int > &ind, Array1D< T > &subvector) |
Extracts from 'vector', elements corresponding to indices 'ind' and returns them in 'subvector' (double or int) | |
template<typename T > | |
void | subMatrix_row (Array2D< T > &matrix, Array1D< int > &ind, Array2D< T > &submatrix) |
Extracts from 'matrix' rows corresponding to indices 'ind' and returns them in 'submatrix' (double or int) | |
template<typename T > | |
void | subMatrix_col (Array2D< T > &matrix, Array1D< int > &ind, Array2D< T > &submatrix) |
Extracts from 'matrix' columns corresponding to indices 'ind' and returns them in 'submatrix' (double or int) | |
template<typename T > | |
void | matPvec (Array2D< T > &matrix, const Array1D< T > &rc, T alpha, char *RC) |
Adds scaled row or column to all rows / columns of a matrix (double or int) | |
template<typename T > | |
T | maxVal (const Array1D< T > &vector, int *indx) |
Returns maximum value in 'vector' and its location in *indx (double or int) | |
void | setdiff (Array1D< int > &A, Array1D< int > &B, Array1D< int > &C) |
Returns (C=Elements of A that are not in B); C is sorted in ascending order. | |
void | setdiff_s (Array1D< int > &A, Array1D< int > &B, Array1D< int > &C) |
Returns ( C=Elements of A that are not in B); C is sorted in ascending order. | |
void | shell_sort (int *a, int n) |
Sorts integer array. | |
void | shell_sort (Array1D< int > &array) |
Sorts integer array in ascending order. | |
void | shell_sort (Array1D< double > &array) |
Sorts double array in ascending order. | |
void | shell_sort_col (Array2D< double > &array, int col, Array1D< int > &newInd, Array1D< int > &oldInd) |
Sorts double array in ascending order according to a given column. | |
void | shell_sort_all (Array2D< double > &array, Array1D< int > &newInd, Array1D< int > &oldInd) |
Sorts double array in ascending order according to first column, then second column breaks the tie, and so on. | |
void | quicksort3 (Array1D< double > &arr, int l, int r) |
Quick-sort with 3-way partitioning of array between indices l and r. | |
void | quicksort3 (Array2D< double > &arr, int left, int right, int col) |
Quick-sort with 3-way partitioning of 2d array between indices l and r, according to column col. | |
void | quicksort3 (Array2D< double > &arr, int left, int right) |
Quick-sort with 3-way partitioning of 2d array between indices l and r, and sorting is done comparing rows (by first element, then by second, etc...) | |
void | intersect (Array1D< int > &A, Array1D< int > &B, Array1D< int > &C, Array1D< int > &iA, Array1D< int > &iB) |
Finds common entries in 1D arrays 'A' and 'B' and returns them in 'C', sorted in ascending order. It also returns the original locations of these entries in 1D arrays 'iA' and 'iB', respectively. | |
void | intersect (Array1D< int > &A, Array1D< int > &B, Array1D< int > &C) |
Find common entries in 1D arrays 'A' and 'B' and return them in 'C', sorted in ascending order. | |
template<typename T > | |
void | find (Array1D< T > &theta, T lmbda, string type, Array1D< int > &indx) |
Return list of indices corresponding to elements of 1D array theta that are: larger ( type="gt" ), larger or equal ( type="ge" ), smaller ( type="lt" ), smaller or equal ( type="le" ) than lmbda. | |
void | prodAlphaMatVec (Array2D< double > &A, Array1D< double > &x, double alpha, Array1D< double > &y) |
Returns , where 'A' is a 2D array, 'x' is 1D array of size and 'alpha' is a scalar. The 1D array 'y' has elements. | |
void | prodAlphaMatTVec (Array2D< double > &A, Array1D< double > &x, double alpha, Array1D< double > &y) |
Returns , where 'A' is a 2D array, 'x' is 1D array of size and 'alpha' is a scalar. The 1D array 'y' has elements. | |
void | prodAlphaMatMat (Array2D< double > &A, Array2D< double > &B, double alpha, Array2D< double > &C) |
Returns , where 'A' and 'B' are 2D arrays and 'alpha' is a scalar. The 2D array 'C' has elements. | |
void | prodAlphaMatTMat (Array2D< double > &A, Array2D< double > &B, double alpha, Array2D< double > &C) |
Returns , where 'A' and 'B' are 2D arrays and 'alpha' is a scalar. The 2D array 'C' has elements. | |
void | addVecAlphaVecPow (Array1D< double > &x, double alpha, Array1D< double > &y, int ip) |
Implements , where 'x' and 'y' are 1D arrays with elements. | |
double | prod_vecTmatvec (Array1D< double > &a, Array2D< double > &B, Array1D< double > &c) |
Returns . | |
Array2D< double > | MatTMat (Array2D< double > &A) |
Returns , where 'A' is a 2D array. | |
template<typename T > | |
void | delRow (Array2D< T > &A, int irow) |
Deletes row 'irow' from 2D array 'A'. | |
template<typename T > | |
void | delCol (Array2D< T > &A, int icol) |
Deletes column 'icol' from 2D array 'A'. | |
template<typename T > | |
void | delCol (Array1D< T > &x, int icol) |
Deletes element 'icol' from 1D array 'A'. | |
void | paddMatRow (Array2D< double > &A, Array1D< double > &x) |
Padds 2D array 'A' with the row 'x'. | |
void | paddMatCol (Array2D< double > &A, Array1D< double > &x) |
Padds 2D array 'A' with the column 'x'. | |
void | paddMatRow (Array2D< int > &A, Array1D< int > &x) |
Padds 2D array 'A' with the row 'x'. | |
void | paddMatCol (Array2D< int > &A, Array1D< int > &x) |
Padds 2D array 'A' with the column 'x'. | |
void | paddMatColScal (Array2D< double > &A, Array1D< double > &x, double scal) |
Padds square 2D array 'A' with the elements of 'x' and 'scal' as follows: and . | |
bool | is_equal (Array1D< int > &a, Array1D< int > &b) |
Checks if two 1d int arrays are equal. | |
bool | is_equal (Array1D< double > &a, Array1D< double > &b) |
Checks if two 1d double arrays are equal. | |
bool | is_less (Array1D< int > &a, Array1D< int > &b) |
Checks if one 1d int array is less than another (by first element, then by second, etc...) | |
bool | is_less (Array1D< double > &a, Array1D< double > &b) |
Checks if one 1d double array is less than another (by first element, then by second, etc...) | |
int | vecIsInArray (Array1D< int > &vec, Array2D< int > &array) |
Checks if vec matches with any of the rows of array Returns the row number, or -1 if vec is not equal to any of the rows of array. | |
double | select_kth (int k, Array1D< double > &arr) |
Select the k-th smallest element of an array arr. | |
double | logdeterm (Array2D< double > &mat) |
Log-determinant of a real symmetric positive-definite matrix. | |
double | trace (Array2D< double > &mat) |
Trace of a matrix. | |
double | evalLogMVN (Array1D< double > &x, Array1D< double > &mu, Array2D< double > &Sigma) |
Evaluates the natural logarithm of a multivariate normal distribution. | |
Array2D< double > | diag (Array1D< double > &diagonal_array) |
Returns a diagonal matrix with a given diagonal. | |
Array1D< double > | copy (Array1D< double > &) |
Returns a copy of 1D array. | |
Array2D< double > | copy (Array2D< double > &) |
Return a copy of 2D Array. | |
Array2D< double > | mtxdel (Array2D< double > &, int index, int dim) |
Deletes matrix columns or rows. Index specifies which column or row and dim = 1 deletes column, dim = 0 deletes the row. | |
Array1D< double > | add (Array1D< double > &, Array1D< double > &) |
Add two 1D Arrays and returns sum (must be of the same shape) | |
Array2D< double > | add (Array2D< double > &, Array2D< double > &) |
Add two 2D Arrays and returns sum (must be of same shape) | |
void | addinplace (Array2D< double > &x, Array2D< double > &y) |
Add two 2D Arrays in place. Summation is returned as x. | |
void | addinplace (Array1D< double > &x, Array1D< double > &y) |
Add two 1D Arrays in place. Summation is returned as x. | |
Array1D< double > | subtract (Array1D< double > &, Array1D< double > &) |
Returns subtraction of two 1D Arrays (must be of the same shape) | |
Array2D< double > | subtract (Array2D< double > &, Array2D< double > &) |
Returns subtraction of two 2D Arrays (must be of the same shape) | |
void | subtractinplace (Array2D< double > &x, Array2D< double > &y) |
Subtract two 2D Arrays in place. Difference is returned as x. | |
void | subtractinplace (Array1D< double > &x, Array1D< double > &y) |
Subtract two 1D Arrays in place. Difference is returned as x. | |
Array1D< double > | scale (Array1D< double > &, double) |
Returns 1D Arrays scaled by a double. | |
Array2D< double > | scale (Array2D< double > &, double) |
Returns 2D Array scaled by a double. | |
void | scaleinplace (Array1D< double > &, double) |
Multiply Array1D by double in place. | |
void | scaleinplace (Array1D< int > &, int) |
Multiply Array1D by int in place. | |
void | scaleinplace (Array2D< double > &, double) |
Multiply Array2D by double in place. | |
void | scaleinplace (Array2D< int > &, int) |
Multiply Array2D by int in place. | |
Array2D< double > | dotmult (Array2D< double > &A, Array2D< double > &B) |
Returns the elementwise multiplication of two 2D Arrays. | |
Array1D< double > | dotmult (Array1D< double > &A, Array1D< double > &B) |
Returns the elementwise multiplication of two 1D Arrays. | |
Array2D< double > | dotdivide (Array2D< double > &A, Array2D< double > &B) |
Returns the elementwise division of two 2D Arrays. | |
Array1D< double > | dotdivide (Array1D< double > &A, Array1D< double > &B) |
Returns the elementwise division of two 1D Arrays. | |
double | norm (Array1D< double > &) |
Returns norm of 1D Array (Euclidean) | |
double | dist_sq (Array1D< double > &x, Array1D< double > &y, Array1D< double > &w) |
Weighted vector distance-squared. | |
Array2D< double > | Trans (Array2D< double > &) |
Returns the transpose of a 2D Array. | |
double | dot (Array1D< double > &, Array1D< double > &) |
Returns the dot product of two 1D Arrays (must be of the same length) | |
Array1D< double > | dot (Array2D< double > &, Array1D< double > &) |
Returns the matrix vector product. | |
Array2D< double > | dot (Array2D< double > &, Array2D< double > &) |
Returns the matrix matrix product. | |
Array2D< double > | dotT (Array2D< double > &, Array2D< double > &) |
Returns the matrix matrix^T product. | |
Array2D< double > | INV (Array2D< double > &A) |
Returns the inverse of a square 2D Array. | |
Array2D< double > | AinvH (Array2D< double > &A, Array2D< double > &H) |
Solves linear system AX=H, i.e. returns A^(-1)*H, where A is real, symmetric and positive definite. | |
Array1D< double > | Ainvb (Array2D< double > &A, Array1D< double > &b) |
Solves linear system Ax=b, i.e. return A^(-1)*b where A is real, symmetric and positive definite. | |
void | LSTSQ (Array2D< double > &A, Array1D< double > &b, Array1D< double > &x) |
Least squares solution for overdetermined system. Note that A must be "taller than wide". Solution is returned in x. | |
void | QR (Array2D< double > &B, Array2D< double > &Q, Array2D< double > &R) |
Computes the QR factorization of a 2D Array (need not be square) | |
void | SVD (Array2D< double > &A, Array2D< double > &U, Array1D< double > &S, Array2D< double > &VT) |
Computes the SVD calculation of a 2D Array (need not be square) | |
void | printarray (Array1D< double > &) |
Prints 1D double Array to screen (alternative to for loop using cout) | |
void | printarray (Array1D< int > &) |
Prints 1D int Array to screen (alternative to for loop using cout) | |
void | printarray (Array2D< double > &) |
Prints 2D double Array to screen (alternative to for loop using cout) | |
void | printarray (Array2D< int > &) |
Prints 2D int Array to screen (alternative to for loop using cout) | |
Header file for array tools.
Some functions are not optimal in terms of array access.
Some functions should be templated and or moved to array class
double access | ( | int | nx, |
int | ny, | ||
Array1D< double > & | arr_1, | ||
int | i, | ||
int | j ) |
Access element from 1D array 'arr_1'.
double accessPythonHelper | ( | int | nx, |
int | ny, | ||
Array1D< double > & | arr_1, | ||
int | i, | ||
int | j ) |
Function written exclusively for Pybind11 to be able to load in the function access.
Add two 1D Arrays and returns sum (must be of the same shape)
Add two 2D Arrays and returns sum (must be of same shape)
Add two 1D Arrays in place. Summation is returned as x.
Add two 2D Arrays in place. Summation is returned as x.
void addVal | ( | Array1D< T > & | arr1d, |
T | val ) |
Adds 'val' to all elements of 1D array arr1d (double or int)
void addVal | ( | Array2D< T > & | arr2d, |
T | val ) |
Adds 'val' to all elements of 2D array arr2d (double or int)
void addVal | ( | int | n, |
T * | arr1d, | ||
T | val ) |
Adds 'val' to the first n elements of an array pointer (double or int)
Implements , where 'x' and 'y' are 1D arrays with elements.
Solves linear system Ax=b, i.e. return A^(-1)*b where A is real, symmetric and positive definite.
Solves linear system AX=H, i.e. returns A^(-1)*H, where A is real, symmetric and positive definite.
Append array y to array x in place (double format)
Append array y to array x in place (int format)
Store a given 1d array in a 2d array with a single second dimension.
Store a given 2d array with a single second dimension in a 1d array.
void delCol | ( | Array1D< T > & | x, |
int | icol ) |
void delCol | ( | Array2D< T > & | A, |
int | icol ) |
void delRow | ( | Array2D< T > & | A, |
int | irow ) |
Returns a diagonal matrix with a given diagonal.
Weighted vector distance-squared.
Returns the dot product of two 1D Arrays (must be of the same length)
Returns the matrix vector product.
Returns the matrix matrix product.
Returns the elementwise division of two 1D Arrays.
Returns the elementwise division of two 2D Arrays.
Returns the elementwise multiplication of two 1D Arrays.
Returns the elementwise multiplication of two 2D Arrays.
Returns the matrix matrix^T product.
Evaluates the natural logarithm of a multivariate normal distribution.
void find | ( | Array1D< T > & | theta, |
T | lmbda, | ||
string | type, | ||
Array1D< int > & | indx ) |
Return list of indices corresponding to elements of 1D array theta that are: larger ( type="gt" ), larger or equal ( type="ge" ), smaller ( type="lt" ), smaller or equal ( type="le" ) than lmbda.
Unfold/flatten a 2d array into a 1d array (double format)
Fold a 1d array into a 2d array (double format), column first.
Fold a 1d array into a 2d array (double format), row first.
Generates multigrid as a cartesian product of each column of grid.
Retrieves column 'k' from 2D array 'arr2d' and returns it in 1D array 'arr1d'.
Retrieves row 'k' from 2D array 'arr2d' and returns it in 1D array 'arr1d'.
Find common entries in 1D arrays 'A' and 'B' and return them in 'C', sorted in ascending order.
void intersect | ( | Array1D< int > & | A, |
Array1D< int > & | B, | ||
Array1D< int > & | C, | ||
Array1D< int > & | iA, | ||
Array1D< int > & | iB ) |
Finds common entries in 1D arrays 'A' and 'B' and returns them in 'C', sorted in ascending order. It also returns the original locations of these entries in 1D arrays 'iA' and 'iB', respectively.
Checks if two 1d double arrays are equal.
Checks if one 1d double array is less than another (by first element, then by second, etc...)
Checks if one 1d int array is less than another (by first element, then by second, etc...)
double logdeterm | ( | Array2D< double > & | mat | ) |
Log-determinant of a real symmetric positive-definite matrix.
Least squares solution for overdetermined system. Note that A must be "taller than wide". Solution is returned in x.
void matPvec | ( | Array2D< T > & | matrix, |
const Array1D< T > & | rc, | ||
T | alpha, | ||
char * | RC ) |
Adds scaled row or column to all rows / columns of a matrix (double or int)
T maxVal | ( | const Array1D< T > & | vector, |
int * | indx ) |
Returns maximum value in 'vector' and its location in *indx (double or int)
Merge 1d double arrays.
Merge 2d double arrays (vertical stack)
Deletes matrix columns or rows. Index specifies which column or row and dim = 1 deletes column, dim = 0 deletes the row.
double norm | ( | Array1D< double > & | x | ) |
Returns norm of 1D Array (Euclidean)
Padds 2D array 'A' with the column 'x'.
Padds 2D array 'A' with the column 'x'.
Padds square 2D array 'A' with the elements of 'x' and 'scal' as follows: and .
Padds 2D array 'A' with the row 'x'.
Padds 2D array 'A' with the row 'x'.
Paste two 1d arrays of same size into a single 2d array with second dimension equal to two.
Paste two 2D arrays next to each other (horizontal stack)
void printarray | ( | Array1D< double > & | x | ) |
Prints 1D double Array to screen (alternative to for loop using cout)
void printarray | ( | Array1D< int > & | x | ) |
Prints 1D int Array to screen (alternative to for loop using cout)
void printarray | ( | Array2D< double > & | x | ) |
Prints 2D double Array to screen (alternative to for loop using cout)
void printarray | ( | Array2D< int > & | x | ) |
Prints 2D int Array to screen (alternative to for loop using cout)
Returns .
void prodAlphaMatMat | ( | Array2D< double > & | A, |
Array2D< double > & | B, | ||
double | alpha, | ||
Array2D< double > & | C ) |
Returns , where 'A' and 'B' are 2D arrays and 'alpha' is a scalar. The 2D array 'C' has elements.
void prodAlphaMatTMat | ( | Array2D< double > & | A, |
Array2D< double > & | B, | ||
double | alpha, | ||
Array2D< double > & | C ) |
Returns , where 'A' and 'B' are 2D arrays and 'alpha' is a scalar. The 2D array 'C' has elements.
void prodAlphaMatTVec | ( | Array2D< double > & | A, |
Array1D< double > & | x, | ||
double | alpha, | ||
Array1D< double > & | y ) |
Returns , where 'A' is a 2D array, 'x' is 1D array of size and 'alpha' is a scalar. The 1D array 'y' has elements.
void prodAlphaMatVec | ( | Array2D< double > & | A, |
Array1D< double > & | x, | ||
double | alpha, | ||
Array1D< double > & | y ) |
Returns , where 'A' is a 2D array, 'x' is 1D array of size and 'alpha' is a scalar. The 1D array 'y' has elements.
Computes the QR factorization of a 2D Array (need not be square)
void quicksort3 | ( | Array1D< double > & | arr, |
int | l, | ||
int | r ) |
Quick-sort with 3-way partitioning of array between indices l and r.
void quicksort3 | ( | Array2D< double > & | arr, |
int | left, | ||
int | right ) |
Quick-sort with 3-way partitioning of 2d array between indices l and r, and sorting is done comparing rows (by first element, then by second, etc...)
void quicksort3 | ( | Array2D< double > & | arr, |
int | left, | ||
int | right, | ||
int | col ) |
Quick-sort with 3-way partitioning of 2d array between indices l and r, according to column col.
Returns 1D Arrays scaled by a double.
Returns 2D Array scaled by a double.
double select_kth | ( | int | k, |
Array1D< double > & | arr ) |
Select the k-th smallest element of an array arr.
Returns (C=Elements of A that are not in B); C is sorted in ascending order.
Returns ( C=Elements of A that are not in B); C is sorted in ascending order.
void shell_sort | ( | Array1D< double > & | array | ) |
Sorts double array in ascending order.
void shell_sort | ( | Array1D< int > & | array | ) |
Sorts integer array in ascending order.
void shell_sort | ( | int * | a, |
int | n ) |
Sorts integer array.
Sorts double array in ascending order according to first column, then second column breaks the tie, and so on.
void shell_sort_col | ( | Array2D< double > & | array, |
int | col, | ||
Array1D< int > & | newInd, | ||
Array1D< int > & | oldInd ) |
Sorts double array in ascending order according to a given column.
void subMatrix_col | ( | Array2D< T > & | matrix, |
Array1D< int > & | ind, | ||
Array2D< T > & | submatrix ) |
Extracts from 'matrix' columns corresponding to indices 'ind' and returns them in 'submatrix' (double or int)
void subMatrix_row | ( | Array2D< T > & | matrix, |
Array1D< int > & | ind, | ||
Array2D< T > & | submatrix ) |
Extracts from 'matrix' rows corresponding to indices 'ind' and returns them in 'submatrix' (double or int)
Returns subtraction of two 1D Arrays (must be of the same shape)
Returns subtraction of two 2D Arrays (must be of the same shape)
Subtract two 1D Arrays in place. Difference is returned as x.
Subtract two 2D Arrays in place. Difference is returned as x.
void subVector | ( | Array1D< T > & | vector, |
Array1D< int > & | ind, | ||
Array1D< T > & | subvector ) |
Extracts from 'vector', elements corresponding to indices 'ind' and returns them in 'subvector' (double or int)
void SVD | ( | Array2D< double > & | A, |
Array2D< double > & | U, | ||
Array1D< double > & | S, | ||
Array2D< double > & | VT ) |
Computes the SVD calculation of a 2D Array (need not be square)
void swap | ( | Array1D< double > & | arr, |
int | i, | ||
int | j ) |
Swap i-th and j-th elements of the array arr.
void swap | ( | Array2D< double > & | arr, |
int | i, | ||
int | j ) |
Swap i-th and j-th rows of the 2d array arr.
double trace | ( | Array2D< double > & | mat | ) |
Trace of a matrix.
Transpose a 2d double or int array x and return the result in xt.