00001 00002 /** @file psMatrix.h 00003 * 00004 * @brief Provides functions for linear algebra operations on psImages and psVectors. 00005 * 00006 * Functions are provided to: 00007 * Transpose a psImage 00008 * Compute LUD 00009 * Solve LUD 00010 * Matrix inversion 00011 * Calculate determinant 00012 * Matrix multiplication 00013 * Calculate Eigenvectors 00014 * Convert matrix to vector 00015 * Convert vector to matrix 00016 * 00017 * These functions treat psImages as if they were matrices, therefore there is no psMatrix. These functions 00018 * operate only with the psF64 data type. 00019 * 00020 * @ingroup Matrix 00021 * 00022 * @author Ross Harman, MHPCC 00023 * 00024 * @version $Revision: 1.15 $ $Name: rel5_0 $ 00025 * @date $Date: 2005/02/17 19:26:23 $ 00026 * 00027 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00028 */ 00029 00030 #ifndef PSMATRIX_H 00031 #define PSMATRIX_H 00032 00033 /// @addtogroup Matrix 00034 /// @{ 00035 00036 /** LU Decomposition of psImage matrix. 00037 * 00038 * Performs a LU decomposition on a psImage matrix and returns the LU matrix. If the user specifies NULL for 00039 * the outImage or outPerm arguments, then they will be automatically created. The input image must 00040 * be square. This function operates only with the psF64 data type. Input and output arguments should not be 00041 * the same. GSL indexes the top row as the zero row, not the bottom. 00042 * 00043 * @return psImage* : Pointer to LU decomposed psImage. 00044 */ 00045 psImage* psMatrixLUD( 00046 psImage* outImage, ///< Image to return, or NULL. 00047 psVector** outPerm, ///< Output permutation vector used by psMatrixLUSolve. 00048 psImage* inImage ///< Image to decompose. 00049 ); 00050 00051 /** LU Solution of psImage matrix. 00052 * 00053 * Solves for and returns the psVector, {x} in the equation [A]{x} = {b}. If the user specifies NULL as the 00054 * outVector argument, then it will automatically be created. The input image must be square. This function 00055 * operates only with the psF64 data type. Input and output arguments should not be the same. GSL indexes 00056 * the top row as the zero row, not the bottom. 00057 * 00058 * @return psVector* : Pointer to psVector solution of matrix equation. 00059 */ 00060 psVector* psMatrixLUSolve( 00061 psVector* outVector, ///< Vector to return, or NULL. 00062 const psImage* luImage, ///< LU-decomposed matrix. 00063 const psVector* inVector, ///< Vector right-hand-side of equation. 00064 const psVector* inPerm ///< Permutation vector resulting from psMatrixLUD function. 00065 ); 00066 00067 /** Invert psImage matrix. 00068 * 00069 * Inverts a psImage matrix and returns the determinant as an option through the argument list. If the user 00070 * specifies NULL as the outImage argument, then it will automatically be created. The input image must be 00071 * square. This function operates only with the psF64 data type. Input and output arguments should not be 00072 * the same. GSL indexes the top row as the zero row, not the bottom. 00073 * 00074 * @return psImage* : Pointer to inverted psImage. 00075 */ 00076 psImage* psMatrixInvert( 00077 psImage* outImage, ///< Image to return, or NULL for in-place substitution. 00078 const psImage* inImage, ///< Image to be inverted 00079 psF32 *det ///< Determinant to return, or NULL 00080 ); 00081 00082 /** Calculate psImage matrix determinant. 00083 * 00084 * Calculates the determinant of a psImage matrix and returns the single precision floating point result. The 00085 * input image must be square. This function operates only with the psF64 data type. GSL indexes the top row 00086 * as the zero row, not the bottom. 00087 * 00088 * @return float: Determinant from psImage. 00089 */ 00090 psF32 *psMatrixDeterminant( 00091 const psImage* inMatrix ///< Image used to calculate determinant. 00092 ); 00093 00094 /** Performs psImage matrix multiplication. 00095 * 00096 * Performs a classical matrix multiplication involving row and column operations. Input images must be square 00097 * and the same size. If the user specifies NULL as the outImage argument, then it will automatically be 00098 * created. This function operates only with the psF64 data type. GSL indexes the top row as the 00099 * zero row, not the bottom. 00100 * 00101 * @return psImage* : Pointer to resulting psImage. 00102 */ 00103 psImage* psMatrixMultiply( 00104 psImage* outImage, ///< Matrix to return, or NULL. 00105 psImage* inImage1, ///< First input image. 00106 psImage* inImage2 ///< Second input image. 00107 ); 00108 00109 /** Transpose matrix. 00110 * 00111 * Performs psImage matrix transpose by substituting existing rows for columns. The input image must be 00112 * square. If the user specifies NULL as the outImage argument, then it will automaticallty be created. 00113 * This function operates only with the psF64 data type. GSL indexes the top row as the zero 00114 * row, not the bottom. 00115 * 00116 * @return psImage* : Pointer to transposed psImage. 00117 */ 00118 psImage* psMatrixTranspose( 00119 psImage* outImage, ///< Image to return, or NULL 00120 const psImage* inImage ///< Image to transpose 00121 ); 00122 00123 /** Calculate matrix eigenvectors. 00124 * 00125 * Calculates the eigenvectors for a matrix. The input image must be symmetric and square. If the user 00126 * specifies NULL as the outImage argument, then it will automatically be created. This function operates 00127 * only with the psF64 data type. GSL indexes the top row as the zero row, not the bottom. 00128 * 00129 * @return psImage* : Pointer to matrix of Eigenvectors. 00130 */ 00131 psImage* psMatrixEigenvectors( 00132 psImage* outImage, ///< Eigenvectors to return, or NULL. 00133 psImage* inImage ///< Input image. 00134 ); 00135 00136 /** Convert matrix to vector. 00137 * 00138 * Converts a 1-d psImage matrix into a vector. If the user specifies NULL as the outVector argument, then it 00139 * will automatically be created based on the input image (PS_DIMEN_VECTOR for an input image with 1 col or 00140 * PS_DIMENT_TRANSV for an input image with 1 row). Either the number of rows or the number of colums of the 00141 * input matrix must be 1. This function operates only with the psF64 data type. 00142 * 00143 * @return psVector* : Pointer to psVector. 00144 */ 00145 psVector* psMatrixToVector( 00146 psVector* outVector, ///< Vector to return, or NULL. 00147 const psImage* inImage ///< Image to convert. 00148 ); 00149 00150 /** Convert vector to matrix. 00151 * 00152 * Converts a vector into a psImage matrix. If the dimensionality of the vector is PS_DIMEN_VECTOR, then the 00153 * resulting psImage is a 1d column. If the dimensionality of the vector is PS_DIMEN_TRANSV, then the 00154 * resulting psImage is a 1d row. If the user specifies NULL as the outImage argument, then it will 00155 * automatically be created. This function operates only with the psF64 data type. 00156 * 00157 * @return psVector* : Pointer to psIamge. 00158 */ 00159 psImage* psVectorToMatrix( 00160 psImage* outImage, ///< Matrix to return, or NULL. 00161 const psVector* inVector ///< Vector to convert. 00162 ); 00163 00164 /// @} 00165 00166 #endif
1.3.9.1