Localized Orbital Scaling Correction (LOSC) C library
matrix.h File Reference

The C interface of matrix used in LOSC. More...

#include <stddef.h>

Go to the source code of this file.

Macros

#define losc_matrix_free(ptr)   _losc_matrix_free(&(ptr))
 Free the losc_matrix. More...
 

Typedefs

typedef struct losc_matrix losc_matirx
 losc_matrix More...
 

Functions

losc_matrix * losc_matrix_create (size_t row, size_t col)
 Create a LOSC matrix object with data allocated. More...
 
losc_matrix * losc_matrix_create_from_data (size_t row, size_t col, double *data)
 Create a LOSC matrix object with data owned externally. More...
 
double * losc_matrix_data (losc_matrix *m)
 Return the pointer that points to the head of matrix data. More...
 
const double * losc_matrix_data_const (const losc_matrix *m)
 Return the const pointer that points to the head of matrix data. More...
 
size_t losc_matrix_rows (const losc_matrix *m)
 Return the number of rows.
 
size_t losc_matrix_cols (const losc_matrix *m)
 Return the number of columns.
 

Detailed Description

The C interface of matrix used in LOSC.

The struct losc_matrix is used to represent matrix object and shared between the C code and C++ LOSC library. The C users only need the interface as provided in this header file to use struct losc_matrix. The implementation of struct losc_matrix is hid.

Macro Definition Documentation

#define losc_matrix_free (   ptr)    _losc_matrix_free(&(ptr))

Free the losc_matrix.

Parameters
[in,out]ptra pointer with type losc_matrix *. At exit, ptr is set to null.

Typedef Documentation

typedef struct losc_matrix losc_matirx

losc_matrix

Note
The complete definition of losc_matrix is hid.

Function Documentation

losc_matrix* losc_matrix_create ( size_t  row,
size_t  col 
)

Create a LOSC matrix object with data allocated.

Parameters
[in]rownumber of rows.
[in]colnumber of columns.
Returns
Create a matrix and return the pointer.
losc_matrix* losc_matrix_create_from_data ( size_t  row,
size_t  col,
double *  data 
)

Create a LOSC matrix object with data owned externally.

Parameters
[in]rownumber of rows.
[in]colnumber of columns.
[in]datadata points to an array which represents a matrix with dimension of [row, col]. The matrix is assumed to be stored in row-major. The size of the array is assumed to be at least row x col.
Returns
Create a matrix and return the pointer.
Note
This created matrix does not own the data.
double* losc_matrix_data ( losc_matrix *  m)

Return the pointer that points to the head of matrix data.

Parameters
[in]ma losc_matrix pointer.
const double* losc_matrix_data_const ( const losc_matrix *  m)

Return the const pointer that points to the head of matrix data.

Parameters
[in]ma const losc_matrix pointer.