41 template<
int R,
int C,
class P,
class B,
class Ps>
class AddIdentity;
52 template<
class C>
operator C()
const 58 template<
class Rhs> Rhs operator*(
One,
const Rhs& v){
return v;}
59 template<
class Lhs> Lhs operator*(
const Lhs& v,
One){
return v;}
60 template<
class Rhs> Rhs operator+(
One,
const Rhs& v){
return 1+v;}
61 template<
class Lhs> Lhs operator+(
const Lhs& v,
One){
return v+1;}
62 template<
class Rhs> Rhs operator-(
One,
const Rhs& v){
return 1-v;}
63 template<
class Lhs> Lhs operator-(
const Lhs& v,
One){
return v-1;}
66 inline int operator-(
const One&)
96 template<
class Rhs>
struct Field<Internal::
One, Rhs>
107 template<
class Lhs>
struct Field<Lhs, Internal::
One>
120 template<>
struct Operator<Internal::SizedZero>;
121 template<> struct
Operator<Internal::RCZero>;
130 template<
int Size,
class Precision,
class Base>
132 for(
int i=0; i < v.size(); i++) {
137 template<
int R,
int C,
class P,
class B>
139 for(
int r=0; r<m.num_rows(); r++){
140 for(
int c=0; c<m.num_cols(); c++){
147 template<
int R,
int C,
class P,
class B>
149 for(
int r=0; r<m.num_rows(); r++)
150 for(
int c=0; c<m.num_cols(); c++)
158 template<
int S,
class P,
class B>
160 for(
int i=0; i<v.size(); i++)
180 Operator(
int r,
int c) : my_rows(r), my_cols(c) {}
185 int num_rows()
const {
return my_rows;}
186 int num_cols()
const {
return my_cols;}
201 int size()
const {
return my_size;}
202 int num_rows()
const {
return my_size;}
203 int num_cols()
const {
return my_size;}
223 template<
int R,
int C,
class P,
class B,
class Precision>
struct Operator<Internal::AddIdentity<R,C,P,B,Precision> >
232 :s(s_),m(m_),invert_m(b){}
237 template<
int R1,
int C1,
class P1,
class B1>
239 for(
int r=0; r < m.num_rows(); r++)
240 for(
int c=0; c < m.num_cols(); c++)
246 for(
int i=0; i < m.num_rows(); i++)
267 template<
class Pr>
struct Operator<Internal::Identity<Pr> > {
272 typedef Pr Precision;
294 template<
int R,
int C,
class P,
class B>
298 for(
int r=0; r<m.num_rows(); r++){
299 for(
int c=0; c<m.num_cols(); c++){
304 for(
int r=0; r < m.num_rows(); r++) {
309 template<
int Rows,
int Cols,
typename P,
typename B>
313 for(
int i=0; i < m.num_rows(); i++)
317 template <
int Rows,
int Cols,
typename P1,
typename B1>
324 template <
int Rows,
int Cols,
typename P1,
typename B1>
331 template <
int Rows,
int Cols,
typename P1,
typename B1>
350 template<
class Precision>
struct Operator<Internal::SizedIdentity<Precision> >
351 :
public Operator<Internal::Identity<Precision> > {
365 int num_rows()
const {
return my_size;}
366 int num_cols()
const {
return my_size;}
386 template<
int S,
class P,
class B,
class Precision>
struct Operator<Internal::ScalarsVector<S,P,B,Precision> >
395 :s(s_),v(v_),invert_v(inv){}
400 template<
int S1,
class P1,
class B1>
402 for(
int i=0; i < v.size(); i++)
422 template<
int R,
int C,
class P,
class B,
class Precision>
struct Operator<Internal::ScalarsMatrix<R,C,P,B,Precision> >
430 :s(s_),m(m_),invert_m(inv){}
431 template<
int R1,
int C1,
class P1,
class B1>
433 for(
int r=0; r < m.num_rows(); r++)
434 for(
int c=0; c < m.num_cols(); c++)
436 mm[r][c] = s - m[r][c];
438 mm[r][c] = s + m[r][c];
459 template<
class P>
struct Operator<Internal::Scalars<P> >
484 template <
int Size,
typename P1,
typename B1>
487 for(
int i=0; i < v.size(); i++)
491 template <
int Size,
typename P1,
typename B1>
494 for(
int i=0; i < v.size(); i++)
498 template <
int Size,
typename P1,
typename B1>
501 for(
int i=0; i < v.size(); ++i)
505 template <
int Size,
typename P1,
typename B1>
511 template <
int Size,
typename P1,
typename B1>
517 template <
int Size,
typename P1,
typename B1>
528 template <
int Rows,
int Cols,
typename P1,
typename B1>
531 for(
int r=0; r < m.num_rows(); r++)
532 for(
int c=0; c < m.num_cols(); c++)
536 template <
int Rows,
int Cols,
typename P1,
typename B1>
539 for(
int r=0; r < m.num_rows(); r++)
540 for(
int c=0; c < m.num_cols(); c++)
544 template <
int Rows,
int Cols,
typename P1,
typename B1>
547 for(
int r=0; r < m.num_rows(); r++)
548 for(
int c=0; c < m.num_cols(); c++)
552 template <
int Rows,
int Cols,
typename P1,
typename B1>
559 template <
int Rows,
int Cols,
typename P1,
typename B1>
565 template <
int Rows,
int Cols,
typename P1,
typename B1>
602 template<
class P>
struct Operator<Internal::SizedScalars<P> >:
public Operator<Internal::Scalars<P> >
611 int num_rows()
const {
614 int num_cols()
const {
634 void operator()(
int);
635 void operator()(
int,
int);
642 template<
class P>
struct Operator<Internal::RCScalars<P> >:
public Operator<Internal::Scalars<P> >
648 const int my_rows, my_cols;
649 int num_rows()
const {
652 int num_cols()
const {
667 void operator()(
int);
668 void operator()(
int,
int);
677 template<
template<
class>
class Op,
class Pl,
class Pr>
679 operator*(
const Pl& l,
const Operator<Op<Pr> >& r)
681 return r.template scale_me<typename Internal::MultiplyType<Pl, Pr>::type, Pl>(l);
684 template<
template<
class>
class Op,
class Pl,
class Pr>
686 operator*(
const Operator<Op<Pl> >& l,
const Pr& r)
688 return l.template scale_me<typename Internal::MultiplyType<Pl, Pr>::type>(r);
691 template<
template<
class>
class Op,
class Pl,
class Pr>
693 operator/(
const Operator<Op<Pl> >& l,
const Pr& r)
702 return o.template scale_me<typename Operator<Op>::Precision>(-1);
706 template<
template<
class>
class Op>
709 return o.template scale_me<DefaultPrecision>(-1);
const Precision val
}
Definition: objects.h:280
const Precision s
Scalar to add.
Definition: objects.h:424
const bool invert_m
Whether to use + or - m.
Definition: objects.h:426
const Precision s
Scalar to add.
Definition: objects.h:388
const bool invert_v
Whether to use + or - v.
Definition: objects.h:390
const Vector< S, P, B > & v
Vector to be added to.
Definition: objects.h:389
Pretty generic SFINAE introspection generator.
Definition: vec_test.cc:21
A vector.
Definition: vector.hh:126
int Type
One really repersents 1.
Definition: objects.h:88
One()
This constructor does nothing.
Definition: objects.h:51
Matrix< 2 > inv(const Matrix< 2 > &m)
Invert a matrix.
Definition: helpers.h:65
const Precision s
Scale of the identity matrix.
Definition: objects.h:225
Definition: objects.h:176
Definition: operators.hh:119
Determine if two classes are in the same field.
Definition: operators.hh:39
C Type
The type of -C.
Definition: objects.h:77
Definition: operators.hh:87
const Matrix< R, C, P, B > & m
matrix to which the identity should be added
Definition: objects.h:226
const Precision s
Value of the scalar being represented.
Definition: objects.h:466
Definition: size_mismatch.hh:103
bool invert_m
Whether the identity should be added to + or - m.
Definition: objects.h:227
Definition: objects.h:127
const Matrix< R, C, P, B > & m
Vector to be added to.
Definition: objects.h:425
Definition: objects.h:193