C-callable Interface to the Matrix object

Function definitions


MATRIX_put_row
MATRIX_allocate_memory
MATRIX_print
MATRIX_assign_name
MATRIX_assign_name_if_new
MATRIX_copy_in
MATRIX_copy_out
int MATRIX_set_zero
int MATRIX_set_unit
int MATRIX_set_value
int MATRIX_increment_value
int MATRIX_scale
int MATRIX_get_value
MATRIX_print_patch
MATRIX_print_patch_v
MATRIX_assign
MATRIX_assign_3d
MATRIX_copy
float MATRIX_dot
int MATRIX_copy_data
int MATRIX_subtract

MATRIX_put_row

Arguments:

 Matrix m                       matrix to write to                                
 int row                        row to be replaced                                
 float *a                       data values                                       
 int n                          number of elements to be replaced                 
Copies a vector into a row of a Matrix.

MATRIX_allocate_memory

Arguments:

 Matrix m                       input matrix                                      
 int nd                         number of dimension of m                          
 int np[MAXDIM]                 dimension values                                  
 int type                       matrix type                                       
Allocate space for a matrix. The Matrix must already exist.

MATRIX_print

Arguments:

 Matrix m                       Matrix to print                                   
 char *format                   C-style print format                              
Prints an entire matrix (lousy formating)

MATRIX_assign_name

Arguments:

 Matrix m                       Input matrix                                      
 char *s                        Required name                                     
Set the title of a matrix

MATRIX_assign_name_if_new

Arguments:

 Matrix m                       Input matrix                                      
 char *s                        Required name                                     
Set the title of a matrix, but only if the name is not already initialised.

MATRIX_copy_in

Arguments:

 Matrix m                       matrix                                            
 float *d                       data to copy in                                   
 int *nd                        required number of dimensions                     
 int ilim[]                     required dimensions                               
Allocates memory and stores data in the matrix

MATRIX_copy_out

Arguments:

 Matrix m                       IN  matrix                                        
 float **d                      OUT result array                                  
 int *limits                    OUT limits of matrix                              
 char **title                   OUT title                                         
Allocate an array and fill with data from the matrix Memory is also allocated for the title string

int MATRIX_set_zero

Arguments:

 Matrix m                       matrix to be zeroed                               
Set all elements of the matrix to zero

int MATRIX_set_unit

Arguments:

 Matrix m                       matrix to be set to unit                          
Set all a matrix to the unit matrix

int MATRIX_set_value

Arguments:

 Matrix m                       Matrix to be manipulated                          
 int *index                     Array of indices defining the element             
 float d                        Value of to be assigned                           
Set a single element of a matrix to the value provided

int MATRIX_increment_value

Arguments:

 Matrix m                       Matrix to access                                  
 int *index                     Array of indices                                  
 float d                        Value to be summed in                             
Add a value to an element of a matrix

int MATRIX_scale

Arguments:

 Matrix m                       Matrix to access                                  
 float fac                      Scale factor                                      
Multiple all elements of a matrix by a scale factor

int MATRIX_get_value

Arguments:

 Matrix m                       Matrix to access                                  
 int *index                     Array of indices                                  
 float *d                       pointer to variable to receive the value          
Access an element of a matrix

MATRIX_print_patch

Arguments:

 Matrix m                                                                         
 char *format                                                                     
 char *rows                                                                       
 char *columns                                                                    
 int width                                                                        
print a patch of a matrix, using a sensible pattern for the rows this routine is designed for 2d matrices.

MATRIX_print_patch_v

Arguments:

 Matrix m                       IN (nxm) matrix to be printed                     
 Matrix v                       IN (nx1) Matrix to head columns                   
 char *format                   IN C format statement for printing                
 char *rows                     spec of rows to print                             
 char *columns                  spec of columns to print                          
 int  width                     number oc columns per page                        
Prints a patch of a matrix, with each column heading derived from another matrix

rows and column specifications are of the form 1-10


MATRIX_assign

Arguments:

 Matrix to                      Source matrix                                     
 Matrix from                    Destination matrix                                
 int rows[]                     list of destination rows to copy to               
 int cols[]                     list of destination columns to copy to            
Assigns some elements of the destination matrix from all elements of a source matrix. The source and destination matrices do not have to be the same shape, and mapping arrays are provided to indicate the rows and columns into which the data are to be copied. These should have the correct length (ie the relevant dimension of the source matrix).

MATRIX_assign_3d

Arguments:

 Matrix to                      Source matrix                                     
 Matrix from                    Destination matrix                                
 int rows[]                     list of destination rows to copy to               
 int cols[]                     list of destination columns to copy to            
 int planes[]                   list of destination planes to copy to             
3d version of MATRIX_assign. The arrays can be any number of dimensions up to 3 but mapping should be specified in 3 dimensions. (i.e. a 3x3 matrix is treated as if it is 3x3x1 - which is identical w.r.t. how the data is stored in the d array) This means that a 2d matrix can be used to assign a plane of a 3d matrix, etc.

MATRIX_copy

Arguments:

 Matrix to                      Destination matrix                                
 Matrix from                    Source matrix                                     
Copy all elements of one matrix to another, Memory is allocated in the destination matrix and the title is copied also.

float MATRIX_dot

Arguments:

 Matrix m1                      Matrix to access                                  
 Matrix m2                      Second matrix                                     
Dot product function for matrices, assumes matrices are the same shape

int MATRIX_copy_data

Arguments:

 Matrix m1                      Matrix to access                                  
 Matrix m2                      Second matrix                                     
Copy function for matrices, assumes matrices are the same shape - only copies data, no reallocation.

int MATRIX_subtract

Arguments:

 Matrix m1                      Matrix to access                                  
 Matrix m2                      Second matrix                                     
 Matrix m3                      Result matrix                                     
Subtract function for matrices, assumes matrices are the same shape