init_matrix.h 887 Bytes
Newer Older
Stefan Lankes's avatar
Stefan Lankes committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
/* 
 * Errorcodes in all integer functions:
 * 
 *  -1: Given pointer is 0 (can't work on it)
 *  -2: Allocation error
 * 
*/

#ifndef __INIT_MATRIX_H__
#define __INIT_MATRIX_H__

#ifdef __cplusplus
extern "C" {
#endif

/* 
 * Creates identity matrix (NxN) and an empty result vector
 * simply solveable
 * 
 *  *********
 *  * 1   0 *
 *  *   1   *
 *  * 0   1 *
 *  *********                 
*/
	int generate_base_matrix(double ***A, double **b, unsigned int N);

/* Creates empty NxN matrix and empty result vector */
	int generate_empty_matrix(double ***A, double **b, unsigned int N);

/* creates a solveable system of linear equations */
	int init_matrix(double ***A, double **b, unsigned int N);

/* frees all pointers below upper level of A */
	void clean_matrix(double ***A);

/* frees the (result) vector */
	void clean_vector(double **b);

#ifdef __cplusplus
}
#endif
#endif