Download Lib Lib - Fraunhofer SCAI
Transcript
27 3.4 Matrices 3.4.3 Matrix Management Using the following two function one can get the number of rows and columns of a specific matrix. Syntax unsigned int hlib_matrix_rows ( const matrix_t A, int * info ); unsigned int hlib_matrix_columns ( const matrix_t A, int * info ); To obtain a copy of a block cluster tree associated with a matrix, the function Syntax blockcluster_t hlib_matrix_bct ( const matrix_t A, int * info ); is available. In contrast to the copy operations so far, e.g. for cluster trees and block cluster trees, copying a matrix always creates a new matrix. The copy can be either exact or up to a given accuracy. Both operations are done with the functions: Syntax matrix_t hlib_matrix_copy ( const matrix_t A, int * info ); matrix_t hlib_matrix_copy_eps ( const matrix_t A, double eps, int * info ); Arguments eps Block-wise accuracy of the copy compared to A. Deallocating a matrix is accomplished with Syntax void hlib_matrix_free ( matrix_t A, int * info ); Again, please remember to only use this function and not free to prevent undefined behaviour. The memory usage of a specific function can be obtained by Syntax unsigned long hlib_matrix_bytesize ( const matrix_t A, int * info ); In some situations it might be necessary to access single matrix coefficients. For this the following functions are available to return the entry Aij : Syntax double hlib_matrix_entry_get ( const const const int complex_t hlib_matrix_centry_get ( const const const int matrix_t unsigned int unsigned int A, i, j, * info ); matrix_t A, unsigned int i, unsigned int j, * info );