Robotran C Documentation
mbs_matrix.h
Go to the documentation of this file.
1 
45 #ifndef mbs_matrix_h
46 #define mbs_matrix_h
47 #include <stdio.h>
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 // Macro functions allowing to retrieve static arrays.
62 #define make_transpose_arr_4x4(mat) {{3, 0, 0, 0}, \
63  {3, mat[1][1], mat[1][2], mat[1][3]}, \
64  {3, mat[2][1], mat[2][2], mat[2][3]}, \
65  {3, mat[3][1], mat[3][2], mat[3][3]}}
66 
75 #define make_transpose_arr_3x3(mat) {{mat[0][0], mat[0][1], mat[0][2]}, \
76  {mat[1][0], mat[1][1], mat[1][2]}, \
77  {mat[2][0], mat[2][1], mat[2][2]}}
78 
79 
92 #define make_transpose_arr_4x4_to_3x3(mat)\
93  {{mat[1][1], mat[1][2], mat[1][3]}, \
94  {mat[2][1], mat[2][2], mat[2][3]}, \
95  {mat[3][1], mat[3][2], mat[3][3]}}
96 /*--------------------*/
104 void transpose(double M[4][4], double Mt[4][4]);
105 
121 void dot_3x3_arr(double res[3], double mat[3][3], double vec[3]);
122 
143 double *dot_3x3_ptr(double *res, double **mat, double *vec);
144 
160 void dot_4x4_arr(double res[4], double mat[4][4], double vec[4]);
161 
182 double *dot_4x4_ptr(double *res, double **mat, double *vec);
183 
209 double *dot_nxm_ptr_0(double *res, double **mat, double *vec, int nr, int nc);
210 
236 double *dot_nxm_ptr_1(double *res, double **mat, double *vec, int nr, int nc);
237 
239 void matrix_product(double M[4][4], double v[4], double Mv[4]);
240 
242 void matrix_product_0(double **M, double *v, double *Mv, int nr, int nc);
243 
245 void matrix_product_1(double **M, double *v, double *v_out, int nr, int nc);
246 
263 void matmul_3x3_arr(double res[3][3], double mat_1[3][3], double mat_2[3][3]);
264 
288 double **matmul_3x3_ptr(double **res, double **mat_1, double **mat_2);
289 
306 void matmul_4x4_arr(double res[4][4], double mat_1[4][4], double mat_2[4][4]);
307 
331 double **matmul_4x4_ptr(double **res, double **mat_1, double **mat_2);
332 
334 void doublematrix_product(double M1[4][4], double M2[4][4], double M[4][4]);
335 
348 void doublematrix_product_0(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M);
349 
362 void doublematrix_product_1(double **M1, int nb_row_M1, int nb_col_M1, double **M2, int nb_col_M2, double **M);
363 
365 int rotation_matrix(int type, double angle, double R[4][4]);
366 
396 int rotation_matrix_4x4_arr(int type, double angle, double R[4][4]);
397 
427 int rotation_matrix_4x4_ptr(int type, double angle, double** R);
428 
458 int rotation_matrix_3x3_arr(int type, double angle, double R[3][3]);
459 
489 int rotation_matrix_3x3_ptr(int type, double angle, double** R);
490 
498 int** get_imat_0(int nb_r, int nb_c);
505 int** get_imat_1(int nb_r, int nb_c);
506 
511 void free_imat_0(int** mat);
516 void free_imat_1(int** mat);
517 
525 void copy_imat_0(int** tab_src, int** tab_dest, int nb_r, int nb_c);
526 
527 
534 void print_imat_0(int** mat, int nb_r, int nb_c);
535 
536 
544 double** get_dmat_0(int nb_r, int nb_c);
551 double** get_dmat_1(int nb_r, int nb_c);
558 double** get_contdmat_1(int nb_r, int nb_c);
559 
564 void free_dmat_0(double** mat);
569 void free_dmat_1(double** mat);
570 
582 void copy_3x3_arr(double res[3][3], double src[3][3]);
583 
601 double **copy_3x3_ptr(double **res, double **src);
602 
616 void copy_4x4_arr(double res[4][4], double src[4][4]);
617 
637 double **copy_4x4_ptr(double **res, double **src);
638 
639 
647 void copy_dmat_0(double** tab_src, double** tab_dest, int nb_r, int nb_c);
648 
656 void copy_dmat_1(double** src, double** dest, int x, int y);
657 
672 double **re_copy_dmat_0(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny);
673 
689 double **re_copy_dmat_1(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny);
690 
698 void transpose_dmat_0(double** tab_src, double** tab_dest, int nb_r, int nb_c);
699 
707 void transpose_dmat_1(double** tab_src, double** tab_dest, int x, int y);
708 
717 void print_dmat_0(double** mat, int nb_r, int nb_c);
725 void print_format_dmat_0(double** mat, int nb_r, int nb_c, char* format);
726 
737 int read_dmat_0(double** mat, int nb_r, int nb_c, const char* name);
738 
745 double** load_dmat_0(int nb_r, int nb_c, char* name);
746 
761 int save_dmat_0(double** mat, int nb_r, int nb_c, char* name);
762 
786 int save_format_dmat_0(double** mat, int nb_r, int nb_c, char* name, char* format);
787 
799 int code_dmat_0(FILE *file_out, double **values, const char *name, int n_row, int n_col);
800 
812 int code_dmat_1(FILE *file_out, double **values, const char *name, int n_row, int n_col);
813 
825 int slct_dmat_0(double** tab_src, int nb_r, int nb_c, double** tab_out, int l_vec, int* vec);
826 
838 int slctr_dmat_0(double** tab_src, int nb_r, int nb_c, double** tab_dest, int l_vec, int* vec);
839 
840 
841 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
842  * SETTING VALUES IN MATRICES (ZEROS, IDENTITY...) *
843  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
844 
851 void zeros_dmat_0(double** mat, int nb_r, int nb_c);
852 
864 int set_diag_dmat_0(double** mat, int size, double value);
865 
875 int set_identity_dmat_0(double** mat, int size);
876 
894 double **identity_dmat_3x3_ptr(double** mat);
895 
915 double **identity_dmat_4x4_ptr(double** mat);
916 
929 int identity_dmat_3x3_arr(double mat[3][3]);
930 
943 int identity_dmat_4x4_arr(double mat[4][4]);
944 
955 void mult_dmat_0(double** A, double** B, double** C, int n1, int n2, int n3);
956 
965 void sum_dmat_0(double** A, double** B, double** C, int n1, int n2);
966 
975 void diff_dmat_0(double** A, double** B, double** C, int n1, int n2);
976 
983 void opposite_dmat_0(double** A, int n1, int n2);
984 
990 void readmatrix(double** matrix, int* n);
991 
1005 int get_dmatfiles_size(const char* fileName, int* n_row, int* n_col);
1006 
1013 void update_initzeros(int* initzeros, double** matrix, int* n);
1014 
1015 
1022 void arrange_matrix(double** matrix, int* n, int* initzeros);
1023 
1030 void scale_matrix(double** matrix, int* n, int* initzeros);
1031 
1032 
1041 void copy_array_dmat_1(double src[4][4], double** dest);
1042 
1053 int same_dmat_0(double **a, double **b, int x, int y);
1054 
1055 #ifdef __cplusplus
1056 }
1057 #endif
1058 
1059 /*--------------------*/
1060 #endif
update_initzeros
void update_initzeros(int *initzeros, double **matrix, int *n)
function to update the initzeros array (obsolete?)
Definition: mbs_matrix.c:1543
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....
Definition: mbs_matrix.c:549
identity_dmat_3x3_arr
int identity_dmat_3x3_arr(double mat[3][3])
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1345
arrange_matrix
void arrange_matrix(double **matrix, int *n, int *initzeros)
function to arrange matrix (obsolete?)
Definition: mbs_matrix.c:1560
MBS_INFO_FAILURE
#define MBS_INFO_FAILURE
Definition: mbs_define.h:32
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
copy_3x3_ptr
double ** copy_3x3_ptr(double **res, double **src)
Copy the matrix into another one.
Definition: mbs_matrix.c:759
matmul_3x3_ptr
double ** matmul_3x3_ptr(double **res, double **mat_1, double **mat_2)
Compute the product of two matrices.
Definition: mbs_matrix.c:224
save_dmat_0
int 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
Definition: mbs_matrix.c:1003
identity_dmat_3x3_ptr
double ** identity_dmat_3x3_ptr(double **mat)
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1301
useful_functions.h
dot_4x4_arr
void dot_4x4_arr(double res[4], double mat[4][4], double vec[4])
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:71
identity_dmat_4x4_ptr
double ** identity_dmat_4x4_ptr(double **mat)
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1323
matrix_product_0
void matrix_product_0(double **M, double *v, double *Mv, int nr, int nc)
Definition: mbs_matrix.c:169
scale_matrix
void scale_matrix(double **matrix, int *n, int *initzeros)
function to scale matrix (obsolete?)
Definition: mbs_matrix.c:1605
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.
Definition: mbs_matrix.c:338
dot_4x4_ptr
double * dot_4x4_ptr(double *res, double **mat, double *vec)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:84
MSG_PRE
#define MSG_PRE
Definition: mbs_matrix.c:26
mbs_error_msg
void mbs_error_msg(int err, const char *msg,...)
Send an error message.
Definition: mbs_message.c:131
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0....
Definition: mbs_1D_array.c:1318
_MBS_ERR_LOW_FILES
#define _MBS_ERR_LOW_FILES
Low Level error number Error during opening/writing files = -9.
Definition: mbs_errors_names.h:157
copy_4x4_arr
void copy_4x4_arr(double res[4][4], double src[4][4])
Copy the array into another one.
Definition: mbs_matrix.c:772
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
Definition: mbs_matrix.c:571
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.
Definition: mbs_matrix.c:794
dot_3x3_arr
void dot_3x3_arr(double res[3], double mat[3][3], double vec[3])
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:41
mbs_define.h
arrange_matrix
void arrange_matrix(double **matrix, int *n, int *initzeros)
function to arrange matrix (obsolete?)
Definition: mbs_matrix.c:1560
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
Definition: mbs_matrix.c:901
free_dmat_0
void free_dmat_0(double **mat)
release memory for a matrix of doubles, starting at index 0
Definition: mbs_matrix.c:683
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
Definition: mbs_matrix.c:1418
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] mat...
Definition: mbs_matrix.c:1220
identity_dmat_4x4_ptr
double ** identity_dmat_4x4_ptr(double **mat)
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1323
matrix_product_0
void matrix_product_0(double **M, double *v, double *Mv, int nr, int nc)
Definition: mbs_matrix.c:169
transpose
void transpose(double M[4][4], double Mt[4][4])
Compute the transpose of a matrix with first index is 1.
Definition: mbs_matrix.c:28
dot_nxm_ptr_1
double * dot_nxm_ptr_1(double *res, double **mat, double *vec, int nr, int nc)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:132
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...
Definition: mbs_matrix.c:1242
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.
Definition: mbs_matrix.c:1492
mbs_matrix.h
Declares all operation betweens matrices, matrice and vector, matrice and scalars.
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
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.
Definition: mbs_matrix.c:820
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
Definition: mbs_matrix.c:1264
copy_3x3_ptr
double ** copy_3x3_ptr(double **res, double **src)
Copy the matrix into another one.
Definition: mbs_matrix.c:759
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.
Definition: mbs_matrix.c:1164
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.
Definition: mbs_matrix.c:1164
readmatrix
void readmatrix(double **mat, int *n)
function to read a matrix (obsolete?)
Definition: mbs_matrix.c:1460
scale_matrix
void scale_matrix(double **matrix, int *n, int *initzeros)
function to scale matrix (obsolete?)
Definition: mbs_matrix.c:1605
mbs_dirname
char * mbs_dirname(const char *path, int verbose)
mbs_dirname returns the leading part of the path (UNIX and MAC).
Definition: mbs_path.c:407
matmul_4x4_arr
void matmul_4x4_arr(double res[4][4], double mat_1[4][4], double mat_2[4][4])
Compute the product of two matrices.
Definition: mbs_matrix.c:259
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 The functi...
Definition: mbs_matrix.c:603
matmul_3x3_arr
void matmul_3x3_arr(double res[3][3], double mat_1[3][3], double mat_2[3][3])
Compute the product of two matrices.
Definition: mbs_matrix.c:194
rotation_matrix_4x4_arr
int rotation_matrix_4x4_arr(int type, double angle, double R[4][4])
Definition: mbs_matrix.c:377
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
Definition: mbs_matrix.c:901
matrix_product
void matrix_product(double M[4][4], double v[4], double Mv[4])
Definition: mbs_matrix.c:163
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 (...
Definition: mbs_matrix.c:996
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.
Definition: mbs_matrix.c:807
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.
Definition: mbs_matrix.c:355
copy_4x4_ptr
double ** copy_4x4_ptr(double **res, double **src)
Copy the matrix into another one.
Definition: mbs_matrix.c:780
update_initzeros
void update_initzeros(int *initzeros, double **matrix, int *n)
function to update the initzeros array (obsolete?)
Definition: mbs_matrix.c:1543
copy_4x4_ptr
double ** copy_4x4_ptr(double **res, double **src)
Copy the matrix into another one.
Definition: mbs_matrix.c:780
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.
Definition: mbs_matrix.c:1098
slct_dmat_0
int slct_dmat_0(double **tab_src, int nb_r1, int nb_c1, double **tab_out, int l2, int *vec)
fill the second [nb_r times l_vec] matrix by selecting the columns of the first [nb_r times nb_c] mat...
Definition: mbs_matrix.c:1220
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
Definition: mbs_matrix.c:906
free_imat_1
void free_imat_1(int **mat)
release memory for a matrix of integers, starting with index 1
Definition: mbs_matrix.c:707
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.
Definition: mbs_matrix.c:855
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,...
Definition: mbs_matrix.c:874
free_imat_0
void free_imat_0(int **mat)
release memory for a matrix of integers, starting with index 0
Definition: mbs_matrix.c:699
dot_3x3_arr
void dot_3x3_arr(double res[3], double mat[3][3], double vec[3])
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:41
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
Definition: mbs_matrix.c:1418
rotation_matrix_4x4_ptr
int rotation_matrix_4x4_ptr(int type, double angle, double **R)
Compute the rotation matrix for a specified angle around a specific axis.
Definition: mbs_matrix.c:420
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
Definition: mbs_matrix.c:1431
rotation_matrix
int rotation_matrix(int type, double angle, double R[4][4])
DEPRECATED, see rotation_matrix_4x4_arr().
Definition: mbs_matrix.c:372
copy_3x3_arr
void copy_3x3_arr(double res[3][3], double src[3][3])
Copy the array into another one.
Definition: mbs_matrix.c:752
_MBS_ERR_LOW_NULL_PTR
#define _MBS_ERR_LOW_NULL_PTR
Low Level error number A called symbolic or user function is set to NULL;.
Definition: mbs_errors_names.h:142
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.
Definition: mbs_matrix.c:1492
matrix_product_1
void matrix_product_1(double **M, double *v, double *v_out, int nr, int nc)
Definition: mbs_matrix.c:181
matrix_product_1
void matrix_product_1(double **M, double *v, double *v_out, int nr, int nc)
Definition: mbs_matrix.c:181
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 ...
Definition: mbs_matrix.c:929
set_diag_dmat_0
int set_diag_dmat_0(double **mat, int size, double value)
Set a diagonal matrix with the given value.
Definition: mbs_matrix.c:1277
free_dvec_1
void free_dvec_1(double *vec)
release memory for a vector of doubles, starting at index 1
Definition: mbs_1D_array.c:1358
dot_3x3_ptr
double * dot_3x3_ptr(double *res, double **mat, double *vec)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:54
set_identity_dmat_0
int set_identity_dmat_0(double **mat, int size)
Set a matrix to identity matrix. Out-of-diagonal elements are set to zero.
Definition: mbs_matrix.c:1391
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.
Definition: mbs_matrix.c:807
matmul_3x3_arr
void matmul_3x3_arr(double res[3][3], double mat_1[3][3], double mat_2[3][3])
Compute the product of two matrices.
Definition: mbs_matrix.c:194
copy_dvec_0
double * copy_dvec_0(double *vec_src, double *vec_dest, int l_v)
Copy the content of a vector (of sizel_v) of doubles to a second vector, starting with index 0.
Definition: mbs_1D_array.c:1363
identity_dmat_3x3_ptr
double ** identity_dmat_3x3_ptr(double **mat)
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1301
free_imat_1
void free_imat_1(int **mat)
release memory for a matrix of integers, starting with index 1
Definition: mbs_matrix.c:707
matmul_4x4_arr
void matmul_4x4_arr(double res[4][4], double mat_1[4][4], double mat_2[4][4])
Compute the product of two matrices.
Definition: mbs_matrix.c:259
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
Definition: mbs_matrix.c:625
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.
Definition: mbs_matrix.c:1630
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....
Definition: mbs_matrix.c:549
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.
Definition: mbs_matrix.c:855
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
Definition: mbs_matrix.c:906
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
Definition: mbs_matrix.c:1264
readmatrix
void readmatrix(double **matrix, int *n)
function to read a matrix (obsolete?)
Definition: mbs_matrix.c:1460
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.
Definition: mbs_matrix.c:715
rotation_matrix_3x3_ptr
int rotation_matrix_3x3_ptr(int type, double angle, double **R)
Compute the rotation matrix for a specified angle around a specific axis.
Definition: mbs_matrix.c:506
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 The functi...
Definition: mbs_matrix.c:603
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]
Definition: mbs_matrix.c:1401
set_diag_dmat_0
int set_diag_dmat_0(double **mat, int size, double value)
Set a diagonal matrix with the given value.
Definition: mbs_matrix.c:1277
dot_nxm_ptr_1
double * dot_nxm_ptr_1(double *res, double **mat, double *vec, int nr, int nc)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:132
free_dmat_0
void free_dmat_0(double **mat)
release memory for a matrix of doubles, starting at index 0
Definition: mbs_matrix.c:683
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)
Definition: mbs_matrix.c:1444
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.
Definition: mbs_matrix.c:1098
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,...
Definition: mbs_matrix.c:874
print_imat_0
void print_imat_0(int **mat, int x, int y)
print a [nb_r times nb_c] matrix of integers in console, starting with index 0
Definition: mbs_matrix.c:728
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
Definition: mbs_matrix.c:1431
identity_dmat_4x4_arr
int identity_dmat_4x4_arr(double mat[4][4])
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1368
free_imat_0
void free_imat_0(int **mat)
release memory for a matrix of integers, starting with index 0
Definition: mbs_matrix.c:699
copy_dvec_1
double * copy_dvec_1(double *vec_src, double *vec_dest)
Copy the content of a vector (of size specified in vec_src[0]) of doubles to a second vector,...
Definition: mbs_1D_array.c:1378
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
Definition: mbs_matrix.c:571
rotation_matrix
int rotation_matrix(int type, double angle, double R[4][4])
DEPRECATED, see rotation_matrix_4x4_arr().
Definition: mbs_matrix.c:372
doublematrix_product
void doublematrix_product(double M1[4][4], double M2[4][4], double M[4][4])
DEPRECATED, see matmul_4x4_arr().
Definition: mbs_matrix.c:324
mbs_message.h
dot_nxm_ptr_0
double * dot_nxm_ptr_0(double *res, double **mat, double *vec, int nr, int nc)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:101
rotation_matrix_4x4_ptr
int rotation_matrix_4x4_ptr(int type, double angle, double **R)
Compute the rotation matrix for a specified angle around a specific axis.
Definition: mbs_matrix.c:420
save_format_dmat_0
int 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.
Definition: mbs_matrix.c:1015
dot_4x4_arr
void dot_4x4_arr(double res[4], double mat[4][4], double vec[4])
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:71
slctr_dmat_0
int slctr_dmat_0(double **tab_src, int nb_r1, int nb_c1, double **tab_out, int l2, int *vec)
fill the second [l_vec times nb_c] matrix by selecting the rows of the first [nb_r times nb_c] matrix...
Definition: mbs_matrix.c:1242
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
Definition: mbs_matrix.c:728
identity_dmat_4x4_arr
int identity_dmat_4x4_arr(double mat[4][4])
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1368
save_dmat_0
int 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
Definition: mbs_matrix.c:1003
matmul_4x4_ptr
double ** matmul_4x4_ptr(double **res, double **mat_1, double **mat_2)
Compute the product of two matrices.
Definition: mbs_matrix.c:289
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.
Definition: mbs_matrix.c:1620
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,...
Definition: mbs_matrix.c:888
dot_4x4_ptr
double * dot_4x4_ptr(double *res, double **mat, double *vec)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:84
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.
Definition: mbs_matrix.c:820
mbs_is_dir_or_file
int mbs_is_dir_or_file(const char *path)
Check if the path is valid and lead to a file or directory.
Definition: mbs_path.c:547
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.
Definition: mbs_matrix.c:355
matrix_product
void matrix_product(double M[4][4], double v[4], double Mv[4])
Definition: mbs_matrix.c:163
free_dmat_1
void free_dmat_1(double **mat)
release memory for a matrix of doubles, starting at index 1
Definition: mbs_matrix.c:691
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]
Definition: mbs_matrix.c:1401
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.
Definition: mbs_matrix.c:338
copy_4x4_arr
void copy_4x4_arr(double res[4][4], double src[4][4])
Copy the array into another one.
Definition: mbs_matrix.c:772
get_dvec_1
double * get_dvec_1(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 1
Definition: mbs_1D_array.c:1334
mbs_path.h
doublematrix_product
void doublematrix_product(double M1[4][4], double M2[4][4], double M[4][4])
DEPRECATED, see matmul_4x4_arr().
Definition: mbs_matrix.c:324
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)
Definition: mbs_matrix.c:1444
set_identity_dmat_0
int set_identity_dmat_0(double **mat, int size)
Set a matrix to identity matrix. Out-of-diagonal elements are set to zero.
Definition: mbs_matrix.c:1391
free_dmat_1
void free_dmat_1(double **mat)
release memory for a matrix of doubles, starting at index 1
Definition: mbs_matrix.c:691
rotation_matrix_3x3_ptr
int rotation_matrix_3x3_ptr(int type, double angle, double **R)
Compute the rotation matrix for a specified angle around a specific axis.
Definition: mbs_matrix.c:506
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:1353
MBS_INFO_SUCCESS
#define MBS_INFO_SUCCESS
Definition: mbs_define.h:30
save_format_dmat_0
int 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.
Definition: mbs_matrix.c:1015
identity_dmat_3x3_arr
int identity_dmat_3x3_arr(double mat[3][3])
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1345
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
Definition: mbs_matrix.c:625
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.
Definition: mbs_matrix.c:1630
transpose
void transpose(double M[4][4], double Mt[4][4])
Compute the transpose of a matrix with first index is 1.
Definition: mbs_matrix.c:28
copy_3x3_arr
void copy_3x3_arr(double res[3][3], double src[3][3])
Copy the array into another one.
Definition: mbs_matrix.c:752
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....
Definition: mbs_matrix.c:655
rotation_matrix_3x3_arr
int rotation_matrix_3x3_arr(int type, double angle, double R[3][3])
Definition: mbs_matrix.c:463
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.
Definition: mbs_matrix.c:794
dot_3x3_ptr
double * dot_3x3_ptr(double *res, double **mat, double *vec)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:54
mbs_makedirs
int mbs_makedirs(char *path)
Create (recursively) the specified directory.
Definition: mbs_path.c:586
matmul_3x3_ptr
double ** matmul_3x3_ptr(double **res, double **mat_1, double **mat_2)
Compute the product of two matrices.
Definition: mbs_matrix.c:224
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 (...
Definition: mbs_matrix.c:996
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 ...
Definition: mbs_matrix.c:929
MSG_ERR
#define MSG_ERR
Definition: mbs_matrix.c:25
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....
Definition: mbs_matrix.c:655
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,...
Definition: mbs_matrix.c:888
matmul_4x4_ptr
double ** matmul_4x4_ptr(double **res, double **mat_1, double **mat_2)
Compute the product of two matrices.
Definition: mbs_matrix.c:289
mbs_errors_names.h
dot_nxm_ptr_0
double * dot_nxm_ptr_0(double *res, double **mat, double *vec, int nr, int nc)
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:101
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.
Definition: mbs_matrix.c:1620
copy_imat_0
void copy_imat_0(int **tab1, int **tab2, int x, int y)
Copy the content of a [nb_r times nb_c] matrix of integers to a second matrix, starting with index 0.
Definition: mbs_matrix.c:715