36 template<
int Size,
typename Precision,
typename Base>
40 template<
int Size,
typename Precision,
typename Base>
41 struct Operator<Internal::DiagMatrixOp<Size, Precision, Base> >
49 inline Operator(
int size_in) : my_vector(size_in) {}
50 inline Operator(Precision* data) : my_vector(data) {}
51 inline Operator(Precision* data,
int size_in) : my_vector(data,size_in) {}
66 template<
int Size2,
typename Precision2,
typename Base2>
68 : my_vector(from.size())
77 template<
int R,
int C,
class P,
class B>
81 m.diagonal_slice() = my_vector;
107 template<
int Size=Dynamic,
typename Precision=DefaultPrecision,
typename Base=Internal::VBase>
125 :
Operator<Internal::DiagMatrixOp<Size, Precision, Base> > (op)
127 op.eval(this->my_vector);
131 template<
int Size2,
typename Precision2,
typename Base2>
135 this->my_vector=from;
144 const Precision&
operator[](
int i)
const {
return this->my_vector[i];}
148 return this->my_vector.as_slice();
153 return this->my_vector.as_slice();
158 return -this->my_vector;
164 for(
int i=0; i <
inv.size(); i++)
165 inv[i] = 1 / this->my_vector[i];
171 template<
int S1,
typename P1,
typename B1,
int S2,
typename P2,
typename B2>
177 template<
int S1,
typename P1,
typename B1,
int S2,
typename P2,
typename B2>
184 template<
int S1,
typename P1,
typename B1,
int S2,
typename P2,
typename B2>
191 template<
int R,
int C,
int Size,
typename P1,
typename P2,
typename B1,
typename B2>
197 template<
int R,
int C,
typename P1,
typename B1,
int Size,
typename P2,
typename B2>
Operator(const Operator< Op > &op)
my_vector constructed from a TooN::Operator
Definition: diagmatrix.h:59
Pretty generic SFINAE introspection generator.
Definition: vec_test.cc:21
A vector.
Definition: vector.hh:126
const Vector< Size, Precision, Base >::as_slice_type diagonal_slice() const
Return the leading diagonal as a vector.
Definition: diagmatrix.h:152
Matrix< 2 > inv(const Matrix< 2 > &m)
Invert a matrix.
Definition: helpers.h:65
A diagonal matrix.
Definition: diagmatrix.h:108
Definition: operators.hh:119
Definition: operators.hh:86
Definition: diagmatrix.h:37
Vector< Size, Precision, Base >::as_slice_type diagonal_slice()
Return the leading diagonal as a vector.
Definition: diagmatrix.h:147
DiagonalMatrix(const Operator< Op > &op)
my_vector constructed from a TooN::Operator
Definition: diagmatrix.h:124
const Precision & operator[](int i) const
Index the leading elements on the diagonal.
Definition: diagmatrix.h:144
Precision & operator[](int i)
Index the leading elements on the diagonal.
Definition: diagmatrix.h:142
Definition: size_mismatch.hh:103
Vector< Size, Precision, Base > my_vector
The vector used to hold the leading diagonal.
Definition: diagmatrix.h:85