31
31
/* return 1 on success, 0 on error (out of memory) */
32
extern int matrix_init(int rows, int cols, MATRIX * res);
32
extern int matrix_init(int rows, int cols, MATRIX *res);
34
34
/* free the memory occupied by the values of m */
35
extern void matrix_free(MATRIX m);
35
extern void matrix_free(MATRIX *m);
37
37
/* multiply two matrices, Return 1 on success, 0 on failure.
38
38
* return value 0 means - bad dimensions */
39
extern int matrix_mult(MATRIX a, MATRIX b, MATRIX * res);
39
extern int matrix_mult(MATRIX *a, MATRIX *b, MATRIX *res);
41
41
/* adds a multiple of the identity matrix to the given matrix
42
42
* M = M + s * Id. Returns 1 on success, 0 otherwise */
43
extern int matrix_add_identity(double s, MATRIX * m);
43
extern int matrix_add_identity(double s, MATRIX *m);
45
45
/* calculate the inverse of given (square) matrix. Returns 0 if
46
46
* the matrix is not invertible or if an error occurs.
47
47
* percents indicates whether we want to show the progress of
49
49
* Otherwise it returns 1 */
50
extern int matrix_inverse(MATRIX a, MATRIX * res, int percents);
50
extern int matrix_inverse(MATRIX *a, MATRIX *res, int percents);
52
52
/* multiplies matrix by a scalar */
53
extern void matrix_mult_scalar(double s, MATRIX * m);
53
extern void matrix_mult_scalar(double s, MATRIX *m);
55
55
/* res = a + b. Does not cheack the dimensions */
56
extern void matrix_add(MATRIX a, MATRIX b, MATRIX * res);
56
extern void matrix_add(MATRIX *a, MATRIX *b, MATRIX *res);
58
58
/* debug function */
59
extern void matrix_print(MATRIX a);
59
extern void matrix_print(MATRIX *a);