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
tvmet_interface::axpy
static void axpy(const real coef, const gene_vector &X, gene_vector &Y, int N)
Definition: tvmet_interface.hh:97
tvmet_interface::gene_vector
Vector< real, SIZE > gene_vector
Definition: tvmet_interface.hh:41
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
tvmet_interface::stl_matrix
std::vector< stl_vector > stl_matrix
Definition: tvmet_interface.hh:39
gtsam::Y
GaussianFactorGraphValuePair Y
Definition: HybridGaussianProductFactor.cpp:29
tvmet_interface::free_matrix
static void free_matrix(gene_matrix &A, int N)
Definition: tvmet_interface.hh:46
trans
static char trans
Definition: blas_interface.hh:58
E1::B
@ B
X
#define X
Definition: icosphere.cpp:20
tvmet_interface::real_type
real real_type
Definition: tvmet_interface.hh:36
tvmet_interface::vector_from_stl
static void vector_from_stl(gene_vector &B, stl_vector &B_stl)
Definition: tvmet_interface.hh:56
tvmet_interface::matrix_vector_product
static void matrix_vector_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
Definition: tvmet_interface.hh:89
tvmet_interface::atv_product
static void atv_product(gene_matrix &A, gene_vector &B, gene_vector &X, int N)
Definition: tvmet_interface.hh:93
tvmet_interface::copy_vector
static void copy_vector(const gene_vector &source, gene_vector &cible, int N)
Definition: tvmet_interface.hh:81
tvmet_interface
Definition: tvmet_interface.hh:32
tvmet_interface::name
static std::string name()
Definition: tvmet_interface.hh:44
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
tvmet_interface::free_vector
static void free_vector(gene_vector &B)
Definition: tvmet_interface.hh:48
tvmet_interface::matrix_from_stl
static void matrix_from_stl(gene_matrix &A, stl_matrix &A_stl)
Definition: tvmet_interface.hh:50
tvmet_interface::vector_to_stl
static void vector_to_stl(gene_vector &B, stl_vector &B_stl)
Definition: tvmet_interface.hh:61
E1::A
@ A
tvmet_interface::matrix_matrix_product
static void matrix_matrix_product(const gene_matrix &A, const gene_matrix &B, gene_matrix &X, int N)
Definition: tvmet_interface.hh:85
tvmet_interface::matrix_to_stl
static void matrix_to_stl(gene_matrix &A, stl_matrix &A_stl)
Definition: tvmet_interface.hh:67
N
#define N
Definition: igam.h:9
prod
EIGEN_DONT_INLINE void prod(const Lhs &a, const Rhs &b, Res &c)
Definition: product_threshold.cpp:39
tvmet_interface::stl_vector
std::vector< real > stl_vector
Definition: tvmet_interface.hh:38
real
Definition: main.h:100
tvmet_interface::gene_matrix
Matrix< real, SIZE, SIZE > gene_matrix
Definition: tvmet_interface.hh:42
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
tvmet_interface::copy_matrix
static void copy_matrix(const gene_matrix &source, gene_matrix &cible, int N)
Definition: tvmet_interface.hh:77


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:36