openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
FMatrix.h
Go to the documentation of this file.
1 
6 #ifndef FMatrix_H
7 #define FMatrix_H
8 
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <math.h>
12 #include <assert.h>
13 #include <string.h>
14 #include <stdbool.h>
15 
16 #include "ludec.h"
17 #include "DataTypes.h"
18 
19 
20 class FMatrix {
21  public:
22  int mxNCols=0;
23  int mxNRows=0;
24  int NCols=0;
25  int NRows=0;
26  int lsize=0;
27  Real **Ent=NULL;
28  bool decomposed=false;
29  int *indx=NULL;
30  Real **base1=NULL;
31  void LUD( );
32  void LUsolve( Real * );
34  template<class T>
35  FMatrix( T , T );
36  ~FMatrix( );
37  void Zero();
38  FMatrix *Transpose(bool);
39  FMatrix *Invert();
40  void resize( int, int );
41  FMatrix *Inv();
42 };
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #endif
48 
50  void Zero_FMatrix(FMatrix *M );
52 
53  FMatrix *FM_Rotate(FMatrix *R, double angle, int ax);
55  void FM_Times_FM(FMatrix *A, FMatrix *B, FMatrix *C);
56  void FM_Times_FMinArray(FMatrix *A, FMatrix *B, Real *C);
57  void TransFM_Times_FM(FMatrix *A, FMatrix *B, FMatrix *C);
58  void FM_Times_TransFM(FMatrix *A, FMatrix *B, FMatrix *C);
59  void FM_Times_Vec(Real dx, FMatrix *B, Real*C, Real *result);
60  void B_C_BTrans(Real dx, FMatrix *B, Real *C, FMatrix *result);
61  void FM_Plus_FM(FMatrix *A, FMatrix *B, FMatrix *C);
62  void FM_Times_Scalar(FMatrix *A,Real a);
63  Real* FM_X_Vec( FMatrix *A, Real *b, Real *c );
64  void Print_FMatrix(FMatrix *A);
65 
66 #ifdef __cplusplus
67 }
68 
77 template<class T>
78 FMatrix::FMatrix(T NR, T NC)
79 {
80  mxNRows = NRows = NR;
81  mxNCols = NCols = NC;
82 
83  Ent = (Real**) calloc(mxNRows, sizeof(Real*));
84  for (int i = 0; i < mxNRows; i++)
85  {
86  Ent[i] = (Real*) calloc(mxNCols, sizeof(Real));
87  }
88 }
89 #endif
90 #endif
double Real
Definition: DataTypes.h:14
void FM_Times_Scalar(FMatrix *A, Real a)
Definition: FMatrix.cc:227
void B_C_BTrans(Real dx, FMatrix *B, Real *C, FMatrix *result)
Definition: FMatrix.cc:543
void Print_FMatrix(FMatrix *A)
Definition: FMatrix.cc:624
Real FMatrix_Det(FMatrix *)
Definition: FMatrix.cc:235
void FM_Plus_FM(FMatrix *A, FMatrix *B, FMatrix *C)
Definition: FMatrix.cc:196
void FM_Times_FMinArray(FMatrix *A, FMatrix *B, Real *C)
Definition: FMatrix.cc:119
Real FMatrix_Trace(FMatrix *M)
Definition: FMatrix.cc:292
void Zero_FMatrix(FMatrix *M)
void FM_Times_Vec(Real dx, FMatrix *B, Real *C, Real *result)
Definition: FMatrix.cc:522
FMatrix * FM_Rotate(FMatrix *R, double angle, int ax)
Definition: FMatrix.cc:478
void TransFM_Times_FM(FMatrix *A, FMatrix *B, FMatrix *C)
Definition: FMatrix.cc:143
Real * FM_X_Vec(FMatrix *A, Real *b, Real *c)
Definition: FMatrix.cc:508
void FM_Times_FM(FMatrix *A, FMatrix *B, FMatrix *C)
Definition: FMatrix.cc:93
void Destroy_FMatrix(FMatrix *M)
void FM_Times_TransFM(FMatrix *A, FMatrix *B, FMatrix *C)
Definition: FMatrix.cc:169
int mxNCols
max. number of cols
Definition: FMatrix.h:22
int NCols
actual number of cols
Definition: FMatrix.h:24
bool decomposed
true if decomposed
Definition: FMatrix.h:28
Real ** Ent
matrix entries
Definition: FMatrix.h:27
int lsize
local size
Definition: FMatrix.h:26
int * indx
indices for decomposition
Definition: FMatrix.h:29
~FMatrix()
Definition: FMatrix.cc:10
int mxNRows
max. number of rows
Definition: FMatrix.h:23
void resize(int, int)
Definition: FMatrix.cc:73
FMatrix & operator=(FMatrix &)
Definition: FMatrix.cc:48
Real ** base1
base1 version of matrix
Definition: FMatrix.h:30
FMatrix(T, T)
FMatrix * Inv()
Definition: FMatrix.cc:376
void LUD()
Definition: FMatrix.cc:320
FMatrix * Transpose(bool)
Definition: FMatrix.cc:443
void LUsolve(Real *)
Definition: FMatrix.cc:355
int NRows
actual number of rows
Definition: FMatrix.h:25
FMatrix * Invert()
Definition: FMatrix.cc:407
void Zero()
Definition: FMatrix.cc:28
V angle(const vec3< V > &v1, const vec3< V > &v2)
Definition: vect.h:120