Robotran C Documentation
Functions
mbs_matrix.h File Reference
#include <stdio.h>

Go to the source code of this file.

Functions

void transpose (double M[4][4], double Mt[4][4])
 Compute the transpose of a matrix with first index is 1. More...
 
void matrix_product (double M[4][4], double v[4], double Mv[4])
 Compute the product of a matrix by a vector. The first index is 1. More...
 
void matrix_product_0 (double **M, double *v, double *Mv, int nr, int nc)
 Compute the product of a matrix by a vector. The first index is 0. More...
 
void matrix_product_1 (double **M, double *v, double *v_out, int nr, int nc)
 Compute the product of a matrix by a vector. The first index is 1. More...
 
void doublematrix_product (double M1[4][4], double M2[4][4], double M[4][4])
 Compute the product of two matrices. The first index is 1. More...
 
void doublematrix_product_0 (double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M)
 Compute the product of two matrices of given shape. The first index is 0. More...
 
void doublematrix_product_1 (double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M)
 Compute the product of two matrices of given shape. The first index is 1. More...
 
void rotation_matrix (int type, double angle, double R[4][4])
 Compute the rotation matrix for a specified angle around a specific axis. The first index is 1. More...
 
int ** get_imat_0 (int nb_r, int nb_c)
 create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 0 More...
 
int ** get_imat_1 (int nb_r, int nb_c)
 create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 1 More...
 
void free_imat_0 (int **mat)
 release memory for a matrix of integers, starting with index 0 More...
 
void free_imat_1 (int **mat)
 release memory for a matrix of integers, starting with index 1 More...
 
void copy_imat_0 (int **tab_src, int **tab_dest, int nb_r, int nb_c)
 Copy the content of a [nb_r times nb_c] matrix of integers to a second matrix, starting with index 0. More...
 
void print_imat_0 (int **mat, int nb_r, int nb_c)
 print a [nb_r times nb_c] matrix of integers in console, starting with index 0 More...
 
double ** get_dmat_0 (int nb_r, int nb_c)
 create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 0 More...
 
double ** get_dmat_1 (int nb_r, int nb_c)
 create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1 More...
 
double ** get_contdmat_1 (int nb_r, int nb_c)
 create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1. The allocated memory is CONTIGUOUS (adapted for Lapack routine) More...
 
void free_dmat_0 (double **mat)
 release memory for a matrix of doubles, starting at index 0 More...
 
void free_dmat_1 (double **mat)
 release memory for a matrix of doubles, starting at index 1 More...
 
void copy_dmat_0 (double **tab_src, double **tab_dest, int nb_r, int nb_c)
 Copy the content of a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0. More...
 
void copy_dmat_1 (double **src, double **dest, int x, int y)
 Copy the content of a [x times y] matrix of doubles to a second matrix, starting with index 1. More...
 
double ** re_copy_dmat_0 (double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
 Copy a 2D array of double into another, reallocate the destination if required. More...
 
double ** re_copy_dmat_1 (double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
 Copy a 2D array of double into another, reallocate the destination if required. More...
 
void transpose_dmat_0 (double **tab_src, double **tab_dest, int nb_r, int nb_c)
 Transpose a [nb_r times nb_c] matrix of doubles and store the results in a [y times nb_r] matrix, starting with index 0. More...
 
void transpose_dmat_1 (double **tab_src, double **tab_dest, int x, int y)
 Transpose a [x times y] matrix of doubles and store the results in a [y times x] matrix, starting with index 1. More...
 
void print_dmat_0 (double **mat, int nb_r, int nb_c)
 print a [nb_r times nb_c] matrix of doubles in console, starting with index 0 More...
 
void print_format_dmat_0 (double **mat, int nb_r, int nb_c, char *format)
 print a [nb_r times nb_c] matrix of doubles in console, starting with index 0 More...
 
int read_dmat_0 (double **mat, int nb_r, int nb_c, const char *name)
 read a [nb_r times nb_c] matrix of doubles from a file starting with index 0 and store the values in a matrix provided by the user. The first nb_r line of the file are loaded, other lines are ignored. More...
 
double ** load_dmat_0 (int nb_r, int nb_c, char *name)
 load a [nb_r times nb_c] matrix of doubles from a file starting with index 0. The matrix is created (memory allocation) and filled with the values from the file. More...
 
void save_dmat_0 (double **mat, int nb_r, int nb_c, char *name)
 save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open with the option "wt" More...
 
void save_format_dmat_0 (double **mat, int nb_r, int nb_c, char *name, char *format)
 save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open with the option "wt" More...
 
int code_dmat_0 (FILE *file_out, double **values, const char *name, int n_row, int n_col)
 Write C-code to allocate and fill an array of arrays of doubles. More...
 
int code_dmat_1 (FILE *file_out, double **values, const char *name, int n_row, int n_col)
 Write C-code to allocate and fill an array of arrays of doubles. More...
 
int slct_dmat_0 (double **tab_src, int nb_r, int nb_c, double **tab_out, int l_vec, int *vec)
 fill the second [nb_r times l_vec] matrix by selecting the columns of the first [nb_r times nb_c] matrix of doubles. The indexes of the columns are specified in the (l_vec sized) vector, starting with index 0 More...
 
int slctr_dmat_0 (double **tab_src, int nb_r, int nb_c, double **tab_dest, int l_vec, int *vec)
 fill the second [l_vec times nb_c] matrix by selecting the rows of the first [nb_r times nb_c] matrix of doubles. The indexes of the rows are specified in the (l_vec sized) vector, starting with index 0 More...
 
void zeros_dmat_0 (double **mat, int nb_r, int nb_c)
 set all the element of a [nb_r times nb_c] matrix of doubles to zero, starting with index 0 More...
 
void mult_dmat_0 (double **A, double **B, double **C, int n1, int n2, int n3)
 function to multiply two matrices: A * B = C [n1 n2] [n2 n3] = [n1 n3] More...
 
void sum_dmat_0 (double **A, double **B, double **C, int n1, int n2)
 function to sum two matrices: A + B = C More...
 
void diff_dmat_0 (double **A, double **B, double **C, int n1, int n2)
 function to sum two matrices: A - B = C More...
 
void opposite_dmat_0 (double **A, int n1, int n2)
 function to take the opposite of a given matrix (minus in front of each entry) More...
 
void readmatrix (double **matrix, int *n)
 function to read a matrix (obsolete?) More...
 
int get_dmatfiles_size (const char *fileName, int *n_row, int *n_col)
 Function to load a file and calculate the number of rows and columns. More...
 
void update_initzeros (int *initzeros, double **matrix, int *n)
 function to update the initzeros array (obsolete?) More...
 
void arrange_matrix (double **matrix, int *n, int *initzeros)
 function to arrange matrix (obsolete?) More...
 
void scale_matrix (double **matrix, int *n, int *initzeros)
 function to scale matrix (obsolete?) More...
 
void copy_array_dmat_1 (double src[4][4], double **dest)
 Copy the content of an array of doubles to a pointer of matrix, starting with index 1. More...
 
int same_dmat_0 (double **a, double **b, int x, int y)
 Compare if two 2D arrays of floats are the same. More...
 

Detailed Description

The header declare functions related to 2D (or more) array operation. This include matrix-vector mixed operations. Some functions are still located in file mbs_utilities.h.

Creation date: 2006

Author
Robotran team

(c) Universite catholique de Louvain

Function Documentation

◆ arrange_matrix()

void arrange_matrix ( double **  matrix,
int *  n,
int *  initzeros 
)

function to arrange matrix (obsolete?)

Parameters
[in,out]matrixthe matrix
[in]nthe vector
[in,out]initzerosthe vector to arrange

◆ code_dmat_0()

int code_dmat_0 ( FILE *  file_out,
double **  values,
const char *  name,
int  n_row,
int  n_col 
)

Write C-code to allocate and fill an array of arrays of doubles.

Parameters
file_outStream in which writing the values.
valuesPointer to the array of arrays to be written (index starts at 0).
nameName of the variable to be filled.
n_rowThe number of rows in the array.
n_colThe number of columns in the array.
Returns
Negative in case of error, 0 if code was generated.

◆ code_dmat_1()

int code_dmat_1 ( FILE *  file_out,
double **  values,
const char *  name,
int  n_row,
int  n_col 
)

Write C-code to allocate and fill an array of arrays of doubles.

Parameters
file_outStream in which writing the values.
valuesPointer to the array of arrays to be written (index starts at 1).
nameName of the variable to be filled.
n_rowThe number of rows in the array (not counting index 0).
n_colThe number of columns in the array (not counting index 0).
Returns
Negative in case of error, 0 if code was generated.

◆ copy_array_dmat_1()

void copy_array_dmat_1 ( double  src[4][4],
double **  dest 
)

Copy the content of an array of doubles to a pointer of matrix, starting with index 1.

Only the content (inner 3x3 submatrix) is copied. The first row and column are not copied.

Parameters
[in]srcThe array[4][4] of doubles.
[out]destThe pointer to the matrix destination

◆ copy_dmat_0()

void copy_dmat_0 ( double **  tab_src,
double **  tab_dest,
int  nb_r,
int  nb_c 
)

Copy the content of a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0.

Parameters
[in]tab_srcthe original matrix of doubles, starting with index 0
[out]tab_destthe copy of tab_src, starting with index 0
[in]nb_rnb of rows
[in]nb_cnb of columns

◆ copy_dmat_1()

void copy_dmat_1 ( double **  src,
double **  dest,
int  x,
int  y 
)

Copy the content of a [x times y] matrix of doubles to a second matrix, starting with index 1.

Parameters
[in]srcthe original matrix of doubles, starting with index 1
[out]destthe copy of tab1, starting with index 1
[in]xnb of rows (without counting the unused first row)
[in]ynb of columns (without counting the unused first column)

◆ copy_imat_0()

void copy_imat_0 ( int **  tab_src,
int **  tab_dest,
int  nb_r,
int  nb_c 
)

Copy the content of a [nb_r times nb_c] matrix of integers to a second matrix, starting with index 0.

Parameters
[in]tab_srcthe original matrix of integer, starting with index 0
[out]tab_destthe copy of tab_src, starting with index 0
[in]nb_rnb of rows
[in]nb_cnb of columns

◆ diff_dmat_0()

void diff_dmat_0 ( double **  A,
double **  B,
double **  C,
int  n1,
int  n2 
)

function to sum two matrices: A - B = C

Parameters
[in]Athe matrix A
[in]Bthe matrix B
[out]Cthe matrix C
[in]n1first size
[in]n2second size

◆ doublematrix_product()

void doublematrix_product ( double  M1[4][4],
double  M2[4][4],
double  M[4][4] 
)

Compute the product of two matrices. The first index is 1.

The matrices have unused index 0. See get_dmat_1() to such matrix and vector creation.

Parameters
[in]M1matrix of size 4x4 with first line and row unused.
[in]M2matrix of size 4x4 with first line and row unused.
[in,out]Mmatrix of size 4x4 such as $ \textbf{M} = \textbf{M1} \ \textbf{M2} $ with first line and row unused.

◆ doublematrix_product_0()

void doublematrix_product_0 ( double **  M1,
int  nb_row_M1,
int  nb_col_M1,
double **  M2,
int  nb_col_M2,
double **  M 
)

Compute the product of two matrices of given shape. The first index is 0.

The memory of the output matrix M must already been allocated. See get_dmat_0() to such matrix creation.

Parameters
[in]M1matrix of size (nb_row_M1 x nb_col_M1).
[in]nb_row_M1number of rows of the matrix M1.
[in]nb_col_M1number of columns of the matrix M1.
[in]M2matrix of size (nb_col_M1 x nb_col_M2).
[in]nb_col_M2number of columns of the matrix M2.
[in,out]Mmatrix of size (nb_row_M1 x nb_col_M2) such as $ \textbf{M} = \textbf{M1} \ \textbf{M2} $.

◆ doublematrix_product_1()

void doublematrix_product_1 ( double **  M1,
int  nb_row_M1,
int  nb_col_M1,
double **  M2,
int  nb_col_M2,
double **  M 
)

Compute the product of two matrices of given shape. The first index is 1.

The memory of the output matrix M must already been allocated. See get_dmat_1() to such matrix creation.

Parameters
[in]M1matrix of size (nb_row_M1 x nb_col_M1) plus first line and row unused.
[in]nb_row_M1number of rows of the matrix M1 (without counting the unused first row/colum).
[in]nb_col_M1number of columns of the matrix M1 (without counting the unused first row/colum).
[in]M2matrix of size (nb_col_M1 x nb_col_M2) plus first line and row unused.
[in]nb_col_M2number of columns of the matrix M2 (without counting the unused first row/colum).
[in,out]MMatrix of size (nb_row_M1 x nb_col_M2) such as $ \textbf{M} = \textbf{M1} \ \textbf{M2} $.

◆ free_dmat_0()

void free_dmat_0 ( double **  mat)

release memory for a matrix of doubles, starting at index 0

Parameters
[out]matmatrix of doubles

◆ free_dmat_1()

void free_dmat_1 ( double **  mat)

release memory for a matrix of doubles, starting at index 1

Parameters
[out]matmatrix of doubles

◆ free_imat_0()

void free_imat_0 ( int **  mat)

release memory for a matrix of integers, starting with index 0

Parameters
[out]matmatrix of integers

◆ free_imat_1()

void free_imat_1 ( int **  mat)

release memory for a matrix of integers, starting with index 1

Parameters
[out]matmatrix of integers

◆ get_contdmat_1()

double** get_contdmat_1 ( int  nb_r,
int  nb_c 
)

create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1. The allocated memory is CONTIGUOUS (adapted for Lapack routine)

Parameters
[in]nb_rnb of rows (0 element not taken into account)
[in]nb_cnb of columns (0 element not taken into account)
Returns
requested matrix of doubles

◆ get_dmat_0()

double** get_dmat_0 ( int  nb_r,
int  nb_c 
)

create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 0

Parameters
[in]nb_rnb of rows
[in]nb_cnb of columns
Returns
requested matrix of doubles

◆ get_dmat_1()

double** get_dmat_1 ( int  nb_r,
int  nb_c 
)

create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1

Parameters
[in]nb_rnb of rows (0 element not taken into account)
[in]nb_cnb of columns (0 element not taken into account)
Returns
requested matrix of doubles

◆ get_dmatfiles_size()

int get_dmatfiles_size ( const char *  fileName,
int *  n_row,
int *  n_col 
)

Function to load a file and calculate the number of rows and columns.

Parameters
[in]fileNameName of the file containing the results to load.
The first column contains the time.
The other columns contain the coordinates.
[in,out]n_rownb of rows
[in,out]n_colnb of columns
Returns
0 if the function succeden in calculating the number of rows and columns, \ otherwise -1

◆ get_imat_0()

int** get_imat_0 ( int  nb_r,
int  nb_c 
)

create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 0

Parameters
[in]nb_r= nb of rows
[in]nb_c= nb of columns
Returns
requested matrix of integers

◆ get_imat_1()

int** get_imat_1 ( int  nb_r,
int  nb_c 
)

create (with memory allocation) a [nb_r times nb_c] matrix of integers, starting at index 1

Parameters
[in]nb_r= nb of rows (0 element not taken into account)
[in]nb_c= nb of columns (0 element not taken into account)
Returns
requested matrix of integers

◆ load_dmat_0()

double** load_dmat_0 ( int  nb_r,
int  nb_c,
char *  name 
)

load a [nb_r times nb_c] matrix of doubles from a file starting with index 0. The matrix is created (memory allocation) and filled with the values from the file.

Parameters
[in]nb_rnb of rows
[in]nb_cnb of columns
[in]namethe path an name of the file in which loading the matrix

◆ matrix_product()

void matrix_product ( double  M[4][4],
double  v[4],
double  Mv[4] 
)

Compute the product of a matrix by a vector. The first index is 1.

The matrices and vector have unused index 0. See get_dmat_1() and get_dvec_1() to such matrix and vector creation.

Parameters
[in]Mmatrix of size 4x4 with first line and row unused, will be multiplied by v.
[in]vvector of size 4 with first element unused.
[in,out]Mvmatrix of size 4x4 such as $ \textbf{Mv} = \textbf{M} \overrightarrow{v} $ with first line and row unused.

◆ matrix_product_0()

void matrix_product_0 ( double **  M,
double *  v,
double *  Mv,
int  nr,
int  nc 
)

Compute the product of a matrix by a vector. The first index is 0.

See get_dmat_0() and get_dvec_0() to such matrix and vector creation.

Parameters
[in]Mmatrix of size nr x nc, will be multiplied by v.
[in]vvector of size nc.
[in]nrnumber of rows of the matrix M and size of the vector Mv.
[in]ncnumber of columns of the matrix M and size of the vector v.
[in,out]Mvmatrix such as $ \textbf{Mv} = \textbf{M} \overrightarrow{v} $ with first index 0.

◆ matrix_product_1()

void matrix_product_1 ( double **  M,
double *  v,
double *  v_out,
int  nr,
int  nc 
)

Compute the product of a matrix by a vector. The first index is 1.

See get_dmat_1() and get_dvec_1() to such matrix and vector creation.

Parameters
[in]Mmatrix of size nr x nc (with first line and row unused not counted), will be multiplied by v.
[in]vvector of size nc (with first element unused not counted).
[in]nrnumber of rows of the matrix M and size of the vector Mv (without counting the unused first row/colum).
[in]ncnumber of columns of the matrix M and size of the vector v (without counting the unused first row/colum).
[in,out]v_outVector such as $ \textbf{v\_out} = \textbf{M} \overrightarrow{v} $ with first index 1.

◆ mult_dmat_0()

void mult_dmat_0 ( double **  A,
double **  B,
double **  C,
int  n1,
int  n2,
int  n3 
)

function to multiply two matrices: A * B = C [n1 n2] [n2 n3] = [n1 n3]

Parameters
[in]Athe matrix A
[in]Bthe matrix B
[out]Cthe matrix C
[in]n1first size
[in]n2second size
[in]n3third size

◆ opposite_dmat_0()

void opposite_dmat_0 ( double **  A,
int  n1,
int  n2 
)

function to take the opposite of a given matrix (minus in front of each entry)

Parameters
[in]Athe matrix A
[in]n1first size
[in]n2second size

◆ print_dmat_0()

void print_dmat_0 ( double **  mat,
int  nb_r,
int  nb_c 
)

print a [nb_r times nb_c] matrix of doubles in console, starting with index 0

call print_format_dmat_0 with default parameter (format = "% -f").

Parameters
[in]matthe matrix to be printed
[in]nb_rnb of rows
[in]nb_cnb of columns

◆ print_format_dmat_0()

void print_format_dmat_0 ( double **  mat,
int  nb_r,
int  nb_c,
char *  format 
)

print a [nb_r times nb_c] matrix of doubles in console, starting with index 0

Parameters
[in]matthe matrix to be printed
[in]nb_rnb of rows
[in]nb_cnb of columns
[in]formatthe chosen format.

◆ print_imat_0()

void print_imat_0 ( int **  mat,
int  nb_r,
int  nb_c 
)

print a [nb_r times nb_c] matrix of integers in console, starting with index 0

Parameters
[in]matthe matrix to be printed
[in]nb_rnb of rows
[in]nb_cnb of columns

◆ re_copy_dmat_0()

double** re_copy_dmat_0 ( double **  src,
int  s_nx,
int  s_ny,
double **  dest,
int  d_nx,
int  d_ny 
)

Copy a 2D array of double into another, reallocate the destination if required.

Parameters
[in]srcSource array to be copied, NULL pointer will free dest.
[in]s_nxSize along axis 0 of the source array, 0 value will free dest.
[in]s_nySize along axis 1 of the source array, 0 value will free dest.
[out]destDestination array to be filled. The array is reallocated if s_nx does not match d_nx. It is allocated if NULL is provided.
[in]d_nxSize along axis 0 of the source array. If 0, dest is reallocated.
[in]d_nySize along axis 1 of the source array. If 0, dest is reallocated.
Returns
NULL if dest has been freed, the pointer to the memory containing the copy. If (re)allocation has occured, the memory is CONTIGUOUS.

◆ re_copy_dmat_1()

double** re_copy_dmat_1 ( double **  src,
int  s_nx,
int  s_ny,
double **  dest,
int  d_nx,
int  d_ny 
)

Copy a 2D array of double into another, reallocate the destination if required.

Parameters
[in]srcSource array to be copied, NULL pointer will free dest.
[in]s_nxSize along axis 0 of the source array.
[in]s_nySize along axis 1 of the source array.
[out]destDestination array to be filled. The array is reallocated if s_nx and s_ny does not match d_nx and d_ny. It is allocated if NULL is provided.
[in]d_nxSize along axis 0 of the source array.
[in]d_nySize along axis 1 of the source array.
Returns
NULL if dest has been freed, the pointer to the memory containing the copy. If (re)allocation has occured, the memory is CONTIGUOUS.

◆ read_dmat_0()

int read_dmat_0 ( double **  mat,
int  nb_r,
int  nb_c,
const char *  name 
)

read a [nb_r times nb_c] matrix of doubles from a file starting with index 0 and store the values in a matrix provided by the user. The first nb_r line of the file are loaded, other lines are ignored.

Parameters
[in]nb_rnb of rows
[in]nb_cnb of columns
[in]namethe path an name of the file in which reading the matrix
[in,out]matallocated array for storing the file
Returns
Error status, <0 in case of failure.

◆ readmatrix()

void readmatrix ( double **  matrix,
int *  n 
)

function to read a matrix (obsolete?)

Parameters
[in,out]matrixthe matrix
[in]nthe vector n

◆ rotation_matrix()

void rotation_matrix ( int  type,
double  angle,
double  R[4][4] 
)

Compute the rotation matrix for a specified angle around a specific axis. The first index is 1.

Parameters
[in]typeinteger for axis selection: $1=\hat{X}$ ; $2=\hat{Y}$ ; $3=\hat{Z}$.
[in]anglevalue of the rotation angle expressed in radian.
[in,out]Rcorresponding rotation matrix of size 4x4 with first line and row unused.

◆ same_dmat_0()

int same_dmat_0 ( double **  a,
double **  b,
int  x,
int  y 
)

Compare if two 2D arrays of floats are the same.

Parameters
[in]aThe first array, starting with index 0.
[in]bThe second array, starting with index 0.
[in]xThe number of rows.
[in]yThe number of cols.
Returns
1 if arrays are the same, 0 otherwise.

◆ save_dmat_0()

void save_dmat_0 ( double **  mat,
int  nb_r,
int  nb_c,
char *  name 
)

save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open with the option "wt"

call save_format_dmat_0 with default parameter (format = "%12.5e").

Parameters
[in]matthe matrix to save, starting with index 0
[in]nb_rnb of rows
[in]nb_cnb of columns
[in]namethe path and name of the file in which saving the matrix

◆ save_format_dmat_0()

void save_format_dmat_0 ( double **  mat,
int  nb_r,
int  nb_c,
char *  name,
char *  format 
)

save a [nb_r times nb_c] matrix of doubles to a second matrix, starting with index 0 The file is open with the option "wt"

Parameters
[in]matthe matrix to save, starting with index 0
[in]nb_rnb of rows
[in]nb_cnb of columns
[in]namethe path and name of the file in which saving the matrix
[in]formatthe chosen format.

◆ scale_matrix()

void scale_matrix ( double **  matrix,
int *  n,
int *  initzeros 
)

function to scale matrix (obsolete?)

Parameters
[in,out]matrixthe matrix
[in]nthe vector n
[in,out]initzerosthe vector to arrange

◆ slct_dmat_0()

int slct_dmat_0 ( double **  tab_src,
int  nb_r,
int  nb_c,
double **  tab_out,
int  l_vec,
int *  vec 
)

fill the second [nb_r times l_vec] matrix by selecting the columns of the first [nb_r times nb_c] matrix of doubles. The indexes of the columns are specified in the (l_vec sized) vector, starting with index 0

Parameters
[in]tab_srcthe matrix containing the original values of doubles to be sliced
[in]nb_rnb of rows of the matrices
[in]nb_cnb of columns of the first matrix (unused)
[out]tab_outthe sliced matrix such as tab_out[i][j] = tab_src[i][vec[j]], starting with index 0. The matrix have to be already allocated to a sufficient size.
[in]l_vecthe size of the vector vec
[in]vecthe vector containing the indexes of the slices
Returns
0 if no error, -1 if a slice index is over y1, -2 if the slice number is negative.

◆ slctr_dmat_0()

int slctr_dmat_0 ( double **  tab_src,
int  nb_r,
int  nb_c,
double **  tab_dest,
int  l_vec,
int *  vec 
)

fill the second [l_vec times nb_c] matrix by selecting the rows of the first [nb_r times nb_c] matrix of doubles. The indexes of the rows are specified in the (l_vec sized) vector, starting with index 0

Parameters
[in]tab_srcthe matrix containing the original values of doubles to be sliced
[in]nb_rnb of rows of the first matrix (unused)
[in]nb_cnb of columns of the matrices
[out]tab_destthe sliced matrix such as tab_dest[i][j] = tab_src[vec[i]][j], starting with index 0. The matrix have to be already allocated to a sufficient size.
[in]l_vecthe size of the vector vec
[in]vecthe vector containing the indexes of the slices
Returns
0 if no error, -1 if a slice index is over x1, -2 if the slice number is negative.

◆ sum_dmat_0()

void sum_dmat_0 ( double **  A,
double **  B,
double **  C,
int  n1,
int  n2 
)

function to sum two matrices: A + B = C

Parameters
[in]Athe matrix A
[in]Bthe matrix B
[out]Cthe matrix C
[in]n1first size
[in]n2second size

◆ transpose()

void transpose ( double  M[4][4],
double  Mt[4][4] 
)

Compute the transpose of a matrix with first index is 1.

The input and output matrices have unused index 0. See get_dmat_1() to such matrices creation.

Parameters
[in]Mmatrix with first line and row unused.
[in,out]Mtthe transpose of M, index starting at 1.

◆ transpose_dmat_0()

void transpose_dmat_0 ( double **  tab_src,
double **  tab_dest,
int  nb_r,
int  nb_c 
)

Transpose a [nb_r times nb_c] matrix of doubles and store the results in a [y times nb_r] matrix, starting with index 0.

Parameters
[in]tab_srcthe original matrix of doubles, starting with index 0
[out]tab_destthe transpose of tab_src, starting with index 0
[in]nb_rnb of rows of tab_src, nb of columns of tab_dest
[in]nb_cnb of columns of tab_src, nb of rows of tab_dest

◆ transpose_dmat_1()

void transpose_dmat_1 ( double **  tab_src,
double **  tab_dest,
int  x,
int  y 
)

Transpose a [x times y] matrix of doubles and store the results in a [y times x] matrix, starting with index 1.

Parameters
[in]tab1the original matrix of doubles, starting with index 1
[out]tab2the transpose of tab1, starting with index 1
[in]xnb of rows of tab1, nb of columns of tab2 (without counting the unused first row/colum)
[in]ynb of columns of tab1, nb of rows of tab2 (without counting the unused first row/colum)

◆ update_initzeros()

void update_initzeros ( int *  initzeros,
double **  matrix,
int *  n 
)

function to update the initzeros array (obsolete?)

Parameters
[in,out]initzerosthe vector to initialize
[in,out]matrixthe matrix
[in]nthe vector n

◆ zeros_dmat_0()

void zeros_dmat_0 ( double **  mat,
int  nb_r,
int  nb_c 
)

set all the element of a [nb_r times nb_c] matrix of doubles to zero, starting with index 0

Parameters
[in]matthe matrix to be nullified, starting with index 0
[in]nb_rnb of rows
[in]nb_cnb of columns