Subversion Repositories FlightCtrl

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
966 MikeW 1
#ifndef __MATMATH_H__
2
#define __MATMATH_H__
3
 
4
/*****************************************************************************
5
  INCLUDES
6
**************************************************************************** */
7
#include "math.h"
8
#include "float.h"
9
 
10
/*****************************************************************************
11
  TYPEDEFS
12
*****************************************************************************/
13
#define f32_t float 
14
#define ui32_t unsigned int 
15
#define i32_t int 
16
 
17
#define PI 3.1415926535897932384626433832795
18
 
19
#define matSetFull(matM,Row,Column,X)               matM[Row+1][Column+1] = (X)
20
#define matSetDiagonal(matM,Row,Column,X)           matM[Row+1][Column+1] = (X)
21
#define matGetFull(matM,Row,Column,X)              *(X) = matM[Row+1][Column+1]
22
#define matGetDiagonal(matM,Row,Column,X)          *(X) = matM[Row+1][Column+1]
23
 
24
 
25
/* B = A */
26
extern void matrix_copy( f32_t **A, f32_t **B, int rows,
27
                        int cols );
28
 
29
/* C = A + B */
30
extern void matrix_add( f32_t **A, f32_t **B, f32_t **C, int m, int n );
31
 
32
/* C = A - B */
33
extern void matrix_sub( f32_t **A, f32_t **B, f32_t **C, int m, int n );
34
 
35
/*   C =  A x  B , A(a_rows x a_cols), B(a_cols x b_cols) */
36
extern void matrix_mult( f32_t **A, f32_t **B, f32_t **C,
37
                        int a_rows, int a_cols, int b_cols );
38
 
39
/*  C =  A x B^T, A(a_rows x a_cols), B(b_cols x a_cols) */
40
extern void matrix_mult_transpose( f32_t **A, f32_t **B, f32_t **C,
41
                                  int a_rows, int a_cols, int b_cols );
42
 
43
/* C = A^T x B, A(a_cols x a_rows), B(a_cols x b_cols) */
44
extern void matrix_transpose_mult( f32_t **A, f32_t **B, f32_t **C,
45
                                  int a_rows, int a_cols, int b_cols );
46
 
47
/* B = A^-1 */
48
extern void take_inverse( f32_t **A, f32_t **B, int size);
49
extern void gaussj( f32_t **A, int n, f32_t **B);
50
 
51
/* Matrix allocation routines */
52
extern f32_t **matrix(long row_low, long row_high, long column_low, long column_high);
53
 
54
/* Deallocation routines */
55
extern void free_matrix(f32_t **m, long row_low, long row_high, long column_low, long column_high);
56
#endif