19 for (i = 0; i <
MROWS (m); i++)
20 for (j = 0; j <
MCOLS (m); j++)
40 for (i = 0; i <
MROWS (*m); i++)
41 for (j = 0; j <
MCOLS (*m); j++)
57 printf (
"%s\n",message);
60 for (i = 0; i <
MROWS (*m); i++)
62 for (j = 0; j <
MCOLS (*m); j++)
63 printf (
"%10.5f ",
MDATA (*m, i, j));
66 else printf (
"Dimension incorrecta!");
117 printf (
"%s\n",message);
121 printf (
"%f ",
VDATA (*v, i));
124 else printf (
"Dimension incorrecta!");
144 printf (
"ERROR (determinant): MATRIX must be square!\n");
152 *result =
MDATA (*m, 0, 0);
153 else if (
MROWS (*m) == 2)
173 printf (
"ERROR (inverse_matrix): MATRIX must be square!\n");
187 printf (
"ERROR (inverse_matrix): singular MATRIX!\n");
196 MDATA (*n, 0, 0) = 1 / det ;
198 else if (
MROWS (*m) == 2)
231 printf (
"ERROR (multiply_matrix_vector): MATRIX and VECTOR dimensions incompatible!\n");
243 for (i = 0; i <
MROWS (*m); i++)
247 datum = datum +
MDATA (*m, i, j) *
VDATA (*v, j);
248 VDATA (*r, i) = datum;
void initialize_matrix(MATRIX *m, int rows, int cols)
MATRIX create_matrix(int rows, int cols)
void print_matrix(char *message, MATRIX const *m)
void print_vector(char *message, VECTOR const *v)
#define MV_COMPAT_DIM(m, v)
VECTOR create_vector(int elements)
int inverse_matrix(MATRIX const *m, MATRIX *n)
int multiply_matrix_vector(MATRIX const *m, VECTOR const *v, VECTOR *r)
void initialize_vector(VECTOR *v, int elements)
float cross_product(MATRIX const *m, int f1, int c1, int f2, int c2)
int determinant(MATRIX const *m, float *result)