init_matrix.hh
Go to the documentation of this file.
1 //=====================================================
2 // File : init_matrix.hh
3 // Author : L. Plagne <laurent.plagne@edf.fr)>
4 // Copyright (C) EDF R&D, lun sep 30 14:23:19 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 INIT_MATRIX_HH
21 #define INIT_MATRIX_HH
22 
23 // The Vector class must satisfy the following part of STL vector concept :
24 // resize() method
25 // [] operator for setting element
26 // value_type defined
27 template<double init_function(int,int), class Vector>
29 
30  X.resize(size);
31 
32  for (unsigned int j=0;j<X.size();j++){
33  X[j]=typename Vector::value_type(init_function(row,j));
34  }
35 }
36 
37 
38 // Matrix is a Vector of Vector
39 // The Matrix class must satisfy the following part of STL vector concept :
40 // resize() method
41 // [] operator for setting rows
42 template<double init_function(int,int),class Vector>
44  A.resize(size);
45  for (unsigned int row=0; row<A.size() ; row++){
46  init_row<init_function>(A[row],size,row);
47  }
48 }
49 
50 template<double init_function(int,int),class Matrix>
52  A.resize(size);
53  for (unsigned int row=0; row<A.size() ; row++)
54  A[row].resize(size);
55  for (unsigned int row=0; row<A.size() ; row++){
56  A[row][row] = init_function(row,row);
57  for (unsigned int col=0; col<row ; col++){
58  double x = init_function(row,col);
59  A[row][col] = A[col][row] = x;
60  }
61  }
62 }
63 
64 #endif
col
m col(1)
init_row
BTL_DONT_INLINE void init_row(Vector &X, int size, int row)
Definition: init_matrix.hh:28
resize
v resize(3)
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
X
#define X
Definition: icosphere.cpp:20
init_matrix
BTL_DONT_INLINE void init_matrix(Vector &A, int size)
Definition: init_matrix.hh:43
size
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
ceres::Matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
Definition: gtsam/3rdparty/ceres/eigen.h:42
A
Definition: test_numpy_dtypes.cpp:298
j
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2
row
m row(1)
init_matrix_symm
BTL_DONT_INLINE void init_matrix_symm(Matrix &A, int size)
Definition: init_matrix.hh:51
BTL_DONT_INLINE
#define BTL_DONT_INLINE
Definition: btl.hh:38
ceres::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
Definition: gtsam/3rdparty/ceres/eigen.h:38


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:42