[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN helpers.h
From: |
Edward Rosten |
Subject: |
[Toon-members] TooN helpers.h |
Date: |
Wed, 06 May 2009 14:55:44 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Edward Rosten <edrosten> 09/05/06 14:55:44
Modified files:
. : helpers.h
Log message:
Removed element-wise functions. I thought I needed them, but I was
mistaken. If there is a good reason to put them back in, then they are
still
available from CVS.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.64&r2=1.65
Patches:
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- helpers.h 6 May 2009 14:51:17 -0000 1.64
+++ helpers.h 6 May 2009 14:55:44 -0000 1.65
@@ -235,77 +235,5 @@
return tr;
}
-
- namespace Internal
- {
- template<int S, class P, class B, class Func> class VectorUnary;
- template<int R, int C, class P, class B, class Func> class
MatrixUnary;
- template<class P> struct Exp{P apply(const P& v) const { using
std::exp; return exp(v);}};
- template<class P> struct Log{P apply(const P& v) const { using
std::exp; return log(v);}};
- };
-
- template<int S, class P, class B, class Func> struct
Operator<Internal::VectorUnary<S, P, B, Func> >
- {
- const Vector<S, P, B>& v;
- const Func& f;
- Operator(const Vector<S, P, B>& v_, const Func& f_)
- :v(v_),f(f_){}
-
-
- int size() const { return v.size(); }
-
- template<int S_, class P_>
- void eval(Vector<S_, P_>& r) const
- {
- for(int i=0; i < r.size(); i++)
- r[i] = f.apply(v[i]);
- }
- };
-
- template<int R, int C, class P, class B, class Func> struct
Operator<Internal::MatrixUnary<R, C, P, B, Func> >
- {
- const Matrix<R, C, P, B>& m;
- const Func& f;
- Operator(const Matrix<R, C, P, B>& m_, const Func& f_)
- :m(m_),f(f_){}
-
- int num_rows() const { return m.num_rows(); }
- int num_cols() const { return m.num_cols(); }
-
- template<int R_, int C_, class P_>
- void eval(Matrix<R_, C_, P_>& ret) const
- {
- for(int r=0; r < m.num_rows(); r++)
- for(int c=0; c < m.num_cols(); c++)
- ret(r,c) = f.apply(m(r,c));
- }
- };
-
-
- template<int S, class P, class B>
- Vector<S, P> e_exp(const Vector<S, P, B>& v)
- {
- return Operator<Internal::VectorUnary<S, P, B, Internal::Exp<P>
> >(v, Internal::Exp<P> ());
- }
-
- template<int S, class P, class B>
- Vector<S, P> e_log(const Vector<S, P, B>& v)
- {
- return Operator<Internal::VectorUnary<S, P, B, Internal::Log<P>
> >(v, Internal::Log<P> ());
- }
-
- template<int R, int C, class P, class B>
- Matrix<R, C, P> e_exp(const Matrix<R, C, P, B>& m)
- {
- return Operator<Internal::MatrixUnary<R, C, P, B,
Internal::Exp<P> > >(m, Internal::Exp<P> ());
- }
-
- template<int R, int C, class P, class B>
- Matrix<R, C, P> e_log(const Matrix<R, C, P, B>& m)
- {
- return Operator<Internal::MatrixUnary<R, C, P, B,
Internal::Log<P> > >(m, Internal::Log<P> ());
- }
-
-
}
#endif