| OptiVec Version 8
for C/C++ and for Pascal / Delphi
|
OptiCode
Dr. Martin Sander Software Development
Brahmsstr. 6
D-32756 Detmold
Germany
http://www.optivec.com
e-mail: optivec@gmx.de
| Part II: MatrixLib
|
A general description of OptiVec is given in HANDBOOK.HTM.
Chapter 1.2 of that file contains the licence terms for the Shareware version, Chapter 1.3 for the Registered version.
See FUNCREF.HTM for the description of individual VectorLib functions,
and CMATH.HTM for CMATH functions.
Contents
1. Introduction
1.1 Matrix Data Types
1.2 Prefixes of MatrixLib Functions
1.3 C/C++ Specifics
1.3.1 MatObj, the object-oriented interface for matrix functions
1.3.2 Direct-pointer form of matrix function calls
1.4 Pascal/Delphi Specifics
2. Management of Dynamically Generated Matrices
3. Initialization of Matrices
4. Data-Type Conversions
5. Symmetry Operations (Transposing, Rotating, Reflecting), Interpolation, Augmenting, Deleting, Extracting, and Filling Parts of a Matrix
6. Arithmetic Operations Performed on a Single Row, Column, or the Diagonal
7. Operations Performed Along All Rows or All Columns Simultaneously, or the Diagonal; Center Of Gravity
8. Operations Involving Two Rows or Two Colums
9. Whole-Matrix Arithmetics: Addition, Multiplication
10. Linear Algebra
11. Eigenvalues and Eigenvectors, Matrix Square-Root
12. Fourier-Transform Methods
13. Data Fitting
13.1 Polynomials
13.2 General Linear Model Functions
13.3 Non-Linear Models
13.4 Fitting Multiple Data Sets
13.5 Helper Functions for Nonlinear Fits
14. Matrix Input and Output
15. Graphical Representation of Matrices
16. Alphabetical Reference for MatrixLib
1. Introduction
The MatrixLib part of OptiVec builds upon the principles established in the VectorLib part. You may wish to refer to the introductory chapters of HANDBOOK.HTM, before reading on for MatrixLib.
Back to Table of Contents
1.1 Matrix Data Types
As VectorLib defines vector data types, here are the matrix data types, defined in MatrixLib:
fMatrix | matrix of floats |
dMatrix | matrix of doubles |
eMatrix | matrix of extended (long double) |
cfMatrix | matrix of fComplex (complex<float>) |
cdMatrix | matrix of dComplex (complex<double>) |
ceMatrix | matrix of eComplex (complex<extended>) |
iMatrix | matrix of int |
uMatrix | matrix of unsigned int |
and so on | for all other integer data types |
The ordering of elements is the same as in the two-dimensional arrays provided by the respective target compilers. This means that the matrices are stored row-wise in MatrixLib versions for C and C++ compilers, but column-wise in the Pascal/Delphi versions.
While we recommend to exclusively use these dynamically allocated matrix types, static matrices defined, e.g., as
float MX[4][6]; (for C/C++), or
MX: array[0..3][0..5] of Single; (for Pascal/Delphi)
can be used in all MatrixLib functions with the exception of the multiLinfit
and multiNonlinfit routines.
Back to Table of Contents
1.2 Prefixes of MatrixLib Functions
Each MatrixLib function has a prefix defining the data type on which it acts:
Prefix: | Arguments: |
MF_ | fMatrix, float and fVector |
MD_ | dMatrix, double and dVector |
ME_ | eMatrix, extended (long double) and eVector |
MCF_ | cfMatrix, fComplex and cfVector |
MCD_ | cdMatrix, dComplex and cdVector |
MCE_ | ceMatrix, eComplex and ceVector |
MI_ | iMatrix, int and iVector |
MU_ | uMatrix, unsigned int and uVector |
| similarly for all other integer types |
In a few cases, the prefix is augmented by a three-letter code denoting special matrix properties:
- MFdia_ means that the function expects a diagonal matrix (i.e., a square matrix which has non-zero elements only on the diagonal); as there is no sense in storing all the zeros, diagonal matrix are actually stored as vectors, holding only the diagonal elements.
- MFsym_ denotes a function which expects the input matrix to be symmetric. At present, only MFsym_eigenvalues and MFsym_sqrt make use of this assumption.
- MFtrd_ means the function is for a tridiagonal matrix (i.e., a square matrix with non-zero elements only on the diagonal plus or minus one column). A tridiagonal matrix has to be entered in the form of a matrix with three rows, representing the three vectors actually containing non-zero data. In other words, the original matrix
d0 | u0 | 0 | ··· | | |
l1 | d1 | u1 | 0 | ··· | |
0 | l2 | d2 | u2 | 0 | ··· |
| | | ··· | | |
| | | lN-2 | dN-2 | uN-2 |
| | | 0 | lN-1 | dN-1 |
is compacted into the form
u0 | u1 | u2 | ··· | uN-2 | * |
d0 | d1 | d2 | ··· | dN-2 | dN-1 |
* | l1 | l2 | ··· | lN-2 | lN-1 |
The elements l0 and uN-1, marked with an asterisk, are undefined and never used.
Back to Table of Contents
1.3 C/C++ Version Specifics
1.3.1 MatObj, the object-oriented interface for matrix functions
Similarly to the vector objects of VecObj, the object-oriented interface for the matrix functions is contained in the include-files <fMatObj.h>, <dMatObj.h> etc., with one include-file for each of the data-types supported in OptiVec. Remember that, in order to get the whole interface (for all data types at once),
#include <OptiVec.h>.
For access to any of the vector graphics functions, always include <OptiVec.h>.
By analogy with the alias names of the vector objects, the matrix objects get the alias names fMatObj, dMatObj, and so on, with the data-type signalled by the first one or two letters of the class name.
The matrix constructors are:
matrix(); // no memory allocated, dimensions set to 0
matrix( ui ht, ui len ); // ht by len matrix allocated
matrix( ui ht, ui len, T fill ); // as before, but initialized with value "fill"
matrix( matrix <T> init ); // creates a copy of the matrix "init"
For the matrix classes, the arithmetic operators
+ - * += -= *=
are defined.
While the vector-vector operator * refers to element-wise multiplication, the matrix-matrix, vector-matrix, or matrix-vector operator * means true matrix-matrix or matrix-vector multiplication.
If you ever need to process a MatObj matrix in a "classic" plain-C OptiVec function, you may use the member functions
getHt() and getLen() to retrieve the matrix dimensions,
getMatrix to obtain the actual matrix pointer of the data type fMatrix etc., or
getM0 for the vector M[0] of the data type fVector etc., which is actually a pointer to the first matrix element.
The syntax of all MatObj functions is described below together with
the basic MatrixLib functions for which tMatObj serves as a wrapper.
Please note the following restrictions, coming from the tight control of matrix dimensions for compatibility:
- With the "normal" MF_ functions, one can use some large matrix as working space for
matrices of smaller dimensions. As long as one does not access individual elements or rows, but uses only whole matrices, this allows to use one and the same working space, say for an [n * n] and an [m * n] matrix (m < n: neglect one or more rows). This is not possible in MatObj, where the matrix dimensions are encapsulated, and no distinction between "actual" and "used" dimensions can be made.
- It is not even possible to overwrite, e.g., a non-square matrix with its transpose, even if you were willing to sacrifice the row pointers, and even if the number of matrix elements obviously stays the same.
- All MatObj Dia_... functions require square matrices (ht = len), whereas MF_Dia_... functions work, in principle, with non-square matrices, as long as the parameter "len" in the function call corresponds to the smaller dimension.
- The multifit functions are not encapsulated, as the VF_EXPERIMENT and MF_EXPERIMENT structures need pointers rather than objects anyway.
1.3.2 Direct-pointer form of matrix function calls
In the C/C++ version of MatrixLib, all functions taking matrix arguments exist in a second form. In this form, all matrix arguments are replaced by pointers to the first elements of the respective matrices. You can explicitly use the second form by leaving away the underbar of the function-name prefix. Calling
MF_mulM( MC, MA, MB, htA, lenA, lenB );
is equivalent to calling
MFmulM(&(MC[0][0]),&(MA[0][0]),&(MB[0][0]),htA,lenA,lenB); or
MFmulM( MC[0], MA[0], MB[0], htA, lenA, lenB );
Actually, the run-time routines are in the second form, and the MatObj member functions as well as the macros defined in <MFstd.h> etc. convert calls to the first form into calls to the second form.
Back to Table of Contents
1.4 Pascal/Delphi Version Specifics:
In the Pascal/Delphi version of MatrixLib, matrices of all data types are actually defined as pointers to the element M[0][0]. This means you can pass static matrices (like MX: array[0..5][0..5] of Single; ) to MatrixLib functions with the address operator:
MF_equ1( @(MX[0][0]), 6 );
The situation is somewhat different for dynamic arrays in Delphi. While, in the one-dimensional case, they they can be used with all VectorLib functions by simply type-casting fArrays into fVectors, two-dimensional arrays require a different approach: Dynamic two-dimensional arrays can be created in Delphi by declaring them as "array of fArray", "array of dArray", etc. Short-cut definitions for these types are also given in the VecLib unit, as f2DArray, d2DArray, etc. As a consequence of the described way of defining 2D-Arrays in Delphi, each row of a matrix is stored in a separate vector. This means that the matrix elements do no longer occupy a single, contiguous memory space. Therefore, 2DArrays cannot be used directly with MatrixLib functions.
Instead, they have to be copied into matrices by calling MF_2DArrayToMatrix etc., before MatrixLib functions can be used on them. The reverse conversion is available as MF_MatrixTo2DArray.
In the following chapters, a brief summary of all MatrixLib function is given, ordered into groups according to their functionality. At the end of this file, chapter 16 describes all MatrixLibfunctions in alphabetical order.
Back to Table of Contents
2. Management of Dynamically Generated Matrices
MF_matrix | allocate memory for a matrix |
MF_matrix0 | allocate memory and set all elements 0 |
M_free | free one matrix (data-type independent) |
M_nfree | free n matrices (data-type independent; only C/C++) |
V_freeAll | free all existing vectors and matrices |
OptiVec's dynamically allocated matrices are aligned on 32-byte boundaries, which allows for optimum cache-line matching for the Pentium processor and its currently available successors and competitors.
C/C++ version only:
OptiVec's dynamically allocated matrices can be addressed just like two-dimensional static arrays of C/C++. If you have, e.g., an fMatrix X; and a variable float a;, you can write a line like
a = MX[3][5];
Both C/C++ and Pascal/Delphi versions:
There are two functions addressing single elements. These functions are the only means to address elements in Pascal/Delphi, and are also needed for getting around the pointer arithmetics bug in some older versions of Borland C++:
To assign a value to a specific matrix element, you should use the syntax
*(MF_Pelement( MX, ht, len, 3, 4 )) = 3.0; /* for C/C++*/
MF_Pelement( MX, ht, len, 3, 4 )^ := 3.0; (* for Pascal/Delphi *)
Back to Table of Contents
3. Initialization of Matrices
In order to initialize all matrix elements with the same value, or to perform the same arithmetic operation on all matrix elements simultaneously, please use the respective VectorLib function. You can do so, because all matrices are in fact stored as vectors, occupying a contiguous space in memory. All you have to do is to pass the first row of the matrix (rather than the matrix itself) to the vector function. Fore example, you can initialize all matrix elements with a constant C by calling
VF_equC( MA[0], ht*len, C ); /* C/C++ */
VF_equC( MA, ht*len, C ); (* Pascal/Delphi *)
As you shall see, some of the most common operations of this kind are also explicitly defined in MatrixLib, like initialization with zero, MF_equ0, or multiplication by a constant, available as MF_mulC (see chapter 9). Here are the typical matrix initialization functions:
MF_equ0 | set all elements to 0 |
MCF_Reequ0 | set the real parts of all matrix elements to 0, leaving the imaginary parts unchanged |
MCF_Imequ0 | set the imaginary parts of all matrix elements to 0, leaving the real parts unchanged |
MF_equ1 | identity matrix: set all diagonal elements to 1.0, all others to 0 |
MF_equm1 | negative identity matrix: set all diagonal elements to -1.0, all others to 0 |
MF_random | fill with random numbers |
MF_outerprod | matrix formed by the "outer product" of two vectors |
MF_Row_equ0 | set all elements of one specific row to 0 |
MF_Col_equ0 | set all elements of one specific column to 0 |
MF_Dia_equ0 | set all diagonal elements to 0 |
MCF_Row_Reequ0 | set the real part of all elements of one specific row of a complex matrix to 0 |
MCF_Col_Reequ0 | set the real part of all elements of one specific column of a complex matrix to 0, leaving the imaginary part unchanged |
MCF_Dia_Reequ0 | set the real part of all diagonal elements of a complex matrix to 0 |
MCF_Row_Imequ0 | set the imaginary part of all elements of one specific row of a complex matrix to 0, leaving the real part unchanged |
MCF_Col_Imequ0 | set the imaginary part of all elements of one specific column of a complex matrix to 0 |
MCF_Dia_Imequ0 | set the imaginary part of all diagonal elements of a complex matrix to 0 |
MF_Row_equC | set all elements of one specific row to the constant C |
MF_Col_equC | set all elements of one specific column to the constant C |
MF_Dia_equC | set all diagonal elements to the constant C |
MF_Row_equV | copy a vector into one specific row |
MF_Col_equV | copy a vector into one specific column |
MF_Dia_equV | copy a vector into the diagonal |
MF_Trd_equM | copy a compacted tridiagonal matrix into a general matrix |
MF_equM | make one matrix the copy of another |
MF_neg | make one matrix the negative of another |
MCF_conj | make one matrix the complex conjugate of another |
MCF_hermconj | make one matrix the Hermitian conjugate of another: MB = MAT* |
MF_UequL | copy lower-diagonal elements into upper-diagonal by index-reflection, so as to get a symmetric matrix |
MF_LequU | copy upper-diagonal elements into lower-diagonal |
Two-dimensional windows for spectral analysis are provided by:
Back to Table of Contents
4. Data-Type Conversions
Matrices of every data type can be converted into every other. Only a few examples are given; the rest should be obvious.
M_FtoD | fMatrix to dMatrix |
M_EtoD | eMatrix to dMatrix (with overflow protection) |
M_CDtoCF | cdMatrix to cfMatrix (with overflow protection) |
M_DtoE | dMatrix to eMatrix |
Back to Table of Contents
5. Symmetry Operations (Transposing, Rotating, Reflecting),
Interpolation, Augmenting, Deleting, Extracting, and Filling Parts of a Matrix
MF_transpose | transpose a matrix: MB = MAT |
MCF_hermconj | Hermitian conjugate: MB = MAT* |
MF_rotate90 | clockwise rotation by 90° |
MF_rotate180 | rotation by 180° |
MF_rotate270 | clockwise rotation by 270° (or counter-clockwise rotation by 90 °) |
MF_Rows_rev | reverse the element order along rows; this corresponds to a reflection of the matrix at the Y axis |
MF_Cols_rev | reverse the element order along columns; this corresponds to a reflection of the matrix at the X axis |
MF_Rows_reflect | set the upper halves of all rows equal to their reversed lower halves |
MF_Cols_reflect | set the upper halves of all columns equal to their reversed lower halves |
MF_UequL | copy lower-diagonal elements into upper-diagonal by index-reflection, so as to get a symmetric matrix |
MF_LequU | copy upper-diagonal elements into lower-diagonal |
Note that, in contrast to the VectorLib functions VF_insert and VF_delete, insertion and deletion of rows or columns of matrices is not done in-place. Rather, the MF_Row_insert etc. store the augmented or truncated input matrix MA in an output matrix MB. If augmenting, be sure that MB is large enough to accommodate the enlarged output matrix! Normally, this means that you have to create a new matrix MB before calling MF_???_insert and possibly discarding MA by calling
M_free( MA ); afterwards.
If this process is repeated more often, you might wish to avoid the inefficiency of these "create new" - "copy" - "delete old" cycles. In this case, you can create MA from the outset with the maximum dimensions that will eventually be reached (or, if these are not known beforehand, with the upper limits of both ht and len). During the build-up process then, you have to keep track of the actual dimensions and use these (not the maxima
used for allocation!) in all MatrixLib function calls. Now you may overwrite the original matrix by the augmented one in each call to MF_???_insert as, e.g., in:
MF_Row_insert( MA, MA, ++actualhtA, actuallenA, 0, X );
C++ with dynamic matrices only:
If you overwrite MA by MB in the column insertion/deletion functions, you lose the possibility of accessing individual matrix elements by writing MB[i][j]. This is no longer possible, as the row pointers of the output matrix will still remain those of the input matrix. Then, you can only use MF_element and MF_Pelement to access individual elements. If you are exclusively inserting/deleting rows rather than columns, on the other hand, the row pointers remain valid.
Back to Table of Contents
6. Arithmetic Operations Performed on a Single Row, Column, or the Diagonal
MF_Row_neg | multiply all elements of a specific row by -1 |
MF_Col_neg | multiply all elements of a specific column by -1 |
MF_Row_addC | add a constant to all elements of a specific row |
MF_Col_addC | add a constant to all elements of a specific column |
MF_Dia_addC | add a constant to all diagonal elements |
MF_Row_addV | add corresponding vector elements to all elements of a specific row |
MF_Col_addV | add corresponding vector elements to all elements of a specific column |
MF_Dia_addV | add corresponding vector elements to the diagonal elements |
A few examples should suffice for the other functions of this family:
MF_Row_subC | subtract a constant from all elements of a specific row |
MF_Col_subrC | reverse substraction: difference between column elements and a constant |
MF_Dia_mulV | multiply the diagonal elements with corresponding vector elements |
MF_Row_divV | divide all elements of a specific row by corresponding vector elements |
MF_Col_divrC | reverse division: division of a constant by the individual column elements |
Back to Table of Contents
7. Operations Performed Along All Rows or All Columns Simultaneously, or Along the Diagonal of a Square Matrix
Distribution (Histogram), Center of Gravity
MF_Rows_max | store the maxima of all rows in a column vector |
MF_Cols_max | store the maxima of all colums in a row vector |
MF_Dia_max | return the maximum of the diagonal as a scalar |
MF_Rows_absmax | store the absolute maxima of all rows in a column vector |
MF_Cols_absmax | store the absolute maxima of all colums in a row vector |
MF_Dia_absmax | return the absolute maximum of the diagonal as a scalar |
MF_Rows_sum | sum, taken along rows and stored in a column vector |
MF_Cols_sum | sum, taken along colums and stored in a row vector |
MF_Dia_sum | sum of the diagonal elements |
MF_Rows_prod | product, taken along rows and stored in a column vector |
MF_Cols_prod | product, taken along colums and stored in a row vector |
MF_Dia_prod | product of the diagonal elements |
MF_Rows_runsum | running sum along rows |
MF_Cols_runsum | running sum along columns |
MF_Rows_runprod | running product along rows |
MF_Cols_runprod | running product along columns |
MF_Rows_rotate | rotate all rows by a specified number of positions |
MF_Rows_rotate_buf | rotate all rows by a specified number of positions, using a specified buffer as work-space |
MF_Cols_rotate | rotate all columns by a specified number of positions |
MF_Cols_rotate_buf | rotate all columns by a specified number of positions, using a specified buffer as work-space |
MF_Rows_reflect | set the upper halves of all rows equal to their reversed lower halves |
MF_Cols_reflect | set the upper halves of all columns equal to their reversed lower halves |
MF_Rows_rev | reverse the element order along rows; this corresponds to a reflection of the matrix at the Y axis |
MF_Cols_rev | reverse the element order along columns; this corresponds to a reflection of the matrix at the X axis |
MF_Rows_FFT | Fourier Transform along rows |
MF_Cols_FFT | Fourier Transform along columns |
MF_Rows_distribution | Histogram (one-dimensional distribution function) along rows |
MF_Cols_distribution | Histogram (one-dimensional distribution function) along colums |
Please note that multiplying all rows or all columns by one and the same vector is equivalent to a multiplication by a diagonal matrix, which is provided by MF_mulMdia and MF_TmulMdia.
For all of the above functions involving maxima (...max, ...absmax), the corresponding minima are found by the functions named ...min, ...absmin.
For complex numbers, maxima can be defined by various criteria. The following table summarizes the functions finding them (again, of course, the corresponding functions for the minima exist as well):
MCF_Rows_absmax | store the maxima of the absolute values of all rows in a (real-valued) column vector |
MCF_Cols_absmax | store the maxima of the absolute values of all colums in a (real-valued) row vector |
MCF_Dia_absmax | return the maximum of the absolute values of the diagonal elements as a (real) scalar |
MCF_Rows_absmaxReIm | find the maximum absolute values of all real and of all imaginary parts separately along the rows of a matrix; merge the maxima into complex numbers, and store them in a column vector |
MCF_Cols_absmaxReIm | find the maximum absolute values of all real and of all imaginary parts separately along the columns of a matrix; merge the maxima into complex numbers, and store them in a row vector |
MCF_Dia_absmaxReIm | find the maximum absolute values of all real and of all imaginary parts separately along the diagonal of a square matrix; merge these two maxima into one complex number and return it as a scalar |
MCF_Rows_cabsmax | find the complex numbers of largest magnitude along rows and store these row maxima in a (complex) column vector |
MCF_Cols_cabsmax | find the complex numbers of largest magnitude along columns and store these column maxima in a (complex) row vector |
MCF_Dia_cabsmax | find the complex number of largest magnitude along the diagonal of a square matrix and return it as a (complex) scalar |
MCF_Rows_maxReIm | find the maxima of all real and of all imaginary parts separately along the rows of a matrix; merge the maxima into complex numbers, and store them in a column vector |
MCF_Cols_maxReIm | find the maxima of all real and of all imaginary parts separately along the columns of a matrix; merge the maxima into complex numbers, and store them in a row vector |
MCF_Dia_maxReIm | find the maximum of all real and of all imaginary parts separately along the diagonal of a square matrix; merge these two maxima into one complex number and return it as a scalar |
MCF_Rows_sabsmax | find the complex numbers of largest sum |Re|+|Im| along rows and store these row maxima in a (complex) column vector |
MCF_Cols_sabsmax | find the complex numbers of largest sum |Re|+|Im| along columns and store these column maxima in a (complex) row vector |
MCF_Dia_sabsmax | find the complex number of largest sum |Re|+|Im| along the diagonal of a square matrix and return it as a (complex) scalar |
To determine the center of gravity of a matrix, you have the choice between the following two functions:
Back to Table of Contents
8. Operations Involving Two Rows or Two Colums
Back to Table of Contents
9. Whole-Matrix Arithmetics: Addition, Multiplication
a) Element-wise operations
MF_addM | add two matrices |
MF_addMT | add one matrix and the transpose of another matrix
MC = MA + MBT |
MF_subM | subtract one matrix from another |
MF_subMT | subtract a transposed matrix
MC = MA - MBT |
MF_subrMT | subtract a matrix from another, transposed, matrix
MC = MBT - MA |
MF_mulC | multiply all matrix elements by a constant |
MCF_mulReC | multiply all elements of a complex matrix by a real number |
MF_divC | divide all matrix elements by a constant |
MCF_divReC | divide all elements of a complex matrix by a real number |
MFs_addM | scaled addition of two matrices:
MC = c * (MA + MB) |
MFs_addMT | scaled addition of one matrix and the transpose of another: MC = c * (MA + MBT) |
MFs_subM | scaled subtraction of two matrices:
MC = c * (MA - MB) |
MFs_subMT | scaled subtraction of one matrix and the transpose of another: MC = c * (MA - MBT) |
MFs_subrMT | scaled reverse subtraction of one matrix and the transpose of another: MC = c * (MBT - MA) |
MF_lincomb | linear combination:
MC = ca * MA + cb * MB |
b) Matrix multiplication:
MF_mulV | multiply a matrix by a column vector:
Y = MA * X |
MF_TmulV | multiply the transpose of a matrix by a column vector:
Y = MAT * X |
VF_mulM | multiply a row vector by a matrix:
Y = X * MA |
VF_mulMT | multiply a row vector by the transpose of a matrix:
Y = X * MAT |
MF_mulM | multiply two matrices:
MC = MA * MB |
MF_mulMT | multiply one matrix by the transpose of another matrix:
MC = MA * MBT |
MF_TmulM | multiply the transpose of a matrix by another matrix:
MC = MAT * MB |
MF_TmulMT | multiply the transpose of one matrix by the transpose of another matrix:
MC = MAT * MBT |
MCF_mulMH | multiply one matrix by the hermitian conjugate of another matrix:
MC = MA * MBT * |
MCF_HmulM | multiply the hermitian conjugate of a matrix by another matrix:
MC = MAT * * MB |
MCF_TmulMH | multiply the transpose of one matrix by the hermitian conjugate of another matrix:
MC = MAT * MBT* |
c) Multiplications of general matrices by diagonal matrices or vice versa
The diagonal matrix is passed to the respective function as a vector.
MF_mulMdia | multiply a general matrix by a diagonal matrix:
MC = MA * MBDia |
MF_TmulMdia | multiply the transpose of a matrix by a diagonal matrix:
MC = MAT * MBDia |
MFdia_mulM | multiply a diagonal matrix by a general matrix:
MC = MADia * MB |
MFdia_mulMT | multiply a diagonal matrix by the transpose of a general matrix:
MC = MADia * MBT |
Back to Table of Contents
10. Linear Algebra
There are four groups of linear algebra functions. The first group consists of "easy-to-use" versions which can be used as black-box functions without caring about their internal working. The second group consists of functions for LU decomposition and its applications. The third group consists of Cholesky factorization and its applications on symmetric, positive-definite matrices. The fourth group, finally, is devoted to Singular Value Decomposition (SVD). The functions based on LUD are available both for real and for complex matrices, those based on Cholesky and SVD only for real matrices.
Here are the "easy-to-use" versions of linear algebra functions:
MF_solve |
solve simultaneous linear equations (using LU decomposition) |
MF_inv | invert a matrix |
MF_det | determinant of a matrix |
MFsym_solve |
solve a symetric system of linear equation, assuming the system is positive-definite (using Cholesky decomposition; in case the system turns out not to be positive-definite, LU decomposition is used) |
MFsym_inv | invert a symmetric matrix (trying first Cholesky decomposition, but switching to LUD in case the system turns out not to be positive-definite) |
MFsym_det | determinant of a symmetric matrix |
MF_solveBySVD | solve simultaneous linear equations, using Singular Value Decomposition |
MF_safeSolve | tries first solution by LUD; if that fails, SVD is done |
Now some functions for explicit LU decomposition and for treatment of LU decomposed matrices:
The following functions are available for Cholesky decomposition and its applications on positive-definite matrices:
MF_CholeskyLdecompose | Cholesky decomposition into left-triangular form |
MF_CholeskyLdecompose | Cholesky decomposition into right-triangular form |
MF_CholeskyLsolve | solution of a positive-definite system of linear equations after Cholesky decomposition into left-triangular form |
MF_CholeskyRsolve | solution of a positive-definite system of linear equations after Cholesky decomposition into right-triangular form |
MF_CholeskyLimprove | iterative improvement of the accuracy of a solution obtained via Cholesky decomposition into L form |
MF_CholeskyRimprove | iterative improvement of the accuracy of a solution obtained via Cholesky decomposition into R form |
MF_CholeskyLinv | invert a matrix which has already been reduced into L form by Cholesky decomposition |
MF_CholeskyRinv | invert a matrix which has already been reduced into L form by Cholesky decomposition |
MF_CholeskyDet | determinant of a matrix which has already been reduced into L or R form by Cholesky decomposition |
Singular Value Decomposition and related functions are offered as:
MF_SVdecompose | Singular Value Decomposition |
MF_SVsort | Sorting of Singular Values in descending order with comcomitant re-ordering of left and right singular vectors |
MF_SVsolve | solve SV-decomposed set of linear equations |
MF_SVDsetEdit | set threshold for Singular Value editing |
MF_SVDgetEdit | retrieve current threshold for Singular Value editing |
Back to Table of Contents
11. Eigenvalues and Eigenvectors, Matrix Square-Root
At present, only the special, but most frequent case of symmetric real matrices is covered:
MFsym_eigenvalues |
eigenvalues with or without eigenvectors of a symmetric real matrix |
MFsym_sqrt |
square-root of a symmetric, positive definite matrix |
Back to Table of Contents
12. Fourier-Transform Methods
By analogy with the corresponding one-dimensional Fourier Transform methods described in the VectorLib handbook, the following functions for the two-dimensional case are available in MatrixLib:
MF_FFTtoC | Forward Fast Fourier Transform (FFT) of a real matrix; the result is a cartesian complex matrix |
MF_FFT | Forward and backward FFT of real matrices; using symmetry relations, the complex result is packed into a real matrix of the same size as the input matrix |
MCF_FFT | Forward and backward FFT of complex matrices |
MF_convolve | Convolution with a spatial response function |
MF_deconvolve | Deconvolution |
MF_filter | Spatial filtering |
MF_autocorr | Spatial autocorrelation |
MF_xcorr | Spatial cross-correlation |
MF_spectrum | Spatial frequency spectrum |
MF_xspectrum | Spatial frequency cross-spectrum (complex) |
MF_xspectrumAbs | Spatial frequency cross-spectrum (absolute) |
MF_coherence | Spatial coherence function |
The one-dimensional Fourier Transform along rows or along columns is available as:
MF_Rows_FFTtoC | Fourier Transform along rows (real input and complex output matrix) |
MF_Cols_FFTtoC | Fourier Transform along columns (real input and complex output matrix) |
MF_Rows_FFT | Fourier Transform along rows (real input and packed output matrix) |
MF_Cols_FFT | Fourier Transform along columns (real input and packed output matrix) |
MCF_Rows_FFT | Fourier Transform along rows (complex input and output matrices) |
MCF_Cols_FFT | Fourier Transform along columns (complex input and output matrices) |
Back to Table of Contents
13. Data Fitting
MatrixLib provides a broad range of data fitting functions for various classes of model functions. Let us first show you an overview over the available functions, before we describe the various classes of model functions and their treatment in OptiVec fitting functions in detail.
Now let us have a look at the various classes of model functions. The most simple one is a straight line,
Yi = a * Xi + b;
Fitting Y = f(X) data to a straight line is called "linear regression" and accomplished by VF_linregress.
The next level of sophistication are polynomials, described in the following paragraph:
13.1 Polynomials
Polynomials are functions of the form
Yi = a0 + a1Xi + a2Xi2 ... anXin
Just as linear regression, polynomial fitting is available for Y-X data (VF_polyfit), but not for MZ=f(X,Y) data. In polynomial fitting, you are interested in the coefficients ai up to a certain limit, the degree n of the polynomial. In the simplest form, all coefficients are treated as free parameters, without the possibility of "fixing" those whose values you happen to know beforehand.
If, however, you know (or suspect) that the polynomial will consist only of odd or only of even powers, there are VF_polyfitOdd and VF_polyfitEven for that purpose.
Polynomial fitting is most useful for two to five free parameters (i.e., VF_polyfit: degrees of 2 to 4, VF_polyfitOdd: degrees 3 to 9, VF_polyfitEven: degrees 2 to 8). With more than five terms, you will be able to fit almost any data - but the resulting coefficients will be at best inaccurate and at worst useless, as already very little experimental noise will strongly influence the balance of the higher terms. If you do need polynomials of higher degrees, you should carefully examine your problem to see which terms you can eliminate. This leads us from polynomials to the next class of fitting functions, namely:
13.2 General Linear Model Functions
In the general linear case, you have to write the model function yourself and pass it as an argument to the fitting routine. The word "linear" means that the model function consists of a linear combination of basis functions each of which depends linearly on the fitting coefficients:
y = a0f0(x) + a1f1(x) + a2f2(x)...
The individual functions fi(x) may be non-linear in x, but not in the coefficients ai. For example,
y = a0sin(x)+ a1cos(x)
is a valid linear fitting function, but
y = sin(a0x)+ cos(a1x)
is not.
For general linear fits, the model function has to be provided in a form which calculates the individual basis functions for each x-value present in the data set. The above example with sine and cosine functions would be coded in C/C++ as
void LinModel( fVector BasFuncs, float x, unsigned nfuncs )
{
BasFuncs[0] = sin(x);
BasFuncs[1] = cos(x);
}
Note that the coefficients ai are not used in the model function itself. The argument nfuncs (which is neglected in the above example) allows to use a variable number of basis functions. It is also possible to switch fitting parameters "on" and "off", i.e., "free" or "fixed". To this end, the routine VF_linfit takes a "status" array as an argument. For all members of the parameter vector that are to be treated as free, the corresponding "status" entry must be set to 1. If statusi is set to 0, the corresponding parameter, ai, is treated as fixed at its value upon input.
Internally, VF_linfit employs a Singular Value Decomposition algorithm to obtain a solution even for (near-)singular lar systems. Thereby, coefficients ai whose significance is lower than a threshold, Thresh, are set to 0 instead of infinity. In order to specify this threshold for each call, use VF_linfitwEdit. If, on the other hand, you are fine with using the default value, just call VF_linfit. You may also modify the default threshold for all calls via VF_setLinfitNeglect. The current threshold can be retrieved by VF_getLinfitNeglect.
Having noted above that functionsine like
y = sin(a0x)+ cos(a1x)
require their own treatment, we arrive at the last and most general class of model functions:
13.3 Non-Linear Models
As described above, fits to linear model functions (which include, of course, simple polynomials) are performed internally by solving a set of coupled linear equations - which is basically a simple matrix inversion process. The situation for non-linear model functions is completely different: no closed-form solution exists, and the fitting problem can be solved only iteratively. In other words, non-linear fitting routines work by performing some sort of educated trial-and-error. Therefore, fitting to non-linear models is much more time-consuming (by 3-5 orders of magnitude!) than fitting to linear models. Two non-linear fitting algorithms are offered:
- the Levenberg-Marquardt method, and the
- Downhill-Simplex method by Nelder and Mead.
As a starting-point, it is normally a good idea to choose a combination of both (choose FitOptions.LevelOfMethod = 3, see below).
All non-linear fitting functions exist in two different syntax variants. One of them expects pointers to a struct VF_NONLINFITOPTIONS and to a struct VF_NONLINFITWORKSPACE as arguments. This is the recommended form. It allows to run two or more fits simultaneously with different sets of options. Additionally, it allows to access the helper functions for progress monitoring. The second syntax variant does without these two parameters, using the default set of options and generating its own workspace. This second variant, however, does not allow to access the helper functions.
The fundamental difference between linear and non-linear data fitting is reflected also in the required formulation of the model functions. In contrast to the linear case, here it is not the individual basis functions which are needed. Rather, the model function will be called by VF_nonlinfit with the whole X-vector as input argument (as well as its size and the array A of parameters) and has to return the whole Y-vector. For the above non-linear sine and cosine example, this could be coded in C/C++ as
void NonlinModel( fVector Y, fVector X, ui size, fVector A)
{
for( ui i=0; i<size; i++ )
Y[i] = sin( A[0]*X[i] ) + cos( A[1]*X[i] );
}
VF_nonlinfit will call this model function again and again, hundreds and thousands of times, with different values in the parameter vector A. This means that a nonlinear fitting routine will spend most of its time in your model function (and its derivatives, see below), and you might wish to optimize this model function as far as possible, using vector functions. Suppose you have declared and allocated the fVector YHelp somewhere within your main program. Then you can write:
void OptNonlinModel( fVector Y, fVector X, ui size, fVector A)
{
VFx_sin( YHelp, X, size, A[0], 0.0, 1.0 );
VFx_cos( Y, X, size, A[1], 0.0, 1.0 );
VF_addV( Y, Y, YHelp, size );
}
The parameter array A you just saw being used by VF_nonlinfit to call your model function, is the one you have to pass as the first argument to VF_nonlinfit. Upon input, "A" must (!) contain your initial "best guess" of the parameters. The better your guess, the faster VF_nonlinfit will converge. If your initial guess is too far off, convergence might be very slow or even never attained. Upon output, "A" will contain the best set of parameters that could be found.
All nonlinfit functions return the figure-of-merit of the best parameter array "A" found. To perform the fit, these functions need not only the fitting function itself, but also its partial derivatives with respect to the individual coefficients. Therefore, an argument "Derivatives" is required in calling the nonlinfit functions. If you happen to know the partial derivatives analytically, Derivatives should point to a function calculating them. If you do not know them, call with Derivatives = NULL (nil in Pascal/Delphi). In the latter case, all derivatives will be calculated numerically inside the functions. In cases where you know some, but not all of the partial derivatives of Y with respect to the coefficients ai, you could also calculate dY / dai wherever you have an analytic formula, and call VF_nonlinfit_autoDeriv for the remaining coefficients. To demonstrate this possibility, here is a function coding the derivatives for our non-linear sine and cosine example:
void DerivModel( fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws )
{
switch( iPar )
{
case 0:
for( ui i=0; i<size; i++ )
dYdAi[i] = X[i] * cos( A[0]*X[i] );
break;
case 1: /* say we don't know this derivative: */
VF_nonlinfit_autoDeriv( dYdAi, X, size, ipar, A, &ws );
}
}
As you might have guessed, the only purpose of the input argument "ws" for DerivModel is to be passed on to VF_nonlinfit_autoDeriv, in case this becomes necessary. Think twice, however, before resorting to VF_nonlinfit_autoDeriv: The function calls needed to determine the derivatives numerically may easily slow down your fit by a factor of 3 to 10! Anyway, as described above for the model function itself, also its derivatives should be implemented using vector functions. This leads us finally to the optimized version of the derivatives function:
void OptDerivModel( fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws )
{
switch( iPar )
{
case 0:
VFx_cos( dYdAi, X, size, A[0], 0.0, 1.0 );
VF_mulV( dYdAi, dYdAi, X, size ); break;
case 1:
VFx_sin( dYdAi, X, size, A[1], 0.0, -1.0 );
VF_mulV( dYdAi, dYdAi, X, size );
}
}
For actual working examples for the polynomial, general linear, and general non-linear cases, please see FITDEMO.CPP, FITDEMOW.CPP, FITDEMOB.BPR, FITDEMO.PAS, or FITDEMO.DPR.
VF_NONLINFITOPTIONS
The nonlinear fitting routines are highly sophisticated and offer the user a lot of different options. All these options are packed into a structure (struct in C/C++, record in Pascal/Delphi) named VF_NONLINFITOPTIONS.
It has the following fields:
int FigureOfMerit; | 0: least squares fitting
1: robust fitting, optimizing for minimum absolute deviation
(default: 0) |
float AbsTolChi; | absolute change of c2 (default: EPSILON) |
float FracTolChi; | fractional change of c2 (default: SQRT_EPSILON) |
float AbsTolPar; | absolute change of all parameters (default: SQRT_MIN) |
float FracTolPar; | fractional change of all parameters (default: SQRT_EPSILON)
The four xxxTolChi and xxxTolPar parameters describe the convergence conditions: if the changes achieved in successive iterations are smaller than demanded by these criteria, this signals convergence. Criteria
which are not applicable should be set to 0.0. |
unsigned HowOftenFulfill; | how often fulfill one of the above conditions before convergence is considered achieved (default: 3) |
unsigned LevelOfMethod; | 1: Levenberg-Marquardt method,
2: Downhill Simplex (Nelder and Mead) method,
3: both methods alternating;
add 4 to this in order to try breaking out of local minima;
0: no fit, calculate only c2 (and Covar)
(default: 1) |
unsigned LevMarIterations; | max.number of successful iterations of LevMar during one run (default: 100) |
unsigned LevMarStarts; | number of LevMar restarts per run (default: 2) |
float LambdaStart,
LambdaMin,
LambdaMax,
LambdaDiv,
LambdaMul; | treatment of LevMar parameter lambda (don't touch, unless you are an expert!) |
unsigned DownhillIterations; | max. number of successful iterations in Downhill Simplex method (default: 200) |
float DownhillReflection,
DownhillContraction,
DownhillExpansion; | treatment of re-shaping of the simplex in Downhill Simplex method (don't touch, unless you are an expert!) |
unsigned TotalStarts; | max. number of LevMar/Downhill pairs (default: 16) |
float FOMThreshForBreakout; | Threshold for triggering of a "breakout" attempt from possible local optima. This option comes into effect only if LevelOfMethod takes one of the values 5, 6, or 7. If you have an idea about the value of c2 or |c| expected for a successful fit, you should set FOMThreshForBreakout a little bit higher than this expected value. Thereby, you prevent this often quite lengthy routine from being triggered unnecessarily. (Default: 0.0; this means, breakout is always attempted, if LevelOfMethod = 5, 6, or 7) |
float BreakoutFenceHeightRel; | In order to find its way from one local optimum of the "FOM vs. parameter set" hypersurface to another local and ultimately to the global optimum, the routine needs, figuratively speaking, to climb over the fence of the local optimum. The option BreakoutFenceHeightRel determines, up to which relative height, measured as a multiple of the so-far best c2 or |c|, the routine will climb the fence. In the event that the routine finds a better parameter set on the other side of the fence, this new-found local optimum will itself be investigated in the same way to determine if a still better one can be found, or if we finally reached the globally best fit. The search ends when the routine has climbed the fence in all directions (i.e., for each single fitting parameter) until the desired multiple of c2 bzw. |c|, without finding a better solution. It will end also in the event of hitting the limits of the fitting parameters, as set in UpperLimits, LowerLimits, Restrict, see below.
Too low a value of BreakoutFenceHeightRel will lead to the search being prematurely called off, while too high a value may lead to much increased execution times. (Default: 2.0) |
float BreakoutFenceHeightAbs; | Instead of measuring the "fence height" for a breakout attempt as a multiple of the hither-to best c2 or |c| (see the previous option), you may set an absolute value by which the routine has to climb the fence, until the found optimum is recognized as the true global one. (Default: FLT_MAX; this means that this option is disabled by default) |
fVector UpperLimits, LowerLimits; | impose upper and/or lower limits on parameters. Default for both: NULL or nil |
void (*Restrictions)(fVector A); | pointer to a user-defined function, implementing restrictions on the parameters which cannot be formulated as simple upper/lower limits. The function must check the whole parameter vector A and edit the parameters as needed. Default: NULL or nil.
A typical application of this function would be a model, in which the parameters Ai have to be in a specific order (ascending or descending). So your Restrictions might call VF_sort to enforce that order. Apart from such very special cases, it is generally better not to use Restrictions at all, but let the nonlinfit routine run its course without too much interfering in it. |
These options will be passed to each nonlinfit function as the parameter FitOptions of the type VF_NONLINFITOPTIONS just described. As mentioned above, all nonlinfit functions exist also with a simplified syntax, which does not take this parameter, using default values instead. You may modify these default values for all future calls of nonlinfit functions by calling V_setNonlinfitOptions. To retrieve current settings, use
V_getNonlinfitOptions. In order to return to "factory settings", call V_setNonlinfitDefaultOptions. To retrieve these factory settings, call V_getNonlinfitDefaultOptions.
A set of options which is explicitly passed as an argument to a nonlinfit function always has priority over the default values set by V_setNonlinfitOptions.
VF_NONLINFITWORKSPACE
As described above, all non-linear fitting functions need a set of variables for internal use which, for the VF_nonlinfit family of functions, is contained in a struct (Delphi: record) VF_NONLINFITWORKSPACE. It is passed by its address to the respective function. This set of variables need not be initialized. It does not contain user-retrievable information. In the MF_nonlinfit family of functions, a similar set of internal variables is needed as MF_NONLINFITWORKSPACE.
A typical call of VF_nonlinfit would look like this in C/C++:
VF_NONLINFITWORKSPACE ws;
VF_NONLINFITOPTIONS fopt;
V_getNonlinfitOptions( &fopt );
// at this point, modify fopt as desired...
VF_nonlinfit( ParValues, AStatus, nParameters, X, Y, sz, ModelFunc, DerivativeFuncs, &ws, &fopt );
or in Delphi:
ws: VF_NONLINFITWORKSPACE;
fopt: VF_NONLINFITOPTIONS;
V_getNonlinfitOptions( @fopt );
// at this point, modify fopt as desired...
VF_nonlinfit( ParValues, AStatus, nParameters, X, Y, sz, @ModelFunc, @DerivativeFuncs, @ws, @fopt );
If you replace the parameter &ws with NULL / nil, VF_nonlinfit will generate its own workspace.
13.4 Fitting Multiple Data Sets
In addition to the fitting functions for single data sets, there are routines for fitting multiple data sets simultaneously. Say, you are a physicist or a chemist and want to measure a rate constant k. You have performed the same kinetic measurement ten times under slightly different conditions. All these measurements have, of course, the same k, but other parameters, like amplitude and time-zero, will differ from experiment to experiment. Now, the usual way would be to perform one fit for each of these ten data sets and average over the resulting k's.
There is a problem with this approach: you don't really know which weight you have to assign to each of the measurements, and how to treat the overlapping error margins of the individual fits. You might want to perform a fit on all your data sets simultaneously, taking the same k for all data sets, and assigning individual amplitudes etc. to each set. This is precisely what the multiLinfit and multiNonlinfit functions of MatrixLib are designed for. You can fit multiple data-sets both to linear and nonlinear models, for Y = f(X) data as well as for MZ = f(X,Y) data.
The multiLinfit and multiNonlinfit functions need the input data to be passed in structures named VF_EXPERIMENT for X-Y data and MF_EXPERIMENT for X-Y-Z data. In C/C++, VF_EXPERIMENT has the following fields:
fVector X, Y; | X and Y vectors: independent variable x and measured y=f(x) data |
fVector InvVar; | inverse variances of the individual data points (needed only for the "with weights" functions) |
ui size; | the number of data points |
float WeightOfExperiment; | individual weight to be assigned to the whole experiment (again needed only for the weighted variants) |
In C/C++, MF_EXPERIMENT has the following fields:
fVector X, Y; | X and Y vectors (independent variables) |
fMatrix Z; | measured data z=f(x,y) |
fMatrix InvVar; | inverse variances of the individual matrix elements (needed only for the "with weights" functions) |
ui htZ, lenZ; | matrix dimensions |
float WeightOfExperiment; | individual weight to be assigned to the whole experiment (again needed only for the weighted variants) |
In Pascal/Delphi, VF_EXPERIMENT and MF_EXPERIMENT are defined as follows:
type VF_EXPERIMENT = record
X, Y, InvVar: fVector;
size: UIntSize;
WeightOfExperiment: Single;
end;
type PVF_EXPERIMENT = ^VF_EXPERIMENT;
type MF_EXPERIMENT = record
X, Y: fVector;
MZ, MInvVar: fMatrix;
htZ, lenZ: UIntSize;
WeightOfExperiment: Single;
end;
type PMF_EXPERIMENT = ^MF_EXPERIMENT;
Both in VF_EXPERIMENT and MF_EXPERIMENT, InvVar and WeightOfExperiment are needed only for the weighted variants of the multifit functions.
13.5 Helper Functions for Nonlinear Fits
As nonlinear fitting tasks - especially with multiple data sets - may become quite tedious and take a very long time (sometimes many hours!) to converge, there is a number of functions which allow to follow the course of nonlinear fits. The names of these functions are always derived from the fitting function they are used with. For example, the helper functions for VF_nonlinfit are:
For the other nonlinear fitting functions, the corresponding helper-function names are obtained by replacing the "VF_nonlinfit_" prefix with the respective fitting function name, as in VF_nonlinfitwW_getBestValues,
MF_multiNonlinfit_stop, and so on.
There are two possibilities how these functions can be called. The first way is to call them from within your model function. For example, you might install a counter into your model function and, upon reaching a certain number of calls, retrieve the current figure-of-merit (chi2 or chiabs), parameter set, etc. The second way is open only for multithreaded programs: a thread, different from the one performing the fit, may call any of the above functions to control the progress of the fit.
Both of these ways require the VF_NONLINFITWORKSPACE to be globally accessible. When a nonlinfit function is called from multiple threads simultaneously, this poses an obvious problem, especially if you wish to call the helper function from your ModelFunc: How does the model function "know" in real time, from which thread it was called? The solution is: Store a thread index in your parameter vector A. For example, in your main program, you might have something like:
float A1[11], A2[11], ...;
int AStatus1[11], AStatus2[11], ...;
VF_NONLINFITWORKSPACE ws1, ws2, ...;
....
VF_random( A1, 10, 1, -1.0, +1.0 ); // any better guess for starting values would be welcome
VI_equC( AStatus1, 10, 1 ); // fist 10 parameters are to be fitted
A1[10] = 1; // thread index = 1
AStatus1[10] = 0; // of course, this parameter is frozen
... throw thread #1 with VF_nonlinfit taking A1, AStatus1, and ws1 as parameters
VF_random( A2, 10, 1, -1.0, +1.0 ); // starting values for second fit
VI_equC( AStatus2, 10, 1 );
A2[10] = 2; // thread index = 2
AStatus2[10] = 0; // again, this parameter is frozen
... throw thread #2 with VF_nonlinfit taking A2, AStatus2, and ws2 as parameters
In your model function then, you would have something along the lines of:
void ModelFunc( fVector Y, fVector X, ui size, fVector A )
{
static unsigned counter1=0, counter2=0, ...;
float CurrentFOM;
....
switch( (unsigned)(A[10]) )
{
case 1: if( (++counter1 % 1024) == 0 )
{ CurrentFOM = VF_nonlinfit_getFOM( ws1 );
printf( "\nCount 1: %u, FOM: %f", counter1, CurrentFOM );
} break;
case 1: if( (++counter2 % 1024) == 0 )
{ CurrentFOM = VF_nonlinfit_getFOM( ws2 );
printf( "\nCount 2: %u, FOM: %f", counter2, CurrentFOM );
} break;
....
}
....
}
Back to Table of Contents
14. Matrix Input and Output
The matrix input/output functions are all analogous to the corresponding vector functions
MF_cprint |
print a matrix to the screen. If necessary, rows are cut off at the screen boundaries. If there are more rows than screen lines, proper paging is applied. For console applications only. |
MF_print | print a matrix to the screen (without paging or row cut-off); for console applications only |
MF_fprint | print a matrix in ANSI format to a stream |
MF_store | store in binary format |
MF_recall | retrieve in binary format |
MF_write | write in ASCII format in a stream |
MF_read | read from an ASCII file |
Back to Table of Contents
15. Graphical Representation of Matrices
True 3D-plotting functions will be included in future versions. For now, only color-density plots are available. In these plots, each data value is translated into a color value by linear interpolation between two colors, specified as mincolor and maxcolor.
MF_xyzAutoDensityMap | Color density map for z=f(x,y) with automatic scaling of the x and y axes and of the color density scale between mincolor and maxcolor |
MF_xyzDataDensityMap | z=f(x,y) color density map, plotted into an existing axis frame, and using the color density scale set by the last call to an AutoDensityMap function |
MF_zAutoDensityMap | Color density map for z=f(i,j) with automatic scaling of the x and y axes and of the color density scale between mincolor and maxcolor. i and j are the indices in x and y direction, respectively |
MF_zDataDensityMap | Color density map for z=f(i,j), plotted into an existing axis frame, and using the color density scale set by the last call to an AutoDensityMap function |
M_setDensityBounds | Set a color scale for matrix color-density plots. |
M_setDensityMapBounds | Set a color scale and draw an X-Y coordinate system for matrix color-density plots. |
M_findDensityMapBounds | Calculate a color scale and draw an X-Y coordinate system for matrix color-density plots, ensuring that the grid lines of the coordinate system correspond to exact (rather than only rounded) values. |
Back to Table of Contents
16. Alphabetical Reference of MatrixLib
This chapter describes, in alphabetical order, all MatrixLib functions. Similarly to the indexing of the vector functions in FUNCREF.HTM, the MF_ or M_ prefix is neglected in the ordering of entries. The particles "Row_", "Rows_", "Col_", "Cols_", "Dia_", and "Trd_", however, are fully taken into account. For example, "MF_Rows_" functions will come after all "MF_Row_" functions. While most MatrixLib functions have the prefixes MF_ or M_, please note that some - notably the X-Y fitting functions - have the prefix VF_ as a reminder that they actually work on vectors, even if they rely on matrix methods and form a part of MatrixLib. In cases where both the VF_ and the MF_ versions exist, contrary to the alphabetical order the VF_ version is described first, as it is the simpler one.
MF_accElement | MD_accElement | ME_accElement |
MCF_accElement | MCD_accElement | MCE_accElement |
MCF_accElementRe | MCD_accElementRe | MCE_accElementRe |
MCF_accElementIm | MCD_accElementIm | MCE_accElementIm |
MI_accElement | MBI_accElement | MSI_accElement | MLI_accElement | MQI_accElement | |
MU_accElement | MUB_accElement | MUS_accElement | MUL_accElement | MUQ_accElement | MUI_accElement |
|
Function | Increment a single matrix element by a given value |
|
Syntax C/C++ | #include <MFstd.h>
void MF_accElement( fVector MA, ui ht, ui len, ui m, ui n, float C );
#include <MCFstd.h>
void MCF_accElement( cfMatrix MA, ui ht, ui len, ui m, ui n, fComplex C );
void MCF_accElementRe( fMatrix MA, ui ht, ui len, ui m, ui n, float C );
void MCF_accElementIm( fMatrix MA, ui ht, ui len, ui m, ui n, float C ); |
C++ VecObj | #include <OptiVec.h>
matrix<T>::accElement( ui ht, ui len, ui m, ui n, T C );
matrix<complex<T>>::accElement( ui ht, ui len, ui m, ui n, complex<T> C );
matrix<complex<T>>::accElementRe( ui ht, ui len, ui m, ui n, T C );
matrix<complex<T>>::accElementIm( ui ht, ui len, ui m, ui n, T C ); |
Pascal/Delphi | uses MFstd;
procedure MF_accElement( MA:fVector; ht, len, m, n:UIntSize; C:Single );
uses MCFstd;
procedure MCF_accElement( MA:cfMatrix; ht, len, m, n:UIntSize; C:fComplex );
procedure MCF_accElementRe( MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
procedure MCF_accElementIm( MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
void cudaMF_accElement( fMatrix d_MA, ui ht, ui len, ui m, ui n, float C );
void cusdMF_accElement( fMatrix d_MA, ui ht, ui len, ui m, ui n, float *d_C );
#include <cudaMCFstd.h>
void cudaMCF_accElement( cfMatrix d_MA, ui ht, ui len, ui m, ui n, fComplex C );
void cusdMCF_accElement( cfMatrix d_MA, ui ht, ui len, ui m, ui n, fComplex *d_C );
void cudaMCF_accElementRe( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float C );
void cusdMCF_accElementRe( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float *d_C );
void cudaMCF_accElementIm( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float C );
void cusdMCF_accElementIm( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float *d_C );
|
CUDA function Pascal/Delphi | uses MFstd;
procedure cudaMF_accElement( d_MA:fMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMF_accElement( d_MA:fMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
uses MCFstd;
procedure cudaMCF_accElement( d_MA:cfMatrix; ht, len, m, n:UIntSize; C:fComplex );
procedure cusdMCF_accElement( d_MA:cfMatrix; ht, len, m, n:UIntSize; d_C:PfComplex );
procedure cudaMCF_accElementRe( d_MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMCF_accElementRe( d_MA:cfMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
procedure cudaMCF_accElementIm( d_MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMCF_accElementIm( d_MA:cfMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
|
|
Description | Real versions:
MA[n][m] += C; The element at the position m, n is incremented by the value C.
Complex versions MCF_accElement etc.:
MA[n][m].Re += C.Re; MA[n][m].Im += C.Im;
Complex versions MCF_accElementRe etc.:
MA[n][m].Re += C.Re;
The imaginary part MA[n][m].Im is left unaffected.
Complex versions MCF_accElementIm etc.:
MA[n][m].Im += C.Im;
The real part MA[n][m].Re is left unaffected.
|
|
|
|
|
MFs_addM |
MDs_addM |
MEs_addM |
MCF_addM |
MCD_addM |
MCE_addM |
|
Function | element-wise addition of two matrices |
|
Syntax C/C++ | #include <MFstd.h>
void MF_addM( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFs_addM( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::addM( const matrix<T>& MA, const matrix<T>& MB);
void matrix<T>::s_addM( const matrix<T>& MA, const matrix<T>& MB, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_addM( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFs_addM( MC, MA, MB:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_addM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
int cudaMFs_addM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float C );
int cusdMFs_addM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float *d_C );
void MFcu_addM( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len );
void MFs_addM( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_addM( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMFs_addM( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMFs_addM( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MF_addM( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
procedure MFs_addM( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | normal version: MCij = MAij + MBij
scaled version: MCij = C * (MAij + MBij) |
|
|
MF_addMT
| MD_addMT |
ME_addMT |
MFs_addMT |
MDs_addMT |
MEs_addMT |
MCF_addMT |
MCD_addMT |
MCE_addMT |
|
Function | element-wise addition of one matrix and the transpose of another |
|
Syntax C/C++ | #include <MFstd.h>
void MF_addMT( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFs_addMT( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::addMT( const matrix<T>& MA, const matrix<T>& MB);
void matrix<T>::s_addMT( const matrix<T>& MA, const matrix<T>& MB, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_addMT( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFs_addMT( MC, MA, MB:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_addMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
int cudaMFs_addMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float C );
int cusdMFs_addMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float *d_C );
void MFcu_addMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len );
void MFs_addMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_addMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMFs_addMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMFs_addMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MF_addMT( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
procedure MFs_addMT( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | normal version: MCij = MAij + MBTji
scaled version: MCij = C * (MAij + MBTji) |
|
|
MF_autocorr
| MD_autocorr |
ME_autocorr |
MFb_autocorr
| MDb_autocorr |
MEb_autocorr |
|
Function | Spatial autocorrelation function |
|
Syntax C/C++ | #include <MFstd.h>
void MF_autocorr( fMatrix Y, fMatrix X, ui ht, ui len );
void MFb_autocorr( fMatrix Y, fMatrix X, ui ht, ui len, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::autocorr( const matrix<T>& MX);
void matrix<T>::b_autocorr( const matrix<T>& MX, vector<T>& Buf); |
Pascal/Delphi | uses MFstd;
procedure MF_autocorr( MY, MX:fMatrix; ht, len:UIntSize );
procedure MFb_autocorr( MY, MX:fMatrix; ht, len:UIntSize; Buf:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_autocorr( fMatrix d_Y, fMatrix d_X, ui ht, ui len );
void MFcu_autocorr( fMatrix h_Y, fMatrix h_X, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_autocorr( d_MY, d_MX:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_autocorr( h_MY, h_MX:fMatrix; ht, len:UIntSize );
|
|
Description | The spatial autocorrelation function (SACF) of MX is calculated and stored in MY in wrap-around order in both dimensions: The row elements MYi,0 to MYi,len/2-1 contain the SACF for zero and positive x lags. Beginning with the most negative lag in MYi,len/2+1, the elements up to MYi,len-1 contain the SACF for negative lags. Since this function assumes MX to be periodic, the SACF for the most positive lag is identical to the SACF for the most negative lag. This element is stored as Yi,len/2.
Similarly, the column elements MY0,j to MYlen/2-1,j contain the SACF for zero and positive y lags. Beginning with the most negative lag in MYlen/2+1,j, the elements up to MYlen-1,j contain the SACF for negative lags.
To get the SACF into normal order, you may call
MF_Rows_rotate( MY, ht, len, len/2 );
MF_Cols_rotate( MY, ht, len, ht/2 );
After that, the zero point is at the position MYht/2,len/2.
In case MX is non-periodic, you should avoid end effects by the methods described in connection with MF_convolve.
Both ht and len must be integer powers of 2.
Internally, MF_autocorr allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_autocorr instead. For C/C++, the size of Buf must be >= ht*(len+2), for Pascal/Delphi, it must be >= ht*len. Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either len or ht is not a power of 2, VF_FFT (on which MF_autocorr is based) complains "Size must be an integer power of 2" and the program is aborted. |
|
|
MF_block_equM
| MD_block_equM |
ME_block_equM |
MCF_block_equM |
MCD_block_equM |
MCE_block_equM |
MI_block_equM | MBI_block_equM | MSI_block_equM | MLI_block_equM | MQI_block_equM |
MU_block_equM | MUB_block_equM | MUS_block_equM | MUL_block_equM | MUQ_block_equM |
|
Function | Copy a matrix into a "block" of another matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_block_equM( fMatrix Dest,
unsigned destHt, unsigned destLen,
ui firstRow, ui firstCol,
fMatrix Srce, ui srceHt, ui srceLen ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::block_equM( const ui firstRow, const ui firstCol, const matrix<T>& MSrce); |
Pascal/Delphi | uses MFstd;
procedure MF_block_equM( MDest:fMatrix;
destHt, destLen, firstRow, firstCol:UIntSize;
MSrce:fMatrix; srceHt, srceLen:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_block_equM( fMatrix d_Dest,
unsigned destHt, unsigned destLen,
ui firstRow, ui firstCol,
fMatrix d_Srce, ui srceHt, ui srceLen );
void MFcu_block_equM( fMatrix h_Dest,
unsigned destHt, unsigned destLen,
ui firstRow, ui firstCol,
fMatrix h_Srce, ui srceHt, ui srceLen ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_block_equM( d_MDest:fMatrix;
destHt, destLen, firstRow, firstCol:UIntSize;
d_MSrce:fMatrix; srceHt, srceLen:UIntSize ): IntBool;
procedure MF_block_equM( h_MDest:fMatrix;
destHt, destLen, firstRow, firstCol:UIntSize;
h_MSrce:fMatrix; srceHt, srceLen:UIntSize );
|
|
Description | MDesti+firstRow, j+firstCol = MSrcei, j, i=0,...,srceHt-1; j=0,...,srceLen-1 |
|
|
MF_block_equMT
| MD_block_equMT |
ME_block_equMT |
MCF_block_equMT |
MCD_block_equMT |
MCE_block_equMT |
MI_block_equMT | MBI_block_equMT | MSI_block_equMT | MLI_block_equMT | MQI_block_equMT |
MU_block_equMT | MUB_block_equMT | MUS_block_equMT | MUL_block_equMT | MUQ_block_equMT |
|
Function | Copy the transpose of a matrix into a "block" of another matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_block_equMT( fMatrix Dest,
unsigned destHt, unsigned destLen,
ui firstRow, ui firstCol,
fMatrix Srce, ui srceHt, ui srceLen ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::block_equMT( const ui firstRow, const ui firstCol, const matrix<T>& MSrce); |
Pascal/Delphi | uses MFstd;
procedure MF_block_equMT( MDest:fMatrix;
destHt, destLen, firstRow, firstCol:UIntSize;
MSrce:fMatrix; srceHt, srceLen:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_block_equMT( fMatrix d_Dest,
unsigned destHt, unsigned destLen,
ui firstRow, ui firstCol,
fMatrix d_Srce, ui srceHt, ui srceLen );
void MFcu_block_equMT( fMatrix h_Dest,
unsigned destHt, unsigned destLen,
ui firstRow, ui firstCol,
fMatrix h_Srce, ui srceHt, ui srceLen ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_block_equMT( d_MDest:fMatrix;
destHt, destLen, firstRow, firstCol:UIntSize;
d_MSrce:fMatrix; srceHt, srceLen:UIntSize ): IntBool;
procedure MF_block_equMT( h_MDest:fMatrix;
destHt, destLen, firstRow, firstCol:UIntSize;
h_MSrce:fMatrix; srceHt, srceLen:UIntSize );
|
|
Description | MDesti+firstRow, j+firstCol = MSrcej, i, i=0,...,srceLen-1; j=0,...,srceHt-1 |
|
|
|
Function | Data type conversions. See M_FtoD.
|
|
MF_chexprint
| MD_chexprint |
ME_chexprint |
MCF_chexprint |
MCD_chexprint |
MCE_chexprint |
MI_chexprint | MBI_chexprint | MSI_chexprint | MLI_chexprint | MQI_chexprint |
MU_chexprint | MUB_chexprint | MUS_chexprint | MUL_chexprint | MUQ_chexprint |
|
Function | print a matrix to the screen (console applications only) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_chexprint( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::chexprint(); |
Pascal/Delphi | uses MFstd;
procedure MF_chexprint( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_chexprint( fMatrix d_MA, ui ht, ui len );
int cudaMF_chexprint_buf( fMatrix d_MA, ui ht, ui len, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_chexprint( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_chexprint_buf( d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | Windows with Borland / Embarcadero compilers or MS Visual C++, DLL runtime: The matrix MA is printed in hexadecimal format to the screen. Each line corresponds to one row of the matrix. The lines are numbered. If necessary, rows are cut off at the screen boundaries. If there are more rows than screen lines, proper paging is applied.
This family of functions is available only for console applications. |
CUDA versions only: | cudaM?_chexprint_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_chexprint to allocate its own buffer memory, cudaM?_chexprint_buf is slightly faster. |
Other Windows compilers as well as Linux: |
As here the width and height of the text window are not easily available, calls to V?_chexprint are redirected to MF_hexprint. The same is true for Visual C++ with static runtime (here for the reason of version-to-version incompatibilities). |
|
Error handling | If the number of columns exceeds the maximum number of entries possible in the current text mode, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the rows are truncated.
|
|
|
MF_centerOfGravityInd | MD_centerOfGravityInd | ME_centerOfGravityInd |
|
Function | Center of gravity of a matrix with respect to the element indizes |
|
Syntax C/C++ | #include <MFstd.h>
fComplex MF_centerOfGravityInd( fMatrix MA, ui ht, ui len ); |
C++ VecObj | #include <OptiVec.h>
complex<T> matrix<T>::centerOfGravityInd(); |
Pascal/Delphi | uses MFstd;
function MF_centerOfGravityInd( MA:fMatrix; ht, len:UIntSize ): fComplex
Alternative syntax for the complex types (obsolete, but still supported):
procedure MF_centerOfGravityInd( var COG:fComplex; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_centerOfGravityInd( fComplex *h_RetVal, fMatrix d_MA, ui ht, ui len );
int cusdMF_centerOfGravityInd( fComplex *d_RetVal, fMatrix d_MA, ui ht, ui len );
fComplex MFcu_centerOfGravityInd( fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_centerOfGravityInd( var h_RetVal:fComplex; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cusdMF_centerOfGravityInd( d_RetVal:PfComplex; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function MFcu_centerOfGravityInd( h_MA:fMatrix; ht, len:UIntSize ): fComplex
Alternative syntax:
procedure MFcu_centerOfGravityInd( var h_RetVal:fComplex; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | The center of gravity of the matrix MA is determined. It is assumend that the values of MA represent point masses situated at the positions given by the element indices. The center of gravity is returned as a complex number whose real part contains the X coordinate and whose imaginary part contains the Y coordinate. Please note that this ordering of the coordinates is different from the ordering of matrix element indices (where the first index gives the i-th row, in other words, the Y coordinate). If all elements of MA are 0, there is no mass and, strictly speaking, no center of gravity. In this case, the center of gravity is assumed as the geometrical center of MA, i.e. as ( (len-1) / 2; ( (ht-1) / 2; ).
In order to calculate the center of gravity of an MZ matrix over explicitly given X-Y coordinates, call MF_centerOfGravityV. |
|
Return value | (Interpolated) coordinates of the center of gravity |
|
|
MF_centerOfGravityInd | MD_centerOfGravityInd | ME_centerOfGravityInd |
|
Function | Center of gravity of an MZ matrix over explicitly given X and Y axes |
|
Syntax C/C++ | #include <MFstd.h>
fComplex MF_centerOfGravityV( fVector X, fVector Y, fMatrix MZ, ui ht, ui len ); |
C++ VecObj | #include <OptiVec.h>
complex<T> matrix<T>::centerOfGravityV( const vector<T>& X, const vector<T>& Y ); |
Pascal/Delphi | uses MFstd;
procedure MF_centerOfGravityV( var COG:fComplex; X, Y:fVector; MZ:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_centerOfGravityV( fComplex *h_RetVal, fVector d_X, fVector d_Y, fMatrix d_MZ, ui ht, ui len );
int cusdMF_centerOfGravityV( fComplex *d_RetVal, fVector d_X, fVector d_Y, fMatrix d_MZ, ui ht, ui len );
fComplex MFcu_centerOfGravityV( fVector h_X, fVector h_Y, fMatrix h_MZ, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_centerOfGravityV( var h_RetVal:fComplex; d_X, d_Y:fVector; d_MZ:fMatrix; ht, len:UIntSize ): IntBool;
function cusdMF_centerOfGravityV( d_RetVal:PfComplex; d_X, d_Y:fVector; d_MZ:fMatrix; ht, len:UIntSize ): IntBool;
function MFcu_centerOfGravityV( h_X, h_Y:fVector; h_MZ:fMatrix; ht, len:UIntSize ): fComplex
Alternative syntax:
procedure MFcu_centerOfGravityV( var h_RetVal:fComplex; h_X, h_Y:fVector; h_MZ:fMatrix; ht, len:UIntSize );
|
|
Description | The center of gravity of the matrix MZ is determined. It is assumend that the values of MZ represent point masses situated at the coordinates specified by the vectors X and Y. The center of gravity is returned as a complex number whose real part contains the X coordinate and whose imaginary part contains the Y coordinate. Please note that this ordering of the coordinates is different from the ordering of matrix element indices (where the first index gives the i-th row, in other words, the Y coordinate). If all elements of MA are 0, there is no mass and, strictly speaking, no center of gravity. In this case, the center of gravity is assumed as the geometrical center of MA, i.e. as ( (X[size-1)] - X[0]) / 2; (X[size-1)] - X[0]) / 2; ).
In order to calculate the center of gravity of an MZ matrix over the element indices, call MF_centerOfGravityInd. |
|
Return value | (Interpolated) coordinates of the center of gravity |
|
|
MF_CholeskyLdecompose
| MD_CholeskyLdecompose |
ME_CholeskyLdecompose |
MF_CholeskyRdecompose |
MD_CholeskyRdecompose |
ME_CholeskyRdecompose |
|
Function | Cholesky decomposition of a symmetric, positive-definite matrix |
|
Syntax C/C++ | #include <MFstd.h>
int MF_CholeskyLdecompose( fMatrix ML, fMatrix MA, ui len );
int MF_CholeskyRdecompose( fMatrix MR, fMatrix MA, ui len );
|
C++ MatObj | #include <OptiVec.h>
void matrix<T>::CholeskyLdecompose( const matrix<T>& MA );
void matrix<T>::CholeskyRdecompose( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
function MF_CholeskyLdecompose( ML:fMatrix; MA:fMatrix; len:UIntSize ):Integer;
function MF_CholeskyRdecompose( MR:fMatrix; MA:fMatrix; len:UIntSize ):Integer;
|
|
Description | MA is decomposed into a product MA = ML * MR, where L is left (lower) triangular, and MR is right (upper) triangular. Additionally, MR is the transposed of ML, MR = MLT. Consequently, one needs only either ML or MR for the complete information, and one can choose either to get ML from MF_CholeskyLdecompose, or to get MR from MF_CholeskyLdecompose
MA may or may not be overwritten by ML or MR.
The return value indicates if the factorization was successful (return value 0), or if the input matrix turned out to be non-positive-definite (return value 1).
|
|
Error handling | In the case of a non-positive-definite matrix, ML or MR will remain undefined, and failure is indicated in the return value 1. |
|
Return value | 0, if successful, or 1 in case of a non-positive-definite input matrix |
|
|
MF_CholeskyDet
| MD_CholeskyDet |
ME_CholeskyDet |
|
Function | determinant of a symmetric matrix which has already undergone Cholesky decomposition |
|
Syntax C/C++ | #include <MFstd.h>
float MF_CholeskyDet( fMatrix MLR, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::CholeskyDet( const matrix<T>& MLR, int permut ); |
Pascal/Delphi | uses MFstd;
function MF_CholeskyDet( MLR:fMatrix; len:UIntSize ): Single; |
|
Description | The determinant of a symmetric matrix already decomposed into either ML or MR form by Cholesky decomposition is calculated and returned. It does not matter if the ML or the MR form is used. |
|
|
|
MF_CholeskyLimprove
| MD_CholeskyLimprove |
ME_CholeskyLimprove |
MF_CholeskyRimprove |
MD_CholeskyRimprove |
ME_CholeskyRimprove |
|
Function | iterative improvement of the solution of a linear system solved by the sequence of Cholesky L/R decomposition and Cholesky L/R solution |
|
Syntax C/C++ | #include <MFstd.h>
void MF_CholeskyLimprove( fVector X, fVector B, fMatrix MA, fMatrix ML, ui len );
void MF_CholeskyRimprove( fVector X, fVector B, fMatrix MA, fMatrix MR, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::CholeskyLimprove( const vector<T> B, const matrix<T>& MA, const matrix<T>& ML );
void vector<T>::CholeskyRimprove( const vector<T> B, const matrix<T>& MA, const matrix<T>& MR ); |
Pascal/Delphi | uses MFstd;
procedure MF_CholeskyLimprove( X, B:fVector; MA, ML:fMatrix; len:UIntSize );
procedure MFb_CholeskyRimprove( X, B:fVector; MA, MR:fMatrix; len:UIntSize ); |
|
Description | Especially for large matrices, accumulated round-off error in the solution of a linear system of equations may become quite noticable. This round-off error will translate into inaccurate results of MF_CholeskyLsolve. If the input matrix was not overwritten by the output matrix in the initial call to MF_CholeskyLdecompose, you may call MF_CholeskyLimprove after MF_CholeskyLsolve to improve the accuracy by iteration. MF_CholeskyLimprove needs the output vector X of MF_CholeskyLsolve, the right-hand-side vector B of the linear system, and both the original matrix MA and its raw ML-decomposed form ML as arguments. Likewise, MF_CholeskyRimprove improves a solution obtained with the MR form.
|
|
|
MF_CholeskyLinv
| MD_CholeskyLinv |
ME_CholeskyLinv |
MF_CholeskyRinv |
MD_CholeskyRinv |
ME_CholeskyRinv |
|
Function | invert a matrix already Cholesky decomposed into ML
or MR form |
|
Syntax C/C++ | #include <MFstd.h>
void MF_CholeskyLinv( fMatrix Inv, fMatrix ML, ui len );
void MF_CholeskyRinv( fMatrix Inv, fMatrix MR, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::CholeskyLinv( const matrix<T>& ML );
void matrix<T>::CholeskyRinv( const matrix<T>& MR ); |
Pascal/Delphi | uses MFstd;
procedure MF_CholeskyLinv( MInv, ML:fMatrix; len:UIntSize );
procedure MF_CholeskyRinv( MInv, MR:fMatrix; len:UIntSize ); |
|
|
|
MF_CholeskyLsolve
| MD_CholeskyLsolve |
ME_CholeskyLsolve |
MF_CholeskyRsolve |
MD_CholeskyRsolve |
ME_CholeskyRsolve |
|
Function | solve a symmetric linear system MA * X = B, where MA has already been decomposed into ML or MR form by Cholesky decomposition |
|
Syntax C/C++ | #include <MFstd.h>
void MF_CholeskyLsolve( fVector X, fMatrix ML, fVector B, ui len );
void MF_CholeskyRsolve( fVector X, fMatrix MR, fVector B, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::CholeskyLsolve( const matrix<T>& ML, const vector<T>& B );
void vector<T>::CholeskyRsolve( const matrix<T>& MR, const vector<T>& B ); |
Pascal/Delphi | uses MFstd;
procedure MF_CholeskyLsolve( X:fVector; ML:fMatrix; B:fVector; len:UIntSize );
procedure MF_CholeskyRsolve( X:fVector; MR:fMatrix; B:fVector; len:UIntSize ); |
|
Description | The linear system MA * X = B is solved for the vector X. Instead of MA itself, MF_CholeskyLsolve expects the ML decomposed form of MA as the input matrix ML, as output by MF_CholeskyLdecompose. Likewise, MF_CholeskyRsolve expects MR coming from MF_CholeskyRdecompose.
|
|
|
MF_Col_addC
| MD_Col_addC |
ME_Col_addC |
MCF_Col_addC |
MCD_Col_addC |
MCE_Col_addC |
|
Function | add a constant to all elements of one column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_addC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_addC( const ui iCol, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_addC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_addC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_addC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_addC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_addC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_addC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_addC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol += C, i=0,...,ht-1 |
|
|
MF_Col_addV
| MD_Col_addV |
ME_Col_addV |
MCF_Col_addV |
MCD_Col_addV |
MCE_Col_addV |
|
Function | add a vector to a column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_addV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_addV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_addV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_addV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_addV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_addV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_addV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol += Xi, i=0,...,ht-1 |
|
|
MCF_Col_conj |
MCD_Col_conj |
MCE_Col_conj |
|
Function | complex conjugate of all elements of one column |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Col_conj( cfMatrix MA, ui ht, ui len, ui iCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T>>::Col_conj( const ui iCol ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Col_conj( MA:cfMatrix; ht, len, iCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Col_conj( cfMatrix d_MA, ui ht, ui len, ui iCol );
void MCFcu_Col_conj( cfMatrix h_MA, ui ht, ui len, ui iCol ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Col_conj( d_MA:cfMatrix; ht, len, iCol:UIntSize ): IntBool;
procedure MCFcu_Col_conj( h_MA:cfMatrix; ht, len, iCol:UIntSize );
|
|
Description | MAi,iCol = MA*i,iCol, i=0,...,ht-1 |
|
|
MF_Col_delete
| MD_Col_delete |
ME_Col_delete |
MCF_Col_delete |
MCD_Col_delete |
MCE_Col_delete |
MI_Col_delete | MBI_Col_delete | MSI_Col_delete | MLI_Col_delete | MQI_Col_delete |
MU_Col_delete | MUB_Col_delete | MUS_Col_delete | MUL_Col_delete | MUQ_Col_delete |
|
Function | delete one column from a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_delete( fMatrix MB, fMatrix MA, ui htA, ui lenA, ui iCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_delete( const matrix<T>& MA, const ui iCol); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_delete( MB, MA:fMatrix; htA, lenA, iCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_delete( fMatrix d_MB, fMatrix d_MA, ui htA, ui lenA, ui iCol );
void MFcu_Col_delete( fMatrix h_MB, fMatrix h_MA, ui htA, ui lenA, ui iCol ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_delete( d_MB, d_MA:fMatrix; htA, lenA, iCol:UIntSize ): IntBool;
procedure MFcu_Col_delete( h_MB, h_MA:fMatrix; htA, lenA, iCol:UIntSize );
|
|
Description | MBi,j = MAi,j, i=0,..htA-1, j=0,..iCol-1
MBi,j = MAi,j+1, i=0,...,htA-1, j=iCol,...,lenA-2
The parameters htA and lenA refer to the input matrix |
|
|
MF_Col_divC
| MD_Col_divC |
ME_Col_divC |
MCF_Col_divC |
MCD_Col_divC |
MCE_Col_divC |
|
Function | divide all elements of one column by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_divC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_divC( const ui iCol, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_divC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_divC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_divC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_divC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_divC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_divC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_divC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol /= C, i=0,...,ht-1 |
|
|
MF_Col_divrC
| MD_Col_divrC |
ME_Col_divrC |
MCF_Col_divrC |
MCD_Col_divrC |
MCE_Col_divrC |
|
Function | Reverse division: divide a constant by a column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_divrC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_divrC( const ui iCol, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_divrC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_divrC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_divrC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_divrC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_divrC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_divrC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_divrC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol = C / MAi,iCol, i=0,...,ht-1 |
|
|
MF_Col_divrV
| MD_Col_divrV |
ME_Col_divrV |
MCF_Col_divrV |
MCD_Col_divrV |
MCE_Col_divrV |
|
Function | Reverse division: divide a vector by a column (element-wise) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_divrV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_divrV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_divrV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_divrV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_divrV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_divrV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_divrV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol = Xi / MAi,iCol, i=0,...,ht-1 |
|
|
MF_Col_divV
| MD_Col_divV |
ME_Col_divV |
MCF_Col_divV |
MCD_Col_divV |
MCE_Col_divV |
|
Function | element-wise division of a column by a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_divV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_divV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_divV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_divV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_divV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_divV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_divV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol /= Xi, i=0,...,ht-1 |
|
|
MF_Col_equ0
| MD_Col_equ0 |
ME_Col_equ0 |
MCF_Col_equ0 |
MCD_Col_equ0 |
MCE_Col_equ0 |
MCF_Col_Reequ0 |
MCD_Col_Reequ0 |
MCE_Col_Reequ0 |
MCF_Col_Imequ0 |
MCD_Col_Imequ0 |
MCE_Col_Imequ0 |
MI_Col_equ0 | MBI_Col_equ0 | MSI_Col_equ0 | MLI_Col_equ0 | MQI_Col_equ0 |
MU_Col_equ0 | MUB_Col_equ0 | MUS_Col_equ0 | MUL_Col_equ0 | MUQ_Col_equ0 |
|
Function | set all elements of one column to zero |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_equ0( fMatrix MA, ui ht, ui len, ui iCol );
void MCF_Col_Reequ0( cfMatrix MA, ui ht, ui len, ui iCol );
void MCF_Col_Imequ0( cfMatrix MA, ui ht, ui len, ui iCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_equ0( const ui iCol );
void matrix<complex<T>>::Col_Reequ0( const ui iCol );
void matrix<complex<T>>::Col_Imequ0( const ui iCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_equ0( MA:fMatrix; ht, len, iCol:UIntSize );
procedure MCF_Col_Reequ0( MA:cfMatrix; ht, len, iCol:UIntSize );
procedure MCF_Col_Imequ0( MA:cfMatrix; ht, len, iCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_equ0( fMatrix d_MA, ui ht, ui len, ui iCol );
int cudaMCF_Col_Reequ0( cfMatrix d_MA, ui ht, ui len, ui iCol );
int cudaMCF_Col_Imequ0( cfMatrix d_MA, ui ht, ui len, ui iCol );
void MFcu_Col_equ0( fMatrix h_MA, ui ht, ui len, ui iCol ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_equ0( d_MA:fMatrix; ht, len, iCol:UIntSize ): IntBool;
function cudaMCF_Col_Reequ0( d_MA:cfMatrix; ht, len, iCol:UIntSize ): IntBool;
function cudaMCF_Col_Imequ0( d_MA:cfMatrix; ht, len, iCol:UIntSize ): IntBool;
procedure MFcu_Col_equ0( h_MA:fMatrix; ht, len, iCol:UIntSize );
|
|
Description | M?_Col_equ0: | MAi,iCol = 0, i=0,...,ht-1 |
MC?_Col_Reequ0: | MAi,iCol.Re = 0, i=0,...,ht-1 (MAi,iCol.Im remains unchanged) |
MC?_Col_Imequ0: | MAi,iCol.Im = 0, i=0,...,ht-1 (MAi,iCol.Re remains unchanged) |
|
|
|
MF_Col_equC
| MD_Col_equC |
ME_Col_equC |
MCF_Col_equC |
MCD_Col_equC |
MCE_Col_equC |
MI_Col_equC | MBI_Col_equC | MSI_Col_equC | MLI_Col_equC | MQI_Col_equC |
MU_Col_equC | MUB_Col_equC | MUS_Col_equC | MUL_Col_equC | MUQ_Col_equC |
|
Function | initialize all elements of one column with a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_equC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_equC( const ui iCol, const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_equC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_equC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_equC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_equC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_equC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_equC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_equC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol = C, i=0,...,ht-1 |
|
|
MF_Col_equV
| MD_Col_equV |
ME_Col_equV |
MCF_Col_equV |
MCD_Col_equV |
MCE_Col_equV |
MI_Col_equV | MBI_Col_equV | MSI_Col_equV | MLI_Col_equV | MQI_Col_equV |
MU_Col_equV | MUB_Col_equV | MUS_Col_equV | MUL_Col_equV | MUQ_Col_equV |
|
Function | copy a vector into one column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_equV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_equV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_equV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_equV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_equV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_equV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_equV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol = Xi, i=0,...,ht-1 |
|
|
MF_Col_extract
| MD_Col_extract |
ME_Col_extract |
MCF_Col_extract |
MCD_Col_extract |
MCE_Col_extract |
MI_Col_extract | MBI_Col_extract | MSI_Col_extract | MLI_Col_extract | MQI_Col_extract |
MU_Col_extract | MUB_Col_extract | MUS_Col_extract | MUL_Col_extract | MUQ_Col_extract |
|
Function | copy one column into a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_extract( fVector Y, fMatrix MA, ui ht, ui len, ui iCol ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Col_extract( const matrix<T>& MA, const ui iCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_extract( Y:fVector; MA:fMatrix; ht, len, iCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_extract( fVector d_Y, fMatrix d_MA, ui ht, ui len, ui iCol );
void MFcu_Col_extract( fVector h_Y, fMatrix h_MA, ui ht, ui len, ui iCol ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_extract( d_Y:fVector; d_MA:fMatrix; ht, len, iCol:UIntSize ): IntBool;
procedure MFcu_Col_extract( h_Y:fVector; h_MA:fMatrix; ht, len, iCol:UIntSize );
|
|
Description | Yi = MAi,iCol, i=0,...,ht-1 |
|
|
MF_Col_insert
| MD_Col_insert |
ME_Col_insert |
MCF_Col_insert |
MCD_Col_insert |
MCE_Col_insert |
MI_Col_insert | MBI_Col_insert | MSI_Col_insert | MLI_Col_insert | MQI_Col_insert |
MU_Col_insert | MUB_Col_insert | MUS_Col_insert | MUL_Col_insert | MUQ_Col_insert |
|
Function | augment a matrix by insertion of one column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_insert( fMatrix MB, fMatrix MA, ui htB, ui lenB, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_insert( const matrix<T>& MA, const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_insert( MB, MA:fMatrix; htB, lenB, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_insert( fMatrix d_MB, fMatrix d_MA, ui htB, ui lenB, ui iCol, fVector d_X );
void MFcu_Col_insert( fMatrix h_MB, fMatrix h_MA, ui htB, ui lenB, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_insert( d_MB, d_MA:fMatrix; htB, lenB, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_insert( h_MB, h_MA:fMatrix; htB, lenB, iCol:UIntSize; h_X:fVector );
|
|
Description | MBi,j = MAi,j, i=0,...,htB-1, j=0,...,iCol-1
MBi,iCol = Xi, i=0,...,htB-1
MBi,j = MAi,j-1, i=0,...,htB-1, j=iCol,...,lenB-1
The parameters htB and lenB refer to the output matrix |
|
|
MF_Col_mulC
| MD_Col_mulC |
ME_Col_mulC |
MCF_Col_mulC |
MCD_Col_mulC |
MCE_Col_mulC |
|
Function | multiply all elements of one column by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_mulC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_mulC( const ui iCol, const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_mulC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_mulC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_mulC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_mulC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_mulC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_mulC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_mulC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol *= C, i=0,...,ht-1 |
|
|
MF_Col_mulV
| MD_Col_mulV |
ME_Col_mulV |
MCF_Col_mulV |
MCD_Col_mulV |
MCE_Col_mulV |
|
Function | element-wise multiplication of a column by a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_mulV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_mulV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_mulV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_mulV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_mulV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_mulV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_mulV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol *= Xi, i=0,..,ht-1 |
|
|
MF_Col_neg
| MD_Col_neg |
ME_Col_neg |
MCF_Col_neg |
MCD_Col_neg |
MCE_Col_neg |
|
Function | multiply all elements of one column by -1 |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_neg( fMatrix MA, ui ht, ui len, ui iCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_neg( const ui iCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_neg( MA:fMatrix; ht, len, iCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_neg( fMatrix d_MA, ui ht, ui len, ui iCol );
void MFcu_Col_neg( fMatrix h_MA, ui ht, ui len, ui iCol ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_neg( d_MA:fMatrix; ht, len, iCol:UIntSize ): IntBool;
procedure MFcu_Col_neg( h_MA:fMatrix; ht, len, iCol:UIntSize );
|
|
Description | MAi,iCol *= -1, i=0,...,ht-1 |
|
|
MF_Col_subC
| MD_Col_subC |
ME_Col_subC |
MCF_Col_subC |
MCD_Col_subC |
MCE_Col_subC |
|
Function | subtract a constant from all elements of one column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_subC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_subC( const ui iCol, const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_subC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_subC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_subC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_subC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_subC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_subC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_subC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol -= C, i=0,..,ht-1 |
|
|
MF_Col_subrC
| MD_Col_subrC |
ME_Col_subrC |
MCF_Col_subrC |
MCD_Col_subrC |
MCE_Col_subrC |
|
Function | reverse subtraction: a constant minus one column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_subrC( fMatrix MA, ui ht, ui len, ui iCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_subrC( const ui iCol, const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_subrC( MA:fMatrix; ht, len, iCol:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_subrC( fMatrix d_MA, ui ht, ui len, ui iCol, float C );
int cusdMF_Col_subrC( fMatrix d_MA, ui ht, ui len, ui iCol, float *d_C );
void MFcu_Col_subrC( fMatrix h_MA, ui ht, ui len, ui iCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_subrC( d_MA:fMatrix; ht, len, iCol:UIntSize; C:Single ): IntBool;
function cusdMF_Col_subrC( d_MA:fMatrix; ht, len, iCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Col_subrC( h_MA:fMatrix; ht, len, iCol:UIntSize; C:Single );
|
|
Description | MAi,iCol = C - MAi,iCol, i=0,..,ht-1 |
|
|
MF_Col_subrV
| MD_Col_subrV |
ME_Col_subrV |
MCF_Col_subrV |
MCD_Col_subrV |
MCE_Col_subrV |
|
Function | reverse subtraction: a vector minus one column (element-wise) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_subrV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_subrV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_subrV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_subrV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_subrV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_subrV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_subrV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol = Xi - MAi,iCol, i=0,..,ht-1 |
|
|
MF_Col_subV
| MD_Col_subV |
ME_Col_subV |
MCF_Col_subV |
MCD_Col_subV |
MCE_Col_subV |
|
Function | subtract a vector from a column (element-wise) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Col_subV( fMatrix MA, ui ht, ui len, ui iCol, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Col_subV( const ui iCol, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Col_subV( MA:fMatrix; ht, len, iCol:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Col_subV( fMatrix d_MA, ui ht, ui len, ui iCol, fVector d_X );
void MFcu_Col_subV( fMatrix h_MA, ui ht, ui len, ui iCol, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Col_subV( d_MA:fMatrix; ht, len, iCol:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Col_subV( h_MA:fMatrix; ht, len, iCol:UIntSize; h_X:fVector );
|
|
Description | MAi,iCol -= Xi, i=0,..,ht-1 |
|
|
MF_Cols_absmax
| MD_Cols_absmax |
ME_Cols_absmax |
MCF_Cols_absmax |
MCD_Cols_absmax |
MCE_Cols_absmax |
|
Function | store the absolute maxima of all individual columns in a row vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_absmax( fVector Y, fMatrix MA, ui ht, ui len );
void MCF_Cols_absmax( fVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Cols_absmax( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_absmax( Y:fVector; MA:fMatrix; ht, len:UIntSize );
procedure MCF_Cols_absmax( Y:fVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_absmax( fVector d_Y, fMatrix d_MA, ui ht, ui len );
int cudaMCF_Cols_absmax( fVector d_Y, cfMatrix d_MA, ui ht, ui len )
void MFcu_Cols_absmax( fVector h_Y, fMatrix h_MA, ui ht, ui len );
void MCFcu_Cols_absmax( fVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_absmax( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMCF_Cols_absmax( d_Y:fVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_absmax( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
procedure MCFcu_Cols_absmax( h_Y:fVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum absolute value of each column j is stored as the element Yj for j=0,..,len-1 |
|
|
MCF_Cols_absmaxReIm
| MCD_Cols_absmaxReIm |
MCE_Cols_absmaxReIm |
|
Function | Separate determination of the largest absolute values of the real and imaginary parts of each column |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Cols_absmaxReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Cols_absmaxReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Cols_absmaxReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_absmaxReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_absmaxReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_absmaxReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_absmaxReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum absolute values of the real and imaginary parts of each column j are combined into the element Yj for j=0,..,len-1 |
|
|
MF_Cols_absmin
| MD_Cols_absmin |
ME_Cols_absmin |
MCF_Cols_absmin |
MCD_Cols_absmin |
MCE_Cols_absmin |
|
Function | store the absolute minima of all individual columns in a row vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_absmin( fVector Y, fMatrix MA, ui ht, ui len );
void MCF_Cols_absmin( fVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Cols_absmin( const matrix<T>& MA );
void vector<T>::Cols_absmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_absmin( Y:fVector; MA:fMatrix; ht, len:UIntSize );
procedure MCF_Cols_absmin( Y:fVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_absmin( fVector d_Y, fMatrix d_MA, ui ht, ui len );
int cudaMCF_Cols_absmin( fVector d_Y, cfMatrix d_MA, ui ht, ui len )
void MFcu_Cols_absmin( fVector h_Y, fMatrix h_MA, ui ht, ui len );
void MCFcu_Cols_absmin( fVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_absmin( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMCF_Cols_absmin( d_Y:fVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_absmin( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
procedure MCFcu_Cols_absmin( h_Y:fVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The minimum absolute value of each column j is stored as the element Yj for j=0,..,len-1 |
|
|
MCF_Cols_absminReIm
| MCD_Cols_absminReIm |
MCE_Cols_absminReIm |
|
Function | Separate determination of the smallest absolute values of the real and imaginary parts of each column |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Cols_absminReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Cols_absminReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Cols_absminReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_absminReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_absminReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_absminReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_absminReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The minimum absolute values of the real and imaginary parts of each column j are combined into the element Yj for j=0,..,len-1 |
|
|
MF_Cols_add
| MD_Cols_add |
ME_Cols_add |
MCF_Cols_add |
MCD_Cols_add |
MCE_Cols_add |
|
Function | make one column the sum of itself and another column |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_add( fMatrix MA, ui ht, ui len, unsigned destCol, unsigned sourceCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_add( const unsigned destCol, const unsigned sourceCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_add( MA:fMatrix; ht, len, destCol, sourceCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_add( fMatrix d_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol );
void MFcu_Cols_add( fMatrix h_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_add( d_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize ): IntBool;
procedure MFcu_Cols_add( h_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize );
|
|
Description | MAi,destCol += MAi,sourceCol, i=0,..,ht-1 |
|
|
MCF_Cols_cabsmax
| MCD_Cols_cabsmax |
MCE_Cols_cabsmax |
|
Function | Find the complex numbers of largest magnitude along columns and store them in a row vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Cols_cabsmax( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Cols_cabsmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Cols_cabsmax( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_cabsmax( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_cabsmax( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_cabsmax( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_cabsmax( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each column j of MA, the complex number of largest magnitude, sqrt(Re2+Im2), is found and stored as the element Yj for j=0,..,len-1 |
|
|
MCF_Cols_cabsmin
| MCD_Cols_cabsmin |
MCE_Cols_cabsmin |
|
Function | Find the complex numbers of smallest magnitude along columns and store them in a row vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Cols_cabsmin( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Cols_cabsmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Cols_cabsmin( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_cabsmin( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_cabsmin( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_cabsmin( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_cabsmin( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each column j of MA, the complex number of smallest magnitude, sqrt(Re2+Im2), is found and stored as the element Yj for j=0,..,len-1 |
|
|
MF_Cols_Cadd
| MD_Cols_Cadd |
ME_Cols_Cadd |
MCF_Cols_Cadd |
MCD_Cols_Cadd |
MCE_Cols_Cadd |
|
Function | make one column the sum of itself and another column, scaled by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_Cadd( fMatrix MA, ui ht, ui len, unsigned destCol, unsigned sourceCol, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_Cadd( const unsigned destCol, const unsigned sourceCol, const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_Cadd( MA:fMatrix; ht, len, destCol, sourceCol:UIntSize;
C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_Cadd( fMatrix d_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol, float C );
int cusdMF_Cols_Cadd( fMatrix d_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol, float *d_C );
void MFcu_Cols_Cadd( fMatrix h_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_Cadd( d_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize; C:Single ): IntBool;
function cusdMF_Cols_Cadd( d_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Cols_Cadd( h_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize; C:Single );
|
|
Description | MAi,destCol += C * MAi,sourceCol, i=0,..,ht-1 |
|
|
MF_Cols_distribution | MD_Cols_distribution | ME_Cols_distribution |
MI_Cols_distribution | MBI_Cols_distribution | MSI_Cols_distribution | MLI_Cols_distribution | MQI_Cols_distribution |
MU_Cols_distribution | MUB_Cols_distribution | MUS_Cols_distribution | MUL_Cols_distribution | MUQ_Cols_distribution |
|
Function | Histogram or Distribution function along columns |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_distribution( uiMatrix MAbund, fVector Limits, ui nbins, fMatrix MA, ui ht, ui len, int mode ); |
C++ VecObj | #include <OptiVec.h>
void matrix<ui>::Cols_distribution( const vector<T>& Limits, const matrix<T>& MA, int mode=0 ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_distribution( MAbund:uiMatrix; Limits:fVector; nbins:UIntSize; MA:fMatrix; ht, len:UIntSize; mode:Integer ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_distribution( uiMatrix d_MAbund, fVector d_Limits, ui nbins, fMatrix d_MA, ui ht, ui len, int mode );
void MFcu_Cols_distribution( uiMatrix h_MAbund, fVector h_Limits, ui nbins, fMatrix h_MA, ui ht, ui len, int mode ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_distribution( d_MAbund:uiMatrix; d_Limits:fVector; nbins:UIntSize; d_MA:fMatrix; ht, len:UIntSize; mode:Integer ): IntBool;
procedure MFcu_Cols_distribution( h_MAbund:uiMatrix; h_Limits:fVector; nbins:UIntSize; h_MA:fMatrix; ht, len:UIntSize; mode:Integer );
|
|
Description | For each column of MA, this function counts the number of elements falling into each of the intervals defined by Limits. The abundances thus determined are stored in the corresponding columns of MAbund.
nbins is the number of elements of Limits, i.e. the number of intervals. The size of MAbund is nbins*len.
Limits must be in ascending order. The spacing between the elements of Limits need not necessarily be constant.
The parameter mode specifies how to interpret the values given in Limits.
mode > 0: Limits contains the upper limits of the intervals
mode < 0: Limits contains the lower limits of the intervals
mode = 0: Limits contains the mid-points of the intervals. An element of MA belongs to the Limits value closest to it. In case of exactly equal distances, the interval with the lower index is chosen.
The interval defined by Limits0 extends down to -HUGE_VAL, the interval defined by Limitsnbins-1 reaches up to +HUGE_VAL.
In contrast to VF_distribution, elements outside the intervals are not taken into account; their number is not returned.
This function may be used for batch processing of several vectors of equal size. To this end, the vectors have to be copied into the columns of a matrix.
At present, these functions are available only in the 64-bit libraries.
|
|
|
|
|
MF_Cols_exchange
| MD_Cols_exchange |
ME_Cols_exchange |
MCF_Cols_exchange |
MCD_Cols_exchange |
MCE_Cols_exchange |
MI_Cols_exchange | MBI_Cols_exchange | MSI_Cols_exchange | MLI_Cols_exchange | MQI_Cols_exchange |
MU_Cols_exchange | MUB_Cols_exchange | MUS_Cols_exchange | MUL_Cols_exchange | MUQ_Cols_exchange |
|
Function | exchange two columns |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_exchange( fMatrix MA, ui ht, ui len, unsigned i1, unsigned i2 ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_exchange( const unsigned i1, const unsigned i2 ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_exchange( MA:fMatrix; ht, len, i1, i2:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_exchange( fMatrix d_MA, ui ht, ui len, unsigned i1, unsigned i2 );
void MFcu_Cols_exchange( fMatrix MA, ui ht, ui len, unsigned i1, unsigned i2 ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_exchange( d_MA:fMatrix; ht, len, i1, i2:UIntSize ): IntBool;
procedure MFcu_Cols_exchange( h_MA:fMatrix; ht, len, i1, i2:UIntSize );
|
|
Description | The elements of the columns i1 and i2 are exchanged. |
|
|
MF_Cols_FFT |
MD_Cols_FFT |
ME_Cols_FFT |
MFb_Cols_FFT |
MDb_Cols_FFT |
MEb_Cols_FFT |
MF_Cols_FFTtoC
| MD_Cols_FFTtoC |
ME_Cols_FFTtoC |
MFb_Cols_FFTtoC
| MDb_Cols_FFTtoC |
MEb_Cols_FFTtoC |
MCF_Cols_FFT |
MCD_Cols_FFT |
MCE_Cols_FFT |
MCFb_Cols_FFT |
MCDb_Cols_FFT |
MCEb_Cols_FFT |
|
Function | Fast Fourier Transform along the columns |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_FFT( fMatrix Y, fMatrix X, ui ht, ui len, int dir );
void MCF_Cols_FFT( cfMatrix Y, cfMatrix X, ui ht, ui len, int dir );
void MF_Cols_FFTtoC( cfMatrix Y, fMatrix X, ui ht, ui len );
void MFb_Cols_FFT( fMatrix Y, fMatrix X, ui ht, ui len, int dir, fVector Buf );
void MCFb_Cols_FFT( cfMatrix Y, cfMatrix X, ui ht, ui len, int dir, cfVector Buf );
void MFb_Cols_FFTtoC( cfMatrix Y, fMatrix X, ui ht, ui len, cfVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_FFT( const matrix<T>& MX, int dir );
void matrix<complex<T> >::FFT( const matrix<complex<T> >& MX, int dir );
void matrix<complex<T> >::FFTtoC( const matrix<T>& MX );
void matrix<T>::b_Cols_FFT( const matrix<T>& MX, int dir, vector<T>& Buf );
void matrix<complex<T> >::b_Cols_FFT( const matrix<complex<T> > MX, int dir, vector<complex<T> >&Buf );
void matrix<complex<T> >::b_Cols_FFTtoC( const matrix<T> MX, vector<complex<T>>&Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCF_Cols_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MF_Cols_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize );
procedure MFb_Cols_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer; Buf:fVector );
procedure MCFb_Cols_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer; Buf:cfVector );
procedure MFb_Cols_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize; Buf:cfVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
#include <cudaMCFstd.h>
int cudaMF_Cols_FFT( fMatrix d_Y, fMatrix d_X, ui ht, ui len, int dir );
int cuda MCF_Cols_FFT( cfMatrix d_Y, cfMatrix d_X, ui ht, ui len, int dir );
int cudaMF_Cols_FFTtoC( cfMatrix d_Y, fMatrix d_X, ui ht, ui len );
void MFcu_Cols_FFT( fMatrix h_Y, fMatrix h_X, ui ht, ui len, int dir );
void MCFcu_Cols_FFT( cfMatrix h_Y, cfMatrix h_X, ui ht, ui len, int dir );
void MFcu_Cols_FFTtoC( cfMatrix h_Y, fMatrix h_X, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd, MCFstd;
function cudaMF_Cols_FFT( d_MY, d_MX:fMatrix; ht, len:UIntSize; dir:Integer ): IntBool;
function cudaMCF_Cols_FFT( d_MY, d_MX:cfMatrix; ht, len:UIntSize; dir:Integer ): IntBool;
function cudaMF_Cols_FFTtoC( d_MY:cfMatrix; d_MX:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_FFT( h_MY, h_MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCFcu_Cols_FFT( h_MY, h_MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MFcu_Cols_FFTtoC( h_MY:cfMatrix; h_MX:fMatrix; ht, len:UIntSize );
|
|
Description | The one-dimensional Fourier transform of all columns of MX is calculated and stored in the corresponding columns of MY. The forward transform is obtained by setting dir = 1, the inverse (or backward) transform by setting dir = -1. By convention, the inverse transform involves scaling the result by the factor 1.0/ht (so as to ensure that the result of one forward and one backward transform yields – within round-off error – the original matrix). Since it is sometimes desirable to skip this implicit scaling, MF_Cols_FFT offers the possibility to do so: specify dir = -2 in this case.
A Fast Fourier Transform algorithm is used that requires ht to be a power of 2. len may be set arbitrarily, but the function will be most efficient if len is a multiple of 4.
Complex version: Both MX and the output MY are complex matrices.
Real-to-complex version: The input matrix MX is real. The output matrix MY is complex. As this function can only perform a forward transform, no argument "dir" is needed.
Purely real version: For the forward transform, MX is a real matrix. The output MY is also defined as fMatrix, although it consists of complex numbers. The reason is that the symmetry properties of FFT allow to store the result in a packed format, fitting into the same memory space as the input matrix. The order of each column of MY is indicated in the following table. U means the uncompressed result, N is ht.
Y0, i | U0, i.Re |
Y1, i | UN/2, i.Re |
Y2, i | U1, i.Re |
Y3, i | U1, i.Im |
..... | ..... |
YN-2, i | UN/2-1, i.Re |
YN-1, i | UN/2-1, i.Im |
This storage scheme implies that, for C/C++ (where matrices are stored in row-major order), the real and imaginary parts of any element are not adjacent in memory .
For inverse real-matrix Cols_FFT, the input matrix has to be of this packed-complex format, and you get a real matrix. If you prefer to get the result of forward FFT in true complex format, use MF_Cols_FFTtoC.
MFb_Cols_FFT, MFb_Cols_FFTtoC and MCFb_Cols_FFT take a buffer vector Buf as an additional argument. They are slightly more efficient than the un-buffered versions. Buf must have (at least) the same size as MX and MY (i.e., Buf.size >= ht*len).
|
|
Error handling | If ht is not a power of 2, the program is aborted with the error message "Size must be an integer power of 2". |
|
|
MF_Cols_lincomb
| MD_Cols_lincomb |
ME_Cols_lincomb |
MCF_Cols_lincomb |
MCD_Cols_lincomb |
MCE_Cols_lincomb |
|
Function | linear combination of two columns |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_lincomb( fMatrix MA, ui ht, ui len, unsigned destCol, float destC, unsigned srceCol, float srceC ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_lincomb( const unsigned destCol, const T& destC, const unsigned srceCol, const T& srceC ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_lincomb( MA:fMatrix; ht, len:UIntSize; destCol:UIntSize; destC:Single; srceCol:UIntSize; srceC:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_lincomb( fMatrix d_MA, ui ht, ui len, unsigned destCol, float destC, unsigned srceCol, float srceC );
int cusdMF_Cols_lincomb( fMatrix d_MA, ui ht, ui len, unsigned destCol, float
d_destC, unsigned srceCol, float *d_srceC );
void MFcu_Cols_lincomb( fMatrix h_MA, ui ht, ui len, unsigned destCol, float destC, unsigned srceCol, float srceC );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_lincomb( d_MA:fMatrix; ht, len:UIntSize; destCol:UIntSize; destC:Single; srceCol:UIntSize; srceC:Single ): IntBool;
function cusdMF_Cols_lincomb( d_MA:fMatrix; ht, len:UIntSize; destCol:UIntSize; d_destC:PSingle; srceCol:UIntSize; d_srceC:PSingle ): IntBool;
procedure MFcu_Cols_lincomb( h_MA:fMatrix; ht, len:UIntSize; destCol:UIntSize; destC:Single; srceCol:UIntSize; srceC:Single );
|
|
Description | MAi,destCol = destC * MAi,destCol+ srceC * MAi,srceCol, i=0,..,ht-1 |
|
|
MF_Cols_max
| MD_Cols_max |
ME_Cols_max |
MI_Cols_max | MBI_Cols_max | MSI_Cols_max | MLI_Cols_max | MQI_Cols_max |
MU_Cols_max | MUB_Cols_max | MUS_Cols_max | MUL_Cols_max | MUQ_Cols_max |
|
Function | store the maxima of all individual columns in a row vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_max( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Cols_max( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_max( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_max( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_max( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_max( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_max( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | The maximum value of each column j is stored as the element Yj for j=0,..,len-1 |
|
|
MCF_Cols_maxReIm
| MCD_Cols_maxReIm |
MCE_Cols_maxReIm |
|
Function | Separate determination of the largest values of the real and imaginary parts of each column |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Cols_maxReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Cols_maxReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Cols_maxReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_maxReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_maxReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_maxReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_maxReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum values of the real and imaginary parts of each column j are combined into the element Yj for j=0,..,len-1 |
|
|
MF_Cols_min
| MD_Cols_min |
ME_Cols_min |
MI_Cols_min | MBI_Cols_min | MSI_Cols_min | MLI_Cols_min | MQI_Cols_min |
MU_Cols_min | MUB_Cols_min | MUS_Cols_min | MUL_Cols_min | MUQ_Cols_min |
|
Function | store the minima of all individual columns in a row vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_min( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Cols_min( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_min( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_min( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_min( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_min( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_min( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | The minimum value of each column j is stored as the element Yj for j=0,..,len-1 |
|
|
MCF_Cols_minReIm
| MCD_Cols_maxReIm |
MCE_Cols_maxReIm |
|
Function | Separate determination of the largest values of the real and imaginary parts of each column |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Cols_maxReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Cols_minReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Cols_minReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_minReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_minReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_minReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_minReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum values of the real and imaginary parts of each column j are combined into the element Yj for j=0,..,len-1 |
|
|
MF_Cols_prod
| MD_Cols_prod |
ME_Cols_prod |
MCF_Cols_prod |
MCD_Cols_prod |
MCE_Cols_prod |
|
Function | products over all elements of each individual column, stored in a row vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_prod(fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Cols_prod( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_prod(Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_prod( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_prod( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_prod( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_prod( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | Yj = prod( MAi,j, i=0,..,ht-1), j=0,..,len-1 |
|
|
MF_Cols_reflect
| MD_Cols_reflect |
ME_Cols_reflect |
MCF_Cols_reflect
| MCD_Cols_reflect |
MCE_Cols_reflect |
MI_Cols_reflect | MBI_Cols_reflect | MSI_Cols_reflect | MLI_Cols_reflect | MQI_Cols_reflect |
MU_Cols_reflect | MUB_Cols_reflect | MUS_Cols_reflect | MUL_Cols_reflect | MUQ_Cols_reflect |
|
Function | Derive the second halves of all columns from their first halves by reflection at the horizontal line through the center of the matrix. |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_reflect( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_reflect(); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_reflect( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_reflect( fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_reflect( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_reflect( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_reflect( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAht-i-1,j = MAi, j, i=0,..(ht-1)/2; j=0,..,len-1 |
|
|
MF_Cols_rev
| MD_Cols_rev |
ME_Cols_rev |
MCF_Cols_rev
| MCD_Cols_rev |
MCE_Cols_rev |
MI_Cols_rev | MBI_Cols_rev | MSI_Cols_rev | MLI_Cols_rev | MQI_Cols_rev |
MU_Cols_rev | MUB_Cols_rev | MUS_Cols_rev | MUL_Cols_rev | MUQ_Cols_rev |
|
Function | Reverse the element ordering along columns. This corresponds to a reflection of the matrix at the X axis. |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_rev( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_rev(); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_rev( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_rev( fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_rev( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_rev( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_rev( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi,j = MAht-i-1, j |
|
|
MF_Cols_rotate
| MD_Cols_rotate |
ME_Cols_rotate |
MCF_Cols_rotate |
MCD_Cols_rotate |
MCE_Cols_rotate |
MI_Cols_rotate | MBI_Cols_rotate | MSI_Cols_rotate | MLI_Cols_rotate | MQI_Cols_rotate |
MU_Cols_rotate | MUB_Cols_rotate | MUS_Cols_rotate | MUL_Cols_rotate | MUQ_Cols_rotate |
|
Function | rotate all columns by a specified number of positions; thereby, whole rows are moved |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_rotate( fMatrix MA, ui ht, ui len, int pos ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_rotate( const int pos ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_rotate( MA:fMatrix; ht, len:UIntSize; pos:Integer ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_rotate( fMatrix d_MA, ui ht, ui len, int pos );
void MFcu_Cols_rotate( fMatrix h_MA, ui ht, ui len, int pos );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_rotate( d_MA:fMatrix; ht, len:UIntSize; pos:Integer ): IntBool;
procedure MFcu_Cols_rotate( h_MA:fMatrix; ht, len:UIntSize; pos:Integer );
|
|
Description | MAi,j = MAht-pos+i, j, i=0,..,pos-1
MAi,j = MAi-pos, j, i=pos,...,ht-1
This function is rather inefficient, as it needs to internally allocate and de-allocate work-space each time it is called. If your application contains frequent calls to this function, we recommend to allocate some matrix MBuf as buffer memory and replace the calls to MF_Cols_rotate by calls to MF_Cols_rotate_buf. |
|
|
MF_Cols_rotate_buf
| MD_Cols_rotate_buf |
ME_Cols_rotate_buf |
MCF_Cols_rotate_buf |
MCD_Cols_rotate_buf |
MCE_Cols_rotate_buf |
MI_Cols_rotate_buf | MBI_Cols_rotate_buf | MSI_Cols_rotate_buf | MLI_Cols_rotate_buf | MQI_Cols_rotate_buf |
MU_Cols_rotate_buf | MUB_Cols_rotate_buf | MUS_Cols_rotate_buf | MUL_Cols_rotate_buf | MUQ_Cols_rotate_buf |
|
Function | efficient column rotation (moving of whole rows), using specified buffer memory |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_rotate_buf( fMatrix MA, ui ht, ui len, int pos, fMatrix MBuf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_rotate_buf( const int pos, const matrix<T> MBuf ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_rotate_buf( MA:fMatrix; ht, len:UIntSize; pos:Integer; MBuf:fMatrix ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_rotate_buf( fMatrix d_MA, ui ht, ui len, int pos, fMatrix d_MBuf );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_rotate_buf( d_MA:fMatrix; ht, len:UIntSize; pos:Integer; d_MBuf:fMatrix ): IntBool;
|
|
Description | MAi,j = MAht-pos+i, j, i=0,..,pos-1
MAi,j = MAi-pos, j, i=pos,...,ht-1
This function is a more efficient variant of MF_Cols_rotate. Instead of internally allocating the necessary work-space, it takes the matrix MBuf as buffer memory. MBuf must be a matrix generated by the OptiVec memory management functions (MF_matrix etc.). The size (i.e., the number of elements, ht*len) of MBuf must be at least the same size as MA. |
|
|
MF_Cols_runprod
| MD_Cols_runprod |
ME_Cols_runprod |
MCF_Cols_runprod |
MCD_Cols_runprod |
MCE_Cols_runprod |
|
Function | running product over column elements |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_runprod( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_runprod(); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_runprod( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_runprod( fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_runprod( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_runprod( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_runprod( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | For all columns separately, each element is the product of itself and all preceding elements. This function should be used with care: overflow is easily reached, and underflow may lead to all elements from a certain position on being zero. |
|
|
MF_Cols_runsum
| MD_Cols_runsum |
ME_Cols_runsum |
MCF_Cols_runsum |
MCD_Cols_runsum |
MCE_Cols_runsum |
|
Function | running sum over column elements |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_runsum( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_runsum(); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_runsum( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_runsum( fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_runsum( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_runsum( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_runsum( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | For all columns separately, each element is the sum of itself and all preceding elements. |
|
|
MCF_Cols_sabsmax
| MCD_Cols_sabsmax |
MCE_Cols_sabsmax |
|
Function | Find the complex numbers of largest sum |Re| + |Im| along columns and store them in a row vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Cols_sabsmax( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Cols_sabsmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Cols_sabsmax( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_sabsmax( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_sabsmax( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_sabsmax( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_sabsmax( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each column j of MA, the complex number with the largest sum, |Re| + |Im|, is found and stored as the element Yj for j=0,..,len-1 |
|
|
MCF_Cols_sabsmin
| MCD_Cols_sabsmin |
MCE_Cols_sabsmin |
|
Function | Find the complex numbers of largest sum |Re| + |Im| along columns and store them in a row vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Cols_sabsmin( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Cols_sabsmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Cols_sabsmin( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
Description | Within each column j of MA, the complex number with the largest sum, |Re| + |Im|, is found and stored as the element Yj for j=0,..,len-1 |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Cols_sabsmin( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Cols_sabsmin( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Cols_sabsmin( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Cols_sabsmin( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
|
MF_Cols_sub
| MD_Cols_sub |
ME_Cols_sub |
MCF_Cols_sub |
MCD_Cols_sub |
MCE_Cols_sub |
|
Function | subtract one column from another and store the result back into the subtrahend |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_sub( fMatrix MA, ui ht, ui len, unsigned destCol, unsigned sourceCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Cols_sub( const unsigned destCol, const unsigned sourceCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_sub( MA:fMatrix; ht, len, destCol, sourceCol:UIntSize; ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_sub( fMatrix d_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol );
void MFcu_Cols_sub( fMatrix h_MA, ui ht, ui len, unsigned destCol, unsigned sourceCol ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_sub( d_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize ): IntBool;
procedure MFcu_Cols_sub( h_MA:fMatrix; ht, len, destCol, sourceCol:UIntSize );
|
|
Description | MAi,destCol -= MAi,sourceCol, i=0,..,ht-1 |
|
|
MF_Cols_sum
| MD_Cols_sum |
ME_Cols_sum |
MCF_Cols_sum |
MCD_Cols_sum |
MCE_Cols_sum |
|
Function | sums over all columns, returned in a row vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Cols_sum( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Cols_sum( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Cols_sum( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Cols_sum( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Cols_sum( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Cols_sum( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Cols_sum( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | Yj = sum( MAi,j, i=0,..,ht-1), j=0,..,len-1 |
|
|
MCF_conj
| MCD_conj |
MCE_conj |
|
Function | complex conjugate |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_conj( cfMatrix MB, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::conj(); |
Pascal/Delphi | uses MFstd;
procedure MCF_conj( MB, MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_conj( cfMatrix d_MB, cfMatrix d_MA, ui ht, ui len );
void MCFcu_conj( cfMatrix h_MB, cfMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_conj( d_MB, d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_conj( h_MB, h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | MBij.Re = MAij.Re
MBij.Im = -MAij.Im |
|
|
MF_coherence
| MD_coherence |
ME_coherence |
MFb_coherence
| MDb_coherence |
MEb_coherence |
MFb_coherence_sizeBuf
| MDb_coherence_sizeBuf |
MEb_coherence_sizeBuf |
|
Function | spatial frequency coherence |
|
Syntax C/C++ | #include <MFstd.h>
void MF_coherence( fMatrix MCohr, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win );
void MFb_coherence( fMatrix MCohr, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win, fVector Buf );
ui MFb_coherence_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::coherence( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin );
void matrix<T>::b_coherence( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin, vector<T> Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_coherence( MCohr:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_coherence( MCohr:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_coherence_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize; |
|
CUDA-Funktion C/C++ | #include <cudaMFstd.h>
int cudaMF_coherence( fMatrix d_MCohr, ui htSpec, ui lenSpec, fMatrix d_MX, fMatrix d_MY, ui htX, ui lenX, fMatrix d_MWin );
void MFcu_coherence( fMatrix h_MCohr, ui htSpec, ui lenSpec, fMatrix h_MX, fMatrix h_MY, ui htX, ui lenX, fMatrix h_MWin );
|
CUDA-Funktion Pascal/Delphi | uses MFstd;
function cudaMF_coherence( d_MCohr:fMatrix; htSpec, lenSpec:UIntSize; d_MX, d_MY:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;
procedure MFcu_coherence( h_MCohr:fMatrix; htSpec, lenSpec:UIntSize; h_MX, h_MY:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
|
|
Description | The spatial coherence function of the data sets MX and MY is calculated and stored in MCohr.
The algorithm follows Welch's method of dividing the input data into overlapping segments and averaging over their spectra and cross-spectra. For meaningful results, there must be more than one segment (i.e., htX and lenX must be multiples of htSpec, lenSpec). For only one segment, this algorithm would yield all elements of MCohr = 1.0 (with slight round-off errors).
MWin is a window that is applied to the data segments. Three functions are available that give suitable
Windows: MF_Welch, MF_Parzen, and MF_Hann. A square window is available by setting all matrix elements equal to 1.0 (MF_equC( MWin, htSpec, lenSpec, 1.0 ); ), but this is not recommended.
htSpec and lenSpec must be integer powers of 2.
Moreover, the following conditions must be fulfilled:
htX >= n*htSpec, lenX >= n*lenSpec, htWin = htSpec, lenWin = lenSpec.
Internally, MF_coherence allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_coherence instead. The necessary size of Buf can be obtained by calling the function MFb_coherence_sizeBuf. It will never need to be more than 11*htX*lenX. Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either htSpec or lenSpec is not a power of 2, VF_FFT (on which MF_coherence relies) complains "Size must be an integer power of 2" and the program is aborted. |
|
|
MF_convolve
| MD_convolve |
ME_convolve |
MF_convolvewEdit
| MD_convolvewEdit |
ME_convolvewEdit |
MFb_convolve
| MDb_convolve |
MEb_convolve |
MFb_convolvewEdit
| MDb_convolvewEdit |
MEb_convolvewEdit |
|
Function | convolution with a spatial response function |
|
Syntax C/C++ | #include <MFstd.h>
void MF_convolve( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len );
void MF_convolvewEdit( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len, fComplex thresh );
void MFb_convolve( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len, fVector Buf );
void MFb_convolvewEdit( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len, fComplex thresh, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::convolve( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp);
void matrix<T>::convolve( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp);
void matrix<T>::convolvewEdit( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh);
void matrix<T>::convolvewEdit( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh);
void matrix<T>::b_convolve( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp, vector<T> Buf);
void matrix<T>::b_convolve( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp, vector<T> Buf);
void matrix<T>::b_convolvewEdit( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh, vector<T> Buf);
void matrix<T>::b_convolvewEdit( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh, vector<T> Buf); |
Pascal/Delphi | uses MFstd;
procedure MF_convolve( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize );
procedure MF_convolvewEdit( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex );
procedure MFb_convolve( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize; Buf:fVector );
procedure MFb_convolvewEdit( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex; Buf:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_convolve( fMatrix d_MY, fMatrix d_MFlt, fMatrix d_MX, fMatrix d_MRsp, ui ht, ui len );
void MFcu_convolve( fMatrix h_MY, fMatrix h_MFlt, fMatrix h_MX, fMatrix h_MRsp, ui ht, ui len );
int cudaMF_convolvewEdit( fMatrix d_MY, fMatrix d_MFlt, fMatrix d_MX, fMatrix d_MRsp, ui ht, ui len, fComplex thresh );
void MFcu_convolvewEdit( fMatrix h_MY, fMatrix h_MFlt, fMatrix h_MX, fMatrix h_MRsp, ui ht, ui len, fComplex thresh );
|
CUDA funcktion Pascal/Delphi | uses MFstd;
function cudaMF_convolve( d_MY, d_MFlt, d_MX, d_MRsp:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_convolve( h_MY, h_MFlt, h_MX, h_MRsp:fMatrix; ht, len:UIntSize );
function cudaMF_convolvewEdit( d_MY, d_MFlt, d_MX, d_MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex ): IntBool;
procedure MFcu_convolvewEdit( h_MY, h_MFlt, h_MX, h_MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex );
|
|
Description | The convolution of MX with the response function MRsp is calculated and stored in MY. A filter MFlt is also calculated. If more than one matrix is to be convolved with the same MRsp, use MF_convolve only once and use MF_filter for the other matrices.
The response has to be stored in MRsp in wrap-around order in both dimensions: in each row i of MRsp, the response for zero and positive x-values is stored in MRspi,0 to MRspi,len/2 and the response for negative x-values (beginning with the most negative x) in MRspi,len/2+1 to MRspi,len-1.
Similarly, in each column of MRsp, the response for zero and positive y-values is stored in MRsp0,j to MRsplen/2,j and the response for negative y-values (beginning with the most negative y) in MRsplen/2+1,j to MRsplen-1,j.
You may wish to use MF_Rows_rotate and MF_Cols_rotate, or MF_Rows_reflect and MF_Cols_reflect to achieve this wrap-around order and to construct the response matrix. The result of the convolution appears scaled with the sum of all elements of MRsp. Normally, therefore, MRsp should be normalized to 1.0.
MX, MY, MRsp, and MFlt must all be of the same dimensions. Both len and ht have to be integer powers of 2. MX may be overwritten by MY, MRsp may be overwritten by MFlt, but MX and MFlt as well as MY and MRsp have to be distinct from each other.
A response function which attenuates some spatial frequences so much that any information about them is lost (e.g., high frequencies for a low-cut filter) is marked by very small values in MFlt for the respective frequencies. Here, "very small" means that they are in the order of round-off error. In order to minimize round-off error, MF_convolve replaces such small values in Flt by 0.
All one- and two-dimensional convolutions and deconvolutions use the same default threshold for this implicit filter editing. It can be retrieved by VF_setRspEdit. If you wish to set a different threshold for all calls to VF / MF_convolve and VF / MF_deconvolve, you may use VF_setRspEdit. However, this method is not thread-safe and should not be used to set different thresholds for different calls to VF / MF_convolve or VF / MF_deconvolve. Here, you have to use the variant MF_convolvewEdit, which takes the desired threshold as the argument thresh (and ignores the default threshold). As MFlt consists of complex numbers, and as it is sometimes desirable to treat real and imaginary parts differently, thresh is complex as well.
The input matrix is assumed to be periodic in both dimensions. See the description of VF_convolve on how to avoid end effects, in case it is not periodic.
Internally, MF_convolve / MF_convolvewEdit allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_convolve / MFb_convolvewEdit instead. The size of Buf must be:
C/C++: | sizeof(Buf) >= ht*(len+4) |
Pascal/Delphi: | sizeof(Buf) >= ht*len |
|
Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
Error handling | If either len or ht is not a power of 2, VF_FFT (on which MF_convolve is based) complains "Size must be an integer power of 2" and the program is aborted. |
|
|
MF_cprint
| MD_cprint |
ME_cprint |
MCF_cprint |
MCD_cprint |
MCE_cprint |
MI_cprint | MBI_cprint | MSI_cprint | MLI_cprint | MQI_cprint |
MU_cprint | MUB_cprint | MUS_cprint | MUL_cprint | MUQ_cprint |
|
Function | print a matrix to the screen (console applications only) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_cprint( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::cprint(); |
Pascal/Delphi | uses MFstd;
procedure MF_cprint( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_cprint( fMatrix d_MA, ui ht, ui len );
int cudaMF_cprint_buf( fMatrix d_MA, ui ht, ui len, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_cprint( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_cprint_buf( d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | Windows with Borland / Embarcadero compilers or MS Visual C++, DLL runtime: The matrix MA is printed to the screen. Each line corresponds to one row of the matrix. The lines are numbered. If necessary, rows are cut off at the screen boundaries. If there are more rows than screen lines, proper paging is applied.
This family of functions is available only for console applications. |
CUDA versions only: | cudaM?_cprint_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_cprint to allocate its own buffer memory, cudaM?_cprint_buf is slightly faster. |
Other Windows compilers as well as Linux: |
As here the width and height of the text window are not easily available, calls to V?_cprint are redirected to MF_print. The same is true for Visual C++ with static runtime (here for the reason of version-to-version incompatibilities). |
GCC Windows specific: | In principle, the Windows port of GCC supports the 80-bit floating point type long double. However, the I/O routines rely on the runtime libraries of Visual C++, where 80-bit reals have disappeared a long time ago. This means that ME_cprint and MPE_cprint work only with double precision and, more importantly, within double range. Input numbers outside double range are treated as ±DBL_MAX. There is, however, a possibility to get a full-accuracy readout at least in hexadecimal format. To this end, call ME_chexprint etc. |
|
Error handling | If the number of columns exceeds the maximum number of entries possible in the current text mode, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the rows are truncated.
|
|
|
MF_decElement | MD_decElement | ME_decElement |
MCF_decElement | MCD_decElement | MCE_decElement |
MCF_decElementRe | MCD_decElementRe | MCE_decElementRe |
MCF_decElementIm | MCD_decElementIm | MCE_decElementIm |
MI_decElement | MBI_decElement | MSI_decElement | MLI_decElement | MQI_decElement | |
MU_decElement | MUB_decElement | MUS_decElement | MUL_decElement | MUQ_decElement | MUI_decElement |
|
Function | Decrement a single matrix element by a given value |
|
Syntax C/C++ | #include <MFstd.h>
void MF_decElement( fVector MA, ui ht, ui len, ui m, ui n, float C );
#include <MCFstd.h>
void MCF_decElement( cfMatrix MA, ui ht, ui len, ui m, ui n, fComplex C );
void MCF_decElementRe( fMatrix MA, ui ht, ui len, ui m, ui n, float C );
void MCF_decElementIm( fMatrix MA, ui ht, ui len, ui m, ui n, float C ); |
C++ VecObj | #include <OptiVec.h>
matrix<T>::decElement( ui ht, ui len, ui m, ui n, T C );
matrix<complex<T>>::decElement( ui ht, ui len, ui m, ui n, complex<T> C );
matrix<complex<T>>::decElementRe( ui ht, ui len, ui m, ui n, T C );
matrix<complex<T>>::decElementIm( ui ht, ui len, ui m, ui n, T C ); |
Pascal/Delphi | uses MFstd;
procedure MF_decElement( MA:fVector; ht, len, m, n:UIntSize; C:Single );
uses MCFstd;
procedure MCF_decElement( MA:cfMatrix; ht, len, m, n:UIntSize; C:fComplex );
procedure MCF_decElementRe( MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
procedure MCF_decElementIm( MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
void cudaMF_decElement( fMatrix d_MA, ui ht, ui len, ui m, ui n, float C );
void cusdMF_decElement( fMatrix d_MA, ui ht, ui len, ui m, ui n, float *d_C );
#include <cudaMCFstd.h>
void cudaMCF_decElement( cfMatrix d_MA, ui ht, ui len, ui m, ui n, fComplex C );
void cusdMCF_decElement( cfMatrix d_MA, ui ht, ui len, ui m, ui n, fComplex *d_C );
void cudaMCF_decElementRe( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float C );
void cusdMCF_decElementRe( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float *d_C );
void cudaMCF_decElementIm( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float C );
void cusdMCF_decElementIm( cfMatrix d_MA, ui ht, ui len, ui m, ui n, float *d_C );
|
CUDA function Pascal/Delphi | uses MFstd;
procedure cudaMF_decElement( d_MA:fMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMF_decElement( d_MA:fMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
uses MCFstd;
procedure cudaMCF_decElement( d_MA:cfMatrix; ht, len, m, n:UIntSize; C:fComplex );
procedure cusdMCF_decElement( d_MA:cfMatrix; ht, len, m, n:UIntSize; d_C:PfComplex );
procedure cudaMCF_decElementRe( d_MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMCF_decElementRe( d_MA:cfMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
procedure cudaMCF_decElementIm( d_MA:cfMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMCF_decElementIm( d_MA:cfMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
|
|
Description | Real versions:
MA[n][m] -= C; The element at the position m, n is decremented by the value C.
Complex versions MCF_decElement etc.:
MA[n][m].Re -= C.Re; MA[n][m].Im -= C.Im;
Complex versions MCF_decElementRe etc.:
MA[n][m].Re -= C.Re;
The imaginary part MA[n][m].Im is left unaffected.
Complex versions MCF_decElementIm etc.:
MA[n][m].Im -= C.Im;
The real part MA[n][m].Re is left unaffected.
|
|
|
|
|
MF_deconvolve
| MD_deconvolve |
ME_deconvolve |
MF_deconvolvewEdit
| MD_deconvolvewEdit |
ME_deconvolvewEdit |
MFb_deconvolve
| MDb_deconvolve |
MEb_deconvolve |
MFb_deconvolvewEdit
| MDb_deconvolvewEdit |
MEb_deconvolvewEdit |
|
Function | spatial deconvolution, edge sharpening |
|
Syntax C/C++ | #include <MFstd.h>
void MF_convolve( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len );
void MF_convolvewEdit( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len, fComplex thresh );
void MFb_convolve( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len, fVector Buf );
void MFb_convolvewEdit( fMatrix Y, fMatrix Flt, fMatrix X, fMatrix Rsp, ui ht, ui len, fComplex thresh, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::convolve( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp);
void matrix<T>::convolve( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp);
void matrix<T>::convolvewEdit( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh);
void matrix<T>::convolvewEdit( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh);
void matrix<T>::b_convolve( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp, vector<T> Buf);
void matrix<T>::b_convolve( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp, vector<T> Buf);
void matrix<T>::b_convolvewEdit( matrix<T> Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh, vector<T> Buf);
void matrix<T>::b_convolvewEdit( matrix<T>* Flt, const matrix<T>& MX, const matrix<T> Rsp, complex<T> thresh, vector<T> Buf); |
Pascal/Delphi | uses MFstd;
procedure MF_convolve( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize );
procedure MF_convolvewEdit( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex );
procedure MFb_convolve( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize; Buf:fVector );
procedure MFb_convolvewEdit( MY, MFlt, MX, MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex; Buf:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_deconvolve( fMatrix d_MY, fMatrix d_MFlt, fMatrix d_MX, fMatrix d_MRsp, ui ht, ui len );
void MFcu_deconvolve( fMatrix h_MY, fMatrix h_MFlt, fMatrix h_MX, fMatrix h_MRsp, ui ht, ui len );
int cudaMF_deconvolvewEdit( fMatrix d_MY, fMatrix d_MFlt, fMatrix d_MX, fMatrix d_MRsp, ui ht, ui len, fComplex thresh );
void MFcu_deconvolvewEdit( fMatrix h_MY, fMatrix h_MFlt, fMatrix h_MX, fMatrix h_MRsp, ui ht, ui len, fComplex thresh );
|
CUDA funcktion Pascal/Delphi | uses MFstd;
function cudaMF_deconvolve( d_MY, d_MFlt, d_MX, d_MRsp:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_deconvolve( h_MY, h_MFlt, h_MX, h_MRsp:fMatrix; ht, len:UIntSize );
function cudaMF_deconvolvewEdit( d_MY, d_MFlt, d_MX, d_MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex ): IntBool;
procedure MFcu_deconvolvewEdit( h_MY, h_MFlt, h_MX, h_MRsp:fMatrix; ht, len:UIntSize; thresh:fComplex );
|
|
Description | MX is assumed to be the result of a convolution of some "true" profile with the response function MRsp; a deconvolution is attempted and stored in MY. A filter MFlt is also calculated; if more than one matrix is to be deconvolved with the same MRsp, use MF_deconvolve only once and use the filter MFlt thus obtained to deconvolve other matrices by calling MF_filter. The response has to be stored in the wrap-around order described above for MF_convolve.
As for MF_convolve, MX, MY, MRsp, and MFlt must all be of the same dimensions, which have to be integer powers of 2. MX may be overwritten by MY, MRsp may be overwritten by MFlt, but MX and MFlt as well as MY and MRsp have to be distinct from each other.
Mathematically, MFlt is the inverse of the Fourier transform of MRsp. If the Fourier transform of MRsp contains elements equal to zero, all information is lost for the respective frequency and no reconstruction is possible. The best one can do in this case is to accept this loss and to deconvolve only up to those frequencies where still something is left to be reconstructed.
You are therefore advised not to use this function blindly but rather to inspect the Fourier transform of MRsp and decide what to do on the basis of your specific application. If you wish to use this function nevertheless, you may rely on the automatic editing of the filter, built into MF_deconvolve. Thereby, MFlt is set to zero (instead of infinity) at those frequences where all information has been lost.
All one- and two-dimensional convolutions and deconvolutions use the same default threshold for this implicit filter editing. It can be retrieved by VF_setRspEdit. If you wish to set a different threshold for all calls to VF / MF_deconvolve and VF / MF_convolve, you may use VF_setRspEdit. However, this method is not thread-safe and should not be used to set different thresholds for different calls to VF / MF_deconvolve or VF / MF_convolve. Here, you have to use the variant MF_deconvolvewEdit, which takes the desired threshold as the argument thresh (and ignores the default threshold). As MFlt consists of complex numbers, and as it is sometimes desirable to treat real and imaginary parts differently, thresh is complex as well.
This deconvolution is based on the implicit assumption that MX is periodic; if this is not the case, see the description of VF_convolve about how to avoid end effects.
Internally, MF_deconvolve / MF_deconvolvewEdit allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_deconvolve / MFb_deconvolvewEdit instead. The size of Buf must be:
C/C++: | sizeof(Buf) >= ht*(len+4) |
Pascal/Delphi: | sizeof(Buf) >= ht*len |
|
Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
Error handling | If either len or ht is not a power of 2, VF_FFT (on which MF_deconvolve is based) complains "Size must be an integer power of 2" and the program is aborted.
If, by VF_setRspEdit, you specified Trunc.Re = Trunc.Im = 0, SING errors may occur that are handled by setting MFlt to ±HUGE_VAL at the respective frequency. During multiplication with the transform of MX, this may lead to unhandled floating-point overflow errors (in case your guess of MRsp was wrong and there is some information left at the frequencies where you thought it was not).
|
|
|
|
Function | determinant of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_det( fMatrix MA, ui len );
float MFb_det( fMatrix MA, ui len, fVector Buf );
fComplex MCF_det( cfMatrix MA, ui len );
fComplex MCFb_det( cfMatrix MA, ui len, cfVector Buf );
ui MFb_det_sizeBuf( ui len );
float MFsym_det( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::det();
T matrix<T>::b_det( vector<T>& Buf );
complex<T> matrix<complex<T>>::det();
complex<T> matrix<complex<T>>::b_det( vector<complex<T>>& Buf );
ui matrix<T>::b_det_sizeBuf( const ui len );
T matrix<T>::sym_det();
|
Pascal/Delphi | uses MFstd;
function MF_det( MA:fMatrix; len:UIntSize ):Single;
function MFb_det( MA:fMatrix; len:UIntSize; Buf:fVector ):Single;
function MCF_det( MA:cfMatrix; len:UIntSize ):fComplex;
function MCFb_det( MA:cfMatrix; len:UIntSize; Buf:cfVector ):fComplex;
function MFb_det_sizeBuf( len:UIntSize ):UIntSize;
function MFsym_det( MA:fMatrix; len:UIntSize ):Single;
|
|
Description | The determinant of MA is calculated. For large matrices, this is done via LU decomposition. For small matrices, individual formulae are applied. For the special case of symmetric matrices, MFsym_det provides a roughly two times faster way.
MF_det needs buffer memory. The "normal" versions (prefixes MF_, MCF_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MCFb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_det_sizeBuf() etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes).
As noted above, the determinant of a symmetric matrix can potentially be obtained faster by MFsym_det. The syntax is the same as for MF_det. Internally, this function first attempts Cholesky decomposition. Only if that fails (i.e. the input matrix is not positive-definite), the way via LUD is used.
|
|
Return value | determinant of the matrix |
|
|
MF_Dia_absmax
| MD_Dia_absmax |
ME_Dia_absmax |
MCF_Dia_absmax |
MCD_Dia_absmax |
MCE_Dia_absmax |
|
Function | absolute maximum of the elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_Dia_absmax( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::Dia_absmax(); |
Pascal/Delphi | uses MFstd;
function MF_Dia_absmax( MA:fMatrix; len:UIntSize ): Single; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_absmax( float *h_RetVal, fMatrix d_MA, ui len );
int cusdMF_Dia_absmax( float *d_RetVal, fMatrix d_MA, ui len );
float MFcu_Dia_absmax( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_absmax( var h_RetVal:Single; d_MA:fMatrix; len:UIntSize ): IntBool;
function cusdMF_Dia_absmax( d_RetVal:PSingle; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_absmax( h_MA:fMatrix; len:UIntSize ): Single;
|
|
Description | The maximum absolute value of all elements MAi,i is returned as a scalar |
|
Return value | absolute maximum of the diagonal |
|
|
MCF_Dia_absmaxReIm
| MCD_Dia_absmaxReIm |
MCE_Dia_absmaxReIm |
|
Function | Separate determination of the largest absolute values of the real and imaginary parts occurring along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_absmaxReIm( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_absmaxReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_absmaxReIm( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_absmaxReIm( var RetVal:fComplex; MA:cfMatrix; len:UIntSize );
|
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_absmaxReIm( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_absmaxReIm( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_absmaxReIm( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_absmaxReIm( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_absmaxReIm( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_absmaxReIm( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCFcu_Dia_absmaxReIm( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The maximum absolute values of the real and imaginary parts of the diagonal of a square matrix are combined into the complex return value (or, for Pascal/Delphi, into the variable Max). |
|
|
MF_Dia_absmin
| MD_Dia_absmin |
ME_Dia_absmin |
MCF_Dia_absmin |
MCD_Dia_absmin |
MCE_Dia_absmin |
|
Function | absolute minimum of the elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_Dia_absmin( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::Dia_absmin(); |
Pascal/Delphi | uses MFstd;
function MF_Dia_absmin( MA:fMatrix; len:UIntSize ):Single; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_absmin( float *h_RetVal, fMatrix d_MA, ui len );
int cusdMF_Dia_absmin( float *d_RetVal, fMatrix d_MA, ui len );
float MFcu_Dia_absmin( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_absmin( var h_RetVal:Single; d_MA:fMatrix; len:UIntSize ): IntBool;
function cusdMF_Dia_absmin( d_RetVal:PSingle; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_absmin( h_MA:fMatrix; len:UIntSize ): Single;
|
|
Description | The minimum absolute value of all elements MAi,i is returned as a scalar |
|
Return value | absolute minimum of the diagonal |
|
|
MCF_Dia_absminReIm
| MCD_Dia_absminReIm |
MCE_Dia_absminReIm |
|
Function | Separate determination of the smallest absolute values of the real and imaginary parts occurring along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_absminReIm( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_absminReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_absminReIm( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_absminReIm( var Min:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_absminReIm( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_absminReIm( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_absminReIm( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_absminReIm( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_absminReIm( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_absminReIm( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCFcu_Dia_absminReIm( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The minimum absolute values of the real and imaginary parts of the diagonal of a square matrix are combined into the the complex return value (or, for Pascal/Delphi, into the variable Min). |
|
|
MF_Dia_addC
| MD_Dia_addC |
ME_Dia_addC |
MCF_Dia_addC |
MCD_Dia_addC |
MCE_Dia_addC |
|
Function | add a constant to all elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_addC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_addC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_addC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_addC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_addC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_addC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_addC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_addC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_addC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i += C, i=0,...,len-1 |
|
|
MF_Dia_addV
| MD_Dia_addV |
ME_Dia_addV |
MCF_Dia_addV |
MCD_Dia_addV |
MCE_Dia_addV |
|
Function | element-wise addition of a vector to the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_addV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_addV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_addV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_addV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_addV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_addV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_addV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i += Xi, i=0,...,len-1 |
|
|
MCF_Dia_cabsmax
| MCD_Dia_cabsmax |
MCE_Dia_cabsmax |
|
Function | Find the complex number of largest magnitude along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_cabsmax( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_cabsmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_cabsmax( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_cabsmax( var Max:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_cabsmax( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_cabsmax( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_cabsmax( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_cabsmax( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_cabsmax( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_cabsmax( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax for the complex types:
procedure MCFcu_Dia_cabsmax( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The complex number of largest magnitude, sqrt(Re2+Im2), is found. |
|
|
MCF_Dia_cabsmin
| MCD_Dia_cabsmin |
MCE_Dia_cabsmin |
|
Function | Find the complex number of smallest magnitude along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_cabsmin( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_cabsmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_cabsmin( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_cabsmin( var Max:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_cabsmin( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_cabsmin( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_cabsmin( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_cabsmin( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_cabsmin( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_cabsmin( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax for the complex types:
procedure MCFcu_Dia_cabsmin( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The complex number of smallest magnitude, sqrt(Re2+Im2), is found. |
|
|
MF_Dia_divC
| MD_Dia_divC |
ME_Dia_divC |
MCF_Dia_divC |
MCD_Dia_divC |
MCE_Dia_divC |
|
Function | divide all elements of the diagonal of a square matrix by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_divC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_divC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_divC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_divC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_divC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_divC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_divC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_divC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_divC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i /= C, i=0,...,len-1 |
|
|
MF_Dia_divrC
| MD_Dia_divrC |
ME_Dia_divrC |
MCF_Dia_divrC |
MCD_Dia_divrC |
MCE_Dia_divrC |
|
Function | reverse division: divide a constant by the elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_divrC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_divrC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_divrC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_divrC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_divrC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_divrC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_divrC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_divrC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_divrC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i = C / MAi,i, i=0,...,len-1 |
|
|
MF_Dia_divrV
| MD_Dia_divrV |
ME_Dia_divrV |
MCF_Dia_divrV |
MCD_Dia_divrV |
MCE_Dia_divrV |
|
Function | reverse division: divide a vector by the diagonal of a square matrix, storing the result back into the diagonal |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_divrV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_divrV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_divrV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_divrV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_divrV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_divrV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_divrV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i = Xi / MAi,i, i=0,...,len-1 |
|
|
MF_Dia_divV
| MD_Dia_divV |
ME_Dia_divV |
MCF_Dia_divV |
MCD_Dia_divV |
MCE_Dia_divV |
|
Function | element-wise division of the diagonal of a square matrix by a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_divV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_divV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_divV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_divV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_divV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_divV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_divV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i / Xi, i=0,...,len-1 |
|
|
MF_Dia_equ0
| MD_Dia_equ0 |
ME_Dia_equ0 |
MCF_Dia_equ0 |
MCD_Dia_equ0 |
MCE_Dia_equ0 |
MCF_Dia_Reequ0 |
MCD_Dia_Reequ0 |
MCE_Dia_Reequ0 |
MCF_Dia_Imequ0 |
MCD_Dia_Imequ0 |
MCE_Dia_Imequ0 |
MI_Dia_equ0 | MBI_Dia_equ0 | MSI_Dia_equ0 | MLI_Dia_equ0 | MQI_Dia_equ0 |
MU_Dia_equ0 | MUB_Dia_equ0 | MUS_Dia_equ0 | MUL_Dia_equ0 | MUQ_Dia_equ0 |
|
Function | initialize all elements of the diagonal of a square matrix with zero |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_equ0( fMatrix MA, ui len );
void MCF_Dia_Reequ0( cfMatrix MA, ui len );
void MCF_Dia_Imequ0( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_equ0( );
void matrix<complex<T>>::Dia_Reequ0( );
void matrix<complex<T>>::Dia_Imequ0( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_equ0( MA:fMatrix; len:UIntSize );
procedure MCF_Dia_Reequ0( MA:cfMatrix; len:UIntSize );
procedure MCF_Dia_Imequ0( MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_equ0( fMatrix d_MA, ui len );
int cudaMCF_Dia_Reequ0( cfMatrix d_MA, ui len );
int cudaMCF_Dia_Imequ0( cfMatrix d_MA, ui len );
void MFcu_Dia_equ0( fMatrix h_MA, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_equ0( d_MA:fMatrix; len:UIntSize ): IntBool;
function cudaMCF_Dia_Reequ0( d_MA:cfMatrix; len:UIntSize ): IntBool;
function cudaMCF_Dia_Imequ0( d_MA:cfMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_equ0( h_MA:fMatrix; len:UIntSize );
|
|
Description | M?_Dia_equ0: | MAi,i = 0, i=0,...,len-1 |
MC?_Dia_Reequ0: | MAi,i.Re = 0, i=0,...,len-1 (MAi,i.Im remains unchanged) |
MC?_Dia_Imequ0: | MAi,i.Im = 0, i=0,...,len-1 (MAi,i.Re remains unchanged) |
|
|
|
MF_Dia_equC
| MD_Dia_equC |
ME_Dia_equC |
MCF_Dia_equC |
MCD_Dia_equC |
MCE_Dia_equC |
MI_Dia_equC | MBI_Dia_equC | MSI_Dia_equC | MLI_Dia_equC | MQI_Dia_equC |
MU_Dia_equC | MUB_Dia_equC | MUS_Dia_equC | MUL_Dia_equC | MUQ_Dia_equC |
|
Function | initialize all elements of the diagonal of a square matrix with a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_equC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_equC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_equC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_equC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_equC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_equC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_equC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_equC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_equC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i = C, i=0,...,len-1 |
|
|
MF_Dia_equV
| MD_Dia_equV |
ME_Dia_equV |
MCF_Dia_equV |
MCD_Dia_equV |
MCE_Dia_equV |
MI_Dia_equV | MBI_Dia_equV | MSI_Dia_equV | MLI_Dia_equV | MQI_Dia_equV |
MU_Dia_equV | MUB_Dia_equV | MUS_Dia_equV | MUL_Dia_equV | MUQ_Dia_equV |
|
Function | copy a vector into the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_equV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_equV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_equV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_equV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_equV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_equV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_equV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i = Xi, i=0,...,len-1 |
|
|
MF_Dia_extract
| MD_Dia_extract |
ME_Dia_extract |
MCF_Dia_extract |
MCD_Dia_extract |
MCE_Dia_extract |
MI_Dia_extract | MBI_Dia_extract | MSI_Dia_extract | MLI_Dia_extract | MQI_Dia_extract |
MU_Dia_extract | MUB_Dia_extract | MUS_Dia_extract | MUL_Dia_extract | MUQ_Dia_extrac |
|
Function | copy the diagonal of a square matrix into a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_extract( fVector Y, fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Dia_extract( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_extract( Y:fVector; MA:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_extract( fVector d_Y, fMatrix d_MA, ui len );
void MFcu_Dia_extract( fVector h_Y, fMatrix h_MA, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_extract( d_Y:fVector; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_extract( h_Y:fVector; h_MA:fMatrix; len:UIntSize );
|
|
Description | Yi = MAi,i, i=0,...,len-1 |
|
|
MF_Dia_max
| MD_Dia_max |
ME_Dia_max |
MCF_Dia_max |
MCD_Dia_max |
MCE_Dia_max |
MI_Dia_max | MBI_Dia_max | MSI_Dia_max | MLI_Dia_max | MQI_Dia_max |
MU_Dia_max | MUB_Dia_max | MUS_Dia_max | MUL_Dia_max | MUQ_Dia_ma; |
|
Function | maximum of all elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_Dia_max( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::Dia_max(); |
Pascal/Delphi | uses MFstd;
function MF_Dia_max( MA:fMatrix; len:UIntSize ):Single; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_max( float *h_RetVal, fMatrix d_MA, ui len );
int cusdMF_Dia_max( float *d_RetVal, fMatrix d_MA, ui len );
float MFcu_Dia_max( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_max( var h_RetVal:Single; d_MA:fMatrix; len:UIntSize ): IntBool;
function cusdMF_Dia_max( d_RetVal:PSingle; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_max( h_MA:fMatrix; len:UIntSize ): Single;
|
|
Description | the largest element of the diagonal is returned as a scalar |
|
Return value | maximum of the diagonal |
|
|
MCF_Dia_maxReIm
| MCD_Dia_maxReIm |
MCE_Dia_maxReIm |
|
Function | Separate determination of the largest values of the real and imaginary parts occurring along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_maxReIm( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_maxReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_maxReIm( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_maxReIm( var Max:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_maxReIm( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_maxReIm( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_maxReIm( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_maxReIm( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_maxReIm( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_maxReIm( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCFcu_Dia_maxReIm( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The maximum values of the real and imaginary parts of the diagonal of a square matrix are combined into the complex return value (or, for Pascal/Delphi, into the variable Max). |
|
|
MF_Dia_min
| MD_Dia_min |
ME_Dia_min |
MCF_Dia_min |
MCD_Dia_min |
MCE_Dia_min |
MI_Dia_min | MBI_Dia_min | MSI_Dia_min | MLI_Dia_min | MQI_Dia_min |
MU_Dia_min | MUB_Dia_min | MUS_Dia_min | MUL_Dia_min | MUQ_Dia_min |
|
Function | minimum of all elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_Dia_min( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::Dia_min(); |
Pascal/Delphi | uses MFstd;
function MF_Dia_min( MA:fMatrix; len:UIntSize ):Single; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_min( float *h_RetVal, fMatrix d_MA, ui len );
int cusdMF_Dia_min( float *d_RetVal, fMatrix d_MA, ui len );
float MFcu_Dia_min( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_min( var h_RetVal:Single; d_MA:fMatrix; len:UIntSize ): IntBool;
function cusdMF_Dia_min( d_RetVal:PSingle; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_min( h_MA:fMatrix; len:UIntSize ): Single;
|
|
Description | the smallest or most negative element of the diagonal is returned as a scalar |
|
Return value | minimum of the diagonal |
|
|
MCF_Dia_minReIm
| MCD_Dia_minReIm |
MCE_Dia_minReIm |
|
Function | Separate determination of the smallest absolute values of the real and imaginary parts occurring along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_minReIm( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_minReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_mubReIm( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_minReIm( var Min:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_minReIm( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_minReIm( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_minReIm( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_minReIm( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_minReIm( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_minReIm( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCFcu_Dia_minReIm( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The minimum absolute values of the real and imaginary parts of the diagonal of a square matrix are combined into the the complex return value (or, for Pascal/Delphi, into the variable Min). |
|
|
MF_Dia_mulC
| MD_Dia_mulC |
ME_Dia_mulC |
MCF_Dia_mulC |
MCD_Dia_mulC |
MCE_Dia_mulC |
|
Function | multiply all elements of the diagonal of a square matrix by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_mulC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_mulC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_mulC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_mulC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_mulC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_mulC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_mulC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_mulC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_mulC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i *= C, i=0,...,len-1 |
|
|
MF_Dia_mulV
| MD_Dia_mulV |
ME_Dia_mulV |
MCF_Dia_mulV |
MCD_Dia_mulV |
MCE_Dia_mulV |
|
Function | element-wise multiplication of the diagonal of a square matrix by a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_mulV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_mulV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_mulV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_mulV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_mulV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_mulV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_mulV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i *= Xi, i=0,...,len-1 |
|
|
MF_Dia_prod
| MD_Dia_prod |
ME_Dia_prod |
MCF_Dia_prod |
MCD_Dia_prod |
MCE_Dia_prod |
|
Function | product of all elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_Dia_prod( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::Dia_prod(); |
Pascal/Delphi | uses MFstd, MCFstd;
function MF_Dia_prod( MA:fMatrix; len:UIntSize ): Single;
function MCF_Dia_prod( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax for the complex types (obsolete, but still supported):
procedure MCF_Dia_prod( var RetVal:fComplex; MA:cfMatrix; len:UIntSize );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_prod( float *h_RetVal, fMatrix d_MA, ui len );
int cusdMF_Dia_prod( float *d_RetVal, fMatrix d_MA, ui len );
float MFcu_Dia_prod( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd, MCFstd;
function cudaMF_Dia_prod( var h_RetVal:Single; d_MA:fMatrix; len:UIntSize ): IntBool;
function cusdMF_Dia_prod( d_RetVal:PSingle; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_prod( h_MA:fMatrix; len:UIntSize ): Single;
function MCFcu_Dia_prod( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax for the complex types:
procedure MCFcu_Dia_prod( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | the product of the diagonal elements is returned as a scalar |
|
Return value | product of the diagonal elements |
|
|
MCF_Dia_sabsmax
| MCD_Dia_sabsmax |
MCE_Dia_sabsmax |
|
Function | Find the complex number of largest sum |Re| + |Im| along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_sabsmax( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_sabsmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_sabsmax( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_sabsmax( var Max:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_sabsmax( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_sabsmax( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_sabsmax( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_sabsmax( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_sabsmax( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_sabsmax( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCFcu_Dia_sabsmax( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The complex number of largest sum |Re| + |Im|, is found. |
|
|
MCF_Dia_sabsmin
| MCD_Dia_sabsmin |
MCE_Dia_sabsmin |
|
Function | Find the complex number of smallest sum |Re| + |Im| along the diagonal of a square matrix |
|
Syntax C/C++ | #include <MCFstd.h>
fComplex MCF_Dia_sabsmin( cfMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
complex<T> matrix<complex<T>>::Dia_sabsmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
function MCF_Dia_sabsmin( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCF_Dia_sabsmin( var Max:fComplex; MA:cfMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Dia_sabsmin( fComplex *h_RetVal, cfMatrix d_MA, ui len );
int cusdMCF_Dia_sabsmin( fComplex *d_RetVal, cfMatrix d_MA, ui len );
fComplex MCFcu_Dia_sabsmin( cfMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Dia_sabsmin( var h_RetVal:fComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function cusdMCF_Dia_sabsmin( d_RetVal:PfComplex; d_MA:cfMatrix; len:UIntSize ): IntBool;
function MCFcu_Dia_sabsmin( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax:
procedure MCFcu_Dia_sabsmin( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | The complex number with the smallest sum |Re| + |Im| is found. |
|
|
MF_Dia_subC
| MD_Dia_subC |
ME_Dia_subC |
MCF_Dia_subC |
MCD_Dia_subC |
MCE_Dia_subC |
|
Function | subtract a constant from all elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_subC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_subC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_subC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_subC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_subC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_subC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_subC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_subC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_subC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i -= C, i=0,...,len-1 |
|
|
MF_Dia_subrC
| MD_Dia_subrC |
ME_Dia_subrC |
MCF_Dia_subrC |
MCD_Dia_subrC |
MCE_Dia_subrC |
|
Function | reverse subtraction: a constant minus the elements of the diagonal of a square matrix, storing the result back into the diagonal |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_subrC( fMatrix MA, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_subrC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_subrC( MA:fMatrix; len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_subrC( fMatrix d_MA, ui len, float C );
int cusdMF_Dia_subrC( fMatrix d_MA, ui len, float *d_C );
void MFcu_Dia_subrC( fMatrix h_MA, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_subrC( d_MA:fMatrix; len:UIntSize; C:Single ): IntBool;
function cusdMF_Dia_subrC( d_MA:fMatrix; len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Dia_subrC( h_MA:fMatrix; len:UIntSize; C:Single );
|
|
Description | MAi,i = C - MAi,i, i=0,...,len-1 |
|
|
MF_Dia_subrV
| MD_Dia_subrV |
ME_Dia_subrV |
MCF_Dia_subrV |
MCD_Dia_subrV |
MCE_Dia_subrV |
|
Function | reverse subtraction: subtract the elements of the diagonal of a square matrix from corresponding elements of a vector, storing the result back into the diagonal |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_subrV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_subrV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_subrV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_subrV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_subrV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_subrV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_subrV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i = Xi - MAi,i, i=0,...,len-1 |
|
|
MF_Dia_subV
| MD_Dia_subV |
ME_Dia_subV |
MCF_Dia_subV |
MCD_Dia_subV |
MCE_Dia_subV |
|
Function | element-wise subtraction of a vector from the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Dia_subV( fMatrix MA, ui len, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Dia_subV( const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Dia_subV( MA:fMatrix; len:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_subV( fMatrix d_MA, ui len, fVector d_X );
void MFcu_Dia_subV( fMatrix h_MA, ui len, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Dia_subV( d_MA:fMatrix; len:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Dia_subV( h_MA:fMatrix; len:UIntSize; h_X:fVector );
|
|
Description | MAi,i -= Xi, i=0,...,len-1 |
|
|
MF_Dia_sum
| MD_Dia_sum |
ME_Dia_sum |
MCF_Dia_sum |
MCD_Dia_sum |
MCE_Dia_sum |
|
Function | sum over all elements of the diagonal of a square matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_Dia_sum( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::Dia_sum(); |
Pascal/Delphi | uses MFstd;
function MF_Dia_sum( MA:fMatrix; len:UIntSize ):Single;
function MCF_Dia_sum( MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax for the complex types:
procedure MCF_Dia_sum( var RetVal:fComplex; MA:cfMatrix; len:UIntSize );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Dia_sum( float *h_RetVal, fMatrix d_MA, ui len );
int cusdMF_Dia_sum( float *d_RetVal, fMatrix d_MA, ui len );
float MFcu_Dia_sum( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd, MCFstd;
function cudaMF_Dia_sum( var h_RetVal:Single; d_MA:fMatrix; len:UIntSize ): IntBool;
function cusdMF_Dia_sum( d_RetVal:PSingle; d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Dia_sum( h_MA:fMatrix; len:UIntSize ): Single;
function MCFcu_Dia_sum( h_MA:cfMatrix; len:UIntSize ): fComplex;
Alternative syntax for the complex types:
procedure MCFcu_Dia_sum( var h_RetVal:fComplex; h_MA:cfMatrix; len:UIntSize );
|
|
Description | the elements of the diagonal are summed up and returned as a scalar |
|
Return value | sum over the diagonal elements |
|
|
MCF_divC |
MCD_divC |
MCE_divC |
MCF_divReC |
MCD_divReC |
MCE_divReC |
|
Function | divide all matrix elements by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_divC( fMatrix MB, fMatrix MA, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::divC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_divC( MB, MA:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_divC( fMatrix d_MB, fMatrix d_MA, ui ht, ui len, float C );
int cusdMF_divC( fMatrix d_MB, fMatrix d_MA, ui ht, ui len, float *d_C );
void MFcu_divC( fMatrix h_MB, fMatrix h_MA, ui ht, ui len, float C );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_divC( d_MB, d_MA:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMF_divC( d_MB, d_MA:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_divC( h_MB, h_MA:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | Mi,j /= C, i=0,...,ht-1; j=0,..,len-1 |
|
|
|
Function | Data type conversions. See M_FtoD. |
|
MFsym_eigenvalues
| MDsym_eigenvalues |
MEsym_eigenvalues |
|
Function | Eigenvalues and/or Eigenvectors of a real symmetric matrix |
|
Syntax C/C++ | #include <MFstd.h>
int MFsym_eigenvalues( fVector EigVals, fMatrix EigVecs, fMatrix MA, ui len, int CalcEigenVec ); |
C++ MatObj | #include <OptiVec.h>
int matrix<T>::sym_eigenvalues( matrix<T> EigVecs, const matrix<T>& MA, int CalcEigenVec );
int matrix<T>::sym_eigenvalues( matrix<T>* EigVecs, const matrix<T>& MA, int CalcEigenVec ); |
Pascal/Delphi | uses MFstd;
function MFsym_eigenvalues( EigVals:fVector; EigVecs, MA:fMatrix; len:UIntSize; CalcEigenVec:IntBool ): IntBool; |
|
Description | The eigenvalues, with or without the eigenvectors, of MA are calculated. This function is for non-singular symmetric real matrices only! It takes the following arguments:
- EigVals: a vector in which the eigenvalues will be returned
- EigVecs: a matrix of size len*len. If the eigenvectors are desired, the routine will fill the columns of EigVecs with the eigenvectors; otherwise, EigVecs is just needed as workspace.
- MA: the input matrix, which may or may not be overwritten by EigVecs
- len: the length of the rows (which is the same as the height of the columns, as MA must be a symmetric square matrix)
- CalcEigenVec: an int or IntBool, deciding if only the eigenvalues are needed (CalcEigenVec = FALSE or 0), or if the eigenvectors are desired as well (CalcEigenVec = TRUE or 1). Calculating the eigenvalues alone, without the eigenvectors, can speed up the calculation by up to a factor of two.
The eigenvalues (and eigenvectors) are returned in no specific order. |
|
Return value | FALSE (0), if no error occurred, otherwise TRUE (non-zero). It is highly recommended to check the return value, as deficiencies of the input matrix usually are not known beforehand, but would lead to failure of this function. |
|
|
MF_element
| MD_element |
ME_element |
MCF_element |
MCD_element |
MCE_element |
MI_element | MBI_element | MSI_element | MLI_element | MQI_element |
MU_element | MUB_element | MUS_element | MUL_element | MUQ_element |
|
Function | read-only access to a matrix element |
|
Syntax C/C++ | #include <MFstd.h>
float MF_element( fMatrix MA, ui ht, ui len, unsigned m, unsigned n );
fComplex MCF_element( cfMatrix MA, ui ht, ui len, unsigned m, unsigned n ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::element( const unsigned m, const unsigned n ); |
Pascal/Delphi | uses MFstd;
function MF_element( MA:fMatrix; ht, len, m, n:UIntSize ): Single;
function MCF_element( MA:cfMatrix; ht, len, m, n:UIntSize ): fComplex;
Alternative syntax for the complex types (obsolete, but still supported):
procedure MCF_element( var RetVal:fComplex; MA:cfMatrix; ht, len, m, n:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
float cudaMF_element( fMatrix d_MA, ui ht, ui len, unsigned m, unsigned n );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_element( d_MA:fMatrix; ht, len, m, n:UIntSize ): Single;
function cudaMCF_element( d_MA:cfMatrix; ht, len, m, n:UIntSize ): fComplex;
Alternative syntax for the complex types:
procedure cudaMCF_element( var RetVal:fComplex; MA:cfMatrix; ht, len, m, n:UIntSize );
|
|
Description | The element MAm,n is returned.
MF_element is "read-only". This means, you c a n n o t write something like
MF_element( MX, ht, len, 3, 4 ) := 5;
Write access to individual matrix elements is provided by MF_setElement and MF_Pelement |
|
Return value | the matrix element m,n (except complex version in Pascal/Delphi) |
|
|
MCF_equ0 |
MCD_equ0 |
MCE_equ0 |
MCF_Reequ0 |
MCD_Reequ0 |
MCE_Reequ0 |
MCF_Imequ0 |
MCD_Imequ0 |
MCE_Imequ0 |
MI_equ0 | MBI_equ0 | MSI_equ0 | MLI_equ0 | MQI_equ0 |
MU_equ0 | MUB_equ0 | MUS_equ0 | MUL_equ0 | MUQ_equ0; |
|
Function | initialize a matrix with all elements set to 0 |
|
Syntax C/C++ | #include <MFstd.h>
void MF_equ0( fMatrix MA, ui ht, ui len );
void MCF_Reequ0( cfMatrix MA, ui ht, ui len );
void MCF_Imequ0( cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::equ0( ); |
Pascal/Delphi | uses MFstd;
procedure MF_equ0( MA:fMatrix; ht, len:UIntSize );
procedure MCF_Reequ0( MA:cfMatrix; ht, len:UIntSize );
procedure MCF_Imequ0( MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_equ0( fMatrix d_MA, ui ht, ui len );
int cudaMCF_Reequ0( cfMatrix d_MA, ui ht, ui len );
int cudaMCF_Imequ0( cfMatrix d_MA, ui ht, ui len );
void MFcu_equ0( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_equ0( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMCF_Reequ0( d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
function cudaMCF_Imequ0( d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_equ0( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | M?_equ0: MAi,j = 0, i=0,...,ht-1, j=0,...,len-1
MC?_Reequ0: MAi,j.Re = 0, i=0,...,ht-1, j=0,...,len-1 (MAi,j.Im remains unchanged)
MC?_Imequ0: MAi,j.Im = 0, i=0,...,ht-1, j=0,...,len-1 (MAi,i.Re remains unchanged) |
|
|
MCF_equ1 |
MCD_equ1 |
MCE_equ1 |
MI_equ1 | MBI_equ1 | MSI_equ1 | MLI_equ1 | MQI_equ1 |
MU_equ1 | MUB_equ1 | MUS_equ1 | MUL_equ1 | MUQ_equ1 |
|
|
Syntax C/C++ | #include <MFstd.h>
void MF_equ1( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::equ1( ); |
Pascal/Delphi | uses MFstd;
procedure MF_equ1( MA:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_equ1( fMatrix d_MA, ui ht, ui len );
void MFcu_equ1( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_equ1( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_equ1( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi,i = 1
MAi,j = 0, i != j |
|
|
MCF_equM |
MCD_equM |
MCE_equM |
MI_equM | MBI_equM | MSI_equM | MLI_equM | MQI_equM |
MU_equM | MUB_equM | MUS_equM | MUL_equM | MUQ_equM |
|
Function | make one matrix the copy of another |
|
Syntax C/C++ | #include <MFstd.h>
void MF_equM( fMatrix MB, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::equM( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_equM( MB, MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_equM( fMatrix d_MB, fMatrix d_MA, ui ht, ui len );
void MFcu_equM( fMatrix h_MB, fMatrix h_MA, ui ht, ui len );
int cudaMF_equMhost( fMatrix d_MB, fMatrix h_NA, ui ht, ui len );
int MF_equMdevice( fMatrix h_MB, fMatrix d_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_equM( d_MB, d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MF_equM( h_MB, h_MA:fMatrix; ht, len:UIntSize );
function cudaMF_equMhost( d_MB, h_MA:fMatrix; ht, len:UIntSize ): IntBool;
function MF_equMdevice( h_MB, d_MA:fMatrix; ht, len:UIntSize ): IntBool;
|
|
Description | MBi,j = MAi,j
CUDA versions: cudaMF_equMhost and MF_equMdevice transfer matrices from host to device memory and vice versa. |
|
|
MF_equm1
| MD_equm1 |
ME_equm1 |
MCF_equm1 |
MCD_equm1 |
MCE_equm1 |
MI_equm1 | MBI_equm1 | MSI_equm1 | MLI_equm1 | MQI_equm1 |
|
Function | negative identity matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_equm1( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::equm1( ); |
Pascal/Delphi | uses MFstd;
procedure MF_equm1( MA:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_equm1( fMatrix d_MA, ui ht, ui len );
void MFcu_equm1( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_equm1( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_equm1( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi,i = -1
MAi,j = 0, i != j |
|
|
MF_equMblock
| MD_equMblock |
ME_equMblock |
MCF_equMblock |
MCD_equMblock |
MCE_equMblock |
MI_equMblock | MBI_equMblock | MSI_equMblock | MLI_equMblock | MQI_equMblock |
MU_equMblock | MUB_equMblock | MUS_equMblock | MUL_equMblock | MUQ_equMblock; |
|
Function | Extract a block from a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_equMblock( fMatrix MSub,
ui subHt, ui subLen,
fMatrix MSrce, ui srceHt, ui srceLen,
ui firstRow, ui firstCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::equMblock( const matrix<T>& MSrce, const ui firstRow, const ui firstCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_equMblock( MSub:fMatrix;
subHt, subLen: UIntSize;
MSrce:fMatrix;
srceHt, srceLen, firstRow, firstCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_equMblock( fMatrix d_MSub,
ui subHt, ui subLen,
fMatrix d_MSrce, ui srceHt, ui srceLen,
ui firstRow, ui firstCol );
void MFcu_equMblock( fMatrix h_MSub,
ui subHt, ui subLen,
fMatrix h_MSrce, ui srceHt, ui srceLen,
ui firstRow, ui firstCol );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_equMblock( d_MSub:fMatrix;
subHt, subLen: UIntSize;
d_MSrce:fMatrix;
srceHt, srceLen, firstRow, firstCol:UIntSize ): IntBool;
procedure MFcu_equMblock( h_MSub:fMatrix;
subHt, subLen: UIntSize;
h_MSrce:fMatrix;
srceHt, srceLen, firstRow, firstCol:UIntSize );
|
|
Description | MSubi, j = MSrcei+firstRow, j+firstCol, i=0,...,subHt-1; j=0,...,subLen-1 |
|
|
MF_equMblockT
| MD_equMblockT |
ME_equMblockT |
MCF_equMblockT |
MCD_equMblockT |
MCE_equMblockT |
MI_equMblockT | MBI_equMblockT | MSI_equMblockT | MLI_equMblockT | MQI_equMblockT |
MU_equMblockT | MUB_equMblockT | MUS_equMblockT | MUL_equMblockT | MUQ_equMblockT; |
|
Function | Extract and transpose a block from a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_equMblockT( fMatrix MSub,
ui subHt, ui subLen,
fMatrix MSrce, ui srceHt, ui srceLen,
ui firstRow, ui firstCol ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::equMblockT( const matrix<T>& MSrce, const ui firstRow, const ui firstCol ); |
Pascal/Delphi | uses MFstd;
procedure MF_equMblockT( MSub:fMatrix;
subHt, subLen: UIntSize;
MSrce:fMatrix;
srceHt, srceLen, firstRow, firstCol:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_equMblockT( fMatrix d_MSub,
ui subHt, ui subLen,
fMatrix d_MSrce, ui srceHt, ui srceLen,
ui firstRow, ui firstCol );
void MFcu_equMblockT( fMatrix h_MSub,
ui subHt, ui subLen,
fMatrix h_MSrce, ui srceHt, ui srceLen,
ui firstRow, ui firstCol );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_equMblockT( d_MSub:fMatrix;
subHt, subLen: UIntSize;
d_MSrce:fMatrix;
srceHt, srceLen, firstRow, firstCol:UIntSize ): IntBool;
procedure MFcu_equMblockT( h_MSub:fMatrix;
subHt, subLen: UIntSize;
h_MSrce:fMatrix;
srceHt, srceLen, firstRow, firstCol:UIntSize );
|
|
Description | MSubj, i = MSrcei+firstRow, j+firstCol, i=0,...,subLen-1; j=0,...,subHt-1 |
|
|
MF_FFT |
MD_FFT |
ME_FFT |
MFb_FFT |
MDb_FFT |
MEb_FFT |
MF_FFTtoC
| MD_FFTtoC |
ME_FFTtoC |
MFb_FFTtoC
| MDb_FFTtoC |
MEb_FFTtoC |
MCF_FFT |
MCD_FFT |
MCE_FFT |
MCFb_FFT |
MCDb_FFT |
MCEb_FFT |
|
Function | two-dimensional Fast Fourier Transform |
|
Syntax C/C++ | #include <MFstd.h>
void MF_FFT( fMatrix MY, fMatrix MX, ui ht, ui len, int dir );
void MCF_FFT( cfMatrix MY, cfMatrix MX, ui ht, ui len, int dir );
void MF_FFTtoC( cfMatrix MY, fMatrix MX, ui ht, ui len );
void MFb_FFT( fMatrix MY, fMatrix MX, ui ht, ui len, int dir, fVector Buf );
void MCFb_FFT( cfMatrix MY, cfMatrix MX, ui ht, ui len, int dir, cfVector Buf );
void MFb_FFTtoC( cfMatrix MY, fMatrix MX, ui ht, ui len, cfVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::FFT( const matrix<T>& MX, int dir );
void matrix<complex<T> >::FFT( const matrix<complex<T> >& MX, int dir );
void matrix<complex<T> >::FFTtoC( const matrix<T>& MX );
void matrix<T>::b_FFT( const matrix<T>& MX, int dir, vector<T>& Buf );
void matrix<complex<T> >::b_FFT( const matrix<complex<T> > MX, int dir, vector<complex<T> >&Buf );
void matrix<complex<T> >::b_FFTtoC( const matrix<T> MX, vector<complex<T>>& Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCF_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MF_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize );
procedure MFb_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer; Buf:fVector );
procedure MCFb_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer; Buf:cfVector );
procedure MFb_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize; Buf:cfVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_FFT( fMatrix d_MY, fMatrix d_MX, ui ht, ui len, int dir );
int cudaMCF_FFT( cfMatrix d_MY, cfMatrix d_MX, ui ht, ui len, int dir );
int cudaMF_FFTtoC( cfMatrix d_MY, fMatrix d_MX, ui ht, ui len );
void MFcu_FFT( fMatrix h_MY, fMatrix h_MX, ui ht, ui len, int dir );
void MCFcu_FFT( cfMatrix h_MY, cfMatrix h_MX, ui ht, ui len, int dir );
void MFcu_FFTtoC( cfMatrix h_MY, fMatrix h_MX, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_FFT( d_MY, d_MX:fMatrix; ht, len:UIntSize; dir:Integer );
function cudaMCF_FFT( d_MY, d_MX:cfMatrix; ht, len:UIntSize; dir:Integer );
function cudaMF_FFTtoC( d_MY:cfMatrix; d_MX:fMatrix; ht, len:UIntSize );
procedure MFcu_FFT( h_MY, h_MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCFcu_FFT( h_MY, h_MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MFcu_FFTtoC( h_MY:cfMatrix; h_MX:fMatrix; ht, len:UIntSize );
|
|
Description | The Fourier transform of MX is calculated and stored in MY. The forward transform is obtained by setting dir = 1, the inverse (or backward) transform by setting dir = -1. By convention, the inverse transform involves scaling the result by the factor 1.0/(ht*len). Since it is sometimes desirable to skip this implicit scaling, MF_FFT offers the possibility to do so: specify dir = -2 in this case.
A Fast Fourier Transform algorithm is used that requires both ht and len to be powers of 2.
Complex version: Both MX and the output MY are complex matrices.
Real-to-complex version: The input matrix MX is real. The output matrix MY is complex. As this function can only perform a forward transform, no argument "dir" is needed.
Purely real version: For the forward transform, MX is a real matrix. The output MY is also defined as fMatrix, although it consists of complex numbers. The reason is that, just as in the one-dimensional case, the symmetry properties of two-dimensional FFT allow to store the result in a packed format, fitting into the same memory space as the input matrix. The order of storage in MY is derived from the ordering in the one-dimensional case, with the packing applied first to all rows, then to the columns. The resulting order is indicated in the following table. U means the uncompressed result.
U0,0.Re | U0,len/2.Re | U0,1.Re | U0,1.Im | ··· | U0,len/2-1.Re | U0,len/2-1.Im |
Uht/2,0.Re | Uht/2,len/2.Re | U1,1.Re | U1,1.Im | ··· | U1,len/2-1.Re | U1,len/2-1.Im |
U1,0.Re | U1,len/2.Re | U2,1.Re | U2,1.Im | ··· | U2,len/2-1.Re | U2,len/2-1.Im |
U1,0.Im | U1,len/2.Im | U3,1.Re | U3,1.Im | ··· | U3,len/2-1.Re | U3,len/2-1.Im |
··· | ··· | ··· | ··· | ··· | ··· | ··· |
Uht/2-1,0.Re | Uht/2-1,len/2.Re | ··· | ··· | ··· | ··· | ··· |
Uht/2-1,0.Im | Uht/2-1,len/2.Im | Uht-1,1.Re | Uht-1,1.Im | ··· | Uht-1,len/2-1.Re | Uht-1,len/2-1.Im |
For inverse real-matrix FFT, the input matrix has to be of this packed-complex format, and you get a real matrix. If you prefer to get the result of forward FFT as a true complex matrix, use MF_FFTtoC.
MFb_FFT, MFb_FFTtoC and MCFb_FFT take a buffer vector Buf as an additional argument. They are slightly more efficient than the un-buffered versions. Buf must have (at least) the same size (ht*len) as MX and MY. Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either ht or len is not a power of 2, the program is aborted with the error message "Size must be an integer power of 2". |
|
|
MF_fhexprint
| MD_fhexprint |
ME_fhexprint |
MCF_fhexprint |
MCD_fhexprint |
MCE_fhexprint |
MI_fhexprint | MBI_fhexprint | MSI_fhexprint | MLI_fhexprint | MQI_fhexprint |
MU_fhexprint | MUB_fhexprint | MUS_fhexprint | MUL_fhexprint | MUQ_fhexprint |
|
Function | print a matrix in hexadecimal format to a stream |
|
Syntax C/C++ | #include <MFstd.h>
void MF_fhexprint( FILE *stream, fMatrix MA, ui ht, ui len, unsigned linewidth ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::fhexprint( FILE *stream, unsigned linewidth ); |
Pascal/Delphi | uses MFstd;
procedure MF_fhexprint( var Stream:TextFile; MA:fMatrix; ht, len:UIntSize; linewidth:UInt );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_fhexprint( FILE *stream, fMatrix d_MA, ui ht, ui len );
int cudaMF_fhexprint_buf( FILE *stream, fMatrix d_MA, ui ht, ui len, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_fhexprint( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize ): IntBool; function cudaMF_fhexprint_buf( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA is written in hexadecimal format to stream. Each line corresponds to one row of the matrix. The lines are numbered. If the specified linewidth is too small to write all columns, rows are cut off.
Printing starts always with a new line. This may lead to an empty line at the beginning. Especially the first line of a file is reserved for a possible headline.
Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}.
CUDA versions only: cudaM?_fhexprint_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_fhexprint to allocate its own buffer memory, cudaM?_fhexprint_buf is slightly faster.
|
|
Error handling | If len exceeds the maximum number of entries possible for the linewidth chosen, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the program truncates the rows at the maximum number of columns possible.
|
|
|
MF_filter
| MD_filter |
ME_filter |
MCF_filter |
MCD_filter |
MCE_filter |
MFb_filter
| MDb_filter |
MEb_filter |
MCFb_filter |
MCDb_filter |
MCEb_filter |
|
Function | Spatial frequency filtering |
|
Syntax C/C++ | #include <MFstd.h>
void MF_filter( fMatrix Y, fMatrix X, fMatrix Flt, ui ht, ui len );
void MFb_filter( fMatrix Y, fMatrix X, fMatrix Flt, ui ht, ui len, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::filter( const matrix<T>& MX, const matrix<T>& MFlt );
void matrix<T>::b_filter( const matrix<T>& MX, const matrix<T>& MFlt, vector<T>& Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_filter( MY, MX, MFlt:fMatrix; ht, len:UIntSize );
procedure MFb_filter( MY, MX, MFlt:fMatrix; ht, len:UIntSize; Buf:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_filter( fMatrix d_MY, fMatrix d_MX, fMatrix d_MFlt, ui ht, ui len );
void MFcu_filter( fMatrix h_MY, fMatrix h_MX, fMatrix h_MFlt, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_filter( d_MY, d_MX, d_MFlt:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_filter( h_MY, h_MX, h_MFlt:fMatrix; ht, len:UIntSize );
|
|
Description | A spatial frequency filter MFlt is applied to the matrix MX. Internally, this is done by performing a Fourier transform on MX, multiplying the transform with MFlt and transforming the product back into the space domain.
Complex versions: MX, MY and the filter MFlt are complex matrices.
Real versions: MX and MY are real. MFlt has to be in the packed complex format that is obtained by Fourier transforming a real matrix with MF_FFT (see that function for the description of the packed complex format) or by using MF_convolve.
If MX is non-periodic, the edges of the filtered function may be spoiled by wrap-around. See VF_convolve about how to avoid end-effects. As described there for vectors, embed the matrix MX in a larger matrix or remove a possible linear trends in both dimensions.
Internally, MF_filter allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_filter instead. The size of Buf must be:
C/C++, real: | sizeof(Buf) >= ht*(len+4) |
C/C++, complex: | sizeof(Buf) >= ht*len |
Pascal/Delphi, real or complex: | sizeof(Buf) >= ht*len |
Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf.
|
|
Error handling | If either ht or len is not a power of 2, VF_FFT (on which MF_filter is based) complains "Size must be an integer power of 2" and the program is aborted. |
|
|
|
Function | Calculate a color scale and draw an X-Y coordinate system for matrix color-density plots |
|
Syntax C/C++ | #include <Mgraph.h>
void M_findDensityMapBounds( extended xmin, extended xmax, extended ymin, extended ymax, extended zmin, extended zmax, COLORREF mincolor, COLORREF maxcolor ); |
Pascal/Delphi | uses Mgraph;
procedure M_findDensityMapBounds( xmin, xmax, ymin, ymax, zmin, zmax: Extended; mincolor, maxcolor: COLORREF ); |
|
Description | Similarly to the function V_findAxes for X-Y vector plots, this function calculates a color scale from the parameters mincolor, maxcolor, zmin and zmax, and prepares an X-Y coordinate system for color-density plots of matrices. If necessary, the x and y ranges are slightly enlarged so as to ensure that the grid-lines correspond to exact (rather than only rounded) values. If zero falls into either or both ranges, it will fall onto a grid line.
The user will rarely call this function himself. It is internally called by all functions of the MF_xyzAutoDensityMap and MF_zAutoDensityMap families. |
|
|
MF_fprint
| MD_fprint |
ME_fprint |
MCF_fprint |
MCD_fprint |
MCE_fprint |
MI_fprint | MBI_fprint | MSI_fprint | MLI_fprint | MQI_fprint |
MU_fprint | MUB_fprint | MUS_fprint | MUL_fprint | MUQ_fprint |
|
Function | print a matrix in ASCII format to a stream |
|
Syntax C/C++ | #include <MFstd.h>
void MF_fprint( FILE *stream, fMatrix MA, ui ht, ui len, unsigned linewidth ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::fprint( FILE *stream, unsigned linewidth ); |
Pascal/Delphi | uses MFstd;
procedure MF_fprint( var Stream:TextFile; MA:fMatrix; ht, len:UIntSize; linewidth:UInt );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_fprint( FILE *stream, fMatrix d_MA, ui ht, ui len );
int cudaMF_fprint_buf( FILE *stream, fMatrix d_MA, ui ht, ui len, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_fprint( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize ): IntBool; function cudaMF_fprint_buf( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA is written in ASCII format to stream. Each line corresponds to one row of the matrix. The lines are numbered. If the specified linewidth is too small to write all columns, rows are cut off.
Printing starts always with a new line. This may lead to an empty line at the beginning. Especially the first line of a file is reserved for a possible headline.
Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}.
In contrast to MF_write, it is not possible to override the automatic choice of the format used for printing. The number of digits per element is determined by the available space, which depends in turn on the parameters len and linewidth.
CUDA versions only: cudaM?_fprint_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_fprint to allocate its own buffer memory, cudaM?_fprint_buf is slightly faster.
|
|
Error handling | If len exceeds the maximum number of entries possible for the linewidth chosen, an error message "Cannot use requested format (too many entries per line)!" is generated; in this case, the program truncates the rows at the maximum number of columns possible.
|
|
|
|
Function | de-allocate a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void M_free( void **M ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::free(); |
Pascal/Delphi | uses MFstd;
procedure M_free( M:Pointer ); |
|
CUDA function C/C++ | #include <cudaMatLib.h>
int cudaM_free( void **d_M );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaM_free( d_M:Pointer ): IntBool;
|
|
Description | The matrix M is freed (i.e. de-allocated). M_free should be used only for the de-allocation of matrices which have previously be allocated by one of the functions of the MF_matrix or MF_matrix0 family. To free several matrices simultaneously, use M_nfree (C/C++ only). To free all allocated vectors and matrices simultaneously, call V_freeAll.
|
|
Error handling | Trying to free a matrix that has already been freed, or that has never been allocated memory, leads to a warning message "Cannot free non-existent vector". Program execution is continued without freeing anything in this case. |
|
|
M_FtoD | M_FtoE | M_CFtoCD | M_CFtoCE |
M_DtoF | M_DtoE | M_CDtoCF | M_CDtoCE |
M_EtoF | M_EtoD | M_CEtoCF | M_CEtoCD |
|
Function | Data type interconversions. |
|
Syntax C/C++ | #include <MDstd.h>
(always include the <M..std.h> file of the destination data-type!)
void M_FtoD( dMatrix MY, fMatrix MX, ui ht, ui len );
(similarly all other functions of this family) |
C++ MatObj | #include <OptiVec.h>
void matrix<double>::FtoD( const matrix<float>& MX ); |
Pascal/Delphi | uses MDstd;
(always include the unit of the destination data-type!)
procedure M_FtoD( MY:dMatrix; MX:fMatrix; ht, len:UIntSize );
(similarly all other functions of this family) |
|
CUDA function C/C++ | #include <cudaMDstd.h>
int cudaM_FtoD( dMatrix d_MY, fMatrix d_MX, ui ht, ui len );
void Mcu_FtoD( dMatrix h_MY, fMatrix h_MX, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MDstd;
function cudaM_FtoD( d_MY:dMatrix; d_MX:fMatrix; ht, len:UIntSize ): IntBool;
procedure Mcu_FtoD( h_MY:dMatrix; h_MX:fMatrix; ht, len:UIntSize );
|
|
Description | Each element of MX is converted from the data type specified for MX to the data type specified for MY and stored in MY. |
|
Error handling | OVERFLOW errors may occur in the course of the "down-conversions" (e.g., M_EtoF); by default, the extreme value possible for the destination data type is stored in MY with the correct sign. |
|
|
MF_getElement
| MD_getElement |
ME_getElement |
MCF_getElement |
MCD_getElement |
MCE_getElement |
MI_getElement | MBI_getElement | MSI_getElement | MLI_getElement | MQI_getElement |
MU_getElement | MUB_getElement | MUS_getElement | MUL_getElement | MUQ_getElement |
|
Function | read-only access to a matrix element |
|
Syntax C/C++ | #include <MFstd.h>
void MF_getElement( float *RetVal, fMatrix MA, ui ht, ui len, unsigned m, unsigned n );
void MCF_getElement( fComplex *RetVal, cfMatrix MA, ui ht, ui len, unsigned m, unsigned n ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::getElement( T*RetVal, const unsigned m, const unsigned n ); |
Pascal/Delphi | uses MFstd;
procedure MF_getElement( var RetVal:Single; MA:fMatrix; ht, len, m, n:UIntSize );
procedure MCF_getElement( var RetVal:fComplex; MA:cfMatrix; ht, len, m, n:UIntSize );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
void cudaMF_getElement( float *h_RetVal, fMatrix d_MA, ui ht, ui len, unsigned m, unsigned n );
void cusdMF_getElement( float *d_RetVal, fMatrix d_MA, ui ht, ui len, unsigned m, unsigned n );
|
CUDA function Pascal/Delphi | uses MFstd;
procedure cudaMF_getElement( var h_RetVal:Single; d_MA:fMatrix; ht, len, m, n:UIntSize );
procedure cusdMF_getElement( d_RetVal:PSingle; d_MA:fMatrix; ht, len, m, n:UIntSize );
|
|
Description | The element MAm,n is copied into the location specified as RetVal.
|
|
|
|
VF_getLinfitNeglect
| VD_getLinfitNeglect |
VE_getLinfitNeglect |
|
Function | retrieve the current significance threshold for data fitting to linear models |
|
Syntax C/C++ | #include <MFstd.h>
float VF_getLinfitNeglect( void ); |
C++ MatObj | #include <OptiVec.h>
T vector<T>::getLinfitNeglect();
T matrix<T>::getLinfitNeglect(); |
Pascal/Delphi | uses MFstd;
function VF_getLinfitNeglect:Single; |
|
Description | Internally, the linear-fitting functions like VF_linfit employ a Singular Value Decomposition algorithm to obtain a solution even for (near-)singular linear systems. Thereby, coefficients ai whose significance is lower than a threshold, Thresh, are set to 0 instead of infinity. This threshold can be modified by calling VF_setLinfitNeglect. The current threshold can be retrieved by VF_getLinfitNeglect.
In the C++ MatObj version, this function takes only the data type from the matrix as whose member function it is called, but has nothing specific to do with it otherwise. |
|
Return value | current significance threshold for linear fitting |
|
|
VF_getNonlinfitOptions
| VD_getNonlinfitOptions |
VE_getNonlinfitOptions |
VF_getNonlinfitDefaultOptions
| VD_getNonlinfitDefaultOptions |
VE_getNonlinfitDefaultOptions |
|
Function | retrieve current or factory settings of options for nonlinear fitting |
|
Syntax C/C++ | #include <MFstd.h>
void VF_getNonlinfitOptions( VF_NONLINFITOPTIONS *Options );
void VF_getNonlinfitDefaultOptions( VF_NONLINFITOPTIONS *Options ); |
Pascal/Delphi | uses MFstd;
procedure VF_getNonlinfitOptions( var Options: VF_NONLINFITOPTIONS );
procedure VF_getNonlinfitDefaultOptions( var Options: VF_NONLINFITOPTIONS ); |
|
Description | The nonlinear fitting routines like VF_nonlinfit offer the user a lot of different options, packed into a structure VF_NONLINFITOPTIONS (VD_NONLINFITOPTIONS and VE_NONLINFITOPTIONS for the higher accuracy data-types). These options may be set by the function V_setNonlinfitOptions. To retrieve current settings, use
V_getNonlinfitOptions. "Factory settings" are retrieved by V_getNonlinfitDefaultOptions. |
|
|
|
Function | two-dimensional Hann window for spatial frequency analysis |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Hann( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Hann(); |
Pascal/Delphi | uses MFstd;
procedure MF_Hann( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Hann( fMatrix d_MA, ui ht, ui len );
void MFcu_Hann( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Hann( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Hann( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi,j = 0.25 * (1 - cos( 2 p i / (ht-1) )) * (1 - cos( 2 p j / (len-1) ))
This function provides a window for spatial power-spectrum estimation with Welch's method of overlapping segments, here implemented as MF_spectrum. The Hann window goes down to zero at the edges. Therefore, it requires a minimum size of 4x4 elements. Otherwise, MA will contain only zeros. For window functions with non-zero values at the edges, see MF_Parzen and MF_Welch. |
|
|
MCF_hermconj
| MCD_hermconj |
MCE_hermconj |
|
Function | Hermitian conjugate of a matrix |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_hermconj( cfMatrix MTr, cfMatrix MA, ui htTr, ui lenTr ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T> >::hermconj( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_hermconj( MTr, MA:cfMatrix; htTr, lenTr:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_hermconj( cfMatrix d_MTr, cfMatrix d_MA, ui htTr, ui lenTr );
void MCFcu_hermconj( cfMatrix h_MTr, cfMatrix h_MA, ui htTr, ui lenTr );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_hermconj( d_MTr, d_MA:cfMatrix; htTr, lenTr:UIntSize ): IntBool;
procedure MCFcu_hermconj( h_MTr, h_MA:cfMatrix; htTr, lenTr:UIntSize );
|
|
Description | The Hermitian conjugate of a complex matrix is defined as the complex conjugate of its transpose:
MTri,j = MAj,i*
The dimensions fed into this function, htTr and lenTr, refer to the transposed matrix rather than to the input matrix. |
|
|
MCF_HmulM |
MCD_HmulM |
MCE_HmulM |
|
Function | multiply the hermitian conjugate of one matrix by another matrix |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_HmulM( cfMatrix MC, cfMatrix MA, cfMatrix MB, ui htA, ui lenA, ui lenB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T> >::HmulM( const matrix<complex<T> >& MA, const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_HmulM( MC, MA, MB:cfMatrix; htA, lenA, lenB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_HmulM( cfMatrix d_MC, cfMatrix d_MA, cfMatrix d_MB, ui htA, ui lenA, ui lenB );
void MCFcu_HmulM( cfMatrix h_MC, cfMatrix h_MA, cfMatrix h_MB, ui htA, ui lenA, ui lenB );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_HmulM( d_MC, d_MA, d_MB:cfMatrix; htA, lenA, lenB:UIntSize ): IntBool;
procedure MCFcu_HmulM( h_MC, h_MA, h_MB:cfMatrix; htA, lenA, lenB:UIntSize );
|
|
Description | MC = MAT* * MB
htA, lenA, and lenB must be specified; the other dimensions are implicitly given as: htB = htA, lenC = lenB, htC = lenA. htA and lenA refer to the original, un-transposed input matrix. |
|
|
MF_hexprint
| MD_hexprint |
ME_hexprint |
MCF_hexprint |
MCD_hexprint |
MCE_hexprint |
MI_hexprint | MBI_hexprint | MSI_hexprint | MLI_hexprint | MQI_hexprint |
MU_hexprint | MUB_hexprint | MUS_hexprint | MUL_hexprint | MUQ_hexprint; |
|
Function | print a matrix in hexadecimal format to stdout (Console applications only) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_hexprint( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::hexprint(); |
Pascal/Delphi | uses MFstd;
procedure MF_hexprint( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_hexprint( fMatrix d_MA, ui ht, ui len );
int cudaMF_hexprint_buf( fMatrix d_MA, ui ht, ui len, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_hexprint( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_hexprint_buf( d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA is written in hexadecimal format to stream. Each line corresponds to one row of the matrix. The lines are numbered.
C/C++: The linewidth is determined by the symbolic constant V_consoleWindowWidth, defined in <VecLib.h> with a default value of 150 characters. If you wish to change this default value, either change it in <VecLib.h> or write #define V_consoleWindowWidth xxxx before you #include <VecLib.h>.
Pascal/Delphi: The linewidth is determined by the variable V_consoleWindowWidth in the unit VecLib with a default value of 150 characters. If you wish to change this default value, you may simply assign a new value to V_consoleWindowWidth, e.g., V_consoleWindowWidth := 80;
If this linewidth is too small to write all columns, rows are cut off.
Cartesian complex numbers are hexprinted in braces, with the real and imaginary parts separated by a komma: {Re, Im}.
In contrast to MF_chexprint, no paging is performed.
This family of functions can be used only in console applications.
CUDA versions only: cudaM?_hexprint_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_hexprint to allocate its own buffer memory, cudaM?_hexprint_buf is slightly faster. |
|
|
MF_invwEdit
| MD_invwEdit |
ME_invwEdit |
MCF_invwEdit |
MCD_invwEdit |
MCE_invwEdit |
MCFb_inv |
MCDb_inv |
MCEb_inv |
MFb_invwEdit
| MDb_invwEdit |
MEb_invwEdit |
MCFb_invwEdit |
MCDb_invwEdit |
MCEb_invwEdit |
MFb_inv_sizeBuf
| MDb_inv_sizeBuf |
MEb_inv_sizeBuf |
MCFb_inv_sizeBuf |
MCDb_inv_sizeBuf |
MCEb_inv_sizeBuf |
MFsym_inv
| MDsym_inv |
MEsym_inv |
|
|
Syntax C/C++ | #include <MFstd.h>
int MF_inv( fMatrix MInv, fMatrix MA, ui len );
int MF_invwEdit( fMatrix MInv, fMatrix MA, ui len, float thresh );
int MCF_invwEdit( cfMatrix MInv, cfMatrix MA, ui len, float thresh );
int MFb_inv( fMatrix MInv, fMatrix MA, ui len, fVector Buf );
int MFb_invwEdit( fMatrix MInv, fMatrix MA, ui len, float thresh, fVector Buf );
int MCFb_invwEdit( cfMatrix MInv, cfMatrix MA, ui len, float thresh, cfVector Buf );
ui MFb_inv_sizeBuf( ui len );
int MFsym_inv( fMatrix MInv, fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::inv( const matrix<T>& MA );
void matrix<T>::invwEdit( const matrix<T>& MA, T thresh );
void matrix<complex<T>>::invwEdit( const matrix<complex<T>>& MA, T thresh );
void matrix<T>::b_inv( const matrix<T>& MA, vector<T>& Buf );
void matrix<T>::b_invwEdit( const matrix<T>& MA, T thresh, vector<T>& Buf );
void matrix<complex<T>>::invwEdit( const matrix<complex<T>>& MA, T thresh, vector<T>& Buf );
ui matrix<T>::b_inv_sizeBuf( const ui len );
void matrix<T>::sym_inv( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
function MF_inv( MInv, MA:fMatrix; len:UIntSize ):Integer;
function MF_invwEdit( MInv, MA:fMatrix; len:UIntSize; thresh:Single ):Integer;
function MCF_invwEdit( MInv, MA:cfMatrix; len:UIntSize; thresh:Single ):Integer;
function MFb_inv( MInv, MA:fMatrix; len:UIntSize; Buf:fVector ):Integer;
function MFb_invwEdit( MInv, MA:fMatrix; len:UIntSize; thresh:Single; Buf:fVector ):Integer;
function MCFb_invwEdit( MInv, MA:cfMatrix; len:UIntSize; thresh:Single; Buf:fVector ):Integer;
function MFb_inv_sizeBuf( len:UIntSize ):UIntSize;
function MFsym_inv( MInv, MA:fMatrix; len:UIntSize ):Integer;
|
|
Description | The inverse of the matrix MA is stored in MInv. If MA is non-invertible, the function fails with an error message. In the general case, MF_inv, inversion is accomplished via LU decomposition. In the special case of symmetric matrices, MFsym_inv can perform the inversion about two times faster, if the matrix is positive-definite.
In order to prevent MF_inv from failing, you can define a minimum pivot for the decomposition. If you wish to do so for all calls to MF_LUdecompose and to the functions based upon it, namely MF_inv and MF_solve, you can do so by calling MF_LUDsetEdit. However, as this method is not thread-safe, you cannot use it in order to set different thresholds for different calls to the functions mentioned. Instead of defining a default editing threshold then, use their "wEdit" variants, i.e. MF_LUdecomposewEdit, MF_invwEdit or MF_solvewEdit. They take the desired threshold as the additional argument thresh. Note that thresh is always real, also in the complex versions.
The return value of MF_inv and MF_invwEdit indicates if the inversion was successful:
Return value | Meaning |
0 | Matrix MA is regular; inversion successful |
1 | Matrix MA is singular; result matrix contains no useful information |
2 | Matrix MA is (nearly) singular; could be inverted only by pivot editing; if the result is still useful, depends on the specific application. |
To check if MF_inv was successful, in single-thread programs, you may also call MF_LUDresult, whose return value will be FALSE (0), if the MA could be inverted without problems (and without pivot editing), and TRUE (1) for singular MA. In multi-thread programs, on the other hand, it would not be clear wich instance of MF_inv the call to MF_LUDresult would refer to. So, here, inspection of the return value of MF_inv is the only option.
The matrix inversion functions need buffer memory. The "normal" versions (prefixes MF_, MCF_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MCFb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_inv_sizeBuf() etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes).
As noted above, symmetric matrices can potentially be inverted faster by MFsym_inv. The syntax and the meaning of the return value is the same as for MF_inv. Internally, this function first attempts Cholesky decomposition. Only if that fails (i.e. the input matrix is not positive-definite), the way via LUD is used. |
|
Return value | Code 0, 1, or 2, see above. |
|
|
MF_LequU
| MD_LequU |
ME_LequU |
MCF_LequU |
MCD_LequU |
MCE_LequU |
MI_LequU | MBI_LequU | MSI_LequU | MLI_LequU | MQI_LequU |
MU_LequU | MUB_LequU | MUS_LequU | MUL_LequU | MUQ_LequU; |
|
Function | copy upper-diagonal elements into lower-diagonal by index-reflection, so as to get a symmetric matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_LequU( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::LequU( ); |
Pascal/Delphi | uses MFstd;
procedure MF_LequU( MA:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_LequU( fMatrix d_MA, ui len );
void MFcu_LequU( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_LequU( d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_LequU( h_MA:fMatrix; len:UIntSize );
|
|
Description | MAi,j = MAj,i, i > j |
|
|
MF_lincomb
| MD_lincomb |
ME_lincomb |
MCF_lincomb |
MCD_lincomb |
MCE_lincomb |
|
Function | linear combination of two matrices |
|
Syntax C/C++ | #include <MFstd.h>
void MF_lincomb( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, float CA, float CB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::lincomb( const matrix<T>& MA, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MF_lincomb( MC, MA, MB:fMatrix; ht, len:UIntSize; CA, CB:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_lincomb( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float CA, float CB );
int cusdMF_lincomb( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float *d_CA, float *d_CB );
void MFcu_lincomb( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len, float CA, float CB );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_lincomb( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; CA, CB:Single ): IntBool;
function cusdMF_lincomb( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; d_CA, d_CB:PSingle ): IntBool;
procedure MFcu_lincomb( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize; CA, CB:Single );
|
|
Description | MC = CA * MA + CB * MB |
|
|
VF_linfit
| VD_linfit |
VE_linfit |
VF_linfitwW |
VD_linfitwW |
VE_linfitwW |
|
Function | Data-fitting to models y=f(x) linear in the parameters |
|
Syntax C/C++ | #include <MFstd.h>
int VF_linfit( fVector A, iVector AStatus, unsigned npars, fVector X, fVector Y, ui sizex,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int VF_linfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, fVector X, fVector Y, fVector InvVar, ui sizex,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int VF_linfitwEdit( fVector A, iVector AStatus, unsigned npars, fVector X, fVector Y, ui sizex, float thresh,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int VF_linfitwWwEdit( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, fVector X, fVector Y, fVector InvVar, ui sizex, float thresh,
void funcs(fVector BasFuncs, float x, unsigned nfuncs)); |
C++ MatObj | #include <OptiVec.h>
int vector<T>::linfit( const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int vector<T>::linfitwW( matrix<T> Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int vector<T>::linfitwW( matrix<T>* Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int vector<T>::linfitwEdit( const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const T thresh,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int vector<T>::linfitwWwEdit( matrix<T> Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar, const T thresh,
void funcs(fVector BasFuncs, float x, unsigned nfuncs));
int vector<T>::linfitwWwEdit( matrix<T>* Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar, const T thresh,
void funcs(fVector BasFuncs, float x, unsigned nfuncs)); |
Pascal/Delphi | uses MFstd;
function VF_linfit( A:fVector; AStatus:iVector; npars:UInt; X, Y:fVector; sizex:UIntSize; funcs:Pointer ): IntBool;
function VF_linfitwW( A:fVector; Covar:fMatrix; AStatus:iVector; npars:UInt; X, Y, InvVar:fVector; sizex:UIntSize; funcs:Pointer ): IntBool;
function VF_linfitwEdit( A:fVector; AStatus:iVector; npars:UInt; X, Y:fVector; sizex:UIntSize; thresh:Single; funcs:Pointer ): IntBool;
function VF_linfitwWwEdit( A:fVector; Covar:fMatrix; AStatus:iVector; npars:UInt; X, Y, InvVar:fVector; sizex:UIntSize; thresh:Single; funcs:Pointer ): IntBool; |
|
Description | The input data X, Y (and InvVar) are used to evaluate the parameters ai of a general linear function,
y = a0f0(x) + a1f1(x) + a2f2(x)...
The parameters ai are returned in the vector A.
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients. If the covariances are not needed, one may call the function with Covar = (fMatrix)NULL / nil. |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
X, Y, InvVar | vectors of size sizex, holding the input data |
funcs | user-defined model function |
Your model function may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide the vector AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). Any fixed parameters must be initialized in A prior to calling VF_linfit. npars denotes the total number of parameters in A (not only the free parameters!).
The model function funcs must calculate the individual fi(x) for any argument x and store the fi(x) in a vector BasFuncs of size npars. In C/C++, it has to be defined as
void MyFunc( fVector BasFuncs, float x, unsigned nfuncs)
{
BasFuncs[0] = f0( x );
BasFuncs[1] = f1( x);
. . .
}
and shall be passed to VF_linfit by calling
VF_linfit( A, AStatus, npars, X, Y, sizex, MyFunc );
In Pascal/Delphi, the model function has to be defined as
procedure MyFunc( BasFuncs:fVector; x:Single; nfuncs:UInt );
begin
VF_Pelement( BasFuncs, 0 )^ := f0( x );
VF_Pelement( BasFuncs, 1 )^ := f1( x );
. . .
end;
and shall be passed to VF_linfit by calling
VF_linfit( A, AStatus, npars, X, Y, sizex, @MyFunc );
Note the address-of operator in front of "MyFunc.".
The functions f0( x ) etc. must not contain the parameters ai.
In the weighted variant, VF_linfitwW, the vector InvVar has to contain the inverse of the variances of the individual X-Y data points, and the matrix Covar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
Internally, VF_linfit employs a Singular Value Decomposition algorithm to obtain a solution even for (near-)singular linear systems. Thereby, coefficients ai whose significance is lower than a threshold, Thresh, are set to 0 instead of infinity. The default threshold can be modified by calling VF_setLinfitNeglect. The current threshold can be retrieved by VF_getLinfitNeglect. As VF_setLinfitNeglect is not thread-safe, this function should not be used to set different thresholds for different calls to VF_linfit etc. Rather than repeatedly changing the default value, use the "wEdit" variants of VF_linfit, namely VF_linfitwEdit, VF_linfitwWwEdit etc.
In the rare case of failure, VF_linfit returns 1 (TRUE) and sets all A[i] = 0. |
|
Return value | FALSE (0), if no error occurred, otherwise TRUE (non-zero). |
|
|
MF_linfit
| MD_linfit |
ME_linfit |
MF_linfitwW |
MD_linfitwW |
ME_linfitwW |
|
Function | Data-fitting to models z=f(x, y) linear in the parameters |
|
Syntax C/C++ | #include <MFstd.h>
int MF_linfit( fVector A, iVector AStatus, unsigned npars, fVector X, fVector Y, fMatrix Z, ui htZ, ui lenZ,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int MF_linfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, fVector X, fVector Y, fMatrix Z, fMatrix InvVar, ui htZ, ui lenZ,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int MF_linfitwEdit( fVector A, iVector AStatus, unsigned npars, fVector X, fVector Y, fMatrix Z, ui htZ, ui lenZ, float thresh,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int MF_linfitwWwEdit( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, fVector X, fVector Y, fMatrix Z, fMatrix InvVar, ui htZ, ui lenZ, float thresh,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs)); |
C++ MatObj | #include <OptiVec.h>
int vector<T>::linfit( const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int vector<T>::linfitwW( matrix<T> Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int vector<T>::linfitwW( matrix<T>* Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int vector<T>::linfitwEdit( const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const T thresh,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int vector<T>::linfitwWwEdit( matrix<T> Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar, const T thresh,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs));
int vector<T>::linfitwWwEdit( matrix<T>* Covar, const vector<int>& AStatus, const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar, const T thresh,
void funcs(fVector BasFuncs, float x, float y, unsigned nfuncs)); |
Pascal/Delphi | uses MFstd;
function MF_linfit( A:fVector; AStatus:iVector; npars:UInt; X, Y:fVector; MZ:fMatrix; htZ, lenZ:UIntSize; funcs:Pointer ): IntBool;
function MF_linfitwW( A:fVector; Covar:fMatrix; AStatus:iVector; npars:UInt; X, Y:fVector; MZ, MInvVar:fMatrix; htZ, lenZ:UIntSize; funcs:Pointer ): IntBool;
function MF_linfitwEdit( A:fVector; AStatus:iVector; npars:UInt; X, Y:fVector; MZ:fMatrix; htZ, lenZ:UIntSize; thresh:Single; funcs:Pointer ): IntBool;
function MF_linfitwWwEdit( A:fVector; Covar:fMatrix; AStatus:iVector; npars:UInt; X, Y:fVector; MZ, MInvVar:fMatrix; htZ, lenZ:UIntSize; thresh:Single; funcs:Pointer ): IntBool; |
|
Description | The input data X, Y, MZ (and MInvVar) are used to evaluate the parameters ai of a general linear function,
z = a0f0(x, y) + a1f1(x, y) + a2f2(x, y)...
The parameters ai are returned in the vector A.
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients. If the covariances are not needed, one may call the function with Covar = (fMatrix)NULL / nil. |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
X, Y | vectors of size lenZ and htZ, respectively, spanning the x-y coordinate system of the matrix MZ |
MZ, MInvVar | matrices of dimensions [htZ, lenZ], holding the input data and, in the weighted variant, the inverse of their variances |
funcs | user-defined model function |
Your model function may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide the vector AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). Any fixed parameters must be initialized in A prior to calling MF_linfit. npars denotes the total number of parameters in A (not only the free parameters!).
You must provide a model function "funcs" which, for any pair of arguments x, y, must calculate the individual fi(x, y) and store them in a vector BasFuncs of size npars. In C/C++, it has to be defined as
void MyFunc( fVector BasFuncs, float x, float y, unsigned nfuncs);
{
BasFuncs[0] = f0( x, y );
BasFuncs[1] = f1( x, y);
. . .
}
and shall be passed to MF_linfit by calling
MF_linfit( A, AStatus, npars, X, Y, MZ, htZ, lenZ, MyFunc );
In Pascal/Delphi, the model function has to be defined as
procedure MyFunc( BasFuncs:fVector; x, y:Single; nfuncs:UInt );
begin
VF_Pelement( BasFuncs, 0 )^ := f0( x, y );
VF_Pelement( BasFuncs, 1 )^ := f1( x, y );
. . .
end;
and shall be passed to MF_linfit by calling
MF_linfit( A, AStatus, npars, X, Y, MZ, htZ, lenZ, @MyFunc );
Note the address-of operator in front of "MyFunc.". In Turbo Pascal, the model function must be compiled with the Force-Far-Calls option {$F+}.
The functions f0( x, y ) etc. must not contain the parameters ai.
In the weighted variant, MF_linfitwW, the matirx MInvVar has to contain the inverse of the variances of the individual X-Y-Z data points, and the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
Internally, MF_linfit employs a Singular Value Decomposition algorithm to obtain a solution even for (near-)singular linear systems. Thereby, coefficients ai whose significance is lower than a threshold, Thresh, are
set to 0 instead of infinity. The default threshold can be modified by calling VF_setLinfitNeglect. The current threshold can be retrieved by VF_getLinfitNeglect. As VF_setLinfitNeglect is not thread-safe, this function should not be used to set different thresholds for different calls to VF / MF_linfit etc. Rather than repeatedly changing the default value, use the "wEdit" variants of VF / MF_linfit, namely MF_linfitwEdit, MF_linfitwWwEdit etc.
In the rare case of failure, this function returns 1 (TRUE) and sets all A[i] = 0. |
|
Return value | FALSE (0), if no error occurred, otherwise TRUE (non-zero). |
|
|
MF_LUdecompose
| MD_LUdecompose |
ME_LUdecompose |
MCF_LUdecompose |
MCD_LUdecompose |
MCE_LUdecompose |
MF_LUdecomposewEdit
| MD_LUdecomposewEdit |
ME_LUdecomposewEdit |
MCF_LUdecomposewEdit |
MCD_LUdecomposewEdit |
MCE_LUdecomposewEdit |
MFb_LUdecompose
| MDb_LUdecompose |
MEb_LUdecompose |
MCFb_LUdecompose |
MCDb_LUdecompose |
MCEb_LUdecompose |
MFb_LUdecomposewEdit
| MDb_LUdecomposewEdit |
MEb_LUdecomposewEdit |
MCFb_LUdecomposewEdit |
MCDb_LUdecomposewEdit |
MCEb_LUdecomposewEdit |
MFb_LUdecompose_sizeBuf
| MDb_LUdecompose_sizeBuf |
MEb_LUdecompose_sizeBuf |
MCFb_LUdecompose_sizeBuf |
MCDb_LUdecompose_sizeBuf |
MCEb_LUdecompose_sizeBuf |
|
|
Syntax C/C++ | #include <MFstd.h>
int MF_LUdecompose( fMatrix MLU, uiVector Ind, fMatrix MA, ui len );
int MF_LUdecomposewEdit( fMatrix MLU, uiVector Ind, fMatrix MA, ui len, float thresh ); int MCF_LUdecomposewEdit( cfMatrix MLU, uiVector Ind, cfMatrix MA, ui len, float thresh );
int MFb_LUdecompose( fMatrix MLU, uiVector Ind, fMatrix MA, ui len, fVector Buf );
int MFb_LUdecomposewEdit( fMatrix MLU, uiVector Ind, fMatrix MA, ui len, float thresh, fVector Buf );
int MCFb_LUdecomposewEdit( cfMatrix MLU, uiVector Ind, cfMatrix MA, ui len, float thresh, cfVector Buf );
ui MFb_LUdecompose_sizeBuf( ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::LUdecompose( vector<ui> Ind, const matrix<T>& MA );
void matrix<T>::LUdecompose( vector<ui>* Ind, const matrix<T>& MA );
void matrix<T>::LUdecomposewEdit( vector<ui> Ind, const matrix<T>& MA, const T& thresh );
void matrix<T>::LUdecomposewEdit( vector<ui>* Ind, const matrix<T>& MA, const T& thresh );
void matrix<complex<T>>::LUdecomposewEdit( vector<ui>* Ind, const matrix<complex<T>>& MA, const T& thresh );
void matrix<T>::b_LUdecompose( vector<ui> Ind, const matrix<T>& MA, vector<T> Buf );
void matrix<T>::b_LUdecompose( vector<ui>* Ind, const matrix<T>& MA, vector<T> Buf );
void matrix<T>::b_LUdecomposewEdit( vector<ui> Ind, const matrix<T>& MA, const T& thresh, vector<T> Buf );
void matrix<T>::b_LUdecomposewEdit( vector<ui>* Ind, const matrix<T>& MA, const T& thresh, vector<T> Buf );
void matrix<complex<T>>::b_LUdecomposewEdit( vector<ui>* Ind, const matrix<complex<T>>& MA, const T& thresh, vector<complex<T>> Buf );
ui matrix<T>::b_LUdecompose_sizeBuf();
|
Pascal/Delphi | uses MFstd;
function MF_LUdecompose( MLU:fMatrix; Ind:uiVector; MA:fMatrix; len:UIntSize ):Integer;
function MF_LUdecomposewEdit( MLU:fMatrix; Ind:uiVector; MA:fMatrix; len:UIntSize; thresh:Single ):Integer;
function MCF_LUdecomposewEdit( MLU:cfMatrix; Ind:uiVector; MA:cfMatrix; len:UIntSize; thresh:Single ):Integer;
function MFb_LUdecompose( MLU:fMatrix; Ind:uiVector; MA:fMatrix; len:UIntSize; Buf:fVector ):Integer;
function MFb_LUdecomposewEdit( MLU:fMatrix; Ind:uiVector; MA:fMatrix; len:UIntSize; thresh:Single; Buf:fVector ):Integer;
function MCFb_LUdecomposewEdit( MLU:cfMatrix; Ind:uiVector; MA:cfMatrix; len:UIntSize; thresh:Single; Buf:cfVector ):Integer;
function MFb_LUdecompose_sizeBuf( len:UIntSize ):UIntSize;
|
|
Description | MA is decomposed into a product MA = L * U, where L is lower-triangular with the diagonal elements equal to 1, and U is upper-triangular. As the combined number of non-trivial elements of L and U just fit into a matrix of the same dimensions as MA, the result is stored in a single matrix MLU rather than in two distinct matrices L and U. Actually, it is not the "true" matrices L and U which are combined into MLU, but rather a row-wise permutation, whose indices are output in the vector Ind.
MA may or may not be overwritten by MLU.
There are applications where it makes sense to make near-singular matrices decomposable by "pivot editing": If, in the partial pivoting process employed in the decomposition and inversion, no diagonal element larger than the threshold is available, the scaling of the matrix is done with the threshold value rather than with the tiny diagonal element. That way, divisions by (near-)zero are avoided.
By default, this pivot editing is switched off. If you wish to switch it on for all calls to MF_LUdecompose and to the functions based upon it, namely MF_inv and MF_solve, you can do so by calling MF_LUDsetEdit. However, as this method is not thread-safe, you cannot use it in order to set different thresholds for different calls to the functions mentioned. Instead, use their "wEdit" variants, i.e. MF_LUdecomposewEdit, MF_invwEdit and MF_solvewEdit. They take the desired threshold as the additional argument thresh. Note that thresh is always real, also in the complex versions.
The return value indicates if the factorization was successful and if the number of permuations was even or uneven:
Return value | Meaning |
0 | Matrix is singular; result cannot be used |
+1 | Factorization successful; even number of permutations |
-1 | Factorization successful; uneven number of permutations |
+2 | Matrix (nearly) singular; could be factorized by pivot editing; result partially usable; even number of permutations |
-2 | Matrix (nearly) singular; could be factorized by pivot editing; result partially usable; uneven number of permutations |
To check if MF_LUdecompose was successful, in single-thread programs, you may also call MF_LUDresult, whose return value will be FALSE (0), if the MA could be decomposed, and TRUE (1) for singular MA. In multi-thread programs, on the other hand, it would not be clear wich instance of MF_LUdecompose the call to MF_LUDresult would refer to. So, here, inspection of the return value of MF_LUdecompose is the only option.
The LU decomposition functions need buffer memory. The "normal" versions (prefixes MF_, MCF_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MCFb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_LUdecompose_sizeBuf() etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes). |
|
Error handling | In the case of a singular matrix, MLU will be undefined, and failure is indicated in the return value. Additionally, an internal flag is set, which can be read by calling MF_LUDresult. |
|
Return value | Code 0, +-1 or +-2, indicating success, even or uneven number of row permutations (see above) |
|
|
MF_LUdet
| MD_LUdet |
ME_LUdet |
MCF_LUdet |
MCD_LUdet |
MCE_LUdet |
|
Function | determinant of an LU decomposed matrix |
|
Syntax C/C++ | #include <MFstd.h>
float MF_LUdet( fMatrix LU, ui len, int permut ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::LUdet( const matrix<T>& MLU, int permut ); |
Pascal/Delphi | uses MFstd;
function MF_LUdet( MLU:fMatrix; len:UIntSize; permut:Integer ): Single; |
|
Description | MF_LUdet calculates the determinant of matrix already decomposed into LU form, and return it as a scalar. The argument permut must be +1 or -1, as given by the return value of MF_LUdecompose |
|
|
|
MF_LUDgetEdit
| MD_LUDgetEdit |
ME_LUDgetEdit |
MCF_LUDgetEdit |
MCD_LUDgetEdit |
MCE_LUDgetEdit |
|
Function | retrieve pivot-editing threshold for LU decomposition |
|
Syntax C/C++ | #include <MFstd.h>
float MF_LUDgetEdit( void ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::LUDgetEdit( ); |
Pascal/Delphi | uses MFstd;
function MF_LUDgetEdit: Single; |
|
|
|
MF_LUimprove
| MD_LUimprove |
ME_LUimprove |
MCF_LUimprove |
MCD_LUimprove |
MCE_LUimprove |
MFb_LUimprove
| MDb_LUimprove |
MEb_LUimprove |
MCFb_LUimprove |
MCDb_LUimprove |
MCEb_LUimprove |
|
Function | iterative improvement of the solution of a linear system solved by LU decomposition |
|
Syntax C/C++ | #include <MFstd.h>
void MF_LUimprove( fVector X, fVector B, fMatrix MA, fMatrix LU, uiVector Ind, ui len );
void MFb_LUimprove( fVector X, fVector B, fMatrix MA, fMatrix LU, uiVector Ind, ui len, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::LUimprove( const vector<T> B, const matrix<T>& MA, const matrix<T>& MLU, const vector<ui>& Ind );
void vector<T>::LUbimprove( const vector<T> B, const matrix<T>& MA, const matrix<T>& MLU, const vector<ui>& Ind, vector<T> Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_LUimprove( X, B:fVector; MA, MLU:fMatrix; Ind:uiVector; len:UIntSize );
procedure MFb_LUimprove( X, B:fVector; MA, MLU:fMatrix; Ind:uiVector; len:UIntSize; Buf:fVector ); |
|
Description | Especially for large matrices, accumulated round-off error in LU decomposition may become quite noticable. This round-off error will translate into inaccurate results of MF_LUsolve. If the input matrix was not overwritten by the output matrix in the initial call to MF_LUdecompose, you may call MF_LUimprove after MF_LUsolve to improve the accuracy by iteration. MF_LUimprove needs the output vector X of MF_LUsolve, the right-hand-side vector B of the linear system, and both the original matrix MA and its raw LU-decomposed form MLU along with its permutation indices, Ind, as arguments.
This function needs buffer memory. The "normal" versions (prefixes MF_, MCF_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MCFb_ etc. take a vector Buf as an additional argument. The required size of Buf is len elements of the respective data type. |
|
|
MF_LUinv
| MD_LUinv |
ME_LUinv |
MCF_LUinv |
MCD_LUinv |
MCE_LUinv |
MCF_LUinv |
MCD_LUinv |
MCE_LUinv |
MFb_LUinv
| MDb_LUinv |
MEb_LUinv |
MCFb_LUinv |
MCDb_LUinv |
MCEb_LUinv |
MFb_LUinv_sizeBuf
| MDb_LUinv_sizeBuf |
MEb_LUinv_sizeBuf |
MCFb_LUinv_sizeBuf |
MCDb_LUinv_sizeBuf |
MCEb_LUinv_sizeBuf |
|
Function | invert a matrix already decomposed into LU form |
|
Syntax C/C++ | #include <MFstd.h>
void MF_LUinv( fMatrix MInv, fMatrix MLU, uiVector Ind, ui len );
void MFb_LUinv( fMatrix MInv, fMatrix MLU, uiVector Ind, ui len, fVector Buf );
ui MFb_LUinv_sizeBuf( ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::LUinv( const matrix<T>& MLU, const vector<ui>& Ind );
void matrix<T>::b_LUinv( const matrix<T>& MLU, const vector<ui>& Ind );
ui matrix<T>::b_LUinv_sizeBuf(); |
Pascal/Delphi | uses MFstd;
procedure MF_LUinv( MInv, MLU:fMatrix; Ind:uiVector; len:UIntSize );
procedure MFb_LUinv( MInv, MLU:fMatrix; Ind:uiVector; len:UIntSize; Buf:fVector );
function MFb_LUinv_sizeBuf( len:UIntSize ):UIntSize; |
|
|
|
MF_LUDresult
| MD_LUDresult |
ME_LUDresult |
MCF_LUDresult |
MCD_LUDresult |
MCE_LUDresult |
|
Function | check if the last operation utilizing LU decomposition worked error-free |
|
Syntax C/C++ | #include <MFstd.h>
int MF_LUDresult( void ); |
C++ MatObj | #include <OptiVec.h>
int matrix<T>::LUDresult( ); |
Pascal/Delphi | uses MFstd;
function MF_LUDresult: IntBool; |
|
Description | After a call to MF_LUdecompose or any of the functions internally relying on LU decomposition (like MF_inv, MF_solve), the result should be checked by MF_LUDresult. If LU decomposition was successful, MF_LUDresult returns FALSE (0); if MA was (nearly) singular, TRUE (1) is returned. |
|
|
|
MF_LUDsetEdit
| MD_LUDsetEdit |
ME_LUDsetEdit |
MCF_LUDsetEdit |
MCD_LUDsetEdit |
MCE_LUDsetEdit |
|
Function | set pivot-editing threshold for LU decomposition |
|
Syntax C/C++ | #include <MFstd.h>
void MF_LUDsetEdit( float Thresh );
void MCF_LUDsetEdit( float Thresh ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::LUDsetEdit( const T& Thresh ); |
Pascal/Delphi | uses MFstd;
procedure MF_LUDsetEdit( Thresh:Single );
procedure MCF_LUDsetEdit( Thresh:Single ); |
|
Description | Set the default pivot-editing threshold for MF_LUdecompose, MF_inv, and MF_solve. As this function is not thread-safe (if different threads call it with different values for thresh, the actual threshold will be undefined), it should not be used to set various thresholds for multiple calls to the functions mentioned. In this case, do not define a default threshold at all, but call the "wEdit" variants of the respective function, i.e., MF_LUdecomposewEdit, MF_invwEdit, or MF_solvewEdit.
Complex versions: The threshold is always real. In MF_LUdecompose, both the real and imaginary parts of possible pivots are compared to it. In case both are smaller, the division is performed with the real number thresh as the divisor.
To read the current threshold, use MF_LUDgetEdit |
|
|
MF_LUsolve
| MD_LUsolve |
ME_LUsolve |
MCF_LUsolve |
MCD_LUsolve |
MCE_LUsolve |
|
Function | solve a linear system MA * X = B, where MA has already been decomposed into LU form |
|
Syntax C/C++ | #include <MFstd.h>
void MF_LUsolve( fVector X, fMatrix LU, fVector B, uiVector Ind, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::LUsolve( const matrix<T>& MLU, const vector<T>& B, const vector<ui>& Ind ); |
Pascal/Delphi | uses MFstd;
procedure MF_LUsolve( X:fVector; MLU:fMatrix; B:fVector; Ind:uiVector;
len:UIntSize ); |
|
Description | The linear system MA * X = B is solved for the vector X. Instead of MA itself, this function expects the LU decomposed form of MA as the input matrix MLU, along with its row-permutation indices in the vector Ind as output by MF_LUdecompose.
If the original matrix MA is still available, it is recommended to "fine-polish" the result by calling MF_LUimprove. In comparison to the LU decomposition and back-substitution already performed, this iterative improvement takes very little time, but it can lead to an appreaciable improvement of the solution and often even save solutions which otherwise would be ruined by round-off error. |
|
|
MF_matrix
| MD_matrix |
ME_matrix |
MCF_matrix |
MCD_matrix |
MCE_matrix |
MI_matrix | MBI_matrix | MSI_matrix | MLI_matrix | MQI_matrix |
MU_matrix | MUB_matrix | MUS_matrix | MUL_matrix | MUQ_matrix; |
|
Function | Memory allocation for a matrix |
|
Syntax C/C++ | #include <MFstd.h>
fMatrix MF_matrix( ui ht, ui len ); |
Pascal/Delphi | uses MFstd;
function MF_matrix( ht, len:UIntSize ): fMatrix; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
fMatrix cudaMF_matrix( ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_matrix( ht, len:UIntSize ): fMatrix;
|
|
Description | Based on memory model and environment, the most appropriate allocation procedure is chosen by these functions. Failure to allocate memory always leads to an error message and a subsequent program abort (similar to the error handling of the "new" operator). To release the memory thus allocated, M_free, M_nfree, or V_freeAll should be used (M_nfree only in C/C++).
For matrices generated by cudaM?_matrix, use cudaM_free, cudaM_nfree, or cudaV_freeAll.
Note: the declaration of a matrix (e.g., as fMatrix) reserves only a name, but no memory!
See chapter 4.1 if you are interested in details of the implementation.
|
|
Error handling | If there is not enough memory available, or if size is zero, an error message "Not enough memory" is displayed and the program aborted.
32-bit:
If more than 4 GB of memory are requested, an error message "Vector > 4 GB not possible" is displayed and the program aborted. If already a single matrix dimensions exceeds this limit, an error message "Invalid matrix dimension(s)" is displayed and the program aborted. |
|
Return value | C/C++: Pointer to the array of row pointers
Pascal/Delphi: Pointer to the allocated memory |
|
|
MF_matrix0
| MD_matrix0 |
ME_matrix0 |
MCF_matrix0 |
MCD_matrix0 |
MCE_matrix0 |
MI_matrix0 | MBI_matrix0 | MSI_matrix0 | MLI_matrix0 | MQI_matrix0 |
MU_matrix0 | MUB_matrix0 | MUS_matrix0 | MUL_matrix0 | MUQ_matrix0 |
|
Function | allocate memory for a matrix and initialize all elements with 0 |
|
Syntax C/C++ | #include <MFstd.h>
fMatrix F_matrix0( ui ht, ui len ); |
Pascal/Delphi | uses MFstd;
function MF_matrix0( ht, len:UIntSize ): fMatrix; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
fMatrix cudaMF_matrix0( ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_matrix0( ht, len:UIntSize ): fMatrix;
|
|
Description | The functions of this family are almost identical to those of the MF_matrix family; in addition to allocating memory, they initialize all elements with 0. (Calls to MF_matrix and MF_matrix0 may be mixed; they and the vector allocation functions, VF_vector etc. use the same tables to keep track of the handles and pointers). For further information, see MF_matrix. |
|
Error handling | If there is not enough memory available, or if size is zero, an error message "Not enough memory" is displayed and the program aborted.
32-bit:
If more than 4 GB of memory are requested, an error message "Vector > 4 GB not possible" is displayed and the program aborted. If already a single matrix dimensions exceeds this limit, an error message "Invalid matrix dimension(s)" is displayed and the program aborted. |
|
Return value | C/C++: Pointer to the array of row pointers
Pascal/Delphi: Pointer to the allocated memory |
|
|
MF_MatrixTo2DArray
| MD_MatrixTo2DArray |
ME_MatrixTo2DArray |
MCF_MatrixTo2DArray |
MCD_MatrixTo2DArray |
MCE_MatrixTo2DArray |
MI_MatrixTo2DArray | MBI_MatrixTo2DArray | MSI_MatrixTo2DArray | MLI_MatrixTo2DArray | MQI_MatrixTo2DArray |
MU_MatrixTo2DArray | MUB_MatrixTo2DArray | MUS_MatrixTo2DArray | MUL_MatrixTo2DArray | |
|
Function | convert OptiVec matrix into 2D-array of Delphi 4 or higher |
|
Syntax C/C++ | N.A. |
Pascal/Delphi | uses VecLib, MFstd;
type fArray = array of Single;
type f2DArray = array of fArray;
procedure MF_MatrixTo2DArray( DelphiArr:f2DArray; MF:fMatrix; ht,len:UIntSize); |
|
Description | This function is necessary only for Delphi 4 or higher. (Previous versions of Borland Pascal/Delphi did not support dynamically allocated matrices.) It converts OptiVec matrices into two-dimensional Delphi arrays. Note that, unlike static Pascal/Delphi matrices, the dynamic matrices of Delphi 4+ cannot directly be passed to OptiVec functions, but have to be converted first by calling MF_2DArrayToMatrix. If you ever need an OptiVec matrix back into Delphi format, this is done by the present function. |
|
|
MCF_mulC |
MCD_mulC |
MCE_mulC |
MCF_mulReC |
MCD_mulReC |
MCE_mulReC |
|
Function | multiply all matrix element by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_mulC( fMatrix MB, fMatrix MA, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::mulC( const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_mulC( MB, MA:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_mulC( fMatrix d_MB, fMatrix d_MA, ui ht, ui len, float C );
int cusdMF_mulC( fMatrix d_MB, fMatrix d_MA, ui ht, ui len, float *d_C );
int cudaMCF_mulC( cfMatrix d_MB, cfMatrix d_MA, ui ht, ui len, fComplex C );
int cusdMCF_mulC( cfMatrix d_MB, cfMatrix d_MA, ui ht, ui len, fComplex *d_C );
int cudaMCF_mulReC( cfMatrix d_MB, cfMatrix d_MA, ui ht, ui len, float CRe );
int cusdMCF_mulReC( cfMatrix d_MB, cfMatrix d_MA, ui ht, ui len, float *d_CRe );
void MFcu_mulC( fMatrix h_MB, fMatrix h_MA, ui ht, ui len, float C );
void MCFcu_mulC( cfMatrix h_MB, cfMatrix h_MA, ui ht, ui len, fComplex C );
void MCFcu_mulReC( cfMatrix h_MB, cfMatrix h_MA, ui ht, ui len, float CRe );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_mulC( d_MB, d_MA:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMF_mulC( d_MB, d_MA:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_mulC( h_MB, h_MA:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | MBij = MAij + C |
|
|
|
Function | multiply a row vector by a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void VF_mulM( fVector Y, fVector X, fMatrix MA, ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::mulM( const vector<T>& X, const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure VF_mulM( Y, X:fVector; MA:fMatrix; htA, lenA:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaVF_mulM( fVector d_Y, fVector d_X, fMatrix d_MA, ui htA, ui lenA );
void VFcu_mulM( fVector h_Y, fVector h_X, fMatrix h_MA, ui htA, ui lenA );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaVF_mulM( d_Y, d_X:fVector; d_MA:fMatrix; htA, lenA:UIntSize ): IntBool;
procedure VFcu_mulM( h_Y, h_X:fVector; h_MA:fMatrix; htA, lenA:UIntSize );
|
|
Description | Y = X * MA;
the dimensions of X and Y are implicitly given by the matrix dimensions: sizX = htA, sizY = lenA. |
|
|
MCF_mulM |
MCD_mulM |
MCE_mulM |
|
Function | matrix multiplication |
|
Syntax C/C++ | #include <MFstd.h>
void MF_mulM( fMatrix MC, fMatrix MA, fMatrix MB, ui htA, ui lenA, ui lenB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::mulM( const matrix<T>& MA, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MF_mulM( MC, MA, MB:fMatrix; htA, lenA, lenB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_mulM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui htA, ui lenA, ui lenB );
void MFcu_mulM( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui htA, ui lenA, ui lenB );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_mulM( d_MC, d_MA, d_MB:fMatrix; htA, lenA, lenB:UIntSize ): IntBool;
procedure MFcu_mulM( h_MC, h_MA, h_MB:fMatrix; htA, lenA, lenB:UIntSize );
|
|
Description | MC = MA * MB
htA, lenA, and lenB must be specified; the other dimensions are implicitly given as: htB = lenA, lenC = lenB, htC = htA. |
|
|
MFdia_mulM
| MDdia_mulM |
MEdia_mulM |
MCFdia_mulM |
MCDdia_mulM |
MCEdia_mulM |
|
Function | multiplication of a diagonal matrix and a general matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MFdia_mulM( fMatrix MC, fVector MADia, fMatrix MB, ui lenA, ui lenB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::dia_mulM( const vector<T>& MADia, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MFdia_mulM( MC:fMatrix; MADia: fVector; MB:fMatrix; lenA, lenB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMFdia_mulM( fMatrix d_MC, fVector d_MADia, fMatrix d_MB, ui lenA, ui lenB );
void MFdiacu_mulM( fMatrix h_MC, fVector h_MADia, fMatrix h_MB, ui lenA, ui lenB );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMFdia_mulM( d_MC:fMatrix; d_MADia:fVector; d_MB:fMatrix; lenA, lenB:UIntSize ): IntBool;
procedure MFdiacu_mulM( h_MC:fMatrix; h_MADia:fVector; h_MB:fMatrix; lenA, lenB:UIntSize );
|
|
Description | MC = MADia * MB
The vector MAdia represents the diagonal matrix MA. (A matrix is called diagonal, it it has non-zero elements only on the diagonal). lenA, and lenB must be specified; htB is equal to lenA. |
|
|
MF_mulMdia
| MD_mulMdia |
ME_mulMdia |
MCF_mulMdia |
MCD_mulMdia |
MCE_mulMdia |
|
Function | multiply a general matrix by a diagonal matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_mulMdia( fMatrix MC, fMatrix MA, fVector MBDia, ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::mulMdia( const matrix<T>& MA, const vector<T>& MBDia, ); |
Pascal/Delphi | uses MFstd;
procedure MF_mulMdia( MC, MA:fMatrix; MBDia:fVector; htA, lenA:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_mulMdia( fMatrix d_MC, fMatrix d_MA, fVector d_MBDia, ui htA, ui lenA );
void MFcu_mulMdia( fMatrix h_MC, fMatrix h_MA, fVector h_MBDia, ui htA, ui lenA );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_mulMdia( d_MC, d_MA:fMatrix; d_MBDia:fVector; htA, lenA:UIntSize ): IntBool;
procedure MFcu_mulMdia( h_MC, h_MA:fMatrix; h_MBDia:fVector; htA, lenA:UIntSize );
|
|
Description | MC = MA * MBDia.
htA and lenA must be specified; sizB = lenA. |
|
|
MCF_mulMH |
MCD_mulMH |
MCE_mulMH |
|
Function | multiply one complex matrix by the hermitian conjugate of another |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_mulMH( cfMatrix MC, cfMatrix MA, cfMatrix MB, ui htA, ui lenA, ui htB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T> >::mulMH( const matrix<complex<T> >& MA, const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_mulMH( MC, MA, MB:cfMatrix; htA, lenA, htB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_mulMH( cfMatrix d_MC, cfMatrix d_MA, cfMatrix d_MB, ui htA, ui lenA, ui htB );
void MCFcu_mulMH( cfMatrix h_MC, cfMatrix h_MA, cfMatrix h_MB, ui htA, ui lenA, ui htB );
|
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_mulMH( d_MC, d_MA, d_MB:cfMatrix; htA, lenA, htB:UIntSize ): IntBool;
procedure MCFcu_mulMH( h_MC, h_MA, h_MB:cfMatrix; htA, lenA, htB:UIntSize );
|
|
Description | MC = MA * MBT *.
htA, lenA, and htB must be specified; the other dimensions are implicitly given as: lenB = lenA, lenC = htB, htC = htA. |
|
|
MF_mulMT
| MD_mulMT |
ME_mulMT |
MCF_mulMT |
MCD_mulMT |
MCE_mulMT |
|
Function | multiply one matrix by the transpose of another |
|
Syntax C/C++ | #include <MFstd.h>
void MF_mulMT( fMatrix MC, fMatrix MA, fMatrix MB, ui htA, ui lenA, ui htB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::mulMT( const matrix<T>& MA, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MF_mulMT( MC, MA, MB:fMatrix; htA, lenA, htB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_mulMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui htA, ui lenA, ui htB );
void MFcu_mulMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui htA, ui lenA, ui htB );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_mulMT( d_MC, d_MA, d_MB:fMatrix; htA, lenA, htB:UIntSize ): IntBool;
procedure MFcu_mulMT( h_MC, h_MA, h_MB:fMatrix; htA, lenA, htB:UIntSize );
|
|
Description | MC = MA * MBT.
htA, lenA, and htB must be specified; the other dimensions are implicitly given as: lenB = lenA, lenC = htB, htC = htA. |
|
|
MFdia_mulMT
| MDdia_mulMT |
MEdia_mulMT |
MCFdia_mulMT |
MCDdia_mulMT |
MCEdia_mulMT |
|
Function | multiply a diagonal matrix by the transpose of a general matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MFdia_mulMT( fMatrix MC, fVector MADia, fMatrix MB, ui htB, ui lenB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::dia_mulMT( const vector<T>& MADia, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MFdia_mulMT( MC:fMatrix; MADia:fVector; MB:fMatrix; htB, lenB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMFdia_mulMT( fMatrix d_MC, fVector d_MADia, fMatrix d_MB, ui htB, ui lenB );
void MFdiacu_mulMT( fMatrix h_MC, fVector h_MADia, fMatrix h_MB, ui htB, ui lenB );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMFdia_mulMT( d_MC:fMatrix; d_MADia:fVector; d_MB:fMatrix; htB, lenB:UIntSize ): IntBool;
procedure MFdiacu_mulMT( h_MC:fMatrix; h_MADia:fVector; h_MB:fMatrix; htB, lenB:UIntSize );
|
|
Description | MC = MADia * MBT
htB and lenB must be specified; sizA equals lenB. |
|
|
VF_mulMT
| VD_mulMT |
VE_mulMT |
|
Function | multiply a row vector by the transpose of a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void VF_mulMT( fVector Y, fVector X, fMatrix MA, ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::mulMT( const vector<T>& X, const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure VF_mulMT( Y, X:fVector; MA:fMatrix; htA, lenA:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaVF_mulMT( fVector d_Y, fVector d_X, fMatrix d_MA, ui htA, ui lenA );
void VFcu_mulMT( fVector h_Y, fVector h_X, fMatrix h_MA, ui htA, ui lenA );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaVF_mulMT( d_Y, d_X:fVector; d_MA:fMatrix; htA, lenA:UIntSize ): IntBool;
procedure VFcu_mulMT( h_Y, h_X:fVector; h_MA:fMatrix; htA, lenA:UIntSize );
|
|
Description | Y = X * MAT
The dimensions htA and lenA refer to the original (rather than the intermediate transposed) matrix MA; the dimensions of X and Y are implicitly given by the matrix dimensions: sizX = lenA, sizY = htA. |
|
|
VF_multiLinfit
| VD_multiLinfit |
VE_multiLinfit |
VF_multiLinfitwW |
VD_multiLinfitwW |
VE_multiLinfitwW |
|
Function | fit multiple X-Y data sets to a common model function, linear in its parameters |
|
Syntax C/C++ | #include <MFstd.h>
int VF_multiLinfit( fVector A, iVector AStatus, unsigned npars, VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*funcs)(fVector BasFuncs, float x,unsigned nfuncs, unsigned iexperiment) );
int VF_multiLinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*funcs)(fVector BasFuncs, float x, unsigned nfuncs, unsigned iexperiment) );
int VF_multiLinfitwEdit( fVector A, iVector AStatus, unsigned npars, VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments, float thresh,
void (*funcs)(fVector BasFuncs, float x,unsigned nfuncs, unsigned iexperiment) );
int VF_multiLinfitwWwEdit( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments, float thresh,
void (*funcs)(fVector BasFuncs, float x, unsigned nfuncs, unsigned iexperiment) ); |
Pascal/Delphi | uses MFstd;
function VF_multiLinfit( A:fVector; AStatus:iVector; nParameters:UInt; ListOfExperiments: PVF_EXPERIMENT; nexperiments:UInt; funcs: Pointer ): IntBool;
function VF_multiLinfitwW( A:fVector; Covar:fMatrix; AStatus:iVector; nParameters:UInt; ListOfExperiments:PVF_EXPERIMENT; nexperiments:UInt; funcs:Pointer ): IntBool;
function VF_multiLinfitwEdit( A:fVector; AStatus:iVector; nParameters:UInt; ListOfExperiments: PVF_EXPERIMENT; nexperiments:UInt; thresh:Single; funcs: Pointer ): IntBool;
function VF_multiLinfitwWwEdit( A:fVector; Covar:fMatrix; AStatus:iVector; nParameters:UInt; ListOfExperiments:PVF_EXPERIMENT; nexperiments:UInt; thresh:Single; funcs:Pointer ): IntBool; |
|
Description | The input data, contained in ListOfExperiments, are used to evaluate the parameters ai of a general linear function,
y = a0f0(x) + a1f1(x) + a2f2(x)...
The parameters ai are returned in the vector A.
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients. If the covariances are not needed, one may call the function with Covar = (fMatrix)NULL / nil. |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
ListOfExperiments | input data, see chap. 13.4 |
nexperiments | number of data sets in ListOfExperiments |
funcs | user-defined model function |
Your model function may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide an additional vector, AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). Any fixed parameters must be initialized in A prior to calling VF_multiLinfit. The argument npars denotes the total number of parameters in A (not only the free parameters!).
The input data must be combined into sets of the type VF_EXPERIMENT. Assuming you have two sets of X-Y data, contained in the vectors X1, Y1 (and, for VF_multiLinfitwW, InvVar1) of size1 elements, and X2, Y2 (and InvVar2) of size2 elements, you have to construct a list of experiments as in the following example:
| Constructing list of experiments in C/C++ |
VF_EXPERIMENT ExpList[2];
ExpList[0].X = X1; ExpList[0].Y = Y1; ExpList[0].size = size1;
ExpList[1].X = X2; ExpList[1].Y = Y2; ExpList[1].size = size2;
/* for the weighted variant, set additionally: */
ExpList[0].InvVar = InvVar1; ExpList[0].WeightOfExperiment = wt1;
ExpList[1].InvVar = InvVar2; ExpList[1].WeightOfExperiment = wt2;
| Constructing list of experiments in Pascal/Delphi |
var ExpList: array[0..1] of VF_EXPERIMENT;
begin
...
ExpList[0].X := X1; ExpList[0].Y := Y1;
ExpList[0].size := size1;
ExpList[1].X := X2; ExpList[1].Y := Y2;
ExpList[1].size := size2;
(* for the weighted variant, set additionally: *)
ExpList[0].InvVar := InvVar1;
ExpList[0].WeightOfExperiment := wt1;
ExpList[1].InvVar := InvVar2;
ExpList[1].WeightOfExperiment := wt2;
...
end;
| Both C/C++ and Pascal/Delphi |
You must provide a model function "funcs" which, for any argument x, must calculate the individual basis functions fi(x) and store them in a vector BasFuncs. The model function has to be defined as
| Model function for C/C++ |
void MyFunc( fVector BasFuncs, float x, unsigned nfuncs, unsigned iexperiment )
{
BasFuncs[0] = f0( x );
BasFuncs[1] = f1( x);
...
}
and shall be passed to VF_multiLinfit by calling
VF_multiLinfit( A, AStatus, npars, ExpList, 2, MyFunc );
| Model function for Pascal/Delphi |
procedure MyFunc( BasFuncs:fVector; x:Single; nfuncs, iexperiment:UInt );
begin
VF_Pelement( BasFuncs, 0 )^ := f0( x );
VF_Pelement( BasFuncs, 1 )^ := f1( x );
...
end;
This model function shall be passed to VF_multiLinfit by calling
VF_multiLinfit( A, AStatus, npars, @ExpList, 2, @MyFunc );
Note the address-of operators in front of "ExpList" (static Pascal array passed to OptiVec function) and "MyFunc." (pointer to the function MyFunc). In Turbo Pascal, the model function must be compiled with the Force-Far-Calls option {$F+}.
| Both C/C++ and Pascal/Delphi |
The argument iexperiment with which MyFunc shall be called by VF_multiLinfit allows to distinguish between parameters that are common to all experiments and others that belong to individual experiments. For example, each experiment's Y values might be shifted by a constant C. In this case, A has to contain as many shifts C as there are experiments. In MyFunc, you would have to code this as (in C/C++; you will easily translate this into Pascal/Delphi):
if( iexperiment == 0 ) { BasFuncs[2] = 1; BasFuncs[3] = 0; }
else {BasFuncs[2] = 0; BasFuncs[3] = 1; }
The functions f0( x ) etc. must not contain the parameters ai. In the weighted variant, the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ). Internally, VF_multiLinfit employs a Singular Value Decomposition algorithm to obtain a solution even for (near-)singular linear systems. Thereby, coefficients ai whose significance is lower than a threshold, Thresh, are set to 0 instead of infinity. The default threshold can be modified by calling VF_setLinfitNeglect. The current threshold can be retrieved by VF_getLinfitNeglect. As VF_setLinfitNeglect is not thread-safe, this function should not be used to set different thresholds for different calls to VF_multiLinfit etc. Rather than repeatedly changing the default value, use the "wEdit" variants of VF_multiLinfit, namely VF_multiLinfitwEdit, VF_multiLinfitwWwEdit etc.
In the rare case of failure, this function returns 1 (TRUE) and sets all A[i] = 0. |
|
Return value | FALSE (0), if no error occurred, otherwise TRUE (non-zero). |
|
|
MF_multiLinfit
| MD_multiLinfit |
ME_multiLinfit |
MF_multiLinfitwW |
MD_multiLinfitwW |
ME_multiLinfitwW |
|
Function | fit multiple X-Y-Z data sets to a common model function, linear in its parameters |
|
Syntax C/C++ | #include <MFstd.h>
int MF_multiLinfit( fVector A, iVector AStatus, unsigned npars, MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*funcs)(fVector BasFuncs, float x, float y, unsigned nfuncs, unsigned iexperiment) );
int MF_multiLinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*funcs)(fVector BasFuncs, float x, float y, unsigned nfuncs, unsigned iexperiment) );
int MF_multiLinfitwEdit( fVector A, iVector AStatus, unsigned npars, MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments, float thresh,
void (*funcs)(fVector BasFuncs, float x, float y, unsigned nfuncs, unsigned iexperiment) );
int MF_multiLinfitwWwEdit( fVector A, fMatrix Covar, iVector AStatus, unsigned npars, MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments, float thresh,
void (*funcs)(fVector BasFuncs, float x, float y, unsigned nfuncs, unsigned iexperiment) ); |
Pascal/Delphi | uses MFstd;
function MF_multiLinfit( A:fVector; AStatus:iVector; nParameters:UInt; ListOfExperiments: PMF_EXPERIMENT; nexperiments:UInt; funcs: Pointer ): IntBool;
function MF_multiLinfitwW( A:fVector; Covar:fMatrix; AStatus:iVector; nParameters:UInt; ListOfExperiments: PMF_EXPERIMENT; nexperiments:UInt; funcs: Pointer ): IntBool;
function MF_multiLinfitwEdit( A:fVector; AStatus:iVector; nParameters:UInt; ListOfExperiments: PMF_EXPERIMENT; nexperiments:UInt; thresh:Single; funcs: Pointer ): IntBool;
function MF_multiLinfitwWwEdit( A:fVector; Covar:fMatrix; AStatus:iVector; nParameters:UInt; ListOfExperiments: PMF_EXPERIMENT; nexperiments:UInt; thresh:Single; funcs: Pointer ): IntBool; |
|
Description | The input data, contained in ListOfExperiments, are used to evaluate the parameters ai of a general linear function,
z = a0f0(x,y) + a1f1(x,y) + a2f2(x,y)...
The parameters ai are returned in the vector A.
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients. If the covariances are not needed, one may call the function with Covar = (fMatrix)NULL / nil. |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
ListOfExperiments | input data, see chap. 13.4 |
nexperiments | number of data sets in ListOfExperiments |
funcs | user-defined model function |
Your model function may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide an additional vector, AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). Any fixed parameters must be initialized in A prior to calling MF_multiLinfit. The argument npars denotes the total number of parameters in A (not only the free parameters!).
The input data must be combined into sets of the type MF_EXPERIMENT. Let us assume you have two sets of X-Y-Z data, each with the vectors X and Y for the independent variables, the matrix MZ for the z=f(x,y) values and, for MF_multiLinfitwW, the weights of all points in MInvVar. The matrix dimensions are htZ (equal to sizeY) and lenZ (equal to sizeX). Now you have to construct a list of experiments as in the following example:
| Constructing list of experiments in C/C++ |
MF_EXPERIMENT ExpList[2];
ExpList[0].X = X1; ExpList[0].Y = Y1;
ExpList[0].MZ = MZ1;
ExpList[0].htZ = htZ1; ExpList[0].lenZ = lenZ1;
ExpList[1].X = X1; ExpList[1].Y = Y2;
ExpList[1].MZ = MZ2;
ExpList[1].htZ = htZ2; ExpList[1].lenZ = lenZ2;
/* for the weighted variant, set additionally: */
ExpList[0].MInvVar = MInvVar1;
ExpList[0].WeightOfExperiment = wt1;
ExpList[1].MInvVar = MInvVar2;
ExpList[1].WeightOfExperiment = wt2;
| Constructing list of experiments in Pascal/Delphi |
var ExpList: array[0..1] of MF_EXPERIMENT;
begin
...
ExpList[0].X := X1; ExpList[0].Y := Y1;
ExpList[0].MZ := MZ1;
ExpList[0].htZ := htZ1; ExpList[0].lenZ := lenZ1;
ExpList[1].X := X2; ExpList[1].Y := Y2;
ExpList[1].MZ := MZ2;
ExpList[1].htZ := htZ2; ExpList[1].lenZ := lenZ2;
(* for the weighted variant, set additionally: *)
ExpList[0].MInvVar := MInvVar1;
ExpList[0].WeightOfExperiment := wt1;
ExpList[1].MInvVar := MInvVar2;
ExpList[1].WeightOfExperiment := wt2;
...
end;
| Both C/C++ and Pascal/Delphi |
You must provide a model function "funcs" which, for any argument x, must calculate the individual basis functions fi(x,y) and store them in a vector BasFuncs. The model function has to be defined as
| Model function for C/C++ |
void MyFunc( fVector BasFuncs, float x, float y, unsigned nfuncs, unsigned iexperiment )
{
BasFuncs[0] = f0( x, y );
BasFuncs[1] = f1( x, y );
...
}
and shall be passed to MF_multiLinfit by calling
MF_multiLinfit( A, AStatus, npars, ExpList, 2, MyFunc );
| Model function for Pascal/Delphi |
procedure MyFunc( BasFuncs:fVector; x, y:Single; nfuncs, iexperiment:UInt );
begin
VF_Pelement( BasFuncs, 0 )^ := f0( x, y );
VF_Pelement( BasFuncs, 1 )^ := f1( x, y );
...
end;
This model function shall be passed to MF_multiLinfit by calling
MF_multiLinfit( A, AStatus, npars, @ExpList, 2, @MyFunc );
Note the address-of operators in front of "ExpList" (static Pascal array passed to OptiVec function) and "MyFunc." (pointer to the function MyFunc). In Turbo Pascal, the model function must be compiled with the Force-Far-Calls option {$F+}.
| Both C/C++ and Pascal/Delphi |
The argument iexperiment with which MyFunc shall be called by MF_multiLinfit allows to distinguish between parameters that are common to all experiments and others that belong to individual experiments. For example, each experiment's MZ values might be shifted by a constant C. In this case, A has to contain as many shifts Ci as there are experiments. In MyFunc, you would have to code this as (in C/C++; you will easily translate this into Pascal/Delphi yourself):
if( iexperiment == 0 ) { BasFuncs[2] = 1; BasFuncs[3] = 0; }
else {BasFuncs[2] = 0; BasFuncs[3] = 1; }
The functions f0( x,y ) etc. must not contain the parameters ai. In the weighted variant, the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
Internally, MF_multiLinfit employs a Singular Value Decomposition algorithm to obtain a solution even for (near-)singular linear systems. Thereby, coefficients ai whose significance is lower than a threshold, Thresh, are set to 0 instead of infinity. The default threshold can be modified by calling VF_setLinfitNeglect. The current threshold can be retrieved by VF_getLinfitNeglect. As VF_setLinfitNeglect is not thread-safe, this function should not be used to set different thresholds for different calls to VF /MF_multiLinfit etc. Rather than repeatedly changing the default value, use the "wEdit" variants of VF / MF_multiLinfit, namely VF / MF_multiLinfitwEdit, VF / MF_multiLinfitwWwEdit etc.
In the rare case of failure, this function returns 1 (TRUE) and sets all A[i] = 0. |
|
Return value | FALSE (0), if no error occurred, otherwise TRUE (non-zero). |
|
|
VF_multiNonlinfit
| VD_multiNonlinfit |
VE_multiNonlinfit |
VF_multiNonlinfitwW |
VD_multiNonlinfitwW |
VE_multiNonlinfitwW |
|
Function | fit multiple X-Y data sets to a common model function, possibly non-linear in its parameters |
|
Syntax C/C++ | #include <MFstd.h>
float VF_multiNonlinfit( fVector A, iVector AStatus, unsigned npars,
VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fVector YModel, fVector XModel, ui size, unsigned iexperiment),
void (*derivatives)(fVector dYdAi,fVector X, ui size, unsigned ipar, unsigned iexperiment),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace );
float VF_multiNonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fVector YModel, fVector X, ui size, unsigned iexperiment, fVector A),
void (*derivatives)(fVector dYdAi, fVector X, ui size, unsigned ipar, unsigned iexperiment, fVector A, VF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace ); |
Syntax C/C++ simplified | #include <MFstd.h>
float VF_multiNonlinfit( fVector A, iVector AStatus, unsigned npars,
VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fVector YModel, fVector XModel, ui size, unsigned iexperiment, fVector A),
void (*derivatives)(fVector dYdAi,fVector X, ui size, unsigned ipar, unsigned iexperiment, fVector A, VF_NONLINFITWORKSPACE *ws) );
float VF_multiNonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
VF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fVector YModel, fVector X, ui size, unsigned iexperiment, fVector A),
void (*derivatives)(fVector dYdAi, fVector X, ui size, unsigned ipar, unsigned iexperiment, fVector A, VF_NONLINFITWORKSPACE *ws) ); |
Pascal/Delphi | uses VFmnlfit;
function VF_multiNonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PVF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS; WorkSpace: PMF_NONLINFITWORKSPACE ): Single;
function VF_multiNonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PVF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS; WorkSpace: PMF_NONLINFITWORKSPACE ): Single; Syntax of user-supplied ModelFunc and Derivatives:
procedure ModelFunc( YModel, X:fVector; size:UIntSize; iexperiment:UInt; A:fVector );
procedure Derivatives( dYdAi, X:fVector; size:UIntSize; ipar, iexperiment:UInt; A:fVector; ws:PVF_NONLINFITWORKSPACE );
|
Pascal/Delphi simplified | uses VFmnlfit;
function VF_multiNonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PVF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer ): Single;
function VF_multiNonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PVF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer ): Single; |
|
Description | The input data, contained in ListOfExperiments, are used to evaluate the parameter array A with npars elements ai of an arbitrary model function y = f(x).
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
ListOfExperiments | input data, see chap. 13.4 |
nexperiments | number of data sets in ListOfExperiments |
modelfunc | user-defined model function |
derivatives | user-defined function, calculating the partial derivatives with respect to all parameters (may be NULL / nil; in this case, the partial derivatives are calculated numerically) |
FitOpts | pointer to a structure containing options, see chap. 13.3 |
WorkSpace | pointer to a structure holding internal variables, see chap. 13.3 |
Return Value | "goodness-of-fit" value. Depending on the function variant and the chosen figure-of-merit, this is:
VF_multiNonlinfitwW with FitOptions.FigureOfMerit=0 (least-square fitting): c2 (chi-square) = S) (Ymod[i] - Y[i] )2 * InvVar[i] );
VF_multiNonlinfitwW with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(Ymod[i] - Y[i] ) * InvVar[i] );
VF_multiNonlinfit with FitOptions.FigureOfMerit=0 (least-square fitting, all std errors assumed=1.0): c2 = S( (Ymod[i] - Y[i] )2 ];
VF_multiNonlinfit with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(Ymod[i] - Y[i] ) );
where Ymod means the theoretical Y values of all experiments as calculated from the model function with the best parameter set found. For robust fitting, InvVar actually does not have the meaning of inverse variances; one could choose weights as inverse absolute uncertainties instead. |
In order to use default options and built-in workspace, FitOpts and WorkSpace may be set to NULL / nil. In the simplified syntax variant, both of them are missing.
The model function (and, consequently, the vector A as well) may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide an additional vector, AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). All parameters must be initialized in A prior to calling VF_multiNonlinfit. The better your initial guess of the parameters, the faster VF_multiNonlinfit shall converge. The argument npars denotes the total number of parameters in A (not only the free parameters!).
The input data must be combined into sets of the type VF_EXPERIMENT. Assuming you have two sets of X-Y data, contained in the vectors X1, Y1 (and, for VF_multiLinfitwW, InvVar1) of size1 elements, and X2, Y2 (and InvVar2) of size2 elements, you have to construct a list of experiments as in the following example:
| Constructing list of experiments in C/C++ |
VF_EXPERIMENT ExpList[2];
ExpList[0].X = X1; ExpList[0].Y = Y1; ExpList[0].size = size1;
ExpList[1].X = X2; ExpList[1].Y = Y2; ExpList[1].size = size2;
/* for the weighted variant, set additionally: */
ExpList[0].InvVar = InvVar1; ExpList[0].WeightOfExperiment = wt1;
ExpList[1].InvVar = InvVar2; ExpList[1].WeightOfExperiment = wt2;
| Constructing list of experiments in Pascal/Delphi |
var ExpList: array[0..1] of VF_EXPERIMENT;
begin
...
ExpList[0].X := X1; ExpList[0].Y := Y1;
ExpList[0].size := size1;
ExpList[1].X := X2; ExpList[1].Y := Y2;
ExpList[1].size := size2;
/* for the weighted variant, set additionally: */
ExpList[0].InvVar := InvVar1;
ExpList[0].WeightOfExperiment := wt1;
ExpList[1].InvVar := InvVar2;
ExpList[1].WeightOfExperiment := wt2;
...
end;
| Both C/C++ and Pascal/Delphi |
You must provide a model function "modelfunc" which, for a given vector of x-values, must calculate the corresponding "theoretical" y-values. In C/C++, it has to be defined as
| Model function for C/C++ |
void _cdecl MyFunc( fVector Y, fVector X, ui size, unsigned iexperiment, fVector A )
{
for (ui i=0; i<size; i++ )
Y[i] = f( X[i] );
}
f( X[i] ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
The argument iexperiment with which MyFunc shall be called by VF_multiNonlinfit allows to distinguish between parameters that are common to all experiments and others that belong to individual experiments. For example, each experiment's Y values might be scaled by an individual constant C. In this case, A has to contain as many scales C as there are experiments. In MyFunc, you would have to code this as something like:
if( iexperiment == 0 ) Y[i] *= A[5]; else Y[i] *= A[6];
In addition to the model function, VF_multiNonlinfit needs the partial derivatives of Y with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on VF_multiNonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for C/C++ |
void _cdecl MyDerivs( fVector dYdAi, fVector X, ui size, unsigned ipar, unsigned iexperiment, fVector A, VF_NONLINFITWORKSPACE *ws )
{
ui i;
switch( ipar )
{
case 0: for(i=0; i<size; i++ )
dYdAi[i] = part_derv_of_Y_w_resp_to_A0( X[i] );
break;
case 1: for(i=0; i<size; i++ )
dYdAi[i] = part_derv_of_Y_w_resp_to_A1( X[i] );
break;
default: /* for all derivatives we don't know: */
VF_multiNonlinfit_autoDeriv(
dYdAi, X, size:UIntSize; ipar, iexperiment, A, ws );
}
}
Again, the argument iexperiment allows you to treat "private" parameters of the individual experiments differently from the shared parameters.
A call to VF_multiNonlinfit will look like:
VF_multiNonlinfit( A, AStatus, npars, ExpList, 2, MyFunc, MyDerivs );
or
VF_multiNonlinfit( A, AStatus, npars, ExpList, 2, MyFunc, MyDerivs, &FitOpts, &WorkSpace );
In case you do not know any of the partial derivatives, do not define MyDerivs, but call VF_multiNonlinfit with derivatives = NULL:
VF_multiNonlinfit( A, AStatus, npars, ExpList, 2, MyFunc, NULL );
| Model function for Pascal/Delphi |
In Pascal/Delphi, the model function has to be defined as
procedure MyFunc( Y, X:fVector; size:UIntSize; iexperiment:UInt; A:fVector );
var i:UIntSize;
begin
for i:=0 to size-1 do
VF_Pelement( Y, i )^ := f( VF_element( X, i ) );
end;
f( X[i] ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see chapter 13.3).
The argument iexperiment with which MyFunc shall be called by VF_multiNonlinfit allows to distinguish between parameters that are common to all experiments and others that belong to individual experiments. For example, each experiment's Y values might be scaled by an individual constant C. In this case, A has to contain as many scales C as there are experiments. In MyFunc, you would have to code this as something like:
if iexperiment = 0 then
VF_Pelement(Y,i)^ := VF_element(Y,i) * VF_element(A,5)
else VF_Pelement(Y,i)^ := VF_element(Y,i) * VF_element(A,6);
In addition to the model function, VF_multiNonlinfit needs the partial derivatives of Y with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on VF_multiNonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for Pascal/Delphi |
procedure MyDerivs( dYdAi, X:fVector; size:UIntSize; ipar, iexperiment:UInt; A:fVector; ws:PVF_NONLINFITWORKSPACE );
var i:UIntSize;
begin
case ipar of
0: begin
for i:=0 to size-1 do
VF_Pelement( dYdAi, i )^ := part_derv_of_Y_w_resp_to_A0(VF_element( X, i )); end;
1: begin
for i:=0 to size-1 do
VF_Pelement( dYdAi, i )^ := part_derv_of_Y_w_resp_to_A0(VF_element( X, i )); end;
else (* for all derivatives we don't know: *)
VF_multiNonlinfit_autoDeriv(
dYdAi, X, size:UIntSize; ipar, iexperiment, A, ws );
end;
end;
Again, the argument iexperiment allows you to treat "private" parameters of the individual experiments differently from the shared parameters.
A call to VF_multiNonlinfit will look like:
VF_multiNonlinfit( A, AStatus, npars, @ExpList, 2, @MyFunc, @MyDerivs, @FitOpts, @WorkSpace );
or with simplified syntax:
VF_multiNonlinfit( A, AStatus, npars, @ExpList, 2, @MyFunc, @MyDerivs );
Note the address-of operator in front of "ExpList", "MyFunc.", and "MyDerivs". In case you do not know any of the partial derivatives, do not define MyDerivs, but call VF_multiNonlinfit with derivatives = nil:
VF_multiNonlinfit( A, AStatus, npars, @ExpList, 2, @MyFunc, nil );
In the weighted variant, VF_multiNonlinfitwW, the vector ExpList[i].InvVar of each experiment has to contain the inverse of the variances of the individual X-Y data points, and the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
| Both C/C++ and Pascal/Delphi: |
For the many different options controlling nonlinear data-fitting functions, please consult chapter 13.3. Helper functions for breaking off excessively long fitting runs and for the monitoring of these often very time-consuming procedures are summarized in chapter 13.5 and, in the special case of VF_multiNonlinfit, described here.
|
|
Multi-threading restrictions | The multi-threading restrictions, present in OptiVec versions up to and including 6.1, have been lifted with v6.2.
These functions should not be called while the FPU is set to reduced accuracy, or else they might hang in an infinite loop. See V_setFPAccuracy. |
|
Error handling | If the number of free parameters (i.e., those with AStatus[i] = 1) exceeds the total number of data points, an error message "Invalid parameter(s)" is generated and the program aborted. |
|
Return value | in case of success: goodness-of-fit parameter c2 (chi-square); in case of failure: -1 |
|
|
VF_multiNonlinfit_...
| VD_multiNonlinfit_... |
VE_multiNonlinfit_... |
VF_multiNonlinfitwW_... |
VD_multiNonlinfitwW_... |
VE_multiNonlinfitwW_... |
|
|
Syntax C/C++ | #include <MFstd.h>
void VF_multiNonlinfit_autoDeriv( fVector dYdAi, fVector X, ui size, unsigned ipar, unsigned iexperiment, fVector A, VF_NONLINFITWORKSPACE *ws );
float VF_multiNonlinfit_getFOM( VF_NONLINFITWORKSPACE *ws );
void VF_multiNonlinfit_getFOMDetail( fVector FOMDetail, VF_NONLINFITWORKSPACE *ws );
void VF_multiNonlinfit_getBestValues( fVector ABest, VF_NONLINFITWORKSPACE *ws );
int VF_multiNonlinfit_getTestDir( VF_NONLINFITWORKSPACE *ws );
unsigned VF_multiNonlinfit_getTestPar( VF_NONLINFITWORKSPACE *ws );
unsigned VF_multiNonlinfit_getTestRun( VF_NONLINFITWORKSPACE *ws );
void VF_multiNonlinfit_stop( VF_NONLINFITWORKSPACE *ws );
(identical syntax for the VF_multiNonlinfitwW_... functions) |
Pascal/Delphi | uses VFmnlfit;
procedure VF_multiNonlinfit_autoDeriv( dYdAi, X:fVector; size:UIntSize; ipar, iex:UInt; ws:PVF_NONLINFITWORKSPACE );
function VF_multiNonlinfit_getFOM( ws:PVF_NONLINFITWORKSPACE ): Single;
procedure VF_multiNonlinfit_getFOMDetail( FOMDetail:fVector; ws:PVF_NONLINFITWORKSPACE );
procedure VF_multiNonlinfit_getBestValues( BestValues: fVector; ws:PVF_NONLINFITWORKSPACE );
function VF_multiNonlinfit_getTestDir( ws:PVF_NONLINFITWORKSPACE ): Integer;
function VF_multiNonlinfit_getTestPar( ws:PVF_NONLINFITWORKSPACE ): UInt;
function VF_multiNonlinfit_getTestRun( ws:PVF_NONLINFITWORKSPACE ): UInt;
procedure VF_multiNonlinfit_stop( ws:PVF_NONLINFITWORKSPACE );
(identical syntax for the VF_multiNonlinfitwW_... functions) |
|
Description | VF_multiNonlinfit_autoDeriv performs a numerical differentiation of a user-provided y=f(x) model function with respect to the parameter aipar of the model. All necessary information (model function, buffer memory, etc.) is passed to this function through the pointer to the VF_NONLINFITWORKSPACE used in the current VF_multiNonlinfit operation.
The following functions allow to monitor the progress of a nonlinear fitting operation. They can either be called from within the provided model function or, for multi-thread applications, from a second thread running in parallel to the thread containing the fitting function.
VF_multiNonlinfit_getFOM returns the best figure-of-merit (c2 or, for robust fits, |c|) obtained so far. If you call this function before VF_multiNonlinfit has had the chance to calculate c2, VF_multiNonlinfit_getFOM returns -1.0.
VF_multiNonlinfit_getFOMDetail fills the user-supplied vector FOMDetail with the individual figures-of-merit (c2iex or, for robust fits, |ciex|) for all experiments. The sum over these individual c2iex or |ciex| values is the best c2 (or |c|) obtained so far, as returned by VF_multiNonlinfit_getFOM.
VF_multiNonlinfit_getBestValues stores the best parameters ai obtained so far into the user-supplied vector ABest.
VF_multiNonlinfit_getTestDir returns the test direction (+1 for upwards, -1 for downwards) during "breakout" attempts from possible local optima which would otherwise prevent the routine from finally reaching the global optimum (level-of-method greater than 3 specified by VF_setNonlinfitOptions).
VF_multiNonlinfit_getTestPar returns the index of the parameter currently under "breakout" investigation.
VF_multiNonlinfit_getTestRun returns the index of the current "breakout" test run. For each fitted parameter, one test run is performed. The order in which the parameters are checked is determined internally in such a way as to test the most sensitive parameters first.
VF_multiNonlinfit_stop makes VF_multiNonlinfit finish its current Levenberg-Marquardt or Downhill-Simplex cycle, update the output parameters and return. Thereby, long fitting sessions (especially tedious "break-out" attempts) may be broke off without the loss of any data. |
|
|
MF_multiNonlinfit
| MD_multiNonlinfit |
ME_multiNonlinfit |
MF_multiNonlinfitwW |
MD_multiNonlinfitwW |
ME_multiNonlinfitwW |
|
Function | fit multiple X-Y-Z data sets to a common model function, possibly non-linear in its parameters |
|
Syntax C/C++ | #include <MFstd.h>
float MF_multiNonlinfit( fVector A, iVector AStatus, unsigned npars,
MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y, unsigned iexperiment, fVector A),
void (*derivatives)(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iexperiment, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace );
float MF_multiNonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y, unsigned iexperiment, fVector A),
void (*derivatives)(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iexperiment, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace ); |
Syntax C/C++ simplified | #include <MFstd.h>
float MF_multiNonlinfit( fVector A, iVector AStatus, unsigned npars,
MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y, unsigned iexperiment, fVector A),
void (*derivatives)(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iexperiment, fVector A, MF_NONLINFITWORKSPACE *ws) );
float MF_multiNonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
MF_EXPERIMENT *ListOfExperiments, unsigned nexperiments,
void (*modelfunc)(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y, unsigned iexperiment, fVector A),
void (*derivatives)(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iexperiment, fVector A, MF_NONLINFITWORKSPACE *ws) ); |
Pascal/Delphi | uses MFmnlfit;
function MF_multiNonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PMF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS; WorkSpace: PMF_NONLINFITWORKSPACE ): Single;
function MF_multiNonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PMF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS; WorkSpace: PMF_NONLINFITWORKSPACE ): Single; Syntax of user-supplied ModelFunc and Derivatives:
procedure ModelFunc( ZModel:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; iexperiment:UInt; A:fVector );
procedure Derivatives( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar, iexperiment:UInt; A:fVector; ws:PMF_NONLINFITWORKSPACE );
|
Pascal/Delphi simplified | uses MFmnlfit;
function MF_multiNonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PMF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer ): Single;
function MF_multiNonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
ListOfExperiments: PMF_EXPERIMENT; nexperiments: UInt;
ModelFunc, Derivatives: Pointer ): Single; |
|
Description | The input data, contained in ListOfExperiments, are used to evaluate the parameter array A with npars elements ai of an arbitrary model function z = f(x, y).
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
ListOfExperiments | input data, see chap. 13.4 |
nexperiments | number of data sets in ListOfExperiments |
modelfunc | user-defined model function |
derivatives | user-defined function, calculating the partial derivatives with respect to all parameters (may be NULL / nil, in which case the partial derivatives will be determined numerically) |
FitOpts | pointer to a structure containing options, see chap. 13.3 |
WorkSpace | pointer to a structure holding internal variables, see chap. 13.3 |
Return Value | "goodness-of-fit" value. Depending on the function variant and the chosen figure-of-merit, this is:
MF_multiNonlinfitwW with FitOptions.FigureOfMerit=0 (least-square fitting): c2 (chi-square) = S) (MZmod[i,j] - MZ[i,j] )2 * MInvVar[i,j] );
MF_multiNonlinfitwW with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(MZmod[i,j] - MZ[i,j] ) * MInvVar[i,j] );
MF_multiNonlinfit with FitOptions.FigureOfMerit=0 (least-square fitting, all std errors assumed=1.0): c2 = S( (MZmod[i,j] - MZ[i,j] )2 ];
MF_multiNonlinfit with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(MZmod[i,j] - MZ[i,j] ) );
where MZmod means the theoretical MZ values as calculated for all experiments from the model function with the best parameter set found. For robust fitting, MInvVar actually does not have the meaning of inverse variances; one could choose weights as inverse absolute uncertainties instead. |
The model function (and, consequently, the vector A as well) may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide an additional vector, AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). All parameters must be initialized in A prior to calling MF_multiNonlinfit. The better your initial guess of the parameters, the faster MF_multiNonlinfit shall converge. The argument npars denotes the total number of parameters in A (not only the free parameters!).
The input data must be combined into sets of the type MF_EXPERIMENT. Let us assume you have two sets of X-Y-Z data, each with the vectors X and Y for the independent variables, the matrix MZ for the z=f(x,y) values and, for MF_multiLinfitwW, the weights of all points in MInvVar. The matrix dimensions are htZ (equal to sizeY) and lenZ (equal to sizeX). Now you have to construct a list of experiments as in the following example:
| Constructing list of experiments in C/C++ |
MF_EXPERIMENT ExpList[2];
ExpList[0].X = X1; ExpList[0].Y = Y1;
ExpList[0].MZ = MZ1;
ExpList[0].htZ = htZ1; ExpList[0].lenZ = lenZ1;
ExpList[1].X = X1; ExpList[1].Y = Y2;
ExpList[1].MZ = MZ2;
ExpList[1].htZ = htZ2; ExpList[1].lenZ = lenZ2;
/* for the weighted variant, set additionally: */
ExpList[0].MInvVar = MInvVar1;
ExpList[0].WeightOfExperiment = wt1;
ExpList[1].MInvVar = MInvVar2;
ExpList[1].WeightOfExperiment = wt2;
| Constructing list of experiments in Pascal/Delphi |
var ExpList: array[0..1] of MF_EXPERIMENT;
begin
...
ExpList[0].X := X1; ExpList[0].Y := Y1;
ExpList[0].MZ := MZ1;
ExpList[0].htZ := htZ1; ExpList[0].lenZ := lenZ1;
ExpList[1].X := X2; ExpList[1].Y := Y2;
ExpList[1].MZ := MZ2;
ExpList[1].htZ := htZ2; ExpList[1].lenZ := lenZ2;
/* for the weighted variant, set additionally: */
ExpList[0].MInvVar := MInvVar1;
ExpList[0].WeightOfExperiment := wt1;
ExpList[1].MInvVar := MInvVar2;
ExpList[1].WeightOfExperiment := wt2;
...
end;
| Both C/C++ and Pascal/Delphi |
You must provide a model function "modelfunc" which, for a given pair of X, Y vectors, must calculate the corresponding "theoretical" z-values. In C/C++, it has to be defined as
| Model function for C/C++ |
void _cdecl MyFunc( fMatrix Z, ui htZ, ui lenZ, fVector X, fVector Y, unsigned iexperiment, fVector A )
{
for (ui i=0; i<htZ; i++ )
for (ui j=0; j<lenZ; j++ )
MZ[i][j] = f( X[j], Y[i] );
}
f( X[j], Y[i] ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
The argument iexperiment with which MyFunc shall be called by MF_multiNonlinfit allows to distinguish between parameters that are common to all experiments and others that belong to individual experiments. For example, each experiment's MZ values might be scaled by an individual constant C. In this case, A has to contain as many scales C as there are experiments. In MyFunc, you would have to code this as something like:
if( iexperiment == 0 ) MZ[i][j] *= A[5]; else MZ[i][j] *= A[6];
In addition to the model function, MF_multiNonlinfit needs the partial derivatives of MZ with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on MF_multiNonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for C/C++ |
void _cdecl MyDerivs( fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iexperiment, fVector A, MF_NONLINFITWORKSPACE *ws )
{
ui i;
switch( ipar )
{
case 0:
for(i=0; i<htZ; i++ )
for( j=0; j<lenZ; j++ )
dZdAi[i][j] = part_derv_MZ_w_resp_to_A0( X[j], Y[i] );
break;
case 1:
for(i=0; i<htZ; i++ )
for( j=0; j<lenZ; j++ )
dZdAi[i][j] = part_derv_MZ_w_resp_to_A1( X[j], Y[i] );
break;
default: /* for all derivatives we don't know: */
MF_multiNonlinfit_autoDeriv( dZdAi, htZ, lenZ, X, Y, ipar, iexperiment, A, ws );
}
}
Again, the argument iexperiment allows you to treat "private" parameters of the individual experiments differently from the shared parameters.
A call to MF_multiNonlinfit will look like:
MF_multiNonlinfit( A, AStatus, npars, ExpList, 2, MyFunc, MyDerivs, &FitOpts, &WorkSpace );
or, with simplified syntax:
MF_multiNonlinfit( A, AStatus, npars, ExpList, 2, MyFunc, MyDerivs );
In case you do not know any of the partial derivatives, do not define MyDerivs, but call MF_multiNonlinfit with derivatives = NULL:
MF_multiNonlinfit( A, AStatus, npars, ExpList, 2, MyFunc, NULL );
| Model function for Pascal/Delphi |
In Pascal/Delphi, the model function has to be defined as
procedure MyFunc( MZ:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; iexperiment:UInt; A:fVector );
var i, j:UIntSize;
begin
for i:=0 to htZ-1 do
for j:=0 to lenZ-1 do
MF_Pelement( MZ, htZ, lenZ, i, j )^ :=
f( VF_element( X, j ), VF_element( Y, i ) );
end;
f( Xj, Yi ) is any arbitrary function, which may be as complicated as you like and your application needs. Its parameters are the individual A[i]. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
The argument iexperiment with which MyFunc shall be called by MF_multiNonlinfit allows to distinguish between parameters that are common to all experiments and others that belong to individual experiments. For example, each experiment's MZ values might be scaled by an individual constant C. In this case, A has to contain as many scales C as there are experiments. In MyFunc, you would have to code this as something like:
if iexperiment = 0 then
MF_Pelement(MZ, htZ, lenZ, i, j)^ :=
MF_element(MZ, htZ, lenZ, i, j) * VF_element(A,5)
else MF_Pelement(MZ, htZ, lenZ, i, j)^ :=
MF_element(MZ, htZ, lenZ, i, j) * VF_element(A,6);
In addition to the model function, MF_multiNonlinfit needs the partial derivatives of MZ with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on MF_multiNonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for Pascal/Delphi |
procedure MyDerivs( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar, iexperiment:UInt; A:fVector; ws:PMF_NONLINFITWORKSPACE );
var i, j:UIntSize;
begin
case ipar of
0: begin
for i:=0 to htZ-1 do
for j:=0 to lenZ-1 do
MF_Pelement( dZdAi, htZ, lenZ, i, j )^ := part_derv_MZ_w_resp_to_A0(VF_element( X, j ), VF_element( Y, i ));
end;
1: begin
for i:=0 to htZ-1 do
for j:=0 to lenZ-1 do
MF_Pelement( dZdAi, htZ, lenZ, i, j )^ := part_derv_MZ_w_resp_to_A1(VF_element( X, j ), VF_element( Y, i ));
end;
else (* for all derivatives we don't know: *)
MF_multiNonlinfit_autoDeriv( dZdAi, htZ, lenZ, X, Y, ipar, A, ws );
end;
end;
Again, the argument iexperiment allows you to treat "private" parameters of the individual experiments differently from the shared parameters.
A call to MF_multiNonlinfit will look like:
MF_multiNonlinfit( A, AStatus, npars, @ExpList, 2, @MyFunc, @MyDerivs, @FitOpts, @WorkSpace );
or, in simplified syntax,
MF_multiNonlinfit( A, AStatus, npars, @ExpList, 2, @MyFunc, @MyDerivs );
Note the address-of operator in front of "ExpList", "MyFunc.", and "MyDerivs". In case you do not know any of the partial derivatives, do not define MyDerivs, but call MF_multiNonlinfit with derivatives = nil:
MF_multiNonlinfit( A, AStatus, npars, @ExpList, 2, @MyFunc, nil );
In the weighted variant, MF_multiNonlinfitwW, the matrix ExpList[i].MInvVar of each experiment has to contain the inverse of the variances of the individual X-Y-Z data points, and the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
| Both C/C++ and Pascal/Delphi: |
For the many different options controlling nonlinear data-fitting functions, please consult chapter 13.3. Helper functions for breaking off excessively long fitting runs and for the monitoring of these often very time-consuming procedures are summarized in chapter 13.5 and, in the special case of MF_multiNonlinfit, described here.
|
|
Multi-threading restrictions | The multi-threading restrictions, present in OptiVec versions up to and including 6.1, have been lifted with v6.2.
These functions should not be called while the FPU is set to reduced accuracy, or else they might hang in an infinite loop. See V_setFPAccuracy. |
|
Error handling | If the number of free parameters (i.e., those with AStatus[i] = 1) exceeds the total number of data points, an error message "Invalid parameter(s)" is generated and the program aborted. |
|
Return value | in case of success: goodness-of-fit parameter c2 (chi-square); in case of failure: -1 |
|
|
MF_multiNonlinfit_...
| MD_multiNonlinfit_... |
ME_multiNonlinfit_... |
MF_multiNonlinfitwW_... |
MD_multiNonlinfitwW_... |
ME_multiNonlinfitwW_... |
|
|
Syntax C/C++ | #include <MFstd.h>
void MF_multiNonlinfit_autoDeriv( fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, unsigned iex, fVector A, MF_NONLINFITWORKSPACE *ws );
float MF_multiNonlinfit_getFOM( MF_NONLINFITWORKSPACE *ws );
void MF_multiNonlinfit_getFOMDetail( fVector FOMDetail, MF_NONLINFITWORKSPACE *ws );
void MF_multiNonlinfit_getBestValues( fVector ABest, MF_NONLINFITWORKSPACE *ws );
int MF_multiNonlinfit_getTestDir( MF_NONLINFITWORKSPACE *ws );
unsigned MF_multiNonlinfit_getTestPar( MF_NONLINFITWORKSPACE *ws );
unsigned MF_multiNonlinfit_getTestRun( MF_NONLINFITWORKSPACE *ws );
void MF_multiNonlinfit_stop( MF_NONLINFITWORKSPACE *ws );
(identical syntax for the MF_nonlinfitwW_... functions) |
Pascal/Delphi | uses MFmnlfit;
procedure MF_multiNonlinfit_autoDeriv( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar, iex: UInt; A:fVector; ws:PMF_NONLINFITWORKSPACE );
function MF_multiNonlinfit_getFOM( ws:PMF_NONLINFITWORKSPACE ): Single;
procedure MF_multiNonlinfit_getFOMDetail( FOMDetail:fVector; ws:PMF_NONLINFITWORKSPACE );
procedure MF_multiNonlinfit_getBestValues( BestValues: fVector; ws:PMF_NONLINFITWORKSPACE );
function MF_multiNonlinfit_getTestDir( ws:PMF_NONLINFITWORKSPACE ): Integer;
function MF_multiNonlinfit_getTestPar( ws:PMF_NONLINFITWORKSPACE ): UInt;
function MF_multiNonlinfit_getTestRun( ws:PMF_NONLINFITWORKSPACE ): UInt;
procedure MF_multiNonlinfit_stop( ws:PMF_NONLINFITWORKSPACE);
(identical syntax for the MF_multiNonlinfitwW_... functions) |
|
Description | MF_multiNonlinfit_autoDeriv performs a numerical differentiation of a user-provided z=f(x,y) model function with respect to the parameter aipar of the model. All necessary information (model function, current state of parameter set, etc.) is passed to this function through the pointer to the MF_NONLINFITWORKSPACE used in the current MF_multiNonlinfit operation.
The following functions allow to monitor the progress of a nonlinear fitting operation. They can either be called from within the provided model function or, for multi-thread applications, from a second thread running in parallel to the thread containing the fitting function.
MF_multiNonlinfit_getFOM returns the best figure-of-merit (c2 or, for robust fits, |c|) obtained so far. If you call this function before MF_multiNonlinfit has had the chance to calculate c2, MF_multiNonlinfit_getFOM returns -1.0.
MF_multiNonlinfit_getFOMDetail fills the user-supplied vector FOMDetail with the individual figures-of-merit (c2iex or, for robust fits, |ciex|) for all experiments. The sum over these individual c2iex or |ciex| values is the best c2 (or |c|) obtained so far, as returned by MF_multiNonlinfit_getFOM.
MF_multiNonlinfit_getBestValues stores the best parameters ai obtained so far into the user-supplied vector ABest.
MF_multiNonlinfit_getTestDir returns the test direction (+1 for upwards, -1 for downwards) during "breakout" attempts from possible local optima which would otherwise prevent the routine from finally reaching the global optimum (level-of-method greater than 3 specified by VF_setNonlinfitOptions).
MF_multiNonlinfit_getTestPar returns the index of the parameter currently under "breakout" investigation.
MF_multiNonlinfit_getTestRun returns the index of the current "breakout" test run. For each fitted parameter, one test run is performed. The order in which the parameters are checked is determined internally in such a way as to test the most sensitive parameters first.
MF_multiNonlinfit_stop makes MF_multiNonlinfit finish its current Levenberg-Marquardt or Downhill-Simplex cycle, update the output parameters and return. Thereby, long fitting sessions (especially tedious "break-out" attempts) may be broke off without the loss of any data. |
|
|
MCF_mulV |
MCD_mulV |
MCE_mulV |
|
Function | multiply a matrix by a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_mulV( fVector Y, fMatrix MA, fVector X, ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::mulV( const matrix<T>& MA, const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_mulV( Y:fVector; MA:fMatrix; X:fVector; htA, lenA:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_mulV( fVector d_Y, fMatrix d_MA, fVector d_X, ui htA, ui lenA );
void MFcu_mulV( fVector h_Y, fMatrix h_MA, fVector h_X, ui htA, ui lenA );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_mulV( d_Y:fVector; d_MA:fMatrix; d_X:fVector; htA, lenA:UIntSize ): IntBool;
procedure MFcu_mulV( h_Y:fVector; h_MA:fMatrix; h_X:fVector; htA, lenA:UIntSize );
|
|
Description | Y = MA * X
the dimensions of X and Y are implicitly given by the matrix dimensions: sizX = lenA, sizY = htA.
|
|
|
MF_natCubSplineInterpol | MD_natCubSplineInterpol | ME_natCubSplineInterpol |
|
Function | Natural cubic-spline interpolation of X-Y-MZ-table values |
|
Syntax C/C++ | #include <MFstd.h>
void MF_natCubSplineInterpol( fMatrix MZ, fVector X, fVector Y, ui ht, ui len, fVector XTab, fVector YTab, fMatrix MZTab, ui httab, ui lentab ); |
C++ VecObj | #include <OptiVec.h>
void matrix<T>::natCubSplineInterpol( const vector<T>& X, const vector<T>& Y, const vector<T>& XTab, const vector<T>& YTab, const matrix<T>& MZTab ); |
Pascal/Delphi | uses VFstd;
procedure MF_natCubSplineInterpol( MZ:fMatrix; X, Y:fVector; ht, len:UIntSize; XTab, YTab:fVector; MZTab:fMatrix; httab, lentab:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_natCubSplineInterpol( fMatrix d_MZ, fVector d_X, fVector d_Y, ui ht, ui len, fVector d_XTab, fVector d_YTab, fMatrix d_MZTab, ui httab, ui lentab );
void MFcu_natCubSplineInterpol( fMatrix h_MZ, fVector h_X, fVector h_Y, ui ht, ui len, fVector h_XTab, fVector h_YTab, fMatrix h_MZTab, ui httab, ui lentab );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_natCubSplineInterpol( d_MZ:fMatrix; d_X, d_Y:fVector; ht, len:UIntSize; d_XTab, d_YTab:fVector; d_MZTab:fMatrix; httab, lentab:UIntSize ): IntBool;
procedure MFcu_natCubSplineInterpol( h_MZ:fMatrix; h_X, h_Y:fVector; ht, len:UIntSize; h_XTab, h_YTab:fVector; h_MZTab:fMatrix; httab, lentab:UIntSize );
|
|
Description | For each of the ht * len x / y coordinates defined by X and Y, the corresponding element of MZ is interpolated from the XTab-YTab-MZTab values. XTab and YTab must be ordered (either ascending or descending). All values of XTab as well as of YTab must be distinct; otherwise a division by zero may occur and lead to a program abort. sizetab must be greater than or equal to 3. |
|
Error handling | none (you have to take care yourself that the XTab and YTab values are distinct and that the MZTab values are not near the limit of overflowing). |
|
|
|
MI_neg | MBI_neg | MSI_neg | MLI_neg | MQI_neg |
|
|
Syntax C/C++ | #include <MFstd.h>
void MF_neg( fMatrix MB, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::neg( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_neg( MB, MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_neg( fMatrix d_MB, fMatrix d_MA, ui ht, ui len );
void MFcu_neg( fMatrix h_MB, fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_neg( d_MB, d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_neg( h_MB, h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MBi,j = -MAi,j |
|
|
|
Function | de-allocate a certain number of matrices (C/C++ only) |
|
Syntax C/C++ | #include <MFstd.h>
void M_nfree( unsigned numfree, ... ); |
Pascal/Delphi | This function does not exist |
|
CUDA function C/C++ | #include <cudaMatLib.h>
int cudaM_nfree( unsigned numfree, ... );
|
|
Description | The parameter numfree "tells" the function how many matrices it has to free. These matrices follow in the parameter list after numfree. De-allocation of matrices not allocated by one of the functions of the MF_matrix or MF_matrix0 family is not possible.
Pascal/Delphi: since a variable number of parameters is not supported in Pascal language, this function is missing.
|
Example C/C++ | M_nfree( 3, MX, MY, MZ ); |
|
|
VF_nonlinfit
| VD_nonlinfit |
VE_nonlinfit |
VF_nonlinfitwW |
VD_nonlinfitwW |
VE_nonlinfitwW |
|
Function | fit y=f(x) data to a model-function which may be nonlinear in its parameters |
|
Syntax C/C++ | #include <MFstd.h>
float VF_nonlinfit( fVector A, iVector AStatus, unsigned npars,
fVector X, fVector Y, ui sizex,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace );
float VF_nonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
fVector X, fVector Y, fVector InvVar, ui sizex,
void modelfunc(fVector YModel, fVector X, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace ); |
Syntax C/C++ simplified | #include <MFstd.h>
float VF_nonlinfit( fVector A, iVector AStatus, unsigned npars,
fVector X, fVector Y, ui sizex,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws) );
float VF_nonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
fVector X, fVector Y, fVector InvVar, ui sizex,
void modelfunc(fVector YModel, fVector X, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws) ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::nonlinfit( const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace );
void vector<T>::nonlinfitwW( matrix<T> Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector AVF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace );
void vector<T>::nonlinfitwW( matrix<T>* Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
VF_NONLINFITWORKSPACE *WorkSpace ); |
C++ MatObj simplified | #include <OptiVec.h>
void vector<T>::nonlinfit( const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws) );
void vector<T>::nonlinfitwW( matrix<T> Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws) );
void vector<T>::nonlinfitwW( matrix<T>* Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar,
void modelfunc(fVector YModel, fVector XModel, ui size, fVector A),
void derivatives(fVector dYdAi, fVector X, ui size, unsigned iPar, fVector A, VF_NONLINFITWORKSPACE *ws) ); |
Pascal/Delphi | uses VFnlfit;
function VF_nonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
X, Y: fVector; sizex:UIntSize;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS;
WorkSpace: PVF_NONLINFITWORKSPACE ): Single;
function VF_nonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
X, Y, InvVar:fVector; sizex:UIntSize;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS;
WorkSpace: PVF_NONLINFITWORKSPACE ): Single;
Syntax of user-supplied ModelFunc and Derivatives:
procedure ModelFunc( YModel, XModel:fVector; size:UIntSize; A:fVector );
procedure Derivatives( dYdAi, X:fVector; size:UIntSize; ipar:UInt; A:fVector; ws:PVF_NONLINFITWORKSPACE );
|
Pascal/Delphi simplified | uses VFnlfit;
function VF_nonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
X, Y: fVector; sizex:UIntSize;
ModelFunc, Derivatives: Pointer ): Single;
function VF_nonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
X, Y, InvVar:fVector; sizex:UIntSize;
ModelFunc, Derivatives: Pointer ): Single; |
|
Description | The input data X, Y (and InvVar) are used to evaluate the parameter array A with npars elements ai of an arbitrary model function y = f(x).
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
X, Y, InvVar | vectors of size sizex, holding the input data |
modelfunc | user-defined model function |
derivatives | user-defined function, calculating the partial derivatives with respect to all parameters. You may set derivatives=NULL / nil; in that case, the partial derivatives are calculated numerically. |
FitOpts | pointer to a structure containing options, see chap. 13.3 |
WorkSpace | pointer to a structure holding internal variables, see chap. 13.3 |
Return Value | "goodness-of-fit" value. Depending on the function variant and the chosen figure-of-merit, this is:
VF_nonlinfitwW with FitOptions.FigureOfMerit=0 (least-square fitting): c2 (chi-square) = S) (Ymod[i] - Y[i] )2 * InvVar[i] );
VF_nonlinfitwW with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(Ymod[i] - Y[i] ) * InvVar[i] );
VF_nonlinfit with FitOptions.FigureOfMerit=0 (least-square fitting, all std errors assumed=1.0): c2 = S( (Ymod[i] - Y[i] )2 ];
VF_nonlinfit with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(Ymod[i] - Y[i] ) );
where Ymod means the theoretical Y values as calculated from the model function with the best parameter set found. For robust fitting, InvVar actually does not have the meaning of inverse variances; one could choose weights as inverse absolute uncertainties instead. |
The model function (and, consequently, the vector A as well) may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide an additional vector, AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). All parameters must be initialized in A prior to calling VF_nonlinfit. The better your initial guess of the parameters, the faster VF_nonlinfit shall converge. The argument npars denotes the total number of parameters in A (not only the free parameters!).
You must provide a model function "modelfunc" which, for a given vector of x-values, must calculate the corresponding "theoretical" y-values. In C/C++, it has to be defined as
| Model function for C/C++ |
void _cdecl MyFunc( fVector Y, fVector X, ui size, fVector A )
{
for (ui i=0; i<size; i++ )
Y[i] = f( X[i] );
}
f( X[i] ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
In addition to the model function, VF_nonlinfit needs the partial derivatives of Y with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on VF_nonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for C/C++ |
void _cdecl MyDerivs( fVector dYdAi, fVector X, ui size, unsigned ipar, fVector A, VF_NONLINFITWORKSPACE *ws )
{
ui i;
switch( ipar )
{
case 0: for(i=0; i<size; i++ )
dYdAi[i] = part_derv_of_Y_w_resp_to_A0( X[i] );
break;
case 1: for(i=0; i<size; i++ )
dYdAi[i] = part_derv_of_Y_w_resp_to_A1( X[i] );
break;
default: /* for all derivatives we don't know: */
VF_nonlinfit_autoDeriv( dYdAi, X, size:UIntSize; ipar, A, ws);
}
}
A call to VF_nonlinfit will look like:
VF_nonlinfit( A, AStatus, npars, X, Y, sizex, MyFunc, MyDerivs, &FitOpts, &WorkSpace );
or, in simplified syntax (only if no explicit call to VF_nonlinfit_autoDeriv has to be made):
VF_nonlinfit( A, AStatus, npars, X, Y, sizex, MyFunc, MyDerivs );
In case you do not know any of the partial derivatives, do not define MyDerivs, but call VF_nonlinfit with derivatives = NULL:
VF_nonlinfit( A, AStatus, npars, X, Y, sizex, MyFunc, NULL );
| Model function for Pascal/Delphi |
In Pascal/Delphi, the model function has to be defined as
procedure MyFunc( Y, X:fVector; size:UIntSize; A:fVector );
var i:UIntSize;
begin
for i:=0 to size-1 do
VF_Pelement( Y, i )^ := f( VF_element( X, i ) );
end;
f( X[i] ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
In addition to the model function, VF_nonlinfit needs the partial derivatives of Y with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on VF_nonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for Pascal/Delphi |
procedure MyDerivs( dYdAi, X:fVector; size:UIntSize; ipar:UInt; A:fVector; ws:PVF_NONLINFITWORKSPACE );
var i:UIntSize;
begin
case ipar of
0: begin
for i:=0 to size-1 do
VF_Pelement( dYdAi, i )^ := part_derv_of_Y_w_resp_to_A0(VF_element( X, i )); end;
1: begin
for i:=0 to size-1 do
VF_Pelement( dYdAi, i )^ := part_derv_of_Y_w_resp_to_A0(VF_element( X, i )); end;
else (* for all derivatives we don't know: *)
VF_nonlinfit_autoDeriv( dYdAi, X, size, ipar, A, ws );
end;
end;
A call to VF_nonlinfit will look like:
VF_nonlinfit( A, AStatus, npars, X, Y, sizex, @MyFunc, @MyDerivs, @FitOpts, @WorkSpace );
or, in simplified syntax (only if no explicit call to VF_nonlinfit_autoDeriv has to be made):
VF_nonlinfit( A, AStatus, npars, X, Y, sizex, @MyFunc, @MyDerivs );
Note the address-of operator in front of "MyFunc." and "MyDerivs". In case you do not know any of the partial derivatives, do not define MyDerivs, but call VF_nonlinfit with derivatives = nil:
VF_nonlinfit( A, AStatus, npars, X, Y, sizex, @MyFunc, nil );
In the weighted variant, VF_nonlinfitwW, the vector InvVar has to contain the inverse of the variances of the individual X-Y data points, and the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
| Both C/C++ and Pascal/Delphi: |
For the many different options controlling nonlinear data-fitting functions, please consult chapter 13.3. Helper functions for breaking off excessively long fitting runs and for the monitoring of these often very time-consuming procedures are summarized in chapter 13.5 and, in the special case of VF_nonlinfit, described here.
|
|
Multi-threading restrictions | The multi-threading restrictions, present in OptiVec versions up to and including 6.1, have been lifted with v6.2.
These functions should not be called while the FPU is set to reduced accuracy, or else they might hang in an infinite loop. See V_setFPAccuracy. |
|
Error handling | If the number of free parameters (i.e., those with AStatus[i] = 1) exceeds the total number of data points, an error message "Invalid parameter(s)" is generated and the program aborted. |
|
Return value | in case of success: goodness-of-fit value, see above. In case of failure: -1.0 |
|
|
VF_nonlinfit_...
| VD_nonlinfit_... |
VE_nonlinfit_... |
VF_nonlinfitwW_... |
VD_nonlinfitwW_... |
VE_nonlinfitwW_... |
|
|
Syntax C/C++ | #include <MFstd.h>
void VF_nonlinfit_autoDeriv( fVector dYdAi, fVector X, ui size, unsigned ipar, fVector A, VF_NONLINFITWORKSPACE *ws );
float VF_nonlinfit_getFOM( VF_NONLINFITWORKSPACE *ws );
void VF_nonlinfit_getBestValues( fVector ABest, VF_NONLINFITWORKSPACE *ws );
int VF_nonlinfit_getTestDir( VF_NONLINFITWORKSPACE *ws );
unsigned VF_nonlinfit_getTestPar( VF_NONLINFITWORKSPACE *ws );
unsigned VF_nonlinfit_getTestRun( VF_NONLINFITWORKSPACE *ws );
void VF_nonlinfit_stop( VF_NONLINFITWORKSPACE *ws );
(identical syntax for the VF_nonlinfitwW_... functions) |
C++ MatObj | #include <OptiVec.h>
void vector<T>::nonlinfit_getFOM( VF_NONLINFITWORKSPACE *ws );
void vector<T>::nonlinfit_getBestValues( VF_NONLINFITWORKSPACE *ws );
unsigned vector<T>::nonlinfit_getTestPar( VF_NONLINFITWORKSPACE *ws );
unsigned vector<T>::nonlinfit_getTestRun( VF_NONLINFITWORKSPACE *ws );
void vector<T>::nonlinfit_stop( VF_NONLINFITWORKSPACE *ws );
(identical syntax for the VF_nonlinfitwW_... functions) |
Pascal/Delphi | uses VFnlfit;
procedure VF_nonlinfit_autoDeriv( dYdAi, X: fVector; size:UIntSize; ipar:UInt; A:fVector; ws:PVF_NONLINFITWORKSPACE );
function VF_nonlinfit_getFOM( ws:PVF_NONLINFITWORKSPACE ): Single;
procedure VF_nonlinfit_getBestValues( BestValues: fVector; ws:PVF_NONLINFITWORKSPACE );
function VF_nonlinfit_getTestDir( ws:PVF_NONLINFITWORKSPACE ): Integer;
function VF_nonlinfit_getTestPar( ws:PVF_NONLINFITWORKSPACE ): UInt;
function VF_nonlinfit_getTestRun( ws:PVF_NONLINFITWORKSPACE ): UInt;
procedure VF_nonlinfit_stop( ws:PVF_NONLINFITWORKSPACE );
(identical syntax for the VF_nonlinfitwW_... functions) |
|
Description | VF_nonlinfit_autoDeriv performs a numerical differentiation of a user-provided y=f(x) model function with respect to the parameter aipar of the model. All necessary information (model function, current state of parameter set, etc.) is passed to this function through the pointer to the VF_NONLINFITWORKSPACE used in the current VF_nonlinfit operation.
The following functions allow to monitor the progress of a nonlinear fitting operation. They can either be called from within the provided model function or, for multi-thread applications, from a second thread running in parallel to the thread containing the fitting function.
VF_nonlinfit_getFOM returns the best figure-of-merit (c2 or, for robust fits, |c|) obtained so far. If you call this function before VF_nonlinfit has had the chance to calculate c2, VF_nonlinfit_getFOM returns -1.0.
VF_nonlinfit_getBestValues stores the best parameters ai obtained so far into the user-supplied vector ABest.
VF_nonlinfit_getTestDir returns the test direction (+1 for upwards, -1 for downwards) during "breakout" attempts from possible local optima which would otherwise prevent the routine from finally reaching the global optimum (level-of-method greater than 3 specified by VF_setNonlinfitOptions).
VF_nonlinfit_getTestPar returns the index of the parameter currently under "breakout" investigation.
VF_nonlinfit_getTestRun returns the index of the current "breakout" test run. For each fitted parameter, one test run is performed. The order in which the parameters are checked is determined internally in such a way as to test the most sensitive parameters first.
VF_nonlinfit_stop makes VF_nonlinfit finish its current Levenberg-Marquardt or Downhill-Simplex cycle, update the output parameters and return. Thereby, long fitting sessions (especially tedious "break-out" attempts) may be broke off without the loss of any data. |
|
|
MF_nonlinfit
| MD_nonlinfit |
ME_nonlinfit |
MF_nonlinfitwW |
MD_nonlinfitwW |
ME_nonlinfitwW |
|
Function | fit z=f(x,y) data to a model-function which may be nonlinear in its parameters |
|
Syntax C/C++ | #include <MFstd.h>
float MF_nonlinfit( fVector A, iVector AStatus, unsigned npars,
fVector X, fVector Y, fMatrix Z, ui htZ, ui lenZ,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace );
float MF_nonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
fVector X, fVector Y, fMatrix Z, fMatrix InvVar, ui htZ, ui lenZ,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace ); |
Syntax C/C++ simplified | #include <MFstd.h>
float MF_nonlinfit( fVector A, iVector AStatus, unsigned npars,
fVector X, fVector Y, fMatrix Z, ui htZ, ui lenZ,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws) );
float MF_nonlinfitwW( fVector A, fMatrix Covar, iVector AStatus, unsigned npars,
fVector X, fVector Y, fMatrix Z, fMatrix InvVar, ui htZ, ui lenZ,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws) ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::nonlinfit( const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace );
void vector<T>::nonlinfitwW( matrix<T> Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace );
void vector<T>::nonlinfitwW( matrix<T>* Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws),
VF_NONLINFITOPTIONS *FitOpts,
MF_NONLINFITWORKSPACE *WorkSpace ); |
C++ MatObj simplified | #include <OptiVec.h>
void vector<T>::nonlinfit( const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws) );
void vector<T>::nonlinfitwW( matrix<T> Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws) );
void vector<T>::nonlinfitwW( matrix<T>* Covar, const vector<int>& AStatus,
const vector<T>& X, const vector<T>& Y, const matrix<T>& MZ, const matrix<T>& MInvVar,
void modelfunc(fMatrix ZModel, ui htZ, ui lenZ, fVector X, fVector Y , fVector A),
void derivatives(fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws) ); |
Pascal/Delphi | uses MFnlfit;
function MF_nonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
X, Y: fVector; MZ: fMatrix; htZ, lenZ:UIntSize;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS;
WorkSpace: PMF_NONLINFITWORKSPACE ): Single;
function MF_nonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
X, Y: fVector; MZ, MInvVar: fMatrix; htZ, lenZ:UIntSize;
ModelFunc, Derivatives: Pointer;
FitOpts: PVF_NONLINFITOPTIONS;
WorkSpace: PMF_NONLINFITWORKSPACE ): Single;
Syntax of user-supplied ModelFunc and Derivatives:
procedure ModelFunc( ZModel:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; A:fVector );
procedure Derivatives( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar:UInt; A:fVector; ws:PMF_NONLINFITWORKSPACE );
|
Pascal/Delphi simplified | uses MFnlfit;
function MF_nonlinfit( A: fVector; AStatus: iVector; nParameters: UInt;
X, Y: fVector; MZ: fMatrix; htZ, lenZ:UIntSize;
ModelFunc, Derivatives: Pointer ): Single;
function MF_nonlinfitwW( A: fVector; Covar: fMatrix; AStatus: iVector; nParameters: UInt;
X, Y: fVector; MZ, MInvVar: fMatrix; htZ, lenZ:UIntSize;
ModelFunc, Derivatives: Pointer ): Single; | |
Description | The input data X, Y, MZ (and MInvVar) are used to evaluate the parameter array A with npars elements ai of an arbitrary model function z = f(x,y).
Arguments:
A | vector of size npars; returns the coefficients |
Covar | matrix of dimensions [npars, npars]; returns the covariances of the coefficients |
AStatus | vector of size npars; decides which parameters are treated as free or as fixed |
npars | total number of parameters |
X, Y | vectors of size lenZ and htZ, respectively, spanning the x-y coordinate system of the matrix MZ |
MZ, MInvVar | matrices of dimensions [htZ, lenZ], holding the input data and, in the weighted variant, the inverse of their variances |
modelfunc | user-defined model function |
derivatives | user-defined function, calculating the partial derivatives with respect to all parameters (may be NULL / nil, in which case the partial derivatives are calculated numerically) |
FitOpts | pointer to a structure containing options, see chap. 13.3 |
WorkSpace | pointer to a structure holding internal variables, see chap. 13.3 |
Return Value | "goodness-of-fit" value. Depending on the function variant and the chosen figure-of-merit, this is:
MF_nonlinfitwW with FitOptions.FigureOfMerit=0 (least-square fitting): c2 (chi-square) = S) (MZmod[i,j] - MZ[i,j] )2 * MInvVar[i,j] );
MF_nonlinfitwW with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(MZmod[i,j] - MZ[i,j] ) * MInvVar[i,j] );
MF_nonlinfit with FitOptions.FigureOfMerit=0 (least-square fitting, all std errors assumed=1.0): c2 = S( (MZmod[i,j] - MZ[i,j] )2 ];
MF_nonlinfit with FitOptions.FigureOfMerit=1 (robust fitting): |c| (chi-abs) = S( abs(MZmod[i,j] - MZ[i,j] ) );
where MZmod means the theoretical MZ values as calculated from the model function with the best parameter set found. For robust fitting, MInvVar actually does not have the meaning of inverse variances; one could choose weights as inverse absolute uncertainties instead. |
The model function (and, consequently, the vector A as well) may actually contain more parameters than you wish to treat as adjustable. This is why you have to provide an additional vector, AStatus, which contains the necessary information about which parameters are to be held fixed at their input values (AStatus[i] = 0) and which are free (AStatus[i] = 1). All parameters must be initialized in A prior to calling MF_nonlinfit. The better your initial guess of the parameters, the faster MF_nonlinfit shall converge. The argument npars denotes the total number of parameters in A (not only the free parameters!).
You must provide a model function "modelfunc" which, for given vectors of x and y values, must calculate the corresponding "theoretical" z values. In C/C++, it has to be defined as
| Model function for C/C++ |
void _cdecl MyFunc( fMatrix Z, ui htZ, ui lenZ, fVector X, fVector Y , fVector A)
{
for (ui i=0; i<htZ; i++ )
for (ui j=0; j<lenZ; j++ )
MZ[i][j] = f( X[j], Y[i] );
}
f( X[j], Y[i] ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
In addition to the model function, MF_nonlinfit needs the partial derivatives of MZ with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on MF_nonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for C/C++ |
void _cdecl MyDerivs( fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws )
{
ui i;
switch( ipar )
{
case 0:
for(i=0; i<htZ; i++ )
for( j=0; j<lenZ; j++ )
dZdAi[i][j] = part_derv_MZ_w_resp_to_A0( X[j], Y[i] );
break;
case 1:
for(i=0; i<htZ; i++ )
for( j=0; j<lenZ; j++ )
dZdAi[i][j] = part_derv_MZ_w_resp_to_A1( X[j], Y[i] );
break;
default: /* for all derivatives we don't know: */
MF_nonlinfit_autoDeriv( dZdAi, htZ, lenZ, X, Y, ipar, A, ws );
}
}
A call to MF_nonlinfit will look like:
MF_nonlinfit( A, AStatus, npars, X, Y, MZ, htZ, lenZ, MyFunc, MyDerivs, &FitOpts, &WorkSpace );
or, in simplified syntax (only, if no explicit call to MF_nonlinfit_autoDeriv has to be made:
MF_nonlinfit( A, AStatus, npars, X, Y, MZ, htZ, lenZ, MyFunc, MyDerivs );
In case you do not know any of the partial derivatives, do not define MyDerivs, but call MF_nonlinfit with derivatives = NULL:
MF_nonlinfit( A, AStatus, npars, X, Y, MZ, htZ, lenZ, MyFunc, NULL );
| Model function for Pascal/Delphi |
In Pascal/Delphi, the model function has to be defined as
procedure MyFunc( MZ:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; A:fVector );
var i, j:UIntSize;
begin
for i:=0 to htZ-1 do
for j:=0 to lenZ-1 do
MF_Pelement( MZ, htZ, lenZ, i, j )^ :=
f( VF_element( X, j ), VF_element( Y, i ) );
end;
f( Xj, Yi ) is any arbitrary function, which may be as complicated as you like and your application needs. The only condition is that it have no singularities, at least within the parameter space specified by upper and lower boundaries (see NONLINFITOPTIONS).
In addition to the model function, MF_nonlinfit needs the partial derivatives of MZ with respect to all parameters A[ipar], according to your model. If you know them analytically, you should write a function MyDerivs. If you happen to know only some, but not all of the partial derivatives, you may rely on MF_nonlinfit_autoDeriv to calculate the unknown derivatives numerically.
| Partial derivatives coded for Pascal/Delphi |
procedure MyDerivs( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar:UInt; A:fVector; ws:PMF_NONLINFITWORKSPACE );
var i, j:UIntSize;
begin
case ipar of
0: begin
for i:=0 to htZ-1 do
for j:=0 to lenZ-1 do
MF_Pelement( dZdAi, htZ, lenZ, i, j )^ := part_derv_MZ_w_resp_to_A0(VF_element( X, j ), VF_element( Y, i ));
end;
1: begin
for i:=0 to htZ-1 do
for j:=0 to lenZ-1 do
MF_Pelement( dZdAi, htZ, lenZ, i, j )^ := part_derv_MZ_w_resp_to_A1(VF_element( X, j ), VF_element( Y, i ));
end;
else (* for all derivatives we don't know: *)
MF_nonlinfit_autoDeriv( dZdAi, htZ, lenZ, X, Y, ipar, A, ws );
end;
end;
A call to MF_nonlinfit will look like:
MF_nonlinfit( A, AStatus, npars, MZ, htZ, lenZ, X, Y, @MyFunc, @MyDerivs, @FitOpts, @WorkSpace );
or, in simplified syntax (only, if no explicit call to MF_nonlinfit_autoDeriv has to be made:
MF_nonlinfit( A, AStatus, npars, MZ, htZ, lenZ, X, Y, @MyFunc, @MyDerivs );
Note the address-of operator in front of "MyFunc." and "MyDerivs". In case you do not know any of the partial derivatives, do not define MyDerivs, but call MF_nonlinfit with derivatives = nil:
MF_nonlinfit( A, AStatus, npars, MZ, htZ, lenZ, X, Y, @MyFunc, nil );
In the weighted variant, MF_nonlinfitwW, the matrix MInvVar has to contain the inverse of the variances of the individual X-Y-Z data points, and the matrix MCovar will be filled with the covariances of the parameters ai on output: MCovari,j = covariance( ai, aj ).
| Both C/C++ and Pascal/Delphi: |
For the many different options controlling nonlinear data-fitting functions, please consult chapter 13.3. Helper functions for breaking off excessively long fitting runs and for the monitoring of these often very time-consuming procedures are summarized in chapter 13.5 and, in the special case of MF_nonlinfit, described here.
|
|
Multi-threading restrictions | The multi-threading restrictions, present in OptiVec versions up to and including 6.1, have been lifted with v6.2.
These functions may not be called while the FPU is set to reduced accuracy, or else they might hang in an infinite loop. See V_setFPAccuracy. |
|
Error handling | If the number of free parameters (i.e., those with AStatus[i] = 1) exceeds the total number of data points, an error message "Invalid parameter(s)" is generated and the program aborted. |
|
Return value | in case of success: goodness-of-fit parameter c2 (chi-square); in case of failure: -1 |
|
|
MF_nonlinfit_...
| MD_nonlinfit_... |
ME_nonlinfit_... |
MF_nonlinfitwW_... |
MD_nonlinfitwW_... |
ME_nonlinfitwW_... |
|
|
Syntax C/C++ | #include <MFstd.h>
void MF_nonlinfit_autoDeriv( fMatrix dZdAi, ui htZ, ui lenZ, fVector X, fVector Y, unsigned ipar, fVector A, MF_NONLINFITWORKSPACE *ws );
float MF_nonlinfit_getFOM( MF_NONLINFITWORKSPACE *ws );
void MF_nonlinfit_getBestValues( fVector ABest, MF_NONLINFITWORKSPACE *ws );
unsigned MF_nonlinfit_getTestRun( MF_NONLINFITWORKSPACE *ws );
unsigned MF_nonlinfit_getTestPar( MF_NONLINFITWORKSPACE *ws );
int MF_nonlinfit_getTestDir( MF_NONLINFITWORKSPACE *ws );
void MF_nonlinfit_stop( MF_NONLINFITWORKSPACE *ws );
(identical syntax for the MF_nonlinfitwW_... functions) |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::nonlinfit_getFOM( MF_NONLINFITWORKSPACE *ws );
void vector<T>::Mnonlinfit_getBestValues( MF_NONLINFITWORKSPACE *ws );
unsigned matrix<T>::nonlinfit_getTestPar( MF_NONLINFITWORKSPACE *ws );
unsigned matrix<T>::nonlinfit_getTestRun( MF_NONLINFITWORKSPACE *ws );
void matrix<T>::nonlinfit_stop( MF_NONLINFITWORKSPACE *ws );
(identical syntax for the nonlinfitwW_... functions) |
Pascal/Delphi | uses MFnlfit;
procedure MF_nonlinfit_autoDeriv( dZdAi:fMatrix; htZ, lenZ:UIntSize; X, Y:fVector; ipar: UInt; A:fVector; ws: PMF_NONLINFITWORKSPACE );
function MF_nonlinfit_getFOM( ws: PMF_NONLINFITWORKSPACE ): Single;
procedure MF_nonlinfit_getBestValues( BestValues: fVector; ws: PMF_NONLINFITWORKSPACE );
function MF_nonlinfit_getTestRun( ws: PMF_NONLINFITWORKSPACE ): UInt;
function MF_nonlinfit_getTestPar( ws: PMF_NONLINFITWORKSPACE ): UInt;
function MF_nonlinfit_getTestDir( ws: PMF_NONLINFITWORKSPACE ): Integer;
procedure MF_nonlinfit_stop( ws: PMF_NONLINFITWORKSPACE );
(identical syntax for the MF_nonlinfitwW_... functions) |
|
Description | MF_nonlinfit_autoDeriv performs a numerical differentiation of a user-provided z=f(x,y) model function with respect to the parameter aipar of the model. This function can be called only from within a function passed as the argument "derivatives" to MF_nonlinfit. The model function that is differentiated by MF_nonlinfit_autoDeriv is the one passed in the same call to MF_nonlinfit (see that function for details!).
The following functions allow to monitor the progress of a nonlinear fitting operation. They can either be called from within the provided model function or, for multi-thread applications, from a second thread running in parallel to the thread containing the fitting function.
MF_nonlinfit_getFOM returns the best figure-of-merit (c2 or, for robust fits, |c|) obtained so far. If you call this function before MF_nonlinfit has had the chance to calculate c2, MF_nonlinfit_getFOM returns -1.0.
MF_nonlinfit_getBestValues stores the best parameters ai obtained so far into the user-supplied vector ABest.
MF_nonlinfit_getTestDir returns the test direction (+1 for upwards, -1 for downwards) during "breakout" attempts from possible local optima which would otherwise prevent the routine from finally reaching the global optimum (level-of-method greater than 3 specified by VF_setNonlinfitOptions).
MF_nonlinfit_getTestPar returns the index of the parameter currently under "breakout" investigation.
MF_nonlinfit_getTestRun returns the index of the current "breakout" test run. For each fitted parameter, one test run is performed. The order in which the parameters are checked is determined internally in such a way as to test the most sensitive parameters first.
MF_nonlinfit_stop makes MF_nonlinfit finish its current Levenberg-Marquardt or Downhill-Simplex cycle, update the output parameters and return. Thereby, long fitting sessions (especially tedious "break-out" attempts) may be broke off without the loss of any data. |
|
|
MF_outerprod
| MD_outerprod |
ME_outerprod |
MCF_outerprod |
MCD_outerprod |
MCE_outerprod |
MI_outerprod | MBI_outerprod | MSI_outerprod | MLI_outerprod | MQI_outerprod |
MU_outerprod | MUB_outerprod | MUS_outerprod | MUL_outerprod | MUQ_outerprod; |
|
Function | formation of a matrix by the "outer product" of two vectors |
|
Syntax C/C++ | #include <MFstd.h>
void MF_outerprod( fMatrix MA, fVector X, fVector Y, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::outerprod( const vector<T>& X, const vector<T>& Y ); |
Pascal/Delphi | uses MFstd;
procedure MF_outerprod( MA:fMatrix; X, Y:fVector; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_outerprod( fMatrix d_MA, fVector d_X, fVector d_Y, ui ht, ui len );
void MFcu_outerprod( fMatrix h_MA, fVector h_X, fVector h_Y, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_outerprod( d_MA:fMatrix; d_X, d_Y:fVector; ht, len:UIntSize ): IntBool;
procedure MF_outerprod( h_MA:fMatrix; h_X, h_Y:fVector; ht, len:UIntSize );
|
|
Description | MAi,j = Xi * Yj |
|
|
MF_Parzen
| MD_Parzen |
ME_Parzen |
|
Function | two-dimensional Parzen window for spatial frequency analysis |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Parzen( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Parzen( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Parzen( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Parzen( fMatrix d_MA, ui ht, ui len );
void MFcu_Parzen( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Parzen( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Parzen( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi,j = (1 - |(i - 0.5*(ht - 1)) / 0.5*(ht + 1)|) * (1 - |(j - 0.5*(len - 1)) / 0.5*(len + 1)|)
This function provides a window for spatial power-spectrum estimation with Welch's method of overlapping segments, here implemented as MF_spectrum. |
|
|
MF_Pelement
| MD_Pelement |
ME_Pelement |
MCF_Pelement |
MCD_Pelement |
MCE_Pelement |
MI_Pelement | MBI_Pelement | MSI_Pelement | MLI_Pelement | MQI_Pelement |
MU_Pelement | MUB_Pelement | MUS_Pelement | MUL_Pelement | MUQ_Pelement |
|
Function | get pointer to a matrix element |
|
Syntax C/C++ | #include <MFstd.h>
float * MF_Pelement( fMatrix MA, ui ht, ui len, unsigned m, unsigned n ); |
C++ MatObj | #include <OptiVec.h>
T * matrix<T>::Pelement( const unsigned m, const unsigned n ); |
Pascal/Delphi | uses MFstd;
function MF_Pelement( MA:fMatrix; ht, len, m, n:UIntSize ): PSingle; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
float * cudaMF_Pelement( fMatrix MA, ui ht, ui len, unsigned m, unsigned n );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Pelement( d_MA:fMatrix; ht, len, m, n:UIntSize ): PSingle;
|
|
Description | A pointer to the element MAm,n is returned.
It is possible to use this function for write access to a matrix element through the dereferenced-pointer syntax: |
C/C++ | *MF_Pelement( MA, ht, len, m, n ) = 3.5; |
Pascal/Delphi | MF_Pelement( MA, ht, len, m, n )^ := 3.5;
This sort of write access is not possible for the CUDA version of this function.
As a safer way of writing single elements, use MF_setElement.
Read-only access to matrix elements is provided by the related functions, MF_element and MF_getElement. |
|
Return value | pointer to the matrix element MAm,n |
|
|
|
Function | cudaOptiVec only: De-allocate a single pinned host-memory matrix |
|
CUDA function C/C++ | #include <cudaMatLib.h>
int cudaM_pinnedFree( void **h_MA );
|
CUDA function Pascal/Delphi | uses VecLib;
function cudaM_pinnedFree( h_X:Pointer ): IntBool;
|
|
Description | The pinned host-memory matrix MA is freed (i.e. de-allocated). This function needs the host address (not the device address!) of the pinned matrix as an argument. To free several pinned matrices simultaneously, use cudaM_pinnedNfree (C/C++ only). |
|
Error handling | Trying to free a pinned matrix that has already been freed, or that has never been allocated memory, leads to a warning message "Cannot free non-existent vector". Program execution is continued without freeing anything in this case. |
|
Return value | FALSE (0) in case of success, otherwise TRUE (non-zero) |
|
|
cudaMF_pinnedMatrix
| cudaMD_pinnedMatrix |
cudaME_pinnedMatrix |
cudaMCF_pinnedMatrix |
cudaMCD_pinnedMatrix |
cudaMCE_pinnedMatrix |
cudaMI_pinnedMatrix | cudaMBI_pinnedMatrix | cudaMSI_pinnedMatrix |
cudaMLI_pinnedMatrix | cudaMQI_pinnedMatrix | |
cudaMU_pinnedMatrix | cudaMUB_pinnedMatrix | cudaMUS_pinnedMatrix |
cudaMUL_pinnedMatrix | cudaMUQ_pinnedMatrix | cudaMUI_pinnedMatrix |
|
Function | Pinned host-memory allocation for a matrix |
|
CUDA function C/C++ | #include <cudaMFstd.h>
fMatrix cudaMF_pinnedMatrix( fMatrix *h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses VecLib;
function cudaMF_pinnedMatrix( var h_MA:fMatrix; ht, len:UIntSize ): fMatrix;
|
|
|
Error handling | If there is not enough memory available, or if size is zero, an error message "Not enough memory" is displayed and the program aborted. |
|
Return value | Device pointer to the allocated matrix |
|
|
cudaMF_pinnedMatrix0
| cudaMD_pinnedMatrix0 |
cudaME_pinnedMatrix0 |
cudaMCF_pinnedMatrix0 |
cudaMCD_pinnedMatrix0 |
cudaMCE_pinnedMatrix0 |
cudaMI_pinnedMatrix0 | cudaMBI_pinnedMatrix0 | cudaMSI_pinnedMatrix0 |
cudaMLI_pinnedMatrix0 | cudaMQI_pinnedMatrix0 | |
cudaMU_pinnedMatrix0 | cudaMUB_pinnedMatrix0 | cudaMUS_pinnedMatrix0 |
cudaMUL_pinnedMatrix0 | cudaMUQ_pinnedMatrix0 | cudaMUI_pinnedMatrix0 |
|
Function | Pinned host-memory allocation for a matrix, initialized with 0 |
|
CUDA function C/C++ | #include <cudaMFstd.h>
fMatrix0 cudaMF_pinnedMatrix0( fMatrix0 *h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses VecLib;
function cudaMF_pinnedMatrix0( var h_MA:fMatrix0; ht, len:UIntSize ): fMatrix0;
|
|
|
Error handling | If there is not enough memory available, or if size is zero, an error message "Not enough memory" is displayed and the program aborted. |
|
Return value | Device pointer to the allocated matrix |
|
|
|
Function | De-allocate pinned host memory occupied by one or more matrices. |
|
CUDA function C/C++ | #include <cudaMatLib.h>
int cudaV_pinnedNfree( unsigned numfree, ... );
|
|
Description | The parameter numfree "tells" the function how many matrices it has to free. The host pointers of these matrices follow in the parameter list after numfree. Only matrices which have been allocated by one of the functions of the cudaVF_pinnedMatrix or cudaVF_pinnedMAtrix0 family can be de-allocated by cudaM_pinnedNfree.
If device pointers are mistakenly used rather than the host pointers, an error message is displayed.
Pascal/Delphi: since a variable number of parameters is not supported in Pascal language, this function is missing. |
Example C/C++ | cudaM_pinnedNfree( 3, h_MX, h_MY, h_MZ ); |
|
Return value | FALSE (0) in case of success, otherwise TRUE (non-zero) |
|
|
VF_polyfit
| VD_polyfit |
VE_polyfit |
VF_polyfitwW |
VD_polyfitwW |
VE_polyfitwW |
VF_polyfitEven
| VD_polyfitEven |
VE_polyfitEven |
VF_polyfitEvenwW |
VD_polyfitEvenwW |
VE_polyfitEvenwW |
VF_polyfitOdd
| VD_polyfitOdd |
VE_polyfitOdd |
VF_polyfitOddwW |
VD_polyfitOddwW |
VE_polyfitOddwW |
|
Function | fitting of one X-Y data set to a polynomial |
|
Syntax C/C++ | #include <MFstd.h>
int VF_polyfit( fVector A, unsigned deg, fVector X, fVector Y, ui sizex );
int VF_polyfitwW( fVector A, fMatrix Covar, unsigned deg, fVector X, fVector Y, fVector InvVar, ui sizex );
identical syntax for VF_polyfitEven, VF_polyfitEvenwW, VF_polyfitOdd, VF_polyfitOddwW |
C++ MatObj | #include <OptiVec.h>
int vector<T>::polyfit( const vector<T>& X, const vector<T>& Y );
int vector<T>::polyfitwW( matrix<T> Covar, const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar );
int vector<T>::polyfitwW( matrix<T>* Covar, const vector<T>& X, const vector<T>& Y, const vector<T>& InvVar );
identical syntax for polyfitEven, polyfitEvenwW, polyfitOdd, polyfitOddwW |
Pascal/Delphi | uses MFstd;
function VF_polyfit( A:fVector; deg:UInt; X, Y:fVector; sizex:UIntSize ): IntBool;
function VF_polyfitwW( A:fVector; Covar:fMatrix; deg:UInt, X, Y, InvVar:fVector; sizex:UIntSize ): IntBool; identical syntax for VF_polyfitEven, VF_polyfitEvenwW, VF_polyfitOdd, VF_polyfitOddwW
|
|
Description | The input data are used to determine the coefficients ai of a polynomial of degree deg.
VF_polyfit, VF_polyfitwW:
Pi = a0 + a1Xi + a2Xi2 ... anXin
A has deg+1 elements.
VF_polyfitEven, VF_polyfitEvenwW:
The polynomial has only even terms,
Pi = a0 + a2Xi2 ... a2nXi2n
A has deg/2+1 elements, as the zero coefficients are not stored.
VF_polyfitOdd, VF_polyfitOddwW:
The polynomial has only odd terms,
Pi = a1Xi + a3Xi3 ... a2n+1Xi2n+1
A has (deg+1)/2 elements, as the zero coefficients are not stored.
The coefficients are determined so as to minimize the deviation between the "theoretical" Pi values, calculated by the polynomial, and the actual Yi values. To be more precise, the figure-of-merit chi-square,
c2 = sum( 1/si2 * (Pi - Yi)2 );
is minimized. In the weighted variants, VF_polyfitwW etc., 1/si2 has to be provided as the vector InvVar. In the non-weighted variant, all si are assumed as 1.0.
Arguments:
A | vector of size deg+1; returns the coefficients |
Covar | matrix of dimensions [deg+1, deg+1]; returns the covariances of the coefficients. If the covariances are not needed, one may call the function with Covar = (fMatrix)NULL / nil. |
deg | the degree of the fitting polynomial |
X, Y, InvVar | vectors of size sizex, holding the input data |
If possible, the X axis should include the zero point. Fitting far off the zero-point may lead to poor matching of the polynomial and your data, given the typical form of a polynomial (which has only deg-1 "turns"). In such a case, you should calculate the polynomial not for the original X, but for a shifted X' axis. If, e.g., you have to find a polynomial matching data for x ranging from 9 to 10, you would best shift your X axis by -9.5, in order to have x'=0 in the middle of the range. Shifting by -9.0 for x'=0 at the beginning of the range would also be fine.
In the rare case of failure, this function returns 1 (TRUE) and sets all A[i] = 0. |
|
Return value | FALSE (0), if no error occurred, otherwise TRUE (non-zero). |
|
|
MF_polyinterpol | MD_polyinterpol | ME_polyinterpol |
|
Function | Polynomial interpolation of X-Y-MZ-table values |
|
Syntax C/C++ | #include <MFstd.h>
void MF_polyinterpol( fMatrix MZ, fVector X, fVector Y, ui ht, ui len, fVector XTab, fVector YTab, fMatrix MZTab, ui httab, ui lentab, unsigned degX, unsigned degY ); |
C++ VecObj | #include <OptiVec.h>
void matrix<T>::polyinterpol( const vector<T>& X, const vector<T>& Y, const vector<T>& XTab, const vector<T>& YTab, const matrix<T>& MZTab, unsigned degX, unsigned degY ); |
Pascal/Delphi | uses MFstd;
procedure MF_polyinterpol( MZ:fMatrix; X, Y:fVector; ht, len:UIntSize; XTab, YTab:fVector; MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_polyinterpol( fMatrix d_MZ, fVector d_X, fVector d_Y, ui ht, ui len, fVector d_XTab, fVector d_YTab, fMatrix d_MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
void MFcu_polyinterpol( fMatrix h_MZ, fVector h_X, fVector h_Y, ui ht, ui len, fVector h_XTab, fVector h_YTab, fMatrix h_MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_polyinterpol( d_MZ:fMatrix; d_X, d_Y:fVector; ht, len:UIntSize; d_XTab, d_YTab:fVector; d_MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt ): IntBool;
procedure MFcu_polyinterpol( h_MZ:fMatrix; h_X, h_Y:fVector; ht, len:UIntSize; h_XTab, h_YTab:fVector; h_MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt );
|
|
Description | For each of the ht * len x / y coordinates defined by X and Y, the corresponding element of MZ is interpolated from the XTab-YTab-MZTab values. XTab and YTab must be ordered (either ascending or descending). All values of XTab as well as of YTab must be distinct; otherwise a division by zero may occur and lead to a program abort. The parameter degX denotes the number of points (this is not the degree of the interpolating polynomial!) that will be taken into account for the interpolation in X direction. Similarly, degY denotes the number of points taken into account for the interpolation in Y direction. Any value between 0 and 2 will be interpreted as meaning linear interpolation. A maximum of 10-point interpolation is possible. degX may not be larger than lentab-1; degY may not be larger than httab-1. |
|
Error handling | Trying to use too many elements for the interpolation (degX or degY > 10) leads to an error message "Not possible with more than 10 elements" and to a program abort. If degX exceeds lentab-1, or if degY exceeds httab-1, an error message "Invalid parameter(s)" is displayed and the program aborted.
No other errors are detected (you have to take care yourself that the XTab and YTab values are distinct and that the MZTab values are not near the limit of overflowing). |
|
|
|
MF_print
| MD_print |
ME_print |
MCF_print |
MCD_print |
MCE_print |
MI_print | MBI_print | MSI_print | MLI_print | MQI_print |
MU_print | MUB_print | MUS_print | MUL_print | MUQ_print; |
|
Function | print a matrix in ASCII format to stdout (Console applications only) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_print( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::print(); |
Pascal/Delphi | uses MFstd;
procedure MF_print( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_print( fMatrix d_MA, ui ht, ui len );
int cudaMF_print_buf( fMatrix d_MA, ui ht, ui len, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_print( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_print_buf( d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA is written to stream. Each line corresponds to one row of the matrix. The lines are numbered.
C/C++: The linewidth is determined by the symbolic constant V_consoleWindowWidth, defined in <VecLib.h> with a default value of 150 characters. If you wish to change this default value, either change it in <VecLib.h> or write #define V_consoleWindowWidth xxxx before you #include <VecLib.h>.
Pascal/Delphi: The linewidth is determined by the variable V_consoleWindowWidth in the unit VecLib with a default value of 150 characters. If you wish to change this default value, you may simply assign a new value to V_consoleWindowWidth, e.g., V_consoleWindowWidth := 80;
If this linewidth is too small to write all columns, rows are cut off.
Cartesian complex numbers are printed in braces, with the real and imaginary parts separated by a komma: {Re, Im}.
In contrast to MF_write, it is not possible to override the automatic choice of the format used for printing. The number of digits per element is determined by the available space, which depends in turn on the parameter len.
In contrast to MF_cprint, no paging is performed.
This family of functions can be used only in console applications.
CUDA versions only: cudaM?_print_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_print to allocate its own buffer memory, cudaM?_print_buf is slightly faster. |
GCC Windows specific: | In principle, the Windows port of GCC supports the 80-bit floating point type long double. However, the I/O routines rely on the runtime libraries of Visual C++, where 80-bit reals have disappeared a long time ago. This means that ME_print and MCE_cprint work only with double precision and, more importantly, within double range. Input numbers outside double range are treated as ±DBL_MAX. There is, however, a possibility to get a full-accuracy readout at least in hexadecimal format. To this end, call ME_chexprint etc. |
|
|
MF_random
| MD_random |
ME_random |
MCF_random |
MCD_random |
MCE_random |
MI_random | MBI_random | MSI_random | MLI_random | MQI_random |
MU_random | MUB_random | MUS_random | MUL_random | MUQ_random; |
|
Function | fill a matrix with high-quality random numbers |
|
Syntax C/C++ | #include <MFstd.h>
long MF_random( fMatrix MA, ui ht, ui len, long seed, float MinVal, float MaxVal ); |
C++ MatObj | #include <OptiVec.h>
long matrix<T>::random( const long& seed, const T& MinVal, const T& MaxVal ); |
Pascal/Delphi | uses MFstd;
function MF_random( MA:fMatrix; ht, len:UIntSize; seed:LongInt; MinVal, MaxVal:Single ): LongInt; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_random( fMatrix d_MA, ui ht, ui len, long seed, float MinVal, float MaxVal );
int cusdMF_random( fMatrix d_MA, ui ht, ui len, long seed, float *d_MinVal, float *d_MaxVal );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_random( d_MA:fMatrix; ht, len:UIntSize; seed:LongInt; MinVal, MaxVal:Single ): IntBool;
function cusdMF_random( d_MA:fMatrix; ht, len:UIntSize; seed:LongInt; d_MinVal, d_MaxVal:PSingle ): IntBool;
|
|
Description | The matrix MA is filled with random numbers. Within the ranges defined by MinVal and MaxVal, and within the restrictions of floating-point representation, all numbers are equally probable (including the extreme values themselves), i.e., so-called "uniform deviates" are produced. The parameter seed may be any number. Successive calls to one and the same of these functions will yield identical sequences, if seed is chosen equal; if seed is chosen differently for successive calls, the results will be uncorrelated.
Internally, these functions employ a 32-bit integer random number generator by H.W.Lewis, with additional steps (so-called "Bays-Durham shuffle") to break sequential correlations. This ensures very good randomness, far superior to simpler generators (like the rand function of C/C++ compilers or the random function of Pascal/Delphi).
A long value is returned which may be used as new seed for subsequent calls.
The CUDA versions of this function do not return a new seed value, but the usual CUDA error flag.
There is no MFcu_ version of this function, as the random numbers are generated on the CPU anyway. |
|
|
Return value | last 32-bit random number generated; this may be used as a new seed value for future calls. |
|
|
MF_randomLC
| MD_randomLC |
ME_randomLC |
MCF_randomLC |
MCD_randomLC |
MCE_randomLC |
MI_randomLC | MBI_randomLC | MSI_randomLC | MLI_randomLC | MQI_randomLC |
MU_randomLC | MUB_randomLC | MUS_randomLC | MUL_randomLC | MUQ_randomLC; |
|
Function | fill a matrix with high-quality randomLC numbers |
|
Syntax C/C++ | #include <MFstd.h>
void MF_randomLC( fMatrix MA, ui ht, ui len, long seed, float MinVal, float MaxValV_RANDOMLCSTATE *state ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::randomLC( const long& seed, const T& MinVal, const T& MaxVal, V_RANDOMLCSTATE *h_state ); |
Pascal/Delphi | uses MFstd;
procedure MF_randomLC( MA:fMatrix; ht, len:UIntSize; seed:LongInt; MinVal, MaxVal:Single; state:PV_RANDOMLCSTATE ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_randomLC( fMatrix d_MA, ui ht, ui len, long seed, float MinVal, float MaxVal, V_RANDOMLCSTATE *h_state );
int cusdMF_randomLC( fMatrix d_MA, ui ht, ui len, long seed, float *d_MinVal, float *d_MaxVal, V_RANDOMLCSTATE *h_state );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_randomLC( d_MA:fMatrix; ht, len:UIntSize; seed:LongInt; MinVal, MaxVal:Single; h_state:PV_RANDOMLCSTATE ): IntBool;
function cusdMF_randomLC( d_MA:fMatrix; ht, len:UIntSize; seed:LongInt; d_MinVal, d_MaxVal:PSingle; h_state:PV_RANDOMLCSTATE ): IntBool;
|
|
Description | The matrix MA is filled with a sequence of random numbers. Within the ranges defined by MinVal and MaxVal (and within the restrictions of floating-point representation in the floating-point versions), all numbers are equally probable (including the extreme values themselves), i.e., so-called "uniform deviates" are produced.
If the parameter seed is any non-zero number, the generator is initialized with that seed value and a new series of random numbers is generated. On the other hand, if you wish to continue a previous series, call this function with seed=0 and with the same parameter state as the previous call. Calls to one and the same of these functions will yield identical sequences, if seed is chosen equal; if seed is chosen differently for successive calls, the results will be uncorrelated.
Internally, these functions employ a linear-congruential (hence the "LC" in the function name) random number generator by H.W. Lewis. The smaller data types use a 32-bit generator, while the larger types use a 64-bit version. Additional steps (so-called "Bays-Durham shuffle") are taken to break sequential correlations. This ensures very good randomness. However, as this algorithm is well-known and its state can be inferred from a given stretch of output numbers, these functions are not suitable for cryptographic applications.
A simplified form of this function is available as MF_random.
There is no MFcu_ version of this function, as the random numbers are generated on the CPU anyway. |
|
|
|
|
MF_ratinterpol | MD_ratinterpol | ME_ratinterpol |
|
Function | Diagonal-rational interpolation of X-Y-MZ-table values |
|
Syntax C/C++ | #include <MFstd.h>
void MF_ratinterpol( fMatrix MZ, fVector X, fVector Y, ui ht, ui len, fVector XTab, fVector YTab, fMatrix MZTab, ui httab, ui lentab, unsigned degX, unsigned degY ); |
C++ VecObj | #include <OptiVec.h>
void matrix<T>::ratinterpol( const vector<T>& X, const vector<T>& Y, const vector<T>& XTab, const vector<T>& YTab, const matrix<T>& MZTab, unsigned degX, unsigned degY ); |
Pascal/Delphi | uses MFstd;
procedure MF_ratinterpol( MZ:fMatrix; X, Y:fVector; ht, len:UIntSize; XTab, YTab:fVector; MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_ratinterpol( fMatrix d_MZ, fVector d_X, fVector d_Y, ui ht, ui len, fVector d_XTab, fVector d_YTab, fMatrix d_MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
void MFcu_ratinterpol( fMatrix h_MZ, fVector h_X, fVector h_Y, ui ht, ui len, fVector h_XTab, fVector h_YTab, fMatrix h_MZTab, ui httab, ui lentab, unsigned degX, unsigned degY );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_ratinterpol( d_MZ:fMatrix; d_X, d_Y:fVector; ht, len:UIntSize; d_XTab, d_YTab:fVector; d_MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt ): IntBool;
procedure MFcu_ratinterpol( h_MZ:fMatrix; h_X, h_Y:fVector; ht, len:UIntSize; h_XTab, h_YTab:fVector; h_MZTab:fMatrix; httab, lentab:UIntSize; degX, degY:UInt );
|
|
Description | For each of the ht * len x / y coordinates defined by X and Y, the corresponding element of MZ is interpolated from the XTab-YTab-MZTab values. XTab and YTab must be ordered (either ascending or descending). All values of XTab as well as of YTab must be distinct; otherwise a division by zero may occur and lead to a program abort. The parameter degX denotes the number of points that will be taken into account for the interpolation in X direction. Similarly, degY denotes the number of points taken into account for the interpolation in Y direction. The diagonal rational interpolation scheme by Stoer and Bulirsch is used. The interpolating function is formed by the quotient of two polynomials, the polynomial in the denominator being of the same order (for even deg) or of an order higher by one (for odd deg) than the polynomial of the numerator.
Diagonal rational interpolation is superior to polynomial interpolation, especially in the presence of poles. It is, however, much slower.
deg must be between 3 and 20. Additionally, degX may not be larger than lentab-1; degY may not be larger than httab-1. |
|
Error handling | A pole (infinity) in the interpolated function is recognized and leads to a SING error with the proposed result being ±HUGE_VAL. (Note: the x-value passed to _matherr is the first element of XTab, if the error occurs while interpolating in X directions, or the first element of YTab, if the error occurs while interpolationg in Y directions). Trying to use too many elements for the interpolation (degX or degY > 20) leads to an error message "Not possible with more than 20 elements" and to a program abort. If degX or degY are < 3, or if degX exceeds lentab-1, or if degY exceeds httab-1, an error message "Invalid parameter(s)" is displayed and the program aborted.
No other errors are detected (you have to take care yourself that the XTab and YTab values are distinct). |
|
|
|
MCF_read |
MCD_read |
MCE_read |
MI_read | MBI_read | MSI_read | MLI_read | MQI_read |
MU_read | MUB_read | MUS_read | MUL_read | MUQ_read |
|
Function | read a matrix in ASCII format from a stream |
|
Syntax C/C++ | #include <MFstd.h>
void MF_read( fMatrix MA, ui ht, ui len, FILE *stream ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::read( FILE *stream ); |
Pascal/Delphi | uses MFstd;
procedure MF_read( MA:fMatrix; ht, len:UIntSize; var Stream:TextFile );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_read( fMatrix d_MA, ui ht, ui len, FILE *stream );
int cudaMF_read_buf( fMatrix d_MA, ui ht, ui len, FILE *stream, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_read( d_MA:fMatrix; ht, len:UIntSize; var Stream:TextFile ): IntBool;
function cudaMF_read_buf( d_MA:fMatrix; ht, len:UIntSize; var Stream:TextFile; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA of ht*len elements is read in ASCII format from stream. Normally, this function will be used to import matrices from a program which cannot store numbers in machine format. It can also be used to retrieve matrices previously stored by MF_write. For storing and retrieving intermediate results, however, the function pair MF_store / MF_recall is to be preferred over MF_write / MF_read (see MF_write).
Cartesian complex versions:
Real und imaginary parts may, but need not, be enclosed in braces { } or brackets ( ). However, you must be consequent: Either all or no element may be written with braces or brackets.
A komma may (but need not) separate the two parts. The imaginary part must always be explicitly specified, even if it is zero.
Examples for legal formats are:
0.3 0.5 (neither braces nor separating komma)
0.3, 0.5 (no braces; separating komma)
{0.3 0.5} (braces; no separating komma)
(0.3, 0.5) (brackets and separating komma)
|
C/C++ specific: | The entries to be read must be separated by whitespace (' ', '\n', or '\t'). Additionally, one (!) "non-whitespace" character is tolerated after each entry, if it follows directly after the last digit. After it, there must be one or more whitespace characters.
|
Pascal/Delphi specific: | The entries to be read must be separated by whitespace (' ', #13, or #9).
Whereas the C/C++ version of these functions follows the conventions of the C functions strtod, strtol, etc., the Pascal/Delphi version has to follow the rules applying to the Pascal/Delphi function Read. This makes the Pascal/Delphi version much less flexible than the C version:
- no separation characters allowed other than ' ' and #9,
- no automatic truncation of overflowing numbers |
|
Error handling | C/C++:
Overflowing numbers are silently truncated to ±HUGE_VAL.
Pascal/Delphi:
Overflowing numbers or numbers otherwise not conforming to the format requirements lead to an I/O error.
CUDA versions only: cudaM?_read_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_read to allocate its own buffer memory, cudaM?_read_buf is slightly faster. |
|
|
MF_recall
| MD_recall |
ME_recall |
MCF_recall |
MCD_recall |
MCE_recall |
MI_recall | MBI_recall | MSI_recall | MLI_recall | MQI_recall |
MU_recall | MUB_recall | MUS_recall | MUL_recall | MUQ_recall |
|
Function | Read a matrix in binary format from a stream |
|
Syntax C/C++ | #include <MFstd.h>
int MF_recall( fMatrix MA, ui ht, ui len, FILE *stream); |
C++ MatObj | #include <OptiVec.h>
int matrix<T>::recall( FILE *stream ); |
Pascal/Delphi | uses MFstd;
function MF_recall( MA:fMatrix; ht, len:UIntSize; var Stream:FILE ): Integer; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_recall( fMatrix d_MA, ui ht, ui len, FILE *stream );
int cudaMF_recall_buf( fMatrix d_MA, ui ht, ui len, FILE *stream, fVector h_Wk );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_recall( d_MA:fMatrix; ht, len:UIntSize; var Stream:File ): IntBool;
function cudaMF_recall_buf( d_MA:fMatrix; ht, len:UIntSize; var Stream:File; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA of ht*len elements is read from stream in binary format. Normally, these functions are used to retrieve data stored by the respective function of the MF_store family.
In C/C++, matrices are stored by rows, where as Pascal/Delphi and Fortran work with matrices stored by columns. This means that you will get the transpose of a matrix stored by a C/C++ program, if you read it with a Pascal/Delphi program, and vice versa. In this case, simply call
MF_transpose( MA, MA, ht, len );.
CUDA versions only: cudaM?_recall_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_recall to allocate its own buffer memory, cudaM?_recall_buf is slightly faster.
GCC and CLang only: GCC and CLang (including BCC32C) pad the 10-byte data type long double to 12 or 16 bytes in memory (12 byte in 32-bit, 16 byte in 64 bit). In order to maintain compatibility of the generated data files between compilers, the ME_store / ME_recall and MCE_store / MCE_recall pairs always use 10-byte storage on disk. |
|
Thread safety | Different threads may safely call any functions of the VF_ / MF_store and VF_ / MF_recall families simultaneously, as long as the refer to different streams. If they have to access one and the same stream, however, the user must take appropriate measures (critical sections, mutexes), in order to prevent race conditions. |
|
Error handling | Error handling is performed by the C function fread or the Delphi function BlockRead, on which MF_recall etc. are based. |
|
Return value | 0, if successful; otherwise 1. In order to obtain more information, inspect errno (C/C++) or IOResult (Delphi). |
|
|
MF_rotate90
| MD_rotate90 |
ME_rotate90 |
MCF_rotate90 |
MCD_rotate90 |
MCE_rotate90 |
MI_rotate90 | MBI_rotate90 | MSI_rotate90 | MLI_rotate90 | MQI_rotate90 |
MU_rotate90 | MUB_rotate90 | MUS_rotate90 | MUL_rotate90 | MUQ_rotate90 |
|
Function | clock-wise rotation of a matrix by 90° |
|
Syntax C/C++ | #include <MFstd.h>
void MF_rotate90( fMatrix MRot, fMatrix MA, ui htRot, ui lenRot ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::rotate90( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_rotate90( MRot, MA:fMatrix; htRot, lenRot:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_rotate90( fMatrix d_MRot, fMatrix d_MA, ui htRot, ui lenRot );
void MFcu_rotate90( fMatrix h_MRot, fMatrix h_MA, ui htRot, ui lenRot );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_rotate90( d_MRot, MA:fMatrix; htRot, lenRot:UIntSize ): IntBool;
procedure MFcu_rotate90( h_MRot, h_MA:fMatrix; htRot, lenRot:UIntSize );
|
|
Description | MRoti,j = MAlenRot-j-1, i
The dimensions fed into this function, htRot and lenRot, refer to the rotated matrix rather than to the input matrix. |
|
|
MF_rotate180
| MD_rotate180 |
ME_rotate180 |
MCF_rotate180 |
MCD_rotate180 |
MCE_rotate180 |
MI_rotate180 | MBI_rotate180 | MSI_rotate180 | MLI_rotate180 | MQI_rotate180 |
MU_rotate180 | MUB_rotate180 | MUS_rotate180 | MUL_rotate180 | MUQ_rotate180 |
|
Function | rotation of a matrix by 180° |
|
Syntax C/C++ | #include <MFstd.h>
void MF_rotate180( fMatrix MRot, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::rotate180( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_rotate180( MRot, MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_rotate180( fMatrix d_MRot, fMatrix d_MA, ui htRot, ui lenRot );
void MFcu_rotate180( fMatrix h_MRot, fMatrix h_MA, ui htRot, ui lenRot );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_rotate180( d_MRot, MA:fMatrix; htRot, lenRot:UIntSize ): IntBool;
procedure MFcu_rotate180( h_MRot, h_MA:fMatrix; htRot, lenRot:UIntSize );
|
|
Description | MRoti,j = MAht-i-1, len-j-1 |
|
|
MF_rotate270
| MD_rotate270 |
ME_rotate270 |
MCF_rotate270 |
MCD_rotate270 |
MCE_rotate270 |
MI_rotate270 | MBI_rotate270 | MSI_rotate270 | MLI_rotate270 | MQI_rotate270 |
MU_rotate270 | MUB_rotate270 | MUS_rotate270 | MUL_rotate270 | MUQ_rotate270 |
|
Function | clock-wise rotation of a matrix by 270° (or counter-clockwise rotation by 90°) |
|
Syntax C/C++ | #include <MFstd.h>
void MF_rotate270( fMatrix MRot, fMatrix MA, ui htRot, ui lenRot ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::rotate270( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_rotate270( MRot, MA:fMatrix; htRot, lenRot:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_rotate270( fMatrix d_MRot, fMatrix d_MA, ui htRot, ui lenRot );
void MFcu_rotate270( fMatrix h_MRot, fMatrix h_MA, ui htRot, ui lenRot );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_rotate270( d_MRot, MA:fMatrix; htRot, lenRot:UIntSize ): IntBool;
procedure MFcu_rotate270( h_MRot, h_MA:fMatrix; htRot, lenRot:UIntSize );
|
|
Description | MRoti,j = MAj, htRot-i-1
The dimensions fed into this function, htRot and lenRot, refer to the rotated matrix rather than to the input matrix. |
|
|
MF_Row_addC
| MD_Row_addC |
ME_Row_addC |
MCF_Row_addC |
MCD_Row_addC |
MCE_Row_addC |
|
Function | add a constant to all elements of one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_addC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_addC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_addC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_addC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_addC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_addC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_addC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_addC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_addC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i += C, i=0,...,len-1 |
|
|
MF_Row_addV
| MD_Row_addV |
ME_Row_addV |
MCF_Row_addV |
MCD_Row_addV |
MCE_Row_addV |
|
Function | element-wise addition of one row and a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_addV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_addV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_addV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_addV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_addV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_addV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_addV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i += Xi, i=0,...,len-1 |
|
|
MCF_Row_conj |
MCD_Row_conj |
MCE_Row_conj |
|
Function | complex conjugate of all elements of one column |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Row_conj( cfMatrix MA, ui ht, ui len, ui iRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T>>::Row_conj( const ui iRow ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Row_conj( MA:cfMatrix; ht, len, iRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Row_conj( cfMatrix d_MA, ui ht, ui len, ui iRow );
void MCFcu_Row_conj( cfMatrix h_MA, ui ht, ui len, ui iRow ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Row_conj( d_MA:cfMatrix; ht, len, iRow:UIntSize ): IntBool;
procedure MCFcu_Row_conj( h_MA:cfMatrix; ht, len, iRow:UIntSize );
|
|
Description | MAiRow,i = MA*iRow,i, i=0,...,len-1 |
|
|
MF_Row_delete
| MD_Row_delete |
ME_Row_delete |
MCF_Row_delete |
MCD_Row_delete |
MCE_Row_delete |
MI_Row_delete | MBI_Row_delete | MSI_Row_delete | MLI_Row_delete | MQI_Row_delete |
MU_Row_delete | MUB_Row_delete | MUS_Row_delete | MUL_Row_delete | MUQ_Row_delete; |
|
Function | delete one row from a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_delete( fMatrix MB, fMatrix MA, ui htA, ui lenA, ui iRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_delete( const matrix<T>& MA, const ui iRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_delete( MB, MA:fMatrix; htA, lenA, iRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_delete( fMatrix d_MB, fMatrix d_MA, ui htA, ui lenA, ui iRow );
void MFcu_Row_delete( fMatrix h_MB, fMatrix h_MA, ui htA, ui lenA, ui iRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_delete( d_MB, d_MA:fMatrix; htA, lenA, iRow:UIntSize ): IntBool;
procedure MFcu_Row_delete( h_MB, h_MA:fMatrix; htA, lenA, iRow:UIntSize );
|
|
Description | MBi,j = MAi,j, i=0,...,iRow-1, j=0,...,len-1
MBi,j = MAi+1,j, i=iRow,...,htA-2, j=0,...,lenA-1
The parameters htA and lenA refer to the input matrix |
|
|
MF_Row_divC
| MD_Row_divC |
ME_Row_divC |
MCF_Row_divC |
MCD_Row_divC |
MCE_Row_divC |
|
Function | divide all elements of one row by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_divC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_divC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_divC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_divC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_divC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_divC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_divC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_divC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_divC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i /= C, i=0,...,len-1 |
|
|
MF_Row_divrC
| MD_Row_divrC |
ME_Row_divrC |
MCF_Row_divrC |
MCD_Row_divrC |
MCE_Row_divrC |
|
Function | reverse division: divide a constant by all elements of one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_divrC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_divrC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_divrC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_divrC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_divrC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_divrC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_divrC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_divrC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_divrC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i = C / MAiRow,i, i=0,...,len-1 |
|
|
MF_Row_divrV
| MD_Row_divrV |
ME_Row_divrV |
MCF_Row_divrV |
MCD_Row_divrV |
MCE_Row_divrV |
|
Function | element-wise reverse division: divide a vector by one row of a matrix, storing the result back into the row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_divrV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_divrV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_divrV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_divrV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_divrV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_divrV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_divrV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i = Xi / MAiRow,i, i=0,...,len-1 |
|
|
MF_Row_divV
| MD_Row_divV |
ME_Row_divV |
MCF_Row_divV |
MCD_Row_divV |
MCE_Row_divV |
|
Function | element-wise division of one row of a matrix by a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_divV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_divV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_divV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_divV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_divV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_divV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_divV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i /= Xi, i=0,...,len-1 |
|
|
MF_Row_equ0
| MD_Row_equ0 |
ME_Row_equ0 |
MCF_Row_equ0 |
MCD_Row_equ0 |
MCE_Row_equ0 |
MCF_Row_Reequ0 |
MCD_Row_Reequ0 |
MCE_Row_Reequ0 |
MCF_Row_Imequ0 |
MCD_Row_Imequ0 |
MCE_Row_Imequ0 |
MI_Row_equ0 | MBI_Row_equ0 | MSI_Row_equ0 | MLI_Row_equ0 | MQI_Row_equ0 |
MU_Row_equ0 | MUB_Row_equ0 | MUS_Row_equ0 | MUL_Row_equ0 | MUQ_Row_equ0; |
|
Function | initialize all elements of one row with zero |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_equ0( fMatrix MA, ui ht, ui len, ui iRow );
void MCF_Row_Reequ0( cfMatrix MA, ui ht, ui len, ui iRow );
void MCF_Row_Imequ0( cfMatrix MA, ui ht, ui len, ui iRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_equ0( const ui iRow );
void matrix<complex<T>>::Row_Reequ0( const ui iRow );
void matrix<complex<T>>::Row_Imequ0( const ui iRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_equ0( MA:fMatrix; ht, len, iRow:UIntSize );
procedure MCF_Row_Reequ0( MA:cfMatrix; ht, len, iRow:UIntSize );
procedure MCF_Row_Imequ0( MA:cfMatrix; ht, len, iRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_equ0( fMatrix d_MA, ui ht, ui len, ui iRow );
int cudaMCF_Row_Reequ0( cfMatrix d_MA, ui ht, ui len, ui iRow );
int cudaMCF_Row_Imequ0( cfMatrix d_MA, ui ht, ui len, ui iRow );
void MFcu_Row_equ0( fMatrix h_MA, ui ht, ui len, ui iRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_equ0( d_MA:fMatrix; ht, len, iRow:UIntSize ): IntBool;
function cudaMCF_Row_Reequ0( d_MA:cfMatrix; ht, len, iRow:UIntSize ): IntBool;
function cudaMCF_Row_Imequ0( d_MA:cfMatrix; ht, len, iRow:UIntSize ): IntBool;
procedure MFcu_Row_equ0( h_MA:fMatrix; ht, len, iRow:UIntSize );
|
|
Description | M?_Row_equ0: | MAiRow,i = 0, i=0,...,len-1 |
MC?_Row_Reequ0: | MAiRow,i.Re = 0, i=0,...,len-1 (MAiRow,i.Im remains unchanged) |
MC?_Row_Imequ0: | MAiRow,i.Im = 0, i=0,...,len-1 (MAiRow,i.Re remains unchanged) |
|
|
|
MF_Row_equC
| MD_Row_equC |
ME_Row_equC |
MCF_Row_equC |
MCD_Row_equC |
MCE_Row_equC |
MI_Row_equC | MBI_Row_equC | MSI_Row_equC | MLI_Row_equC | MQI_Row_equC |
MU_Row_equC | MUB_Row_equC | MUS_Row_equC | MUL_Row_equC | MUQ_Row_equC |
|
Function | initialize all elements of one row with a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_equC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_equC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_equC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_equC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_equC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_equC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_equC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_equC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_equC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i = C, i=0,...,len-1 |
|
|
MF_Row_equV
| MD_Row_equV |
ME_Row_equV |
MCF_Row_equV |
MCD_Row_equV |
MCE_Row_equV |
MI_Row_equV | MBI_Row_equV | MSI_Row_equV | MLI_Row_equV | MQI_Row_equV |
MU_Row_equV | MUB_Row_equV | MUS_Row_equV | MUL_Row_equV | MUQ_Row_equV |
|
Function | copy a vector into one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_equV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_equV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_equV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_equV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_equV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_equV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_equV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i = Xi, i=0,...,len-1 |
|
|
MF_Row_extract
| MD_Row_extract |
ME_Row_extract |
MCF_Row_extract |
MCD_Row_extract |
MCE_Row_extract |
MI_Row_extract | MBI_Row_extract | MSI_Row_extract | MLI_Row_extract | MQI_Row_extract |
MU_Row_extract | MUB_Row_extract | MUS_Row_extract | MUL_Row_extract | MUQ_Row_extract |
|
Function | copy one row into a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_extract( fVector Y, fMatrix MA, ui ht, ui len, ui iRow ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Row_extract( const matrix<T>& MA, const ui iRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_extract( Y:fVector; MA:fMatrix; ht, len, iRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_extract( fVector d_Y, fMatrix d_MA, ui ht, ui len, ui iRow );
void MFcu_Row_extract( fVector h_Y, fMatrix h_MA, ui ht, ui len, ui iRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_extract( d_Y:fVector; d_MA:fMatrix; ht, len, iRow:UIntSize ): IntBool;
procedure MFcu_Row_extract( h_Y:fVector; h_MA:fMatrix; ht, len, iRow:UIntSize );
|
|
Description | Xi = MAiRow,i, i=0,...,len-1 |
|
|
MF_Row_insert
| MD_Row_insert |
ME_Row_insert |
MCF_Row_insert |
MCD_Row_insert |
MCE_Row_insert |
MI_Row_insert | MBI_Row_insert | MSI_Row_insert | MLI_Row_insert | MQI_Row_insert |
MU_Row_insert | MUB_Row_insert | MUS_Row_insert | MUL_Row_insert | MUQ_Row_insert |
|
Function | augment a matrix by insertion of one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_insert( fMatrix MB, fMatrix MA, ui htB, ui lenB, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_insert( const matrix<T>& MA, const ui iRow, const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_insert( MB, MA:fMatrix; htB, lenB, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_insert( fMatrix d_MB, fMatrix d_MA, ui htB, ui lenB, ui iRow, fVector d_X );
void MFcu_Row_insert( fMatrix h_MB, fMatrix h_MA, ui htB, ui lenB, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_insert( d_MB, d_MA:fMatrix; htB, lenB, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_insert( h_MB, h_MA:fMatrix; htB, lenB, iRow:UIntSize; h_X:fVector );
|
|
Description | MBi,j = MAi,j, i=0,...,iRow-1, j=0,...,len-1
MBiRow,j = Xj, j=0,...,lenB-1
MBi,j = MAi-1,j, i=iRow,...,htB-1, j=0,...,lenB-1
The parameters htB and lenB refer to the output matrix |
|
|
MF_Row_mulC
| MD_Row_mulC |
ME_Row_mulC |
MCF_Row_mulC |
MCD_Row_mulC |
MCE_Row_mulC |
|
Function | multiply all elements of one row by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_mulC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_mulC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_mulC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_mulC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_mulC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_mulC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_mulC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_mulC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_mulC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i *= C, i=0,...,len-1 |
|
|
MF_Row_mulV
| MD_Row_mulV |
ME_Row_mulV |
MCF_Row_mulV |
MCD_Row_mulV |
MCE_Row_mulV |
|
Function | element-wise multiplication of one row and a vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_mulV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_mulV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_mulV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_mulV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_mulV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_mulV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_mulV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i *= Xi, i=0,...,len-1 |
|
|
MF_Row_neg
| MD_Row_neg |
ME_Row_neg |
MCF_Row_neg |
MCD_Row_neg |
MCE_Row_neg |
|
Function | multiply all elements of one row by -1 |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_neg( fMatrix MA, ui ht, ui len, ui iRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_neg( const ui iRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_neg( MA:fMatrix; ht, len, iRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_neg( fMatrix d_MA, ui ht, ui len, ui iRow );
void MFcu_Row_neg( fMatrix h_MA, ui ht, ui len, ui iRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_neg( d_MA:fMatrix; ht, len, iRow:UIntSize ): IntBool;
procedure MFcu_Row_neg( h_MA:fMatrix; ht, len, iRow:UIntSize );
|
|
Description | MAiRow,i *= -1, i=0,...,len-1 |
|
|
MF_Row_subC
| MD_Row_subC |
ME_Row_subC |
MCF_Row_subC |
MCD_Row_subC |
MCE_Row_subC |
|
Function | subtract a constant from all elements of one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_subC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_subC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_subC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_subC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_subC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_subC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_subC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_subC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_subC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i -= C, i=0,...,len-1 |
|
|
MF_Row_subrC
| MD_Row_subrC |
ME_Row_subrC |
MCF_Row_subrC |
MCD_Row_subrC |
MCE_Row_subrC |
|
Function | reverse subtraction: a constant minus one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_subrC( fMatrix MA, ui ht, ui len, ui iRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_subrC( const ui iRow, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_subrC( MA:fMatrix; ht, len, iRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_subrC( fMatrix d_MA, ui ht, ui len, ui iRow, float C );
int cusdMF_Row_subrC( fMatrix d_MA, ui ht, ui len, ui iRow, float *d_C );
void MFcu_Row_subrC( fMatrix h_MA, ui ht, ui len, ui iRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_subrC( d_MA:fMatrix; ht, len, iRow:UIntSize; C:Single ): IntBool;
function cusdMF_Row_subrC( d_MA:fMatrix; ht, len, iRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Row_subrC( h_MA:fMatrix; ht, len, iRow:UIntSize; C:Single );
|
|
Description | MAiRow,i = C - MAiRow,i, i=0,...,len-1 |
|
|
MF_Row_subrV
| MD_Row_subrV |
ME_Row_subrV |
MCF_Row_subrV |
MCD_Row_subrV |
MCE_Row_subrV |
|
Function | element-wise reverse subtraction: subtract one row from a vector, storing the result back into the row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_subrV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_subrV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_subrV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_subrV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_subrV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_subrV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_subrV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i = Xi - MAiRow,i, i=0,...,len-1 |
|
|
MF_Row_subV
| MD_Row_subV |
ME_Row_subV |
MCF_Row_subV |
MCD_Row_subV |
MCE_Row_subV |
|
Function | element-wise subtraction of a vector from one row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Row_subV( fMatrix MA, ui ht, ui len, ui iRow, fVector X ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Row_subrV( const ui iRow, const vector<T>& X); |
Pascal/Delphi | uses MFstd;
procedure MF_Row_subV( MA:fMatrix; ht, len, iRow:UIntSize; X:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Row_subV( fMatrix d_MA, ui ht, ui len, ui iRow, fVector d_X );
void MFcu_Row_subV( fMatrix h_MA, ui ht, ui len, ui iRow, fVector h_X ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Row_subV( d_MA:fMatrix; ht, len, iRow:UIntSize; d_X:fVector ): IntBool;
procedure MFcu_Row_subV( h_MA:fMatrix; ht, len, iRow:UIntSize; h_X:fVector );
|
|
Description | MAiRow,i -= Xi, i=0,...,len-1 |
|
|
MF_Rows_absmax
| MD_Rows_absmax |
ME_Rows_absmax |
MCF_Rows_absmax |
MCD_Rows_absmax |
MCE_Rows_absmax |
|
Function | store the absolute maxima of all individual rows in a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_absmax( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Rows_absmax( const matrix<T>& MA );
void vector<T>::Rows_absmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_absmax( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_absmax( fVector d_Y, fMatrix d_MA, ui ht, ui len );
int cudaMCF_Rows_absmax( fVector d_Y, cfMatrix d_MA, ui ht, ui len )
void MFcu_Rows_absmax( fVector h_Y, fMatrix h_MA, ui ht, ui len );
void MCFcu_Rows_absmax( fVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_absmax( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMCF_Rows_absmax( d_Y:fVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_absmax( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
procedure MCFcu_Rows_absmax( h_Y:fVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum absolute value of each row i is stored as the element Yi for i=0,...,ht-1 |
|
|
MCF_Rows_absmaxReIm
| MCD_Rows_absmaxReIm |
MCE_Rows_absmaxReIm |
|
Function | Separate determination of the largest absolute values of the real and imaginary parts of each row |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Rows_absmaxReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Rows_absmaxReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Rows_absmaxReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_absmaxReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_absmaxReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_absmaxReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_absmaxReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum absolute values of the real and imaginary parts of each row i are combined into the element Yi for i=0,..,ht-1 |
|
|
MF_Rows_absmin
| MD_Rows_absmin |
ME_Rows_absmin |
MCF_Rows_absmin |
MCD_Rows_absmin |
MCE_Rows_absmin |
|
Function | store the absolute minima of all individual rows in a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_absmin( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Rows_absmin( const matrix<T>& MA );
void vector<T>::Rows_absmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_absmin( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_absmin( fVector d_Y, fMatrix d_MA, ui ht, ui len );
int cudaMCF_Rows_absmin( fVector d_Y, cfMatrix d_MA, ui ht, ui len )
void MFcu_Rows_absmin( fVector h_Y, fMatrix h_MA, ui ht, ui len );
void MCFcu_Rows_absmin( fVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_absmin( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMCF_Rows_absmin( d_Y:fVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_absmin( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
procedure MCFcu_Rows_absmin( h_Y:fVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The minimum absolute value of each row i is stored as the element Yi for i=0,...,ht-1 |
|
|
MCF_Rows_absminReIm
| MCD_Rows_absminReIm |
MCE_Rows_absminReIm |
|
Function | Separate determination of the largest absolute values of the real and imaginary parts of each row |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Rows_absminReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Rows_absminReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Rows_absminReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_absminReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_absminReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_absminReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_absminReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum absolute values of the real and imaginary parts of each row i are combined into the element Yi for i=0,..,ht-1 |
|
|
MF_Rows_add
| MD_Rows_add |
ME_Rows_add |
MCF_Rows_add |
MCD_Rows_add |
MCE_Rows_add |
|
Function | make one row the sum of itself and another row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_add( fMatrix MA, ui ht, ui len, unsigned destRow, unsigned sourceRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_add( const unsigned destRow, const unsigned sourceRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_add( MA:fMatrix; ht, len, destRow, sourceRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_add( fMatrix d_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow );
void MFcu_Rows_add( fMatrix h_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_add( d_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize ): IntBool;
procedure MFcu_Rows_add( h_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize );
|
|
Description | MAdestRow, j += MAsourceRow, j, i=0,...,len-1 |
|
|
MCF_Rows_cabsmax
| MCD_Rows_cabsmax |
MCE_Rows_cabsmax |
|
Function | Find the complex numbers of largest magnitude along rows and store them in a column vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Rows_cabsmax( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Rows_cabsmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Rows_cabsmax( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_cabsmax( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_cabsmax( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_cabsmax( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_cabsmax( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each row i of MA, the complex number of largest magnitude, sqrt(Re2+Im2), is found and stored as the element Yi for i=0,..,ht-1 |
|
|
MCF_Rows_cabsmin
| MCD_Rows_cabsmin |
MCE_Rows_cabsmin |
|
Function | Find the complex numbers of smallest magnitude along rows and store them in a column vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Rows_cabsmin( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Rows_cabsmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Rows_cabsmin( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_cabsmin( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_cabsmin( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_cabsmin( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_cabsmin( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each row i of MA, the complex number of smallest magnitude, sqrt(Re2+Im2), is found and stored as the element Yi for i=0,..,ht-1 |
|
|
MF_Rows_Cadd
| MD_Rows_Cadd |
ME_Rows_Cadd |
MCF_Rows_Cadd |
MCD_Rows_Cadd |
MCE_Rows_Cadd |
|
Function | make one row the sum of itself and another row, scaled by a constant |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_Cadd( fMatrix MA, ui ht, ui len, unsigned destRow, unsigned sourceRow, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_Cadd( const unsigned destRow, const unsigned sourceRow, const T& C ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_Cadd( MA:fMatrix; ht, len, destRow, sourceRow:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_Cadd( fMatrix d_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow, float C );
int cusdMF_Rows_Cadd( fMatrix d_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow, float *d_C );
void MFcu_Rows_Cadd( fMatrix h_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_Cadd( d_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize; C:Single ): IntBool;
function cusdMF_Rows_Cadd( d_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize; d_C:PSingle ): IntBool;
procedure MFcu_Rows_Cadd( h_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize; C:Single );
|
|
Description | MAdestRow, j += C * MAsourceRow, j, i=0,...,len-1 |
|
|
MF_Rows_distribution | MD_Rows_distribution | ME_Rows_distribution |
MI_Rows_distribution | MBI_Rows_distribution | MSI_Rows_distribution | MLI_Rows_distribution | MQI_Rows_distribution |
MU_Rows_distribution | MUB_Rows_distribution | MUS_Rows_distribution | MUL_Rows_distribution | MUQ_Rows_distribution |
|
Function | Histogram or Distribution function along rows |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_distribution( uiMatrix MAbund, fVector Limits, ui nbins, fMatrix MA, ui ht, ui len, int mode ); |
C++ VecObj | #include <OptiVec.h>
void matrix<ui>::Rows_distribution( const vector<T>& Limits, const matrix<T>& MA, int mode=0 ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_distribution( MAbund:uiMatrix; Limits:fVector; nbins:UIntSize; MA:fMatrix; ht, len:UIntSize; mode:Integer ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_distribution( uiMatrix d_MAbund, fVector d_Limits, ui nbins, fMatrix d_MA, ui ht, ui len, int mode );
void MFcu_Rows_distribution( uiMatrix h_MAbund, fVector h_Limits, ui nbins, fMatrix h_MA, ui ht, ui len, int mode ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_distribution( d_MAbund:uiMatrix; d_Limits:fVector; nbins:UIntSize; d_MA:fMatrix; ht, len:UIntSize; mode:Integer ): IntBool;
procedure MFcu_Rows_distribution( h_MAbund:uiMatrix; h_Limits:fVector; nbins:UIntSize; h_MA:fMatrix; ht, len:UIntSize; mode:Integer );
|
|
Description | For each row of MA, this function counts the number of elements falling into each of the intervals defined by Limits. The abundances thus determined are stored in the corresponding columns of MAbund.
nbins is the number of elements of Limits, i.e. the number of intervals. The size of MAbund is ht*nbins.
Limits must be in ascending order. The spacing between the elements of Limits need not necessarily be constant.
The parameter mode specifies how to interpret the values given in Limits.
mode > 0: Limits contains the upper limits of the intervals
mode < 0: Limits contains the lower limits of the intervals
mode = 0: Limits contains the mid-points of the intervals. An element of MA belongs to the Limits value closest to it. In case of exactly equal distances, the interval with the lower index is chosen.
The interval defined by Limits0 extends down to -HUGE_VAL, the interval defined by Limitsnbins-1 reaches up to +HUGE_VAL.
In contrast to VF_distribution, elements outside the intervals are not taken into account; their number is not returned.
This function may be used for batch processing of several vectors of equal size. To this end, the vectors have to be copied into the rows of a matrix.
At present, these functions are available only in the 64-bit libraries.
|
|
|
|
|
MF_Rows_exchange
| MD_Rows_exchange |
ME_Rows_exchange |
MCF_Rows_exchange |
MCD_Rows_exchange |
MCE_Rows_exchange |
MI_Rows_exchange | MBI_Rows_exchange | MSI_Rows_exchange | MLI_Rows_exchange | MQI_Rows_exchange |
MU_Rows_exchange | MUB_Rows_exchange | MUS_Rows_exchange | MUL_Rows_exchange | MUQ_Rows_exchange |
|
Function | exchange two rows |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_exchange( fMatrix MA, ui ht, ui len, unsigned i1, unsigned i2 ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_exchange( const unsigned i1, const unsigned i2 ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_exchange( MA:fMatrix; ht, len, i1, i2:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_exchange( fMatrix d_MA, ui ht, ui len, unsigned i1, unsigned i2 );
void MFcu_Rows_exchange( fMatrix MA, ui ht, ui len, unsigned i1, unsigned i2 ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_exchange( d_MA:fMatrix; ht, len, i1, i2:UIntSize ): IntBool;
procedure MFcu_Rows_exchange( h_MA:fMatrix; ht, len, i1, i2:UIntSize );
|
|
Description | The elements of the rows i1 and i2 are exchanged. |
|
|
MF_Rows_FFT |
MD_Rows_FFT |
ME_Rows_FFT |
MFb_Rows_FFT |
MDb_Rows_FFT |
MEb_Rows_FFT |
MF_Rows_FFTtoC
| MD_Rows_FFTtoC |
ME_Rows_FFTtoC |
MFb_Rows_FFTtoC
| MDb_Rows_FFTtoC |
MEb_Rows_FFTtoC |
MCF_Rows_FFT |
MCD_Rows_FFT |
MCE_Rows_FFT |
MCFb_Rows_FFT |
MCDb_Rows_FFT |
MCEb_Rows_FFT |
|
Function | Fast Fourier Transform along the rows |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_FFT( fMatrix Y, fMatrix X, ui ht, ui len, int dir );
void MCF_Rows_FFT( cfMatrix Y, cfMatrix X, ui ht, ui len, int dir );
void MF_Rows_FFTtoC( cfMatrix Y, fMatrix X, ui ht, ui len );
void MFb_Rows_FFT( fMatrix Y, fMatrix X, ui ht, ui len, int dir, fVector Buf );
void MCFb_Rows_FFT( cfMatrix Y, cfMatrix X, ui ht, ui len, int dir, cfVector Buf );
void MFb_Rows_FFTtoC( cfMatrix Y, fMatrix X, ui ht, ui len, cfVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_FFT( const matrix<T>& MX, int dir );
void matrix<complex<T> >::FFT( const matrix<complex<T> >& MX, int dir );
void matrix<complex<T> >::FFTtoC( const matrix<T>& MX );
void matrix<T>::b_Rows_FFT( const matrix<T>& MX, int dir, vector<T>& Buf );
void matrix<complex<T> >::b_Rows_FFT( const matrix<complex<T> > MX, int dir, vector<complex<T> >&Buf );
void matrix<complex<T> >::b_Rows_FFTtoC( const matrix<T> MX, vector<complex<T>>& Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCF_Rows_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MF_Rows_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize );
procedure MFb_Rows_FFT( MY, MX:fMatrix; ht, len:UIntSize; dir:Integer; Buf:fVector );
procedure MCFb_Rows_FFT( MY, MX:cfMatrix; ht, len:UIntSize; dir:Integer; Buf:cfVector );
procedure MFb_Rows_FFTtoC( MY:cfMatrix; MX:fMatrix; ht, len:UIntSize; Buf:cfVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
#include <cudaMCFstd.h>
int cudaMF_Rows_FFT( fMatrix d_Y, fMatrix d_X, ui ht, ui len, int dir );
int cuda MCF_Rows_FFT( cfMatrix d_Y, cfMatrix d_X, ui ht, ui len, int dir );
int cudaMF_Rows_FFTtoC( cfMatrix d_Y, fMatrix d_X, ui ht, ui len );
void MFcu_Rows_FFT( fMatrix h_Y, fMatrix h_X, ui ht, ui len, int dir );
void MCFcu_Rows_FFT( cfMatrix h_Y, cfMatrix h_X, ui ht, ui len, int dir );
void MFcu_Rows_FFTtoC( cfMatrix h_Y, fMatrix h_X, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd, MCFstd;
function cudaMF_Rows_FFT( d_MY, d_MX:fMatrix; ht, len:UIntSize; dir:Integer ): IntBool;
function cudaMCF_Rows_FFT( d_MY, d_MX:cfMatrix; ht, len:UIntSize; dir:Integer ): IntBool;
function cudaMF_Rows_FFTtoC( d_MY:cfMatrix; d_MX:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_FFT( h_MY, h_MX:fMatrix; ht, len:UIntSize; dir:Integer );
procedure MCFcu_Rows_FFT( h_MY, h_MX:cfMatrix; ht, len:UIntSize; dir:Integer );
procedure MFcu_Rows_FFTtoC( h_MY:cfMatrix; h_MX:fMatrix; ht, len:UIntSize );
|
|
Description | The one-dimensional Fourier transform of all rows of MX is calculated and stored in the corresponding rows of MY. The forward transform is obtained by setting dir = 1, the inverse (or backward) transform by setting dir = -1. By convention, the inverse transform involves scaling the result by the factor 1.0/len (so as to ensure that the result of one forward and one backward transform yields – within round-off error – the original matrix). Since it is sometimes desirable to skip this implicit scaling, MF_Rows_FFT offers the possibility to do so: specify dir = -2 in this case.
A Fast Fourier Transform algorithm is used that requires len to be a power of 2. ht may be set arbitrarily, but the function will be most efficient if ht is a multiple of 4.
Complex version: Both MX and the output MY are complex matrices.
Real-to-complex version: The input matrix MX is real. The output matrix MY is complex. As this function can only perform a forward transform, no argument "dir" is needed.
Purely real version: For the forward transform, MX is a real matrix. The output MY is also defined as fMatrix, although it consists of complex numbers. The reason is that the symmetry properties of FFT allow to store the result in a packed format, fitting into the same memory space as the input matrix. The order of each row of MY is indicated in the following table. U means the uncompressed result, N is len.
MYi,0 | MYi,1 | MYi,2
| MYi,3 | .....
| MYi,N-2 | MYi,N-1 |
Ui,0.Re | Ui,N/2.Re | Ui,1.Re
| Ui,1.Im | .....
| Ui,N/2-1.Re | Ui,N/2-1.Im |
This storage scheme implies that, for Pascal/Delphi (where matrices are stored in column-major order), the real and imaginary parts of any element are not adjacent in memory .
For inverse real-matrix Rows_FFT, the input matrix has to be of this packed-complex format, and you get a real matrix. If you prefer to get the result of forward FFT in true complex format, use MF_Rows_FFTtoC.
MFb_Rows_FFT, MFb_Rows_FFTtoC and MCFb_Rows_FFT take a buffer vector Buf as an additional argument. They are slightly more efficient than the un-buffered versions. Buf must have (at least) the same size as X and Y (i.e., Buf.size >= ht*len).
|
|
Error handling | If len is not a power of 2, the program is aborted with the error message "Size must be an integer power of 2". |
|
|
MF_Rows_lincomb
| MD_Rows_lincomb |
ME_Rows_lincomb |
MCF_Rows_lincomb |
MCD_Rows_lincomb |
MCE_Rows_lincomb |
|
Function | linear combination of two rows |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_lincomb( fMatrix MA, ui ht, ui len, unsigned destRow, float destC, unsigned srceRow, float srceC ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_lincomb( const unsigned destRow, const T& destC, const unsigned sourceRow, const T& srceC ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_lincomb( MA:fMatrix; ht, len:UIntSize; destRow:UIntSize; destC:Single;
srceRow:UIntSize; srceC:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_lincomb( fMatrix d_MA, ui ht, ui len, unsigned destRow, float destC, unsigned srceRow, float srceC );
int cusdMF_Rows_lincomb( fMatrix d_MA, ui ht, ui len, unsigned destRow, float
d_destC, unsigned srceRow, float *d_srceC );
void MFcu_Rows_lincomb( fMatrix h_MA, ui ht, ui len, unsigned destRow, float destC, unsigned srceRow, float srceC );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_lincomb( d_MA:fMatrix; ht, len:UIntSize; destRow:UIntSize; destC:Single; srceRow:UIntSize; srceC:Single ): IntBool;
function cusdMF_Rows_lincomb( d_MA:fMatrix; ht, len:UIntSize; destRow:UIntSize; d_destC:PSingle; srceRow:UIntSize; d_srceC:PSingle ): IntBool;
procedure MFcu_Rows_lincomb( h_MA:fMatrix; ht, len:UIntSize; destRow:UIntSize; destC:Single; srceRow:UIntSize; srceC:Single );
|
|
Description | MAdestRow, j = destC * MAdestRow, j+ srceC * MAsrceRow, j, j=0,...,len-1 |
|
|
MF_Rows_max
| MD_Rows_max |
ME_Rows_max |
MI_Rows_max | MBI_Rows_max | MSI_Rows_max | MLI_Rows_max | MQI_Rows_max |
MU_Rows_max | MUB_Rows_max | MUS_Rows_max | MUL_Rows_max | MUQ_Rows_max |
|
Function | store the maxima of all individual rows in a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_max( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Rows_max( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_max( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_max( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_max( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_max( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_max( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | The maximum value of each row i is stored as the element Yi for i=0,...,ht-1 |
|
|
MCF_Rows_maxReIm
| MCD_Rows_maxReIm |
MCE_Rows_maxReIm |
|
Function | Separate determination of the largest values of the real and imaginary parts of each row |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Rows_maxReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Rows_maxReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Rows_maxReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_maxReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_maxReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_maxReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_maxReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The maximum values of the real and imaginary parts of each row i are combined into the element Yi for i=0,..,ht-1 |
|
|
MF_Rows_min
| MD_Rows_min |
ME_Rows_min |
MI_Rows_min | MBI_Rows_min | MSI_Rows_min | MLI_Rows_min | MQI_Rows_min |
MU_Rows_min | MUB_Rows_min | MUS_Rows_min | MUL_Rows_min | MUQ_Rows_min |
|
Function | store the minima of all individual rows in a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_min( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Rows_min( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_min( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_min( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_min( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_min( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_min( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | The smallest or most negative element of each row i is stored as the element Yi for i=0,...,ht-1 |
|
|
MCF_Rows_minReIm
| MCD_Rows_minReIm |
MCE_Rows_minReIm |
|
Function | Separate determination of the smallest values of the real and imaginary parts of each row |
|
Syntax C/C++ | #include <MFstd.h>
void MCF_Rows_minReIm( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> >::Rows_minReIm( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_Rows_minReIm( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_minReIm( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_minReIm( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_minReIm( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_minReIm( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | The minimum values of the real and imaginary parts of each row i are combined into the element Yi for i=0,..,ht-1 |
|
|
MF_Rows_prod
| MD_Rows_prod |
ME_Rows_prod |
MCF_Rows_prod |
MCD_Rows_prod |
MCE_Rows_prod |
|
Function | products over all elements of each individual row, stored in a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_prod(fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Rows_prod( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_prod(Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_prod( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_prod( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_prod( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_prod( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | Yi = prod( MAi,j, j=0,...,len-1), i=0,...,ht-1 |
|
|
MF_Rows_reflect
| MD_Rows_reflect |
ME_Rows_reflect |
MCF_Rows_reflect |
MCD_Rows_reflect |
MCE_Rows_reflect |
MI_Rows_reflect | MBI_Rows_reflect | MSI_Rows_reflect | MLI_Rows_reflect | MQI_Rows_reflect |
MU_Rows_reflect | MUB_Rows_reflect | MUS_Rows_reflect | MUL_Rows_reflect | MUQ_Rows_reflect |
|
Function | Derive the second halves of all rows from their first halves by reflection at the vertical line through the center of the matrix. |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_reflect( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_reflect( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_reflect( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_reflect( fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_reflect( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_reflect( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_reflect( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi, len-j-1 = MAi, j, i=0,...,ht-1; j=0,...,(len-1)/2; |
|
|
MF_Rows_rev
| MD_Rows_rev |
ME_Rows_rev |
MCF_Rows_rev |
MCD_Rows_rev |
MCE_Rows_rev |
MI_Rows_rev | MBI_Rows_rev | MSI_Rows_rev | MLI_Rows_rev | MQI_Rows_rev |
MU_Rows_rev | MUB_Rows_rev | MUS_Rows_rev | MUL_Rows_rev | MUQ_Rows_rev |
|
Function | Reverse the element ordering along rows. This corresponds to a relection of the matrix at the X axis. |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_rev( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_rev( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_rev( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_rev( fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_rev( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_rev( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_rev( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi, j = MAi, len-j-1 |
|
|
MF_Rows_rotate
| MD_Rows_rotate |
ME_Rows_rotate |
MCF_Rows_rotate |
MCD_Rows_rotate |
MCE_Rows_rotate |
MI_Rows_rotate | MBI_Rows_rotate | MSI_Rows_rotate | MLI_Rows_rotate | MQI_Rows_rotate |
MU_Rows_rotate | MUB_Rows_rotate | MUS_Rows_rotate | MUL_Rows_rotate | MUQ_Rows_rotate |
|
Function | rotate all rows by a specified number of positions; thereby, whole columns are moved |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_rotate( fMatrix MA, ui ht, ui len, int pos ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_rotate( const int pos ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_rotate( MA:fMatrix; ht, len:UIntSize; pos:Integer ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_rotate( fMatrix d_MA, ui ht, ui len, int pos );
void MFcu_Rows_rotate( fMatrix h_MA, ui ht, ui len, int pos );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_rotate( d_MA:fMatrix; ht, len:UIntSize; pos:Integer ): IntBool;
procedure MFcu_Rows_rotate( h_MA:fMatrix; ht, len:UIntSize; pos:Integer );
|
|
Description | MAi,j = MAi, len-pos+j, j=0,..,pos-1
MAi,j = MAi, j-pos, j=pos,...,len-1
MAi,j = MAi-pos, j, i=pos,...,ht-1
This function is rather inefficient, as it needs to internally allocate and de-allocate work-space each time it is called. If your application contains frequent calls to this function, we recommend to allocate some matrix MBuf as buffer memory and replace the calls to MF_Rows_rotate by calls to MF_Rows_rotate_buf. |
|
|
MF_Rows_rotate_buf
| MD_Rows_rotate_buf |
ME_Rows_rotate_buf |
MCF_Rows_rotate_buf |
MCD_Rows_rotate_buf |
MCE_Rows_rotate_buf |
MI_Rows_rotate_buf | MBI_Rows_rotate_buf | MSI_Rows_rotate_buf | MLI_Rows_rotate_buf | MQI_Rows_rotate_buf |
MU_Rows_rotate_buf | MUB_Rows_rotate_buf | MUS_Rows_rotate_buf | MUL_Rows_rotate_buf | MUQ_Rows_rotate_buf |
|
Function | efficient row rotation (moving of whole rows), using specified buffer memory |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_rotate_buf( fMatrix MA, ui ht, ui len, int pos, fMatrix MBuf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_rotate_buf( const int pos, const matrix<T> MBuf ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_rotate_buf( MA:fMatrix; ht, len:UIntSize; pos:Integer; MBuf:fMatrix ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_rotate_buf( fMatrix d_MA, ui ht, ui len, int pos, fMatrix d_MBuf );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_rotate_buf( d_MA:fMatrix; ht, len:UIntSize; pos:Integer; d_MBuf:fMatrix ): IntBool;
|
|
Description | MAi,j = MAi, len-pos+j, j=0,..,pos-1
MAi,j = MAi, j-pos, j=pos,...,len-1
MAi,j = MAi-pos, j, i=pos,...,ht-1
This function is a more efficient variant of MF_Rows_rotate. Instead of internally allocating the necessary work-space, it takes the matrix MBuf as buffer memory. MBuf must be a matrix generated by the OptiVec memory management functions (MF_matrix etc.). The size (i.e., the number of elements, ht*len) of MBuf must be at least the same size as MA. |
|
|
MF_Rows_runprod
| MD_Rows_runprod |
ME_Rows_runprod |
MCF_Rows_runprod |
MCD_Rows_runprod |
MCE_Rows_runprod |
|
Function | running product over row elements |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_runprod( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_runprod( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_runprod( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_runprod( fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_runprod( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_runprod( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_runprod( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | For all rows separately, each element is the product of itself and all preceding elements. This function should be used with care: overflow is easily reached, and underflow may lead to all elements from a certain position on being zero. |
|
|
MF_Rows_runsum
| MD_Rows_runsum |
ME_Rows_runsum |
MCF_Rows_runsum |
MCD_Rows_runsum |
MCE_Rows_runsum |
|
Function | running sum over row elements |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_runsum( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_runsum( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_runsum( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_runsum( fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_runsum( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_runsum( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_runsum( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | For all rows separately, each element is the sum of itself and all preceding elements. |
|
|
MCF_Rows_sabsmax
| MCD_Rows_sabsmax |
MCE_Rows_sabsmax |
|
Function | Find the complex numbers of largest sum |Re| + |Im| along rows and store them in a column vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Rows_sabsmax( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Rows_sabsmax( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Rows_sabsmax( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_sabsmax( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_sabsmax( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_sabsmax( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_sabsmax( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each row i of MA, the complex number with the largest sum, |Re| + |Im|, is found and stored as the element Yi for i=0,..,ht-1 |
|
|
MCF_Rows_sabsmin
| MCD_Rows_sabsmin |
MCE_Rows_sabsmin |
|
Function | Find the complex numbers of largest sum |Re| + |Im| along rows and store them in a column vector |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_Rows_sabsmin( cfVector Y, cfMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<complex<T> T>::Rows_sabsmin( const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MCFstd;
procedure MCF_Rows_sabsmin( Y:cfVector; MA:cfMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_Rows_sabsmin( cfVector d_Y, cfMatrix d_MA, ui ht, ui len );
void MCFcu_Rows_sabsmin( cfVector h_Y, cfMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_Rows_sabsmin( d_Y:cfVector; d_MA:cfMatrix; ht, len:UIntSize ): IntBool;
procedure MCFcu_Rows_sabsmin( h_Y:cfVector; h_MA:cfMatrix; ht, len:UIntSize );
|
|
Description | Within each row i of MA, the complex number with the largest sum, |Re| + |Im|, is found and stored as the element Yi for i=0,..,ht-1 |
|
|
MF_Rows_sub
| MD_Rows_sub |
ME_Rows_sub |
MCF_Rows_sub |
MCD_Rows_sub |
MCE_Rows_sub |
|
Function | make one row the difference of itself and another row |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_sub( fMatrix MA, ui ht, ui len, unsigned destRow, unsigned sourceRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Rows_sub( const unsigned destRow, const unsigned sourceRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_sub( MA:fMatrix; ht, len, destRow, sourceRow:UIntSize; ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_sub( fMatrix d_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow );
void MFcu_Rows_sub( fMatrix h_MA, ui ht, ui len, unsigned destRow, unsigned sourceRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_sub( d_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize ): IntBool;
procedure MFcu_Rows_sub( h_MA:fMatrix; ht, len, destRow, sourceRow:UIntSize );
|
|
Description | MAdestRow, j -= MAsourceRow, j, i=0,...,len-1 |
|
|
MF_Rows_sum
| MD_Rows_sum |
ME_Rows_sum |
MCF_Rows_sum |
MCD_Rows_sum |
MCE_Rows_sum |
|
Function | sums over all elements of each individual row, stored in a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Rows_sum( fVector Y, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::Rows_sum( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Rows_sum( Y:fVector; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Rows_sum( fVector d_Y, fMatrix d_MA, ui ht, ui len );
void MFcu_Rows_sum( fVector h_Y, fMatrix h_MA, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Rows_sum( d_Y:fVector; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Rows_sum( h_Y:fVector; h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | Yi = sum( MAi,j, j=0,...,len-1), i=0,...,ht-1 |
|
|
MF_safeSolve
| MD_safeSolve |
ME_safeSolve |
MFb_safeSolve
| MDb_safeSolve |
MEb_safeSolve |
MFb_safeSolve_sizeBuf
| MDb_safeSolve_sizeBuf |
MEb_safeSolve_sizeBuf |
|
Function | solve a linear system MA * X = B; in case the system is singular, get one solution out of the infinite solution space |
|
Syntax C/C++ | #include <MFstd.h>
int MF_safeSolve( fVector X, fMatrix MA, fVector B, ui len );
int MF_safeSolvewEdit( fVector X, fMatrix MA, fVector B, ui len, float thresh );
int MFb_safeSolve( fVector X, fMatrix MA, fVector B, ui len, fVector Buf );
int MFb_safeSolvewEdit( fVector X, fMatrix MA, fVector B, ui len, float thresh, fVector Buf );
ui MFb_safeSolve_sizeBuf( ui len ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::safeSolve( const matrix<T>& MA, const vector<T>& B );
void vector<T>::safeSolvewEdit( const matrix<T>& MA, const vector<T>& B, T thresh ); |
Pascal/Delphi | uses MFstd;
function MF_safeSolve( X:fVector; MA:fMatrix; B:fVector; len:UIntSize ):Integer;
function MF_safeSolvewEdit( X:fVector; MA:fMatrix; B:fVector; len:UIntSize; thresh:Single ):Integer;
function MFb_safeSolve( X:fVector; MA:fMatrix; B:fVector; len:UIntSize; Buf:fVector ):Integer;
function MFb_safeSolvewEdit( X:fVector; MA:fMatrix; B:fVector; len:UIntSize; thresh:Single; Buf:fVector ):Integer;
function MFb_safeSolve_sizeBuf( len:UIntSize ):UIntSize; |
|
Description | MF_safeSolve is similar to MF_solve with the difference that, in case there is no unique solution of the linear system (i.e., LU decomposition fails), singular value decomposition is employed to obtain at least one solution out of the infinite solution space. Recall that the problem with singular linear systems is not that they don't have a solution, but rather that they are under-determined and have infinitely many solutions. In other words, one or more elements of the solution vector can be chosen arbitrarily. This is what MF_safeSolve does, with the additional constraint that the "smallest" solution vector in the least-squares sense is determined.
A return value of 0 indicates success via LUD, 1 signals success via SVD, and -1 is returned in the very rare case that even SVD fails.
The default threshold for the decision between LUD and SVD, as well as for the singular-value editing in the SVD branch may be changed by calling MF_SVDsetEdit. As MF_SVDsetEdit is not thread-safe, this function should not be used to set different editing thresholds for different calls to MF_safeSolve etc. Rather than repeatedly changing the default value, use the "wEdit" variant of MF_safeSolve etc., namely MF_safeSolvewEdit, MF_SVsolvewEdit and MF_solveBySVDwEdit.
These functions need buffer memory. The "normal" versions (prefixes MF_, MD_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MDb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_safeSolve_sizeBuf(len) etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes).
|
|
|
|
Function | Calculate a color scale for color density plots |
|
Syntax C/C++ | #include <Mgraph.h>
void M_setDensityBounds( extended zmin, extended zmax, COLORREF mincolor, COLORREF maxcolor ); |
Pascal/Delphi | uses Mgraph;
procedure M_setDensityBounds( zmin, zmax: Extended; mincolor, maxcolor: COLORREF ); |
|
Description | A color scale is calculated between the colors mincolor and maxcolor, corresponding to zmin and zmax. In any following MF_xyzDataDensityMap or MF_zDataDensityMap plot, the z values will be translated into colors by interpolation between the extreme values set by M_setDensityBounds. You will rarely call this function directly. It is internally called by all functions of the MF_xyzAutoDensityMap and MF_zAutoDensityMap families. |
|
|
|
Function | Set a color scale and draw an X-Y coordinate system for matrix color-density plots |
|
Syntax C/C++ | #include <Mgraph.h>
void M_setDensityMapBounds( extended xmin, extended xmax, extended ymin, extended ymax, extended zmin, extended zmax, COLORREF mincolor, COLORREF maxcolor ); |
Pascal/Delphi | uses Mgraph;
procedure M_setDensityMapBounds( xmin, xmax, ymin, ymax, zmin, zmax: Extended; mincolor, maxcolor: COLORREF ); |
|
Description | Similarly to the function V_drawAxes for X-Y vector plots, this function calculates a color scale from the parameters mincolor, maxcolor, zmin and zmax, and prepares an X-Y coordinate system with the x and y ranges specified by xmin, xmax, ymin, and ymax for color-density plots of matrices. Unlike M_findDensityMapBounds, no adjustment of the x and y ranges is made.
The user will rarely call this function himself. It is internally called by all functions of the MF_xyzAutoDensityMap and MF_zAutoDensityMap families. |
|
|
MF_setElement
| MD_setElement |
ME_setElement |
MCF_setElement |
MCD_setElement |
MCE_setElement |
MI_setElement | MBI_setElement | MSI_setElement | MLI_setElement | MQI_setElement |
MU_setElement | MUB_setElement | MUS_setElement | MUL_setElement | MUQ_setElement |
|
Function | Write access to a matrix element |
|
Syntax C/C++ | #include <MFstd.h>
void MF_setElement( fMatrix MA, ui ht, ui len, unsigned m, unsigned n, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::setElement( const unsigned m, const unsigned n, const T C ); |
Pascal/Delphi | uses MFstd;
procedure MF_setElement( MA:fMatrix; ht, len, m, n:UIntSize; C:Single );
|
|
CUDA function C/C++ | #include <cudaMFstd.h>
void cudaMF_setElement( fMatrix d_MA, ui ht, ui len, unsigned m, unsigned n, float C );
void cusdMF_setElement( fMatrix d_MA, ui ht, ui len, unsigned m, unsigned n, float *d_C );
|
CUDA function Pascal/Delphi | uses MFstd;
procedure cudaMF_setElement( d_MA:fMatrix; ht, len, m, n:UIntSize; C:Single );
procedure cusdMF_setElement( d_MA:fMatrix; ht, len, m, n:UIntSize; d_C:PSingle );
|
|
Description | The element MAm,n is overwritten with the value C.
|
|
|
|
VF_setLinfitNeglect
| VD_setLinfitNeglect |
VE_setLinfitNeglect |
|
Function | define significance threshold for data fitting to linear models |
|
Syntax C/C++ | #include <MFstd.h>
void VF_setLinfitNeglect( float Thresh ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::setLinfitNeglect( const T& Thresh );
void matrix<T>::setLinfitNeglect( const T& Thresh ); |
Pascal/Delphi | uses MFstd;
procedure VF_setLinfitNeglect( Thresh:Single ); |
|
Description | As described in connection with VF_linfit, this function allows to define a significance threshold below which fit parameters ai are neglected. The default of this threshold is 4*FLT_EPSILON, 8*DLB_EPSILON, or 16*LDBL_EPSILON. The current threshold can be retrieved by VF_getLinfitNeglect. |
|
|
VF_setNonlinfitOptions
| VD_setNonlinfitOptions |
VE_setNonlinfitOptions |
VF_setNonlinfitDefaultOptions
| VD_setNonlinfitDefaultOptions |
VE_setNonlinfitDefaultOptions |
|
Function | set options for the nonlinear fitting routines |
|
Syntax C/C++ | #include <MFstd.h>
void VF_setNonlinfitOptions( VF_NONLINFITOPTIONS *Options );
void VF_setNonlinfitDefaultOptions( void ); |
Pascal/Delphi | uses MFstd;
procedure VF_setNonlinfitOptions( Options: VF_NONLINFITOPTIONS );
procedure VF_setNonlinfitDefaultOptions( ); |
|
Description | The nonlinear fitting routines like VF_nonlinfit offer the user a lot of different options, packed into a structure VF_NONLINFITOPTIONS (VD_NONLINFITOPTIONS and VE_NONLINFITOPTIONS for the higher accuracy data-types). These options may be set by the function V_setNonlinfitOptions. To retrieve current settings, use V_getNonlinfitOptions. In order to return to "factory settings", call V_setNonlinfitDefaultOptions.
The options set with this function are valid for all fitting-functions of the same accuracy level. Thus, e.g., VD_setNonlinfitOptions sets the options governing VD_nonlinfit, VD_multiNonlinfit, MD_nonlinfit, MD_multiNonlinfit and their siblings with data-weighting ("wW" versions).
This function is not suitable for setting different fitting options for calls to the nonlinfit functions made from different execution threads. Give each nonlinfit call its own set of options instead by using the complete syntax of the nonlinfit functions. |
Example C/C++ | VD_NONLINFITOPTIONS Opt;
VD_getNonlinfitDefaultOptions( &Opt ); // start with "factory settings"
Opt.FigureOfMerit = 0; // choose least-square fitting
Opt.AbsTolChi = 1.e-6;
Opt.FracTolChi = 1.e-3; // make the fit fast, but not very accurate
Opt.LevelOfMethod = 3; // choose alternating Levenberg-Marquardt and Downhill-Simplex runs
VD_setNonlinfitOptions( &Opt ); |
Example Pascal/Delphi | Opt: VD_NONLINFITOPTIONS;
VD_getNonlinfitDefaultOptions(Opt );
Opt.FigureOfMerit := 0; (* choose least-square fitting *)
Opt.AbsTolChi := 1.e-6;
Opt.FracTolChi := 1.e-3; (* make the fit fast, but not very accurate *)
Opt.LevelOfMethod := 3; (* choose alternating Levenberg-Marquardt and Downhill-Simplex runs *)
VD_setNonlinfitOptions(Opt ); |
|
|
MF_setWriteFormat
| MD_setWriteFormat |
ME_setWriteFormat |
MCF_setWriteFormat |
MCD_setWriteFormat |
MCE_setWriteFormat |
|
Function | Definition of the format to be used by M?_write: C/C++ only! |
|
Syntax C/C++ | #include <MFstd.h>
void MF_setWriteFormat( char *FormatString ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::setWriteFormat( char *FormatString ); |
Pascal/Delphi | This function does not exist. |
|
Description | These functions are identical to the VF_setWriteFormat family.
The number format with which the M?_write functions print matrix elements into a stream can be adjusted by means of this function. When defining a write format, one should always be aware of the restrictions imposed by the read functions (not all formats you can write will be read correcly, see MF_read).
MF_setWriteFormat should not be used for the definition of whitespace between the columns. This is the task of MF_setWriteSeparate.
For details about the formats used for each of the various data types, please refer to the following table. The last column of this table gives the maximum length of the format string.
Version | Standard Format | Alternative Example | max. length |
MF_ | "% 11.8e" | "% 8.4f" | 16 |
MD_ | "% 19.16le" | "% 16.8lf" | 16 |
ME_ | "% 22.19Le" | "% 22.19LG" | 16 |
MCF_ | "% 11.8e, % 11.8e" | "{% 8.4f, % 8.4f}" | 32 |
MCD_ | "% 19.16le, % 19.16le" | "{% 19.16lE % 19.16lE}" | 32 |
MCE_ | "% 22.19Le, % 22.19Le" | "{% 22.19Lg % 22.19Lg}" | 32 |
|
|
Error handling | Format strings longer than the maximum length specified in the above table lead to a program abort with the error message "Invalid Parameter(s)".
The contents of the format string is not checked. So you have to be very careful to specify a format which is valid for the respective data type. |
|
|
MF_setWriteSeparate
| MD_setWriteSeparate |
ME_setWriteSeparate |
MCF_setWriteSeparate |
MCD_setWriteSeparate |
MCE_setWriteSeparate |
|
Function | define a character string used to separate columns in the M?_write functions |
|
Syntax C/C++ | #include <MFstd.h>
void MF_setWriteSeparate( char *SepString ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::setWriteSeparate( char *SepString ); |
Pascal/Delphi | uses MFstd;
procedure MF_setWriteSeparate( SepString:PChar ); |
|
Description | These functions are identical to the functions of the VF_setNWriteSeparate family. They are used to define the character string to be inserted between the columns of a table written by MF_write. MF_setWriteSeparate does not influence the end of each line which is always a line-feed character ('\n' for C/C++ and #13 for Pascal/Delphi).
SepString may contain up to twelve characters. The default setting is a single tab character ("\t" for C/C++ and #9 for Pascal/Delphi).
|
|
Error handling | In the case of SepString longer than twelve characters, the program is aborted with the error message "Invalid Parameter(s)".
The contents of SepString is not checked. |
|
|
MF_solve
| MD_solve |
ME_solve |
MCF_solve |
MCD_solve |
MCE_solve |
MF_solvewEdit
| MD_solvewEdit |
ME_solvewEdit |
MCF_solvewEdit |
MCD_solvewEdit |
MCE_solvewEdit |
MFb_solve
| MDb_solve |
MEb_solve |
MCFb_solve |
MCDb_solve |
MCEb_solve |
MFb_solvewEdit
| MDb_solvewEdit |
MEb_solvewEdit |
MCFb_solvewEdit |
MCDb_solvewEdit |
MCEb_solvewEdit |
MFb_solve_sizeBuf
| MDb_solve_sizeBuf |
MEb_solve_sizeBuf |
MCFb_solve_sizeBuf |
MCDb_solve_sizeBuf |
MCEb_solve_sizeBuf |
MFsym_solve
| MDsym_solve |
MEsym_solve |
|
Function | solve a linear system |
|
Syntax C/C++ | #include <MFstd.h>
int MF_solve( fVector X, fMatrix MA, fVector B, ui len );
int MF_solvewEdit( fVector X, fMatrix MA, fVector B, ui len, float thresh );
int MCF_solvewEdit( cfVector X, cfMatrix MA, cfVector B, ui len, float thresh );
int MFsym_solve( fVector X, fMatrix MA, fVector B, ui len );
|
C++ MatObj | #include <OptiVec.h>
void vector<T>::solve( const matrix<T>& MA, const vector<T>& B );
void vector<T>::solvewEdit( const matrix<T>& MA, const vector<T>& B, T thresh );
void vector<T>::sym_solve( const matrix<T>& MA, const vector<T>& B );
|
Pascal/Delphi | uses MFstd;
function MF_solve( X:fVector; MA:fMatrix; B:fVector; len:UIntSize ): Integer;
function MF_solvewEdit( X:fVector; MA:fMatrix; B:fVector; len:UIntSize; thresh:Single ): Integer;
function MCF_solvewEdit( X:cfVector; MA:cfMatrix; B:cfVector; len:UIntSize; thresh:Single ): Integer;
function MFsym_solve( X:fVector; MA:fMatrix; B:fVector; len:UIntSize ): Integer; |
|
Description | These functions solve the system MA * X = B of simultaneous linear equations. In the general case, MF_solve, LU decomposition is used. For symmetric matrices, assumed to be positive-definite, MFsym_solve provides a roughly two times faster way, employing Cholesky decomposition.
First, MF_solve is described. MFsym_solve follows at the end.
MF_solve works well in all cases where there is one unique solution. If successful, it returns FALSE (0).
If, on the other hand, the system is ill-determined, which happens in all cases where one or more of the equations are linear combinations of other equations of the same system, the resulting matrix becomes singular and the function fails with an error message.
To avoid outright failure in an application where ill-determined matrices might occur, you can define a minimum pivot for the decomposition. If you wish to do so for all calls to MF_LUdecompose and to the functions based upon it, namely MF_inv and MF_solve, you can do so by calling MF_LUDsetEdit. However, as this method is not thread-safe, you cannot use it in order to set different thresholds for different calls to the functions mentioned. Instead of defining a default editing threshold then, use their "wEdit" variants, i.e. MF_LUdecomposewEdit, MF_invwEdit or MF_solvewEdit. They take the desired threshold as the additional argument thresh. Note that thresh is always real, also in the complex versions.
The return value of MF_solve and MF_solvewEdit indicates if the linear system could successfully be solved:
Return value | Meaning |
0 | Matrix MA is regular; linear system successfully solved |
1 | Under-determined system; matrix MA is singular; result X contains no useful information |
2 | Under-determined system; matrix MA is (nearly) singular; solution was achieved only by pivot editing; it depends on the specific application, if the result is useful or not. |
To check if MF_solve was successful, in single-thread programs, you may also call MF_LUDresult, whose return value will be FALSE (0), if the system could be solved without problems (and without pivot editing), and TRUE (1) for singular MA. In multi-thread programs, on the other hand, it would not be clear wich instance of MF_solve the call to MF_LUDresult would refer to. So, here, inspection of the return value of MF_solve is the only option.
As an often preferrable alternative to pivot editing, you might switch to MF_safeSolve or MF_solveBySVD.
For symmetric matrices, we already noticed that MFsym_solve provides a potentially much faster way. This routine first tries Cholesky decomposition. If the matrix turns out not to be positive-definite, LU decomposition is used. The return value of MFsym_solve indicates if the linear system could successfully be solved:
Return value | Meaning |
0 | Linear system successfully solved, either by Cholesky or by LUD |
1 | Under-determined system; both Cholesky and LUD failed; matrix MA is singular; result X contains no useful information |
2 | Under-determined system; matrix MA is (nearly) singular; solution was achieved only by LUD with pivot editing; it depends on the specific application, if the result is partially useful or not. |
|
|
Return value | Code 0, 1, or 2, see above |
|
|
MF_solveBySVD
| MD_solveBySVD |
ME_solveBySVD |
MFb_solveBySVD
| MDb_solveBySVD |
MEb_solveBySVD |
MFb_solveBySVD_sizeBuf
| MDb_solveBySVD_sizeBuf |
MEb_solveBySVD_sizeBuf |
|
Function | solve a possibly over- or underdetermined linear system by singular value decomposition |
|
Syntax C/C++ | #include <MFstd.h>
int MF_solveBySVD( fVector X, fMatrix MA, fVector B, ui htA, ui lenA );
int MF_solveBySVDwEdit( fVector X, fMatrix MA, fVector B, ui htA, ui lenA, float thresh );
int MFb_solveBySVD( fVector X, fMatrix MA, fVector B, ui htA, ui lenA, fVector Buf );
int MFb_solveBySVDwEdit( fVector X, fMatrix MA, fVector B, ui htA, ui lenA, float thresh, fVector Buf );
ui MFb_solveBySVD_sizeBuf( ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::solveBySVD( const matrix<T>& MA, const vector<T>& B );
void vector<T>::solveBySVDwEdit( const matrix<T>& MA, const vector<T>& B, T thresh ); |
Pascal/Delphi | uses MFstd;
function MF_solveBySVD( X:fVector; MA:fMatrix; B:fVector; htA, lenA:UIntSize ): IntBool;
function MF_solveBySVDwEdit( X:fVector; MA:fMatrix; B:fVector; htA, lenA:UIntSize; thresh:Single ): IntBool;
function MFb_solveBySVD( X:fVector; MA:fMatrix; B:fVector; htA, lenA:UIntSize; Buf:fVector ): IntBool;
function MFb_solveBySVDwEdit( X:fVector; MA:fMatrix; B:fVector; htA, lenA:UIntSize; thresh:Single; Buf:fVector ): IntBool;
function MFb_solveBySVD( htA, lenA:UIntSize ): UIntSize; |
|
Description | The system MA * X = B of simultaneous linear equations is solved for X, using Singular Value Decomposition. Here, under-determined systems do not lead to an error. Rather, you get one particular solution out of the solution space. If you have more equations than unknowns, i.e., in the case of an overdetermined system, the solution vector contains a least-square "compromise" between the equations.
The function should always return FALSE (0). Only in the very rare case of SVD failure, TRUE (1) is returned. The length of the desired solution vector, sizX must be equal to the width of the input matrix, lenA, whereas the length of the right-hand-side vector, sizB must be equal to htA.
The default threshold for singular-value editing may be changed by calling MF_SVDsetEdit. As MF_SVDsetEdit is not thread-safe, this function should not be used to set different editing thresholds for different calls to MF_solveBySVD etc. Rather than repeatedly changing the default value, use the "wEdit" variant of MF_solveBySVD etc., namely MF_solveBySVDwEdit, MF_SVsolvewEdit and MF_safeSolvewEdit.
These functions need buffer memory. The "normal" versions (prefixes MF_, MD_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MDb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_solveBySVD_sizeBuf(ht,len) etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes).
|
|
Return value | usually FALSE (0); only in the very rare case of failure, TRUE (1) |
|
|
MF_spectrum
| MD_spectrum |
ME_spectrum |
MFb_spectrum
| MDb_spectrum |
MEb_spectrum |
MFb_spectrum_sizeBuf
| MDb_spectrum_sizeBuf |
MEb_spectrum_sizeBuf |
|
Function | spatial frequency spectrum |
|
Syntax C/C++ | #include <MFstd.h>
void MF_spectrum( fMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, ui htX, ui lenX, fMatrix Win );
void MFb_spectrum( fMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, ui htX, ui lenX, fMatrix Win, fVector Buf );
ui MFb_spectrum_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::spectrum( const matrix<T>& MX, const matrix<T>& MWin );
void matrix<T>::b_spectrum( const matrix<T>& MX, const matrix<T>& MWin, vector<T> Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_spectrum( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_spectrum( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_spectrum_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_spectrum( fMatrix d_MSpec, ui htSpec, ui lenSpec, fMatrix d_MX, ui htX, ui lenX, fMatrix d_MWin );
void MFcu_spectrum( fMatrix h_MSpec, ui htSpec, ui lenSpec, fMatrix h_MX, ui htX, ui lenX, fMatrix h_MWin );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_spectrum( d_MSpec:fMatrix; htSpec, lenSpec:UIntSize; d_MX:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;
procedure MFcu_spectrum( h_MSpec:fMatrix; htSpec, lenSpec:UIntSize; h_MX:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
|
|
Description | The data set MX is analyzed for the mean square amplitude of its spatial frequency spectrum. The result is stored in MSpc.
Internally, the spectrum is calculated by dividing the input data into overlapping segments, similarly to the one-dimensional case described for VF_spectrum.
MWin is a window that is applied to the data segments. Three functions are available that give suitable
Windows: MF_Welch, MF_Parzen, and MF_Hann. A square window is available by setting all matrix elements equal to 1.0 (MF_equC( MWin, htSpec, lenSpec, 1.0 ); ), but this is not recommended.
htSpec and lenSpec must be integer powers of 2.
Moreover, the following conditions must be fulfilled:
htX >= n*htSpec, lenX >= n*lenSpec, htWin = htSpec, lenWin = lenSpec.
Internally, MF_spectrum allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_spectrum instead. The necessary size of Buf can be obtained by calling the function MFb_spectrum_sizeBuf. It will never need to be more than 4*htX*lenX. Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either htSpec or lenSpec is not a power of 2, VF_FFT (on which MF_spectrum relies) complains "Size must be an integer power of 2" and the program is aborted. If MSpc overwrites MX or MWin, an error message "Vectors/matrices must not be identical" is generated and the program aborted. |
|
|
MFsym_sqrt
| MDsym_sqrt |
MEsym_sqrt |
|
Function | Square root of a symmetric, positive definite matrix |
|
Syntax C/C++ | #include <MFstd.h>
int MFsym_sqrt( fMatrix MB, fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::sqrt( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
function MFsym_sqrt( MB, MA:fMatrix; len:UIntSize ):IntBool; |
|
Description | The square-root of a symmetric, positive definite matrix is calculated, so that MB * MB = MA is satisfied. Please note that non-symmetric matrices or matrices which are not positive definite may or may not have existing square-roots, too. The present algorithm, however, is restricted to the most simple case where a square-root always exists. It uses eigenvalues and eigenvectors and fails whenever a negative eigenvalue is encountered, indicating an input matrix which is not positive definite. In the latter case, an error message is displayed and the result is calculated with zero substituted for the negative eigenvalue. This result may still be useful, namely if the negative eigenvalue is very small.
A return value of FALSE or 0 indicates success, whereas a non-zero return value indicates that the input matrix did not meet the condition of being symmetric and positive definite. |
|
Return value | FALSE (0), if the matrix square-root could be calculated; otherwise TRUE (1) |
|
|
MF_store
| MD_store |
ME_store |
MCF_store |
MCD_store |
MCE_store |
MI_store | MBI_store | MSI_store | MLI_store | MQI_store |
MU_store | MUB_store | MUS_store | MUL_store | MUQ_store |
|
Function | store a matrix in binary format into a stream |
|
Syntax C/C++ | #include <MFstd.h>
int MF_store( FILE *stream, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
int matrix<T>::store( FILE *stream ); |
Pascal/Delphi | uses MFstd;
function MF_store( var Stream:FILE; MA:fMatrix; ht, len:UIntSize ): Integer; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_store( FILE *stream, fMatrix d_MA, ui ht, ui len );
int cudaMF_store_buf( FILE *stream, fMatrix d_MA, ui ht, ui len, fVector h_Wk ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_store( var Stream:File; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_store_buf( var Stream:File; d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA of ht*len elements is written to stream in binary format. The stream must be already open for binary write operations.
CUDA versions only: cudaM?_store_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_store to allocate its own buffer memory, cudaM?_store_buf is slightly faster.
GCC and CLang only: GCC and CLang (including BCC32C) pad the 10-byte data type long double to 12 or 16 bytes in memory (12 byte in 32-bit, 16 byte in 64 bit). In order to maintain compatibility of the generated data files between compilers, the ME_store / ME_recall and MCE_store / MCE_recall pairs always use 10-byte storage on disk. |
|
Thread safety | Different threads may safely call any functions of the VF_ / MF_store and VF_ / MF_recall families simultaneously, as long as the refer to different streams. If they have to access one and the same stream, however, the user must take appropriate measures (critical sections, mutexes), in order to prevent race conditions. |
|
Error handling | Error handling is performed by the C function fwrite or the Delphi function BlockWrite, on which MF_store etc. are based. |
|
Return value | 0, if successful; otherwise 1. In order to obtain more information, inspect errno (C/C++) or IOResult (Delphi). |
|
|
MFs_subM |
MDs_subM |
MEs_subM |
MCF_subM |
MCD_subM |
MCE_subM |
|
Function | element-wise subtraction of two matrices |
|
Syntax C/C++ | #include <MFstd.h>
void MF_subM( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFs_subM( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::subM( const matrix<T>& MA, const matrix<T>& MB);
void matrix<T>::s_subM( const matrix<T>& MA, const matrix<T>& MB, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_subM( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFs_subM( MC, MA, MB:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_subM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
int cudaMFs_subM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float C );
int cusdMFs_subM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float *d_C );
void MFcu_subM( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len );
void MFs_subM( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_subM( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMFs_subM( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMFs_subM( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MF_subM( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
procedure MFs_subM( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | normal version: MCij = MAij - MBij
scaled version: MCij = C * (MAij - MBij) |
|
|
MF_subMT
| MD_subMT |
ME_subMT |
MFs_subMT |
MDs_subMT |
MEs_subMT |
MCF_subMT |
MCD_subMT |
MCE_subMT |
|
Function | subtract the transpose of one matrix from another matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_subMT( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFs_subMT( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::subMT( const matrix<T>& MA, const matrix<T>& MB);
void matrix<T>::s_subMT( const matrix<T>& MA, const matrix<T>& MB, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_subMT( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFs_subMT( MC, MA, MB:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_subMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
int cudaMFs_subMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float C );
int cusdMFs_subMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float *d_C );
void MFcu_subMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len );
void MFs_subMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_subMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMFs_subMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMFs_subMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MF_subMT( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
procedure MFs_subMT( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | normal version: MCi,j = MAi,j - MBTj,i
scaled version: MCi,j = C * (MAi,j - MBTj,i) |
|
|
MF_subrMT
| MD_subrMT |
ME_subrMT |
MFs_subrMT |
MDs_subrMT |
MEs_subrMT |
MCF_subrMT |
MCD_subrMT |
MCE_subrMT |
|
Function | reverse subtraction: subtract one matrix from the transpose of another |
|
Syntax C/C++ | #include <MFstd.h>
void MF_subrMT( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFs_subrMT( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, float C ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::subrMT( const matrix<T>& MA, const matrix<T>& MB);
void matrix<T>::s_subrMT( const matrix<T>& MA, const matrix<T>& MB, const T& C); |
Pascal/Delphi | uses MFstd;
procedure MF_subrMT( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFs_subrMT( MC, MA, MB:fMatrix; ht, len:UIntSize; C:Single ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_subrMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
int cudaMFs_subrMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float C );
int cusdMFs_subrMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len, float *d_C );
void MFcu_subrMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len );
void MFs_subrMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len, float C ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_subrMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMFs_subrMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; C:Single ): IntBool;
function cusdMFs_subrMT( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize; d_C:PSingle ): IntBool;
procedure MF_subrMT( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
procedure MFs_subrMT( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize; C:Single );
|
|
Description | normal version: MCi,j = MBTj,i - MAi,j
scaled version: MCi,j = C * (MBTj,i - MAi,j) |
|
|
MF_submatrix
| MD_submatrix |
ME_submatrix |
MCF_submatrix |
MCD_submatrix |
MCE_submatrix |
MI_submatrix | MBI_submatrix | MSI_submatrix | MLI_submatrix | MQI_submatrix |
MU_submatrix | MUB_submatrix | MUS_submatrix | MUL_submatrix | MUQ_submatrix |
|
Function | extract a submatrix from a (larger) matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_submatrix( fMatrix MSub, ui subHt, ui subLen, fMatrix MSrce, ui srceHt, ui srceLen, ui firstRowInCol, ui sampInCol, ui firstColInRow, ui sampInRow ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::submatrix( const matrix<T>& MSrce, const ui firstRowInCol, const ui sampInCol, const ui firstColInRow, const ui sampInRow ); |
Pascal/Delphi | uses MFstd;
procedure MF_submatrix( MSub:fMatrix; subHt, subLen:UIntSize; MSrce:fMatrix; srceHt, srceLen:UIntSize; firstRowInCol, sampInCol, firstColInRow, sampInRow:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_submatrix( fMatrix d_MSub, ui subHt, ui subLen, fMatrix d_MSrce, ui srceHt, ui srceLen, ui firstRowInCol, ui sampInCol, ui firstColInRow, ui sampInRow );
void MFcu_submatrix( fMatrix h_MSub, ui subHt, ui subLen, fMatrix h_MSrce, ui srceHt, ui srceLen, ui firstRowInCol, ui sampInCol, ui firstColInRow, ui sampInRow ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_submatrix( d_MSub:fMatrix; subHt, subLen:UIntSize; d_MSrce:fMatrix; srceHt, srceLen:UIntSize; firstRowInCol, sampInCol, firstColInRow, sampInRow:UIntSize ): IntBool;
procedure MFcu_submatrix( h_MSub:fMatrix; subHt, subLen:UIntSize; h_MSrce:fMatrix; srceHt, srceLen:UIntSize; firstRowInCol, sampInCol firstColInRow, sampInRow:UIntSize );
|
|
Description | MSubi, j = MSrcei*sampInCol+firstRowInCol, j*sampInRow+firstColInRow |
|
|
MF_submatrix_equM
| MD_submatrix_equM |
ME_submatrix_equM |
MCF_submatrix_equM |
MCD_submatrix_equM |
MCE_submatrix_equM |
MI_submatrix_equM | MBI_submatrix_equM | MSI_submatrix_equM | MLI_submatrix_equM | MQI_submatrix_equM |
MU_submatrix_equM | MUB_submatrix_equM | MUS_submatrix_equM | MUL_submatrix_equM | MUQ_submatrix_equM |
|
Function | distribute the elements of a matrix to a submatrix of another (larger) matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_submatrix_equM( fMatrix MDest, unsigned destHt, unsigned destLen, ui firstRowInCol, ui sampInCol, ui firstColInRow, ui sampInRow, fMatrix MSrce, ui srceHt, ui srceLen ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::submatrix_equM( const ui firstRowInCol, const ui sampInCol, const ui firstColInRow, const ui sampInRow, const matrix<T>& MSrce ); |
Pascal/Delphi | uses MFstd;
procedure MF_submatrix_equM( MDest:fMatrix; destHt, destLen, firstRowInCol, sampInCol, firstColInRow, sampInRow:UIntSize; MSrce:fMatrix; srceHt, srceLen:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_submatrix_equM( fMatrix d_MDest, unsigned destHt, unsigned destLen, ui firstRowInCol, ui sampInCol, ui firstColInRow, ui sampInRow, fMatrix d_MSrce, ui srceHt, ui srceLen );
void MFcu_submatrix_equM( fMatrix h_MDest, unsigned destHt, unsigned destLen, ui firstRowInCol, ui sampInCol, ui firstColInRow, ui sampInRow, fMatrix h_MSrce, ui srceHt, ui srceLen ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_submatrix_equM( d_MDest:fMatrix; destHt, destLen, firstRowInCol, sampInCol, firstColInRow, sampInRow:UIntSize; d_MSrce:fMatrix; srceHt, srceLen:UIntSize ): IntBool;
procedure MFcu_submatrix_equM( h_MDest:fMatrix; destHt, destLen, firstRowInCol, sampInCol, firstColInRow, sampInRow:UIntSize; h_MSrce:fMatrix; srceHt, srceLen:UIntSize );
|
|
Description | MDesti*sampInCol+firstRowInCol, j*sampInRow+firstColInRow = MSrcei, j
This function does the inverse of MF_submatrix |
|
|
MF_SVdecompose
| MD_SVdecompose |
ME_SVdecompose |
MFb_SVdecompose
| MDb_SVdecompose |
MEb_SVdecompose |
MFb_SVdecompose_sizeBuf
| MDb_SVdecompose_sizeBuf |
MEb_SVdecompose_sizeBuf |
|
Function | Singular Value Decomposition |
|
Syntax C/C++ | #include <MFstd.h>
int MF_SVdecompose( fMatrix U, fMatrix V, fVector W, fMatrix MA, ui htA, ui lenA );
int MFb_SVdecompose( fMatrix U, fMatrix V, fVector W, fMatrix MA, ui htA, ui lenA, fVector Buf );
ui MFb_SVdecompose_sizeBuf( ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
int matrix<T>::SVdecompose( matrix<T> MV, vector<T> W, const matrix<T>& MA );
int matrix<T>::SVdecompose( matrix<T>* MV, vector<T>* W, const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
function MF_SVdecompose( MU, MV:fMatrix; W:fVector; MA:fMatrix; htA, lenA:UIntSize ): IntBool;
function MFb_SVdecompose( MU, MV:fMatrix; W:fVector; MA:fMatrix; htA, lenA:UIntSize; Buf:fVector ): IntBool;
function MFb_SVdecompose_sizeBuf( htA, lenA:UIntSize ): UIntSize; |
|
Description | The matrix MA of dimensions [ht, len] is decomposed into a product
MA = MU * MW * MVT,
where MU has the dimensions [max(ht,len), len]. MW is a diagonal matrix with all elements positive or zero. Actually, only the diagonal of this matrix is stored in the vector W of size [len], MV, finally, is a square matrix [len, len]. Both MU and MV are orthogonal:
MUT * MU = MVT * MV = (1).
Due to these orthogonality relations, the solution of a linear system MA * X = B is straightforward, once MA has been singular-value decomposed:
X = MV * W-1 * MUT
(This equation must be evaluated from right to left.) As MU and MV are orthogonal, only W must explicitly be inverted. This, however, is easy, as W is diagonal, and the inverse of a diagonal matrix consists of the inverse of the diagonal elements. This is the important point which makes SVD so useful, because it provides both a diagnosis and a cure for singularities. If any element of W is very small compared to the largest element, this corresponds to a singularity (at least in the numerical sense, where dividing by extremely small numbers is almost as bad as dividing by zero). A singularity means that the underlying linear system is under-determined. This, in turn, means that one can arbitrarily choose one particular solution. Specifically, one may choose W-1ii = 0 for very small Wii, which is one of the rare cases where it makes sense to set the result of a division by (near-)zero to zero instead of infinity. This reduction of the dimension by "Singular Value editing" is the crucial point in all functions relying on SVD, like MF_SVsolve, MF_safeSolve), VF_linfit and others. If you wish to change the default editing threshold, you can do so by calling MF_SVDsetEdit. As MF_SVDsetEdit is not thread-safe, this function should not be used to set different editing thresholds for different calls to MF_SVsolve etc. Rather than repeatedly changing the default value then, use the "wEdit" variant of MF_SVsolve etc., namely MF_SVsolvewEdit, MF_solveBySVDwEdit and MF_safeSolvewEdit.
The singular values are stored in W in arbitrary order. For some applications, like visual inspection of the singular values, dimension reduction, calculation of the rank of a matrix, etc., it is desirable to bring the singular values into descending order, re-ordering also the right and left singular vectors (stored in the matrices MU and MV) accordingly. This is done by calling MF_SVsort.
The SVD functions need buffer memory. The "normal" versions (prefixes MF_, MD_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MDb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_SVdecompose_sizeBuf(ht,len) etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes).
If you compare results of MF_SVdecompose with SVD routines by other vendors, please note the following points:
- MF_SVdecompose itself does not perform a dimension reduction (replacement of small singular values by 0), but leaves this step to following functions or to manual inspection by the user.
- Singular values can be permutated, if the same permutation is also applied to the corresponding columns of both MU and MV. Often, this property in of SVD is exploited to bring the singular values into a certain (for example, into descending) order. As the price for this increased beauty is an increased work-load, MF_SVdecompose itself keeps the singular values in arbitrary order. Only if really needed, the task of sorting may be performed by calling the separate function MF_SVsort after MF_SVdecompose, as described above.
- The sign of a singular value may be exchanged if the corresponding column of MV is also multiplied by -1. MF_SVdecompose uses this property to make all non-vanishing singular values positive.
|
|
Verifying SVD results | The following routine demonstrates SV decomposition and the verification of its results.
#include <VDstd.h>
#include <MDstd.h>
#include <conio.h>
void SVDtest( void )
{
unsigned ht=386, len=52, // choose any values
maxhtlen, sizeA, sizeV;
dMatrix MA, MU, MV, MOne, MA2, MUV2, MDiffA, MDiffOne;
dVector W;
double err;
maxhtlen = (ht >= len ? ht : len);
sizeA = ht*len;
sizeV = len*len;
MA = MD_matrix( ht, len ); // input matrix
MU = MD_matrix( maxhtlen, len );
MV = MD_matrix( len, len );
W = VD_vector( len );
MOne = MD_matrix( len, len ); // unity matrix for comparison
MD_equ1( MOne, len );
MA2 = MD_matrix( maxhtlen, len );
// will be filled with MU*W*MVT to compare with input matrix
// leading dimension maxhtlen is needed for under-determined matrices
MUV2 = MD_matrix( len, len );
// will be filled with MUT*MU, MVT*MV, MV*MVT for comparison with MOne
MDiffA = MD_matrix( ht, len ); // will hold temporary result
MDiffOne = MD_matrix( len, len ); // will hold temporary result
MD_random( MA, ht, len, 1, -1., +1. );
// fill MA with random numbers between -1 and +1
// alternatively generate or read in any other test matrix
MD_SVdecompose( MU, MV, W, MA, ht, len );
/* check if MA = MU*W*MVT, evaluating from right to left : */
MDdia_mulMT( MUV2, W, MV, len, len ); // use MUV2 to store W * MVT
MD_mulM( MA2, MU, MUV2, maxhtlen, len, len );
MD_subM( MDiffA, MA, MA2, ht, len );
// for under-determined matrices, just ignore the rows from ht to maxhtlen-1
err = VD_absmax( MDiffA[0], sizeA );
printf( "SVDtest: check the SVD routine of OptiVec\n\n"
"In the following tests in double precision,\n"
"errors of up to a few times 1.e-14 are okay\n"
"for matrices on the order of 100x100 to 1000x1000 elements:\n\n"
"max. error of matrix reconstruction MA = MU*W*MVT: %lg", err );
/* check if MU is orthogonal, i.e. MUT*MU = (1): */
MD_TmulM( MUV2, MU, MU, maxhtlen, len, len );
MD_subM( MDiffOne, MUV2, MOne, len, len );
err = VD_absmax( MDiffOne[0], sizeV );
printf( "\nmax. error of MUT*MU = (1): %lg", err );
/* check if MV is orthogonal, i.e. MVT*MV = (1): */
MD_TmulM( MUV2, MV, MV, len, len, len );
MD_subM( MDiffOne, MUV2, MOne, len, len );
err = VD_absmax( MDiffOne[0], sizeV );
printf( "\nmax. error of MVT*MV = (1): %lg", err );
/* check if MV is also orthonormal, i.e. MV*MVT = (1): */
MD_mulMT( MUV2, MV, MV, len, len, len );
MD_subM( MDiffOne, MUV2, MOne, len, len );
err = VD_absmax( MDiffOne[0], sizeV );
printf( "\nmax. error of MV*MVT = (1): %lg", err );
printf( "\n\nHit any key to end SVDtest" ); _getch();
M_nfree( 8, MA, MU, MV, MOne, MA2, MUV2, MDiffA, MDiffOne );
V_free( W );
} |
|
|
MF_SVDgetEdit
| MD_SVDgetEdit |
ME_SVDgetEdit |
|
Function | retrieve current editing threshold for Singular Value backsubstitution |
|
Syntax C/C++ | #include <MFstd.h>
float MF_SVDgetEdit( void ); |
C++ MatObj | #include <OptiVec.h>
T matrix<T>::SVDgetEdit( ); |
Pascal/Delphi | uses MFstd;
function MF_SVDgetEdit: Single; |
|
Description | This function returns the current default Singular Value editing threshold. The default SV editing threshold may be modified by MF_SVDsetEdit. |
|
Return value | current SV editing threshold |
|
|
MF_SVDsetEdit
| MD_SVDsetEdit |
ME_SVDsetEdit |
|
Function | set the Singular Value editing threshold |
|
Syntax C/C++ | #include <MFstd.h>
void MF_SVDsetEdit( float Thresh ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::SVDsetEdit( const T& Thresh ); |
Pascal/Delphi | uses MFstd;
procedure MF_SVDsetEdit( Thresh:Single ); |
|
Description | As described in connection with MF_SVdecompose and MF_SVsolve, the crucial point in using functions which rely on Singular Value Decomposition is the Singular Value editing step. By default, the SV editing threshold is 4*FLT_EPSILON, 8*DBL_EPSILON, or 16*LDBL_EPSILON. You may change these default values by calling MF_SVDsetEdit. To retrieve the current SV editing threshold, call MF_SVDgetEdit.
As MF_SVDsetEdit is not thread-safe, this function should not be used to set different editing thresholds for different calls to MF_SVsolve etc. Rather than repeatedly changing the default value then, use the "wEdit" variant of MF_SVsolve etc., namely MF_SVsolvewEdit, MF_solveBySVDwEdit and MF_safeSolvewEdit. |
|
|
MF_SVsolve
| MD_SVsolve |
ME_SVsolve |
MFb_SVsolve
| MDb_SVsolve |
MEb_SVsolve |
MFb_SVsolve_sizeBuf
| MDb_SVsolve_sizeBuf |
MEb_SVsolve_sizeBuf |
|
Function | solve a system of linear equations, given its Singular Value decomposed form |
|
Syntax C/C++ | #include <MFstd.h>
void MF_SVsolve( fVector X, fMatrix MU, fMatrix MV, fVector W, fVector B, ui htA, ui lenA );
void MF_SVsolvewEdit( fVector X, fMatrix MU, fMatrix MV, fVector W, fVector B, ui htA, ui lenA, float thresh );
void MFb_SVsolve( fVector X, fMatrix MU, fMatrix MV, fVector W, fVector B, ui htA, ui lenA, fVector Buf );
void MFb_SVsolvewEdit( fVector X, fMatrix MU, fMatrix MV, fVector W, fVector B, ui htA, ui lenA, float thresh, fVector Buf );
ui MFb_SVsolve_sizeBuf( ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::SVsolve( const matrix<T>& MU, const matrix<T>& MV, const vector<T>& W, const vector<T>& B );
void vector<T>::SVsolvewEdit( const matrix<T>& MU, const matrix<T>& MV, const vector<T>& W, const vector<T>& B, T thresh ); |
Pascal/Delphi | uses MFstd;
procedure MF_SVsolve( X:fVector; MU, MV:fMatrix; W, B:fVector; htA, lenA:UIntSize );
procedure MF_SVsolvewEdit( X:fVector; MU, MV:fMatrix; W, B:fVector; htA, lenA:UIntSize; thresh:Single );
procedure MFb_SVsolve( X:fVector; MU, MV:fMatrix; W, B:fVector; htA, lenA:UIntSize; Buf:fVector );
procedure MFb_SVsolvewEdit( X:fVector; MU, MV:fMatrix; W, B:fVector; htA, lenA:UIntSize; thresh:Single; Buf:fVector );
function MFb_SVsolve_sizeBuf( htA, lenA:UIntSize ): UIntSize;
|
|
Description | MF_SVsolve solves an SV-decomposed set of linear equations; sometimes this process is also called Singular Value Backsubstitution. In this function, at first W is edited such that elements smaller than a threshold are set to zero. Then, in the backsubstitution process, which involves divisions by the elements of W, any divisions by Wi = 0 are replaced by setting the result to 0.
You can change the default editing threshold by calling MF_SVDsetEdit. If you prefer to inspect and edit W yourself before calling MF_SVsolve, you can call MF_SVDsetEdit with the argument 0.0, thereby switching off the automatic SV editing. As MF_SVDsetEdit is not thread-safe, this function should not be used to set different editing thresholds for different calls to MF_SVsolve etc. Rather than repeatedly changing the default value then, use the "wEdit" variant of MF_SVsolve etc., namely MF_SVsolvewEdit, MF_solveBySVDwEdit and MF_safeSolvewEdit.
The parameters htA and lenA refer to the original matrix MA as fed into MF_SVdecompose. The actual dimensions of the vectors and matrices entered into MF_SVsolve are:
sizeB = htA;
sizeX = htU = max( lenA, htA );
sizeW = lenU = htV = lenV = lenA;
These functions need buffer memory. The "normal" versions (prefixes MF_, MD_ etc.) allocate it themselves, whereas the version with the prefixes MFb_, MDb_ etc. take a vector Buf as an additional argument. The required size of Buf can be obtained by calling MFb_SVsolve_sizeBuf(ht,len) etc., whereby the size is given as the number of elements of Buf in the respective data type (rather than in bytes).
|
|
|
MF_SVsort
| MD_SVsort |
ME_SVsort |
|
|
Syntax C/C++ | #include <MFstd.h>
void MF_SVsort( fMatrix MUout, fMatrix MVout, fVector Wout, fMatrix MUraw, fMatrix MVraw, fVector Wraw, ui htU, ui lenU ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::SVsort( matrix<T> MVout, vector<T> Wout, const matrix<T>& MUraw, const matrix<T>& MVraw, const vector<T>& Wraw ); |
Pascal/Delphi | uses MFstd;
procedure MF_SVsort( MUraw, MVraw:fMatrix; Wraw:fVector; MUraw, MVraw:fMatrix; Wraw:fVector; htU, lenU:UIntSize ); |
|
Description | MF_SVsort brings the vector W, containing the unordered singular values, as obtained from MF_SVdecompose, into descending order. Simultaneously, columns of both matrices MV and MU are interchanged accordingly. The "raw" input data are MUraw, MVraw, and Wraw, while the ordered data on output are MUout, MVout, Wout. MUout may or may not overwrite MUraw; the same holds for the pairs MVout / MVraw and Wout / Wraw.
The parameters htU and lenU refer to the matrix MU. They relate to the dimensions of the original matrix MA, fed into MF_SVdecompose, as:
htU = max( lenA, htA );
lenU = lenA; |
|
|
MF_TmulM
| MD_TmulM |
ME_TmulM |
MCF_TmulM |
MCD_TmulM |
MCE_TmulM |
|
Function | multiply the transpose of one matrix by another matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_TmulM( fMatrix MC, fMatrix MA, fMatrix MB, ui htA, ui lenA, ui lenB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::TmulM( const matrix<T>& MA, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MF_TmulM( MC, MA, MB:fMatrix; htA, lenA, lenB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_TmulM( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui htA, ui lenA, ui lenB );
void MFcu_TmulM( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui htA, ui lenA, ui lenB ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_TmulM( d_MC, d_MA, d_MB:fMatrix; htA, lenA, lenB:UIntSize ): IntBool;
procedure MFcu_TmulM( h_MC, h_MA, h_MB:fMatrix; htA, lenA, lenB:UIntSize );
|
|
Description | MC = MAT * MB
htA, lenA, and lenB must be specified; the other dimensions are implicitly given as: htB = htA, lenC = lenB, htC = lenA. htA and lenA refer to the original, un-transposed input matrix. |
|
|
MF_TmulMdia
| MD_TmulMdia |
ME_TmulMdia |
MCF_TmulMdia |
MCD_TmulMdia |
MCE_TmulMdia |
|
Function | multiply the transpose of a general matrix by a diagonal matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_TmulMdia( fMatrix MC, fMatrix MA, fVector MBDia, ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::mulMdia( const matrix<T>& MA, const vector<T>& MBDia, ); |
Pascal/Delphi | uses MFstd;
procedure MF_TmulMdia( MC, MA:fMatrix; MBDia:fVector; htA, lenA:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_TmulMdia( fMatrix d_MC, fMatrix d_MA, fVector d_MBDia, ui htA, ui lenA );
void MFcu_TmulMdia( fMatrix h_MC, fMatrix h_MA, fVector h_MBDia, ui htA, ui lenA ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_TmulMdia( d_MC, d_MA:fMatrix; d_MBDia:fVector; htA, lenA:UIntSize ): IntBool;
procedure MFcu_TmulMdia( h_MC, h_MA:fMatrix; h_MBDia:fVector; htA, lenA:UIntSize );
|
|
Description | MC = MAT * MBDia
htA and lenA must be specified. They refer to the original, un-transposed input matrix. Implicitly, sizB = htA. |
|
|
MCF_TmulMH |
MCD_TmulMH |
MCE_TmulMH |
|
Function | multiply the transpose of one matrix by the hermitian conjugate of another |
|
Syntax C/C++ | #include <MCFstd.h>
void MCF_TmulMH( cfMatrix MC, cfMatrix MA, cfMatrix MB, ui htA, ui lenA, ui htB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T> >::TmulMH( const matrix<complex<T> >& MA, const matrix<complex<T> >& MA ); |
Pascal/Delphi | uses MFstd;
procedure MCF_TmulMH( MC, MA, MB:cfMatrix; htA, lenA, htB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMCFstd.h>
int cudaMCF_TmulMH( cfMatrix d_MC, cfMatrix d_MA, cfMatrix d_MB, ui htA, ui lenA, ui htB );
void MCFcu_TmulMH( cfMatrix h_MC, cfMatrix h_MA, cfMatrix h_MB, ui htA, ui lenA, ui htB ); |
CUDA function Pascal/Delphi | uses MCFstd;
function cudaMCF_TmulMH( d_MC, d_MA, d_MB:cfMatrix; htA, lenA, htB:UIntSize ): IntBool;
procedure MCF_TmulMH( h_MC, h_MA, h_MB:cfMatrix; htA, lenA, htB:UIntSize );
|
|
Description | MC = MAT * MBT*
htA, lenA, and htB must be specified; the other dimensions are implicitly given as: lenB = htA, lenC = htB, htC = lenA. All dimensions refer to the original, un-transposed input matrices. |
|
|
MF_TmulMT
| MD_TmulMT |
ME_TmulMT |
MCF_TmulMT |
MCD_TmulMT |
MCE_TmulMT |
|
Function | multiply the transpose of one matrix by the transpose of another |
|
Syntax C/C++ | #include <MFstd.h>
void MF_TmulMT( fMatrix MC, fMatrix MA, fMatrix MB, ui htA, ui lenA, ui htB ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::TmulMT( const matrix<T>& MA, const matrix<T>& MB ); |
Pascal/Delphi | uses MFstd;
procedure MF_TmulMT( MC, MA, MB:fMatrix; htA, lenA, htB:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_TmulMT( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui htA, ui lenA, ui htB );
void MFcu_TmulMT( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui htA, ui lenA, ui htB ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_TmulMT( d_MC, d_MA, d_MB:fMatrix; htA, lenA, htB:UIntSize ): IntBool;
procedure MFcu_TmulMT( h_MC, h_MA, h_MB:fMatrix; htA, lenA, htB:UIntSize );
|
|
Description | MC = MAT * MBT
htA, lenA, and htB must be specified; the other dimensions are implicitly given as: lenB = htA, lenC = htB, htC = lenA. All dimensions refer to the original, un-transposed input matrices. |
|
|
MF_TmulV
| MD_TmulV |
ME_TmulV |
MCF_TmulV |
MCD_TmulV |
MCE_TmulV |
|
Function | multiply the transpose of a matrix by a column vector |
|
Syntax C/C++ | #include <MFstd.h>
void MF_TmulV( fVector Y, fMatrix MA, fVector X, ui htA, ui lenA ); |
C++ MatObj | #include <OptiVec.h>
void vector<T>::TmulV( const matrix<T>& MA, const vector<T>& X ); |
Pascal/Delphi | uses MFstd;
procedure MF_TmulV( Y:fVector; MA:fMatrix; X:fVector; htA, lenA:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_TmulV( fVector d_Y, fMatrix d_MA, fVector d_X, ui htA, ui lenA );
void MFcu_TmulV( fVector h_Y, fMatrix h_MA, fVector h_X, ui htA, ui lenA ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_TmulV( d_Y:fVector; d_MA:fMatrix; d_X:fVector; htA, lenA:UIntSize ): IntBool;
procedure MFcu_TmulV( h_Y:fVector; h_MA:fMatrix; h_X:fVector; htA, lenA:UIntSize );
|
|
Description | Y = MAT * X
The dimensions htA and lenA refer to the original (rather than the intermediate transposed) matrix MA; the dimensions of X and Y are implicitly given by the matrix dimensions: sizX = htA, sizY = lenA. |
|
|
MF_transpose
| MD_transpose |
ME_transpose |
MCF_transpose |
MCD_transpose |
MCE_transpose |
MI_transpose | MBI_transpose | MSI_transpose | MLI_transpose | MQI_transpose |
MU_transpose | MUB_transpose | MUS_transpose | MUL_transpose | MUQ_transpose |
|
Function | transpose of a matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_transpose( fMatrix MTr, fMatrix MA, ui htTr, ui lenTr ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::transpose( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_transpose( MTr, MA:fMatrix; htTr, lenTr:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_transpose( fMatrix d_MTr, fMatrix d_MA, ui htTr, ui lenTr );
void MFcu_transpose( fMatrix h_MTr, fMatrix h_MA, ui htTr, ui lenTr ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_transpose( d_MTr, d_MA:fMatrix; htTr, lenTr:UIntSize ): IntBool;
procedure MFcu_transpose( h_MTr, h_MA:fMatrix; htTr, lenTr:UIntSize );
|
|
Description | MTri,j = MAj,i
The dimensions fed into this function, htTr and lenTr, refer to the transposed matrix rather than to the input matrix. |
|
|
MF_Trd_equM
| MD_Trd_equM |
ME_Trd_equM |
MCF_Trd_equM |
MCD_Trd_equM |
MCE_Trd_equM |
MI_Trd_equM | MBI_Trd_equM | MSI_Trd_equM | MLI_Trd_equM | MQI_Trd_equM |
MU_Trd_equM | MUB_Trd_equM | MUS_Trd_equM | MUL_Trd_equM | MUQ_Trd_equM |
|
Function | initialize the tridiagonal part of a matrix with the three vectors contained in a compacted tradiagonal matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Trd_equM( fMatrix MA, fMatrix Trd, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Trd_equM( const matrix<T>& MTrd ); |
Pascal/Delphi | uses MFstd;
procedure MF_Trd_equM( MA, MTrd:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Trd_equM( fMatrix d_MA, fMatrix Trd, ui len );
void MFcu_Trd_equM( fMatrix h_MA, fMatrix Trd, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Trd_equM( d_MA, d_MTrd:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Trd_equM( h_MA, h_MTrd:fMatrix; len:UIntSize );
|
|
Description | Row 0 of MTrd is copied into the first diagonal above the main diagonal of the square matrix MA. Row 1 of MTrd goes into the main diagonal of MA, and Row 2 of MTrd into the first diagonal below the main diagonal of MA. See chapter 1.2 for details about the storing of tridiagonal matrices. |
|
|
MF_Trd_extract
| MD_Trd_extract |
ME_Trd_extract |
MCF_Trd_extract |
MCD_Trd_extract |
MCE_Trd_extract |
MI_Trd_extract | MBI_Trd_extract | MSI_Trd_extract | MLI_Trd_extract | MQI_Trd_extract |
MU_Trd_extract | MUB_Trd_extract | MUS_Trd_extract | MUL_Trd_extract | MUQ_Trd_extract |
|
Function | extract the tridiagonal part from a general matrix and store it into a compacted tridiagonal matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Trd_extract( fMatrix MTrd, fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Trd_estract( const matrix<T>& MA ); |
Pascal/Delphi | uses MFstd;
procedure MF_Trd_extract( MTrd, MA:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Trd_extract( fMatrix d_MTrd, fMatrix d_MA, ui len );
void MFcu_Trd_extract( fMatrix h_MTrd, fMatrix h_MA, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Trd_extract( d_MTrd, d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_Trd_extract( h_MTrd, h_MA:fMatrix; len:UIntSize );
|
|
Description | The first diagonal above the main diagonal of the square matrix MA is copied into Row 0 of MTrd. The main diagonal of MA goes into Row1 of MTrd, and the first diagonal below the main diagonal of MA is copied into Row 2 of MTrd. See chapter 1.2 for details about the storing of tridiagonal matrices. |
|
|
MF_UequL
| MD_UequL |
ME_UequL |
MCF_UequL |
MCD_UequL |
MCE_UequL |
MI_UequL | MBI_UequL | MSI_UequL | MLI_UequL | MQI_UequL |
MU_UequL | MUB_UequL | MUS_UequL | MUL_UequL | MUQ_UequL |
|
Function | copy lower-diagonal elements into upper-diagonal by index-reflection, so as to get a symmetric matrix |
|
Syntax C/C++ | #include <MFstd.h>
void MF_UequL( fMatrix MA, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::UequL( ); |
Pascal/Delphi | uses MFstd;
procedure MF_UequL( MA:fMatrix; len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_UequL( fMatrix d_MA, ui len );
void MFcu_UequL( fMatrix h_MA, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_UequL( d_MA:fMatrix; len:UIntSize ): IntBool;
procedure MFcu_UequL( h_MA:fMatrix; len:UIntSize );
|
|
Description | MAi,j = MAj,i, i < j |
|
|
MF_Welch
| MD_Welch |
ME_Welch |
|
Function | two-dimensional Welch window for use in spatial frequency analysis |
|
Syntax C/C++ | #include <MFstd.h>
void MF_Welch( fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::Welch( ); |
Pascal/Delphi | uses MFstd;
procedure MF_Welch( MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_Welch( fMatrix d_MA, ui ht, ui len );
void MFcu_Welch( fMatrix h_MA, ui ht, ui len );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_Welch( d_MA:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_Welch( h_MA:fMatrix; ht, len:UIntSize );
|
|
Description | MAi,j = (1 - ( (i - 0.5*(ht - 1)) / (0.5*(ht + 1)) )2) * (1 - ( (j - 0.5*(len - 1)) / (0.5*(len + 1)) )2) This function provides a window for spatial power-spectrum estimation with Welch's method of overlapping segments, here implemented as MF_spectrum. |
|
|
MF_write
| MD_write |
ME_write |
MCF_write |
MCD_write |
MCE_write |
MI_write | MBI_write | MSI_write | MLI_write | MQI_write |
MU_write | MUB_write | MUS_write | MUL_write | MUQ_write |
|
Function | write a matrix in ASCII format into a stream |
|
Syntax C/C++ | #include <MFstd.h>
void MF_write( FILE *stream, fMatrix MA, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::write( FILE *stream ); |
Pascal/Delphi | uses MFstd;
procedure MF_write( var Stream:TextFile; MA:fMatrix; ht, len:UIntSize ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_write( FILE *stream, fMatrix d_MA, ui ht, ui len );
int cudaMF_write_buf( FILE *stream, fMatrix d_MA, ui ht, ui len, fVector h_Wk ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_write( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cudaMF_write_buf( var Stream:TextFile; d_MA:fMatrix; ht, len:UIntSize; h_Wk:fVector ): IntBool;
|
|
Description | The matrix MA with len columns and ht rows is written to stream in ASCII format. stream must already be open for write operations in text format.
The number format and the separation between columns may be specified using MF_setWriteFormat (C/C++ only) and MF_setWriteSeparate, respectively. See these functions for details.
Storing data in ASCII format is useful if the data have to be readable by human eyes, or if they are to be exported into other programs which are not able to read machine-format numbers. If avoidable, these functions should not be used for the storage of intermediate results that later have again to be read in. Instead, the function pairs of the MF_store / MF_recall family are recommended for the following reasons: conversion into ASCII format is slow, may lead to round-off errors, and requires much more disk memory than storage in machine format.
CUDA versions only: cudaM?_write_buf takes a host vector h_Wk as additional argument. The latter serves as buffer memory and needs to be (at least) of the same size as d_MA, i.e. ht*len. By avoiding the need of cudaM?_write to allocate its own buffer memory, cudaM?_write_buf is slightly faster.
|
|
|
|
MF_xcorr
| MD_xcorr |
ME_xcorr |
MFb_xcorr
| MDb_xcorr |
MEb_xcorr |
|
Function | spatial cross-correlation function |
|
Syntax C/C++ | #include <MFstd.h>
void MF_xcorr( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len );
void MFb_xcorr( fMatrix MC, fMatrix MA, fMatrix MB, ui ht, ui len, fVector Buf ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::xcorr( const matrix<T>& MA, const matrix<T>& MB );
void matrix<T>::b_xcorr( const matrix<T>& MA, const matrix<T>& MB, vector<T>& Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_xcorr( MC, MA, MB:fMatrix; ht, len:UIntSize );
procedure MFb_xcorr( MC, MA, MB:fMatrix; ht, len:UIntSize; Buf:fVector ); |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_xcorr( fMatrix d_MC, fMatrix d_MA, fMatrix d_MB, ui ht, ui len );
void MFcu_xcorr( fMatrix h_MC, fMatrix h_MA, fMatrix h_MB, ui ht, ui len ); |
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_xcorr( d_MC, d_MA, d_MB:fMatrix; ht, len:UIntSize ): IntBool;
procedure MFcu_xcorr( h_MC, h_MA, h_MB:fMatrix; ht, len:UIntSize );
|
|
Description | The spatial cross-correlation function (SCCF) of MA and MB is calculated and stored in MC in wrap-around order in both dimensions: The row elements MCi,0 to MCi,len/2-1 contain the SCCF for zero and positive x lags. Beginning with the most negative lag in MCi,len/2+1, the elements up to MCi,len-1 contain the SCCF for negative lags. Since this function assumes MA and MB to be periodic, the SCCF for the most positive lag is identical to the SCCF for the most negative lag. This element is stored as MCi,len/2.
Similarly, the column elements MC0,j to MClen/2-1,j contain the SCCF for zero and positive y lags. Beginning with the most negative lag in MClen/2+1,j, the elements up to MClen-1,j contain the SCCF for negative lags.
To get the SCCF into normal order, you may call
MF_Rows_rotate( MC, ht, len, len/2 );
MF_Cols_rotate( MC, ht, len, ht/2 );
After that, the zero point is at the position MCht/2,len/2.
In case MA or MB are non-periodic, you should avoid end effects by the methods described in connection with MF_convolve.
All three matrices involved have the same dimensions. Both ht and len must be integer powers of 2.
Internally, MF_xcorr allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_xcorr instead. For C/C++, the size of Buf must be >= 2*ht*(len+2), for Pascal/Delphi, it must be >= 2*ht*len.Additionally, Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either len or ht is not a power of 2, VF_FFT (on which MF_xcorr is based) complains "Size must be an integer power of 2" and the program is aborted. |
|
|
MF_xspectrum
| MD_xspectrum |
ME_xspectrum |
MF_xspectrumAbs
| MD_xspectrumAbs |
ME_xspectrumAbs |
MFb_xspectrum
| MDb_xspectrum |
MEb_xspectrum |
MFb_xspectrumAbs
| MDb_xspectrumAbs |
MEb_xspectrumAbs |
MFb_xspectrum_sizeBuf
| MDb_xspectrum_sizeBuf |
MEb_xspectrum_sizeBuf |
MFb_xspectrumAbs_sizeBuf
| MDb_xspectrumAbs_sizeBuf |
MEb_xspectrumAbs_sizeBuf |
|
Function | spatial frequency cross spectrum |
|
Syntax C/C++ | #include <MFstd.h>
void MF_xspectrum( cfMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win );
void MFb_xspectrum( cfMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win, fVector Buf );
ui MFb_xspectrum_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX );
void MF_xspectrumAbs( fMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, fMatrix MY, ui htX, ui lenX, fMatrix Win );
void MFb_xspectrumAbs( fMatrix MSpec, ui htSpec, ui lenSpec, fMatrix MX, ui htX, fMatrix MY, ui lenX, fMatrix Win, fVector Buf );
ui MFb_xspectrumAbs_sizeBuf( ui htSpec, ui lenSpec, ui htX, ui lenX ); |
C++ MatObj | #include <OptiVec.h>
void matrix<complex<T>>::xspectrum( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin );
void matrix<complex<T>>::b_xspectrum( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin, vector<T> Buf );
void matrix<T>::xspectrumAbs( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin );
void matrix<T>::b_xspectrumAbs( const matrix<T>& MX, const matrix<T>& MY, const matrix<T>& MWin, vector<T> Buf ); |
Pascal/Delphi | uses MFstd;
procedure MF_xspectrum( MSpec:cfMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_xspectrum( MSpec:cfMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_xspectrum_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize;
procedure MF_xspectrumAbs( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix );
procedure MFb_xspectrumAbs( MSpec:fMatrix; htSpec, lenSpec:UIntSize; MX, MY:fMatrix; htX, lenX:UIntSize; MWin:fMatrix; Buf:fVector );
function MFb_xspectrumAbs_sizeBuf( htSpec, lenSpec, htX, lenX:UIntSize ): UIntSize; |
|
CUDA function C/C++ | #include <cudaMFstd.h>
int cudaMF_xspectrum( cfMatrix d_Spec, ui htSpec, ui lenSpec, fMatrix d_X, fMatrix d_Y, ui htX, ui lenX, fMatrix d_Win );
void MFcu_xspectrum( cfMatrix h_Spec, ui htSpec, ui lenSpec, fMatrix h_X, fMatrix h_Y, ui htX, ui lenX, fMatrix h_Win );
int cudaMF_xspectrumAbs( fMatrix d_Spec, ui htSpec, ui lenSpec, fMatrix d_X, fMatrix d_Y, ui htX, ui lenX, fMatrix d_Win );
void MFcu_xspectrumAbs( fMatrix h_Spec, ui htSpec, ui lenSpec, fMatrix h_X, fMatrix h_Y, ui htX, ui lenX, fMatrix h_Win );
|
CUDA function Pascal/Delphi | uses MFstd;
function cudaMF_xspectrum( d_MSpec:cfMatrix; htSpec, lenSpec:UIntSize; d_MX, d_MY:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;
procedure MFcu_xspectrum( h_MSpec:cfMatrix; htSpec, lenSpec:UIntSize; h_MX, h_MY:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
function cudaMF_xspectrumAbs( d_MSpec:fMatrix; htSpec, lenSpec:UIntSize; d_MX, d_MY:fMatrix; htX, lenX:UIntSize; d_MWin:fMatrix ): IntBool;
procedure MFcu_xspectrumAbs( h_MSpec:fMatrix; htSpec, lenSpec:UIntSize; h_MX, h_MY:fMatrix; htX, lenX:UIntSize; h_MWin:fMatrix );
|
|
Description | The cross spectrum of the two matrices MX and MY is calculated and stored in MSpc.
MF_xspectrum stores the complex cross spectrum (i.e., including phase information), whereas MF_xspectrumAbs covers the more frequent case that only the absolute values are of interest.
The algorithm follows Welch's method of dividing the input data into overlapping segments, similarly to the one-dimensional case described for VF_xspectrum.
MWin is a window that is applied to the data segments. Three functions are available that give suitable
Windows: MF_Welch, MF_Parzen, and MF_Hann. A square window is available by setting all matrix elements equal to 1.0 (MF_equC( MWin, htSpec, lenSpec, 1.0 ); ), but this is not recommended.
htSpec and lenSpec must be integer powers of 2.
Moreover, the following conditions must be fulfilled:
htX >= n*htSpec, lenX >= n*lenSpec, htWin = htSpec, lenWin = lenSpec.
Internally, MF_xspectrum / MF_xspectrumAbs allocates and frees additional workspace memory. For repeated calls, this would be inefficient. In such a case, it is recommended to use MFb_xspectrum / MFb_xspectrumAbs instead. The necessary size of Buf can be obtained by calling the function MFb_xspectrum_sizeBuf / MFb_xspectrumAbs_sizeBuf. It will never need to be more than 7*htX*lenX for MFb_xspectrum and 8*htX*lenX for MFb_xspectrumAbs. Buf must be 128-bit (P8) or 256-bit (P9) aligned. This usually means you can only take a vector allocated by the VF_vector family as Buf. |
|
Error handling | If either htSpec or lenSpec is not a power of 2, VF_FFT (on which MF_xspectrum relies) complains "Size must be an integer power of 2" and the program is aborted. If MSpc overwrites MX, MY, or MWin, an error message "Vectors/matrices must not be identical" is generated and the program aborted. |
|
|
MF_xyzAutoDensityMap
| MD_xyzAutoDensityMap |
ME_xyzAutoDensityMap |
MI_xyzAutoDensityMap | MBI_xyzAutoDensityMap | MSI_xyzAutoDensityMap | MLI_xyzAutoDensityMap | MQI_xyzAutoDensityMap |
MU_xyzAutoDensityMap | MUB_xyzAutoDensityMap | MUS_xyzAutoDensityMap | MUL_xyzAutoDensityMap | MUQ_xyzAutoDensityMap |
|
Function | draw an X-Y coordinate system and plot a color-density map for z = f( x, y ) into it |
|
Syntax C/C++ | #include <Mgraph.h>
void MF_xyzAutoDensityMap( fVector X, fVector Y, fMatrix Z, ui ht, ui len, COLORREF mincolor, COLORREF maxcolor ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::xyzAutoDensityMap( const vector<T>& X, const vector<T>& Y, COLORREF mincolor, COLORREF maxcolor ); |
Pascal/Delphi | uses Mgraph;
procedure MF_xyzAutoDensityMap( X, Y:fVector; MZ:fMatrix; ht, len:UIntSize; mincolor, maxcolor: COLORREF ); |
|
Description | A Cartesian coordinate system is drawn with automatic scaling of the axes and the matrix MZ is plotted as a color-density map against the vectors X and Y. Prior to calling MF_xyzAutoDensityMap, the plotting routines have to be initialized by V_initPlot.
The font of the axis tick labels is the actual text font of the current device context.
All MZ values will be translated into colors by linear interpolation between the parameters mincolor and maxcolor.
The data type COLORREF is unsigned long. The colors BLACK, BLUE, GREEN, CYAN, RED, MAGENTA, BROWN, LIGHTGRAY, DARKGRAY, LIGHTBLUE, LIGHTGREEN, LIGHTCYAN, LIGHTRED, LIGHTMAGENTA, YELLOW, and WHITE are defined in <Vgraph.h> (or the unit Vgraph) by analogy with the COLORS defined decades ago in the DOS BGI routines of Borland. If you wish to have fine-tuned colors, define them by the RGB macro, instead of using these predefined colors.
If you wish to define the boudaries of the coordinate system differently, instead of relying on the automatic range detection and scaling, you may call first M_setDensityMapBounds or (for preserved automatic scaling, but with arbitrary x and y ranges) MF_findDensityMapBounds. Subsequently, call MF_xyzDataDensityMap instead of MF_xyzAutoDensityMap. |
|
|
MF_xyzDataDensityMap
| MD_xyzDataDensityMap |
ME_xyzDataDensityMap |
MI_xyzDataDensityMap | MBI_xyzDataDensityMap | MSI_xyzDataDensityMap | MLI_xyzDataDensityMap | MQI_xyzDataDensityMap |
MU_xyzDataDensityMap | MUB_xyzDataDensityMap | MUS_xyzDataDensityMap | MUL_xyzDataDensityMap | MUQ_xyzDataDensityMap |
|
Function | plot a color density map z = f( x, y ) into an existing coordinate system with a previously defined color scale |
|
Syntax C/C++ | #include <Mgraph.h>
void MF_xyzDataDensityMap( fVector X, fVector Y, fMatrix Z, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::xyzDataDensityMap( const vector<T>& X, const vector<T>& Y ); |
Pascal/Delphi | uses Mgraph;
procedure MF_xyzDataDensityMap( X, Y:fVector; MZ:fMatrix; ht, len:UIntSize ); |
|
|
|
MF_zAutoDensityMap
| MD_zAutoDensityMap |
ME_zAutoDensityMap |
MI_zAutoDensityMap | MBI_zAutoDensityMap | MSI_zAutoDensityMap | MLI_zAutoDensityMap | MQI_zAutoDensityMap |
MU_zAutoDensityMap | MUB_zAutoDensityMap | MUS_zAutoDensityMap | MUL_zAutoDensityMap | MUQ_zAutoDensityMap |
|
Function | plot a color density map of a matrix against the indices over its dimensions |
|
Syntax C/C++ | #include <Mgraph.h>
void MF_zAutoDensityMap( fMatrix Z, ui ht, ui len, COLORREF mincolor, COLORREF maxcolor ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::zAutoDensityMap( COLORREF mincolor, COLORREF maxcolor ); |
Pascal/Delphi | uses Mgraph;
procedure MF_xyzDataDensityMap( X, Y:fVector; MZ:fMatrix; ht, len:UIntSize ); |
|
Description | This function is similar to MF_xyzAutoDensityMap, but here MZ is plotted against the indices of its dimensions instead of explicit X and Y values. |
|
|
MF_zDataDensityMap
| MD_zDataDensityMap |
ME_zDataDensityMap |
MI_zDataDensityMap | MBI_zDataDensityMap | MSI_zDataDensityMap | MLI_zDataDensityMap | MQI_zDataDensityMap |
MU_zDataDensityMap | MUB_zDataDensityMap | MUS_zDataDensityMap | MUL_zDataDensityMap | MUQ_zDataDensityMap |
|
Function | plot a color-density map of a matrix into an existing coordinate system whose axes comprise the range of the indices of the matrix dimensions |
|
Syntax C/C++ | #include <Mgraph.h>
void MF_zDataDensityMap( fMatrix Z, ui ht, ui len ); |
C++ MatObj | #include <OptiVec.h>
void matrix<T>::zDataDensityMap( ); |
Pascal/Delphi | uses Mgraph;
procedure MF_zDataDensityMap( MZ:fMatrix; ht, len:UIntSize ); |
|
Description | This function is similar to MF_xyzDataDensityMap, but here MZ is plotted against the indices of its dimensions instead of explicit X and Y values. |
|
|
MF_2DArrayToMatrix
| MD_2DArrayToMatrix |
ME_2DArrayToMatrix |
MCF_2DArrayToMatrix |
MCD_2DArrayToMatrix |
MCE_2DArrayToMatrix |
MI_2DArrayToMatrix | MBI_2DArrayToMatrix | MSI_2DArrayToMatrix | MLI_2DArrayToMatrix | MQI_2DArrayToMatrix |
MU_2DArrayToMatrix | MUB_2DArrayToMatrix | MUS_2DArrayToMatrix | MUL_2DArrayToMatrix | |
|
Function | convert 2D-array of Delphi 4 or higher into OptiVec matrix |
|
Syntax C/C++ | N.A. |
Pascal/Delphi | uses MFstd, VecLib;
type fArray = array of Single;
type f2DArray = array of fArray;
procedure MF_2DArrayToMatrix( MF:fMatrix; DelphiArr:f2DArray; ht,len:UIntSize); |
|
Description | This function converts two-dimensional Delphi arrays into OptiVec matrices. Note that, unlike static Pascal/Delphi matrices, the dynamic matrices of Delphi cannot directly be passed to OptiVec functions, but have to be converted first. |
|
|
Back to Table of Contents
E N D
Copyright for OptiVec software and documentation
© 1996-2024 OptiCode - Dr. Martin Sander Software Dev.
All rights reserved!