Matrix Utilities
Defines | |
#define | PIX_STACK_SIZE 50 |
Functions | |
cxdouble | giraffe_matrix_sigma_mean (const cpl_matrix *matrix, cxdouble mean) |
Compute sigma of matrix elements, with a given mean value. | |
cxdouble | giraffe_matrix_sigma_fit (const cpl_matrix *matrix, const cpl_matrix *matrix_fit) |
Compute sigma of matrix fit. | |
cpl_image * | giraffe_matrix_create_image (const cpl_matrix *matrix) |
Converts a matrix into an image. | |
cxint | giraffe_matrix_sort (cpl_matrix *mA) |
Sort in place the matrix elements in ascending order. | |
cpl_matrix * | giraffe_matrix_leastsq (const cpl_matrix *mA, const cpl_matrix *mB) |
Computes the solution of an equation using a pseudo-inverse. | |
cpl_matrix * | giraffe_matrix_solve_cholesky (const cpl_matrix *A, const cpl_matrix *b, const cpl_matrix *Cb, cpl_matrix *Cx) |
Solve a linear system using the Cholesky decomposition. | |
cxint | giraffe_matrix_clear (cpl_matrix *matrix) |
Set all elements of a matrix to zero. | |
void | giraffe_matrix_dump (const cpl_matrix *matrix, cxint max_rows) |
Output a maximum number of rows of the input matrix. |
Detailed Description
TBDFunction Documentation
cxint giraffe_matrix_clear | ( | cpl_matrix * | matrix | ) |
Set all elements of a matrix to zero.
- Parameters:
-
matrix The matrix to update.
- Returns:
- The function returns 0 on success, or a non-zero value otherwise.
0
.
Definition at line 804 of file gimatrix.c.
cpl_image* giraffe_matrix_create_image | ( | const cpl_matrix * | matrix | ) |
Converts a matrix into an image.
- Parameters:
-
matrix The matrix to convert.
- Returns:
- The newly image created from the matrix, or
NULL
if the image cannot be created.
Definition at line 345 of file gimatrix.c.
void giraffe_matrix_dump | ( | const cpl_matrix * | matrix, | |
cxint | max_rows | |||
) |
Output a maximum number of rows of the input matrix.
- Parameters:
-
matrix Matrix to print. max_rows Maximum number of rows to print.
- Returns:
- Nothing.
- Note:
- This function should be moved to CPL proper...
Definition at line 844 of file gimatrix.c.
Referenced by giraffe_slitgeometry_print(), and giraffe_wcalsolution_dump().
cpl_matrix* giraffe_matrix_leastsq | ( | const cpl_matrix * | mA, | |
const cpl_matrix * | mB | |||
) |
Computes the solution of an equation using a pseudo-inverse.
- Parameters:
-
mA left hand side [nr, nc] coefficients matrix. mB right hand side [nr, nc] matrix of the equation.
- Returns:
- The function returns the solution vector as a [nr, 1] column matrix.
mX * mA = mB
mX = mB * transpose(mA) * inverse(mA * transpose(mA))
cpl_matrix_delete()
should be used.
- Note:
- This function works properly only in the case all the elements of the input matrix do not contain garbage (such as
NaN
or infinity).
Definition at line 511 of file gimatrix.c.
cxdouble giraffe_matrix_sigma_fit | ( | const cpl_matrix * | matrix, | |
const cpl_matrix * | matrix_fit | |||
) |
Compute sigma of matrix fit.
- Parameters:
-
matrix Original matrix matrix_fit Matrix to compare
- Returns:
- Sigma of fit
- Note:
- This function may be moved to CPL
Definition at line 283 of file gimatrix.c.
cxdouble giraffe_matrix_sigma_mean | ( | const cpl_matrix * | matrix, | |
cxdouble | mean | |||
) |
Compute sigma of matrix elements, with a given mean value.
- Parameters:
-
matrix Input matrix mean Value to be used as mean value during calculation
- Returns:
- Sigma of matrix
- Note:
- This function might be moved to CPL.
Definition at line 237 of file gimatrix.c.
cpl_matrix* giraffe_matrix_solve_cholesky | ( | const cpl_matrix * | A, | |
const cpl_matrix * | b, | |||
const cpl_matrix * | Cb, | |||
cpl_matrix * | Cx | |||
) |
Solve a linear system using the Cholesky decomposition.
- Parameters:
-
A The design matrix of the system b The right hand side of the system Cb The covariance matrix of the right hand side. Cx The covariance matrix of the solution vector.
- Returns:
- The function returns the solution vector of the linear system, or
NULL
in case of an error.
m
times n
matrix, b is an m
times 1
matrix (a column vector), and x is the n
times 1
solution matrix.
A covariance matrix Cb of the right hand side vector b may be given. If it is not NULL, it is when the system is solved. It has to be a m
times m
matrix.
Similarly if the covariance matrix of the solution vector x, Cx, is not NULL
, the computed covariance matrix of the solution is stored there. It must be a n
times n
matrix. Any contents of this matrix is overwritten, and its contents is undetermined if the function returns with an error.
Definition at line 587 of file gimatrix.c.
cxint giraffe_matrix_sort | ( | cpl_matrix * | mA | ) |
Sort in place the matrix elements in ascending order.
- Parameters:
-
mA The matrix to sort.
- Returns:
- 0 on success, -1 on failure
Definition at line 388 of file gimatrix.c.
References PIX_STACK_SIZE.