[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN helpers.h doc/documentation.h internal/con...
From: |
Edward Rosten |
Subject: |
[Toon-members] TooN helpers.h doc/documentation.h internal/con... |
Date: |
Tue, 28 Apr 2009 21:45:47 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Edward Rosten <edrosten> 09/04/28 21:45:47
Modified files:
. : helpers.h
doc : documentation.h
internal : config.hh debug.hh
Log message:
internal/debug.hh
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/documentation.h?cvsroot=toon&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/config.hh?cvsroot=toon&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/debug.hh?cvsroot=toon&r1=1.4&r2=1.5
Patches:
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- helpers.h 28 Apr 2009 17:19:11 -0000 1.60
+++ helpers.h 28 Apr 2009 21:45:45 -0000 1.61
@@ -109,6 +109,18 @@
return result;
}
+ /// Frobenius (root of sum of squares) norm of input matrix m
+ /// computes the maximum of the sums of absolute values over rows
+ template <int R, int C, typename P, typename B>
+ P inline norm_fro( const Matrix<R,C,P,B> & m ){
+ using std::sqrt;
+ P n = 0;
+ for(int r = 0; r < m.num_rows(); ++r)
+ for(int c = 0; c < m.num_cols(); ++c)
+ n += m[r][c] * m[r][c];
+
+ return sqrt(n);
+ }
/// row sum norm of input matrix m
/// computes the maximum of the sums of absolute values over rows
@@ -208,6 +220,15 @@
}
}
+ template<int R, int C, class P, class B> P trace(const Matrix<R,C,P,B>&
m)
+ {
+ SizeMismatch<R, C>::test(m.num_rows(), m.num_cols());
+ P p=0;
+ for(int i=0; i < m.num_rows(); i++)
+ p+=m[i][i];
+ return p;
+ }
+
/// computes the trace of a square matrix
template<int Rows, int Cols, typename Precision, typename Base>
Precision trace(const Matrix<Rows, Cols, Precision, Base> & m ){
Index: doc/documentation.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/documentation.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- doc/documentation.h 28 Apr 2009 14:41:11 -0000 1.23
+++ doc/documentation.h 28 Apr 2009 21:45:46 -0000 1.24
@@ -295,10 +295,12 @@
TooN does not initialize data in a Vector or Matrix. For debugging
purposes
the following macros can be defined:
- - \c TOON_INITIALIZE_NAN Sets every element of newly defined Vectors or
- Matrixs to NaN, if it exists, and 0 otherwise. Your code will not
compile
+ - \c TOON_INITIALIZE_QNAN Sets every element of newly defined Vectors or
+ Matrixs to quiet NaN, if it exists, and 0 otherwise. Your code will
not compile
if you have made a Vector or Matrix of a type which cannot be
constructed
from a number.
+ - \c TOON_INITIALIZE_SNAN Sets every element of newly defined Vectors or
+ Matrixs to signalling NaN, if it exists, and 0 otherwise.
- \c TOON_INITIALIZE_VAL Sets every element of newly defined Vectors or
Matrixs to the expansion of this macro.
- \c TOON_INITIALIZE_RANDOM Fills up newly defined Vectors and Matrixs
with
Index: internal/config.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/config.hh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- internal/config.hh 27 Apr 2009 13:33:25 -0000 1.6
+++ internal/config.hh 28 Apr 2009 21:45:46 -0000 1.7
@@ -1 +1,13 @@
+/* internal/config.hh. Generated from config.hh.in by configure. */
+/* #undef TOON_TYPEOF_DECLTYPE */
+
+/* #undef TOON_TYPEOF_TYPEOF */
+
+#define TOON_TYPEOF___TYPEOF__ 1
+
+/* #undef TOON_TYPEOF_BOOST */
+
+/* #undef TOON_TYPEOF_BUILTIN */
+
+#define PACKAGE_VERSION "version-2.0.0-beta2"
Index: internal/debug.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/debug.hh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- internal/debug.hh 27 Apr 2009 16:58:27 -0000 1.4
+++ internal/debug.hh 28 Apr 2009 21:45:46 -0000 1.5
@@ -20,12 +20,19 @@
static inline void check_index(int, int){}
#endif
- #if defined TOON_INITIALIZE_NAN
+ #if defined TOON_INITIALIZE_SNAN
template<class P> static void debug_initialize(P* data, int n)
{
using std::numeric_limits;
for(int i=0; i < n; i++)
- data[i] = numeric_limits<P>::signaling_NaN()
+ data[i] = numeric_limits<P>::signaling_NaN();
+ }
+ #elif defined TOON_INITIALIZE_QNAN
+ template<class P> static void debug_initialize(P* data, int n)
+ {
+ using std::numeric_limits;
+ for(int i=0; i < n; i++)
+ data[i] = numeric_limits<P>::quiet_NaN();
}
#elif defined TOON_INITIALIZE_VAL
template<class P> static void debug_initialize(P* data, int n)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN helpers.h doc/documentation.h internal/con...,
Edward Rosten <=