tvmet_interface.hh
Go to the documentation of this file.
1 //=====================================================
2 // File : tvmet_interface.hh
3 // Author : L. Plagne <laurent.plagne@edf.fr)>
4 // Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002
5 //=====================================================
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 //
20 #ifndef TVMET_INTERFACE_HH
21 #define TVMET_INTERFACE_HH
22 
23 #include <tvmet/tvmet.h>
24 #include <tvmet/Vector.h>
25 #include <tvmet/Matrix.h>
26 
27 #include <vector>
28 
29 using namespace tvmet;
30 
31 template<class real, int SIZE>
33 
34 public :
35 
36  typedef real real_type ;
37 
38  typedef std::vector<real> stl_vector;
39  typedef std::vector<stl_vector > stl_matrix;
40 
41  typedef Vector<real,SIZE> gene_vector;
42  typedef Matrix<real,SIZE,SIZE> gene_matrix;
43 
44  static inline std::string name() { return "tiny_tvmet"; }
45 
46  static void free_matrix(gene_matrix & A, int N){}
47 
48  static void free_vector(gene_vector & B){}
49 
50  static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
51  for (int j=0; j<A_stl.size() ; j++)
52  for (int i=0; i<A_stl[j].size() ; i++)
53  A(i,j) = A_stl[j][i];
54  }
55 
56  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
57  for (int i=0; i<B_stl.size() ; i++)
58  B[i]=B_stl[i];
59  }
60 
61  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
62  for (int i=0; i<B_stl.size() ; i++){
63  B_stl[i]=B[i];
64  }
65  }
66 
67  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
68  int N = A_stl.size();
69  for (int j=0;j<N;j++){
70  A_stl[j].resize(N);
71  for (int i=0;i<N;i++)
72  A_stl[j][i] = A(i,j);
73  }
74  }
75 
76 
77  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
78  cible = source;
79  }
80 
81  static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
82  cible = source;
83  }
84 
85  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
86  X = prod(A,B);
87  }
88 
89  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
90  X = prod(A,B);
91  }
92 
93  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
94  X = prod(trans(A),B);
95  }
96 
97  static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
98  Y+=coef*X;
99  }
100 
101 };
102 
103 
104 #endif
const char Y
Vector< real, SIZE > gene_vector
static void copy_matrix(const gene_matrix &source, gene_matrix &cible, int N)
Matrix< real, SIZE, SIZE > gene_matrix
static void free_vector(gene_vector &B)
static char trans
#define N
Definition: gksort.c:12
static void vector_to_stl(gene_vector &B, stl_vector &B_stl)
static std::string name()
static void vector_from_stl(gene_vector &B, stl_vector &B_stl)
static void copy_vector(const gene_vector &source, gene_vector &cible, int N)
static void matrix_from_stl(gene_matrix &A, stl_matrix &A_stl)
EIGEN_DONT_INLINE void prod(const Lhs &a, const Rhs &b, Res &c)
Definition: main.h:100
static void matrix_vector_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
std::vector< real > stl_vector
static void atv_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
std::vector< stl_vector > stl_matrix
static void matrix_to_stl(gene_matrix &A, stl_matrix &A_stl)
static void free_matrix(gene_matrix &A, int N)
#define X
Definition: icosphere.cpp:20
static void axpy(const real coef, const gene_vector &X, gene_vector &Y, int N)
static void matrix_matrix_product(const gene_matrix &A, const gene_matrix &B, gene_matrix &X, int N)
std::ptrdiff_t j


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:40:38