[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN Cholesky.h Doxyfile LU.h SVD.h SymEigen.h ...
From: |
Edward Rosten |
Subject: |
[Toon-members] TooN Cholesky.h Doxyfile LU.h SVD.h SymEigen.h ... |
Date: |
Tue, 09 Jun 2009 13:33:23 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Edward Rosten <edrosten> 09/06/09 13:33:23
Modified files:
. : Cholesky.h Doxyfile LU.h SVD.h SymEigen.h
TooN.h gaussian_elimination.h helpers.h se2.h
so2.h so3.h wls.h
doc : documentation.h
internal : allocator.hh config.hh diagmatrix.h objects.h
optimization : conjugate_gradient.h golden_section.h
Removed files:
. : util.h
Log message:
Added some documentation.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/Cholesky.h?cvsroot=toon&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/TooN/Doxyfile?cvsroot=toon&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/TooN/LU.h?cvsroot=toon&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/TooN/SVD.h?cvsroot=toon&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/TooN/SymEigen.h?cvsroot=toon&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/TooN/TooN.h?cvsroot=toon&r1=1.43&r2=1.44
http://cvs.savannah.gnu.org/viewcvs/TooN/gaussian_elimination.h?cvsroot=toon&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.67&r2=1.68
http://cvs.savannah.gnu.org/viewcvs/TooN/se2.h?cvsroot=toon&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/TooN/so2.h?cvsroot=toon&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/TooN/so3.h?cvsroot=toon&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/TooN/wls.h?cvsroot=toon&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/TooN/util.h?cvsroot=toon&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/documentation.h?cvsroot=toon&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/allocator.hh?cvsroot=toon&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/config.hh?cvsroot=toon&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/diagmatrix.h?cvsroot=toon&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/objects.h?cvsroot=toon&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/TooN/optimization/conjugate_gradient.h?cvsroot=toon&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/TooN/optimization/golden_section.h?cvsroot=toon&r1=1.4&r2=1.5
Patches:
Index: Cholesky.h
===================================================================
RCS file: /cvsroot/toon/TooN/Cholesky.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- Cholesky.h 20 Apr 2009 20:40:24 -0000 1.36
+++ Cholesky.h 9 Jun 2009 13:33:22 -0000 1.37
@@ -92,6 +92,7 @@
do_compute();
}
+ private:
void do_compute() {
int size=my_cholesky.num_rows();
for(int col=0; col<size; col++){
@@ -116,6 +117,7 @@
}
}
}
+ public:
/// Compute x = A^-1*v
/// Run time is O(N^2)
@@ -152,7 +154,8 @@
return result;
}
- ///@overload
+ /**overload
+ */
template<int Size2, int C2, class P2, class B2>
Matrix<Size, C2, Precision> backsub (const Matrix<Size2, C2, P2, B2>&
m) {
int size=my_cholesky.num_rows();
@@ -194,6 +197,7 @@
return backsub(I);
}
+ ///Compute the determinant.
Precision determinant(){
Precision answer=my_cholesky(0,0);
for(int i=1; i<my_cholesky.num_rows(); i++){
Index: Doxyfile
===================================================================
RCS file: /cvsroot/toon/TooN/Doxyfile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- Doxyfile 12 May 2009 09:27:32 -0000 1.5
+++ Doxyfile 9 Jun 2009 13:33:22 -0000 1.6
@@ -23,7 +23,7 @@
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 2.0.0-beta3
+PROJECT_NUMBER = 2.0.0-beta4
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@@ -203,7 +203,7 @@
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
-EXTRACT_STATIC = NO
+EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
@@ -245,7 +245,7 @@
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
-INTERNAL_DOCS = NO
+INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
@@ -259,7 +259,7 @@
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
-HIDE_SCOPE_NAMES = NO
+HIDE_SCOPE_NAMES = YES
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the
documentation
@@ -412,7 +412,7 @@
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT
tag.
-EXCLUDE = wls_cholesky.h lapack.h internal/make_vector.hh
+EXCLUDE = wls_cholesky.h lapack.h internal/make_vector.hh
internal/builtin_typeof.h
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
directories
# that are symbolic links (a Unix filesystem feature) are excluded from the
input.
Index: LU.h
===================================================================
RCS file: /cvsroot/toon/TooN/LU.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- LU.h 15 Apr 2009 15:50:32 -0000 1.17
+++ LU.h 9 Jun 2009 13:33:22 -0000 1.18
@@ -174,6 +174,7 @@
/// are L.
const Matrix<Size,Size,Precision>& get_lu()const {return my_lu;}
+ private:
inline int get_sign() const {
int result=1;
for(int i=0; i<my_lu.num_rows()-1; i++){
@@ -183,6 +184,7 @@
}
return result;
}
+ public:
/// Calculate the determinant of the matrix
inline Precision determinant() const {
Index: SVD.h
===================================================================
RCS file: /cvsroot/toon/TooN/SVD.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- SVD.h 23 Apr 2009 22:30:03 -0000 1.18
+++ SVD.h 9 Jun 2009 13:33:22 -0000 1.19
@@ -86,11 +86,12 @@
**/
template<int Rows=Dynamic, int Cols=Rows, typename Precision=DefaultPrecision>
class SVD {
-public:
// this is the size of the diagonal
// NB works for semi-dynamic sizes because -1 < +ve ints
static const int Min_Dim = Rows<Cols?Rows:Cols;
+public:
+
/// default constructor for Rows>0 and Cols>0
SVD() {}
@@ -119,6 +120,7 @@
do_compute();
}
+ private:
void do_compute(){
Precision* const a = my_copy.my_data;
int lda = my_copy.num_cols();
@@ -168,6 +170,7 @@
int min_dim(){ return std::min(my_copy.num_rows(), my_copy.num_cols());
}
+ public:
/// Calculate result of multiplying the (pseudo-)inverse of M by
another matrix.
/// For a matrix \f$A\f$, this calculates \f$M^{\dagger}A\f$ by back
substitution
@@ -257,7 +260,11 @@
}
}
-
+ ///Return the pesudo-inverse diagonal. The reciprocal of the diagonal
elements
+ ///is returned if the elements are well scaled with respect to the
largest element,
+ ///otherwise 0 is returned.
+ ///@param inv_diag Vector in which to return the inverse diagonal.
+ ///@param condition Elements must be larger than this factor times the
largest diagonal element to be considered well scaled.
void get_inv_diag(Vector<Min_Dim>& inv_diag, const Precision condition){
for(int i=0; i<min_dim(); i++){
if(my_diagonal[i] * condition <= my_diagonal[0]){
@@ -284,12 +291,15 @@
/// @ingroup gDecomps
template<int Size, typename Precision>
struct SQSVD : public SVD<Size, Size, Precision> {
- // forward all constructors to SVD
+ ///All constructors are forwarded to SVD in a straightforward manner.
+ ///@name Constructors
+ ///@{
SQSVD() {}
SQSVD(int size) : SVD<Size,Size,Precision>(size, size) {}
template <int R2, int C2, typename P2, typename B2>
SQSVD(const Matrix<R2,C2,P2,B2>& m) : SVD<Size,Size,Precision>(m) {}
+ ///@}
};
Index: SymEigen.h
===================================================================
RCS file: /cvsroot/toon/TooN/SymEigen.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- SymEigen.h 8 May 2009 12:06:28 -0000 1.15
+++ SymEigen.h 9 Jun 2009 13:33:22 -0000 1.16
@@ -39,10 +39,18 @@
namespace TooN {
+///Default condition number for SymEigen::backsub, SymEigen::get_pinv and
SymEigen::get_inv_diag
static const double symeigen_condition_no=1e9;
+///Helper struct for computing eigensystems, to allow for specialization on
+///2x2 matrices.
+///@ingroup gInternal
template <int Size> struct ComputeSymEigen {
+ ///Compute an eigensystem.
+ ///@param m Input matrix (assumed to be symmetric)
+ ///@param evectors Eigen vector output
+ ///@param evalues Eigen values output
template<typename P, typename B>
static inline void compute(const Matrix<Size,Size,P, B>& m,
Matrix<Size,Size,P> & evectors, Vector<Size, P>& evalues) {
evectors = m;
@@ -193,6 +201,9 @@
/// They are returned in order of the size of the corresponding
eigenvalue, i.e.
/// the vector with the largest eigenvalue is first.
Matrix<Size,Size,Precision>& get_evectors() {return my_evectors;}
+
+ /**\overload
+ */
const Matrix<Size,Size,Precision>& get_evectors() const {return
my_evectors;}
@@ -200,6 +211,8 @@
/// The eigenvalues are listed in order, from the largest to the
smallest.
/// These are also the diagonal values of the matrix \f$\Lambda\f$.
Vector<Size, Precision>& get_evalues() {return my_evalues;}
+ /**\overload
+ */
const Vector<Size, Precision>& get_evalues() const {return my_evalues;}
/// Is the matrix positive definite?
Index: TooN.h
===================================================================
RCS file: /cvsroot/toon/TooN/TooN.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- TooN.h 22 May 2009 10:31:42 -0000 1.43
+++ TooN.h 9 Jun 2009 13:33:22 -0000 1.44
@@ -76,10 +76,102 @@
template<int Size, class Precision, class Base> struct Vector;
template<int Rows, int Cols, class Precision, class Base> struct Matrix;
template<int Size, class Precision, class Base> struct DiagonalMatrix;
+
+ #ifdef DOXYGEN_INCLUDE_ONLY_FOR_DOCS
+ ///This is a struct used heavily in TooN.
+ ///
+ ///They have two main uses. The first use is in construction
and is completely hidden.
+ ///For an expression such as a+b, the return value of operator+
will be constructed in
+ ///place in the return statement, to prevent excessive copying
and calls to new/delete.
+ ///
+ ///The other use is much more visible and is for objects such
as TooN::Zeros and TooN::Idendity .
+ ///
+ ///The features allowed (construction, addition, etc) depend on
the members present.
+ ///For simplicity, general arguments are given below. If
members are non-general, then the
+ ///operators will simply not be applicable to all vectors or
matrices.
+ ///@ingroup gInternal
+ template<typename T> struct Operator{
+ ///@name Members used by Vector
+ ///@{
+ ///This must be provided in order to construct vectors.
+ int size() const;
+
+ ///This function must be present for construction and
assignment
+ ///of vectors to work.
+ template<int Size, class Precision, class Base>
+ void eval(Vector<Size, Precision, Base>& v) const;
+
+ ///This must be present for vector += operator
+ template <int Size, typename P1, typename B1>
+ void plusequals(Vector<Size, P1, B1>& v) const;
+
+ ///This must be present for vector -= operator
+ template <int Size, typename P1, typename B1>
+ void minusequals(Vector<Size, P1, B1>& v) const;
+
+ ///This function must be present for vector + operator
+ ///and operator + vector
+ template <int Size, typename P1, typename B1>
+ Operator<T> add(const Vector<Size, P1, B1>& v) const;
+
+ ///This function must be present for vector - operator
+ template <int Size, typename P1, typename B1>
+ Operator<T> rsubtract(const Vector<Size, P1, B1>& v)
const;
+
+ ///This function must be present for operator - vector
+ template <int Size, typename P1, typename B1>
+ Operator<T> lsubtract(const Vector<Size, P1, B1>& v)
const;
+
+ ///@}
+
+ ///@name Members used by Matrix
+ ///@{
+
+ ///This along with num_cols() must be present in order
to construct matrices.
+ ///The return value will be ignored for static rows.
+ int num_rows() const;
+ ///This along with num_rows() must be present in order
to construct matrices.
+ ///The return value will be ignored for static columns.
+ int num_cols() const;
+
+ ///This function must be present for construction and
assignment
+ ///of matrices to work.
+ template<int R, int C, class P, class B>
+ void eval(Matrix<R,C,P,B>& m) const;
+
+ ///This function must be present for matrix + operator
+ ///and operator + matrix
+ template <int Rows, int Cols, typename P1, typename B1>
+ Operator<T> add(const Matrix<Rows,Cols, P1, B1>& m)
const;
+
+
+ ///This function must be present for matrix - operator
+ template <int Rows, int Cols, typename P1, typename B1>
+ Operator<T> rsubtract(const Matrix<Rows,Cols, P1, B1>&
m) const;
+
+ ///This function must be present for operator - matrix
+ template <int Rows, int Cols, typename P1, typename B1>
+ Operator<T> lsubtract(const Matrix<Rows,Cols, P1, B1>&
m) const;
+
+ ///This must be present for matrix += operator
+ template <int Rows, int Cols, typename P1, typename B1>
+ void plusequals(Matrix<Rows,Cols, P1, B1>& m) const;
+
+ ///This must be present for matrix -= operator
+ template <int Rows, int Cols, typename P1, typename B1>
+ void minusequals(Matrix<Rows,Cols, P1, B1>& m) const;
+
+ ///@}
+ }
+
+ #else
template<typename T> struct Operator;
+ #endif
+ ///Template size value used to indicate dynamically sized vectors and
matrices.
static const int Dynamic = -1;
+ ///All TooN classes default to using this precision for computations
and storage.
typedef double DefaultPrecision;
}
Index: gaussian_elimination.h
===================================================================
RCS file: /cvsroot/toon/TooN/gaussian_elimination.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- gaussian_elimination.h 15 Apr 2009 15:59:37 -0000 1.7
+++ gaussian_elimination.h 9 Jun 2009 13:33:22 -0000 1.8
@@ -37,6 +37,9 @@
namespace TooN {
///@ingroup gEquations
+ ///Return the solution for \f$Ax = b\f$, given \f$A\f$ and \f$b\f$
+ ///@param A \f$A\f$
+ ///@param b \f$b\f$
template<int N, typename Precision>
inline Vector<N, Precision> gaussian_elimination (Matrix<N,N,Precision>
A, Vector<N, Precision> b) {
using std::swap;
@@ -95,6 +98,9 @@
};
///@ingroup gEquations
+ ///Return the solution for \f$Ax = b\f$, given \f$A\f$ and \f$b\f$
+ ///@param A \f$A\f$
+ ///@param b \f$b\f$
template<int R1, int C1, int R2, int C2, typename Precision>
inline Matrix<Internal::Size3<R1, C1, R2>::s, C2, Precision>
gaussian_elimination (Matrix<R1,C1,Precision> A, Matrix<R2, C2, Precision> b) {
using std::swap;
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- helpers.h 13 May 2009 13:58:49 -0000 1.67
+++ helpers.h 9 Jun 2009 13:33:22 -0000 1.68
@@ -42,13 +42,16 @@
namespace TooN {
-
+ ///\deprecated
+ ///@ingroup gLinAlg
template<int Size, class Precision, class Base> TOON_DEPRECATED void
Fill(Vector<Size, Precision, Base>& v, const Precision& p)
{
for(int i=0; i < v.size(); i++)
v[i]= p;
}
+ ///\deprecated
+ ///@ingroup gLinAlg
template<int Rows, int Cols, class Precision, class Base>
TOON_DEPRECATED void Fill(Matrix<Rows, Cols, Precision, Base>& m, const
Precision& p)
{
for(int i=0; i < m.num_rows(); i++)
@@ -56,17 +59,27 @@
m[i][j] = p;
}
+ ///Compute the \f$L_2\f$ norm of \e v
+ ///@param v \e v
+ ///@ingroup gLinAlg
template<int Size, class Precision, class Base> inline Precision
norm(const Vector<Size, Precision, Base>& v)
{
using std::sqrt;
return sqrt(v*v);
}
+ ///Compute the \f$L_2^2\f$ norm of \e v
+ ///@param v \e v
+ ///@ingroup gLinAlg
template<int Size, class Precision, class Base> inline Precision
norm_sq(const Vector<Size, Precision, Base>& v)
{
return v*v;
}
+
+ ///Compute a the unit vector \f$\hat{v}\f$.
+ ///@param v \e v
+ ///@ingroup gLinAlg
template<int Size, class Precision, class Base> inline Vector<Size,
Precision> unit(const Vector<Size, Precision, Base> & v)
{
using std::sqrt;
@@ -86,20 +99,31 @@
}
//This overload is required to operate on non-slice vectors
- ///@overload
+ /**
+ \overload
+ */
template<int Size, class Precision> inline void normalize(Vector<Size,
Precision> & v)
{
normalize(v.as_slice());
}
+ ///For a vector \e v of length \e i, return \f$[v_1, v_2, \cdots,
v_{i-1}] / v_i \f$
+ ///@param v \e v
+ ///@ingroup gLinAlg
template<int Size, typename Precision, typename Base> inline
Vector<Size-1, Precision> project( const Vector<Size, Precision, Base> & v){
return v.template slice<0,Size-1>() / v[Size-1];
}
+ /**
+ \overload
+ */
template<typename Precision, typename Base> inline Vector<-1,
Precision> project( const Vector<-1, Precision, Base> & v){
return v.slice(0,v.size()-1) / v[v.size()-1];
}
+ ///For a vector \e v of length \e i, return \f$[v_1, v_2, \cdots,
v_{i}, 1]\f$
+ ///@param v \e v
+ ///@ingroup gLinAlg
template<int Size, typename Precision, typename Base> inline
Vector<Size+1, Precision> unproject( const Vector<Size, Precision, Base> & v){
Vector<Size+1, Precision> result;
result.template slice<0,Size>() = v;
@@ -107,6 +131,9 @@
return result;
}
+ /**
+ \overload
+ */
template<typename Precision, typename Base> inline Vector<-1,
Precision> unproject( const Vector<-1, Precision, Base> & v){
Vector<-1, Precision> result(v.size()+1);
result.slice(0,v.size()) = v;
@@ -114,7 +141,9 @@
return result;
}
- /// Frobenius (root of sum of squares) norm of input matrix m
+ /// Frobenius (root of sum of squares) norm of input matrix \e m
+ ///@param m \e m
+ ///@ingroup gLinAlg
template <int R, int C, typename P, typename B>
P inline norm_fro( const Matrix<R,C,P,B> & m ){
using std::sqrt;
@@ -126,8 +155,9 @@
return sqrt(n);
}
- /// row sum norm of input matrix m
+ /// \e L<sub>∞</sub> (row sum) norm of input matrix m
/// computes the maximum of the sums of absolute values over rows
+ ///@ingroup gLinAlg
template <int R, int C, typename P, typename B>
P inline norm_inf( const Matrix<R,C,P,B> & m ){
using std::abs;
@@ -142,8 +172,9 @@
return n;
}
- /// col sum norm of input matrix m
+ /// \e L<sub>1</sub> (col sum) norm of input matrix m
/// computes the maximum of the sums of absolute values over columns
+ ///@ingroup gLinAlg
template <int R, int C, typename P, typename B>
P inline norm_1( const Matrix<R,C,P,B> & m ){
using std::abs;
@@ -179,6 +210,7 @@
/// squaring again.
/// @param m input matrix, must be square
/// @return result matrix of the same size/type as input
+ /// @ingroup gLinAlg
template <int R, int C, typename P, typename B>
inline Matrix<R, C, P> exp( const Matrix<R,C,P,B> & m ){
using std::max;
@@ -192,6 +224,7 @@
}
/// Returns true if every element is finite
+ ///@ingroup gLinAlg
template<int S, class P, class B> bool isfinite(const Vector<S, P, B>&
v)
{
using std::isfinite;
@@ -202,6 +235,7 @@
}
/// Returns true if any element is NaN
+ ///@ingroup gLinAlg
template<int S, class P, class B> bool isnan(const Vector<S, P, B>& v)
{
using std::isnan;
@@ -212,6 +246,9 @@
}
/// Symmetrize a matrix
+ ///@param m \e m
+ ///@return \f$ \frac{m + m^{\mathsf T}}{2} \f$
+ ///@ingroup gLinAlg
template<int Rows, int Cols, typename Precision, typename Base>
void Symmetrize(Matrix<Rows,Cols,Precision,Base>& m){
SizeMismatch<Rows,Cols>::test(m.num_rows(), m.num_cols());
@@ -226,6 +263,7 @@
/// computes the trace of a square matrix
+ ///@ingroup gLinAlg
template<int Rows, int Cols, typename Precision, typename Base>
Precision trace(const Matrix<Rows, Cols, Precision, Base> & m ){
SizeMismatch<Rows,Cols>::test(m.num_rows(), m.num_cols());
@@ -238,6 +276,7 @@
/// creates an returns a cross product matrix M from a 3 vector v, such
that for all vectors w, the following holds: v ^ w = M * w
/// @param vec the 3 vector input
/// @return the 3x3 matrix to set to the cross product matrix
+ ///@ingroup gLinAlg
template<int Size, class P, class B> inline TooN::Matrix<3, 3, P>
cross_product_matrix(const Vector<Size, P, B>& vec)
{
SizeMismatch<Size,3>::test(vec.size(), 3);
Index: se2.h
===================================================================
RCS file: /cvsroot/toon/TooN/se2.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- se2.h 29 Apr 2009 16:05:50 -0000 1.7
+++ se2.h 9 Jun 2009 13:33:22 -0000 1.8
@@ -96,9 +96,9 @@
/// returns the generators for the Lie group. These are a set of
matrices that
/// form a basis for the vector space of the Lie algebra.
- /// @item 0 is translation in x
- /// @item 1 is translation in y
- /// @item 2 is rotation in the plane
+ /// - 0 is translation in x
+ /// - 1 is translation in y
+ /// - 2 is rotation in the plane
static inline Matrix<3,3, Precision> generator(int i) {
Matrix<3,3,Precision> result(Zeros);
if(i < 2){
Index: so2.h
===================================================================
RCS file: /cvsroot/toon/TooN/so2.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- so2.h 29 Apr 2009 16:05:50 -0000 1.10
+++ so2.h 9 Jun 2009 13:33:22 -0000 1.11
@@ -55,8 +55,10 @@
/// Default constructor. Initialises the matrix to the identity (no
rotation)
SO2() : my_matrix(Identity) {}
+ /// Construct from a rotation matrix.
SO2(const Matrix<2,2,Precision>& rhs) { *this = rhs; }
+ /// Construct from an angle.
SO2(const Precision l) { *this = exp(l); }
/// Assigment operator from a general matrix. This also calls coerce()
Index: so3.h
===================================================================
RCS file: /cvsroot/toon/TooN/so3.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- so3.h 30 Apr 2009 17:50:38 -0000 1.36
+++ so3.h 9 Jun 2009 13:33:22 -0000 1.37
@@ -58,9 +58,11 @@
/// Default constructor. Initialises the matrix to the identity (no
rotation)
SO3() : my_matrix(Identity) {}
+ /// Construct from the axis of rotation (and angle given by the
magnitude).
template <int S, typename P, typename A>
SO3(const Vector<S, P, A> & v) { *this = exp(v); }
+ /// Construct from a rotation matrix.
template <int R, int C, typename P, typename A>
SO3(const Matrix<R,C,P,A>& rhs) { *this = rhs; }
Index: wls.h
===================================================================
RCS file: /cvsroot/toon/TooN/wls.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- wls.h 22 May 2009 17:47:12 -0000 1.20
+++ wls.h 9 Jun 2009 13:33:23 -0000 1.21
@@ -38,7 +38,7 @@
namespace TooN {
-/// Performs weighted least squares computation.
+/// Performs Gauss-Newton weighted least squares computation.
/// @param Size The number of dimensions in the system
/// @param Precision The numerical precision used (double, float etc)
/// @param Decomposition The class used to invert the inverse Covariance
matrix (must have one integer size and one typename precision template
arguments) this is Cholesky by default, but could also be SQSVD
@@ -59,8 +59,6 @@
}
/// Clear all the measurements and apply a constant regularisation
term.
- /// Equates to a prior that says all the parameters are zero with
\f$\sigma^2 = \frac{1}{\text{val}}\f$.
- /// @param prior The strength of the prior
void clear(){
my_C_inv = Zeros;
my_vector = Zeros;
@@ -112,7 +110,6 @@
}
/// Add multiple measurements at once (much more efficiently)
- /// @param N The number of measurements
/// @param m The measurements to add
/// @param J The Jacobian matrix
\f$\frac{\partial\text{m}_i}{\partial\text{param}_j}\f$
/// @param invcov The inverse covariance of the measurement values
@@ -150,12 +147,12 @@
Matrix<Size,Size,Precision>& get_C_inv() {return my_C_inv;}
/// Returns the inverse covariance matrix
const Matrix<Size,Size,Precision>& get_C_inv() const {return my_C_inv;}
- Vector<Size,Precision>& get_mu(){return my_mu;}
- const Vector<Size,Precision>& get_mu() const {return my_mu;}
- Vector<Size,Precision>& get_vector(){return my_vector;}
- const Vector<Size,Precision>& get_vector() const {return my_vector;}
- Decomposition<Size,Precision>& get_decomposition(){return
my_decomposition;}
- const Decomposition<Size,Precision>& get_decomposition() const {return
my_decomposition;}
+ Vector<Size,Precision>& get_mu(){return my_mu;} ///<Returns the
update. With no prior, this is the result of \f$J^\dagger e\f$.
+ const Vector<Size,Precision>& get_mu() const {return my_mu;}
///<Returns the update. With no prior, this is the result of \f$J^\dagger e\f$.
+ Vector<Size,Precision>& get_vector(){return my_vector;} ///<Returns the
vector \f$J^{\mathsf T} e\f$
+ const Vector<Size,Precision>& get_vector() const {return my_vector;}
///<Returns the vector \f$J^{\mathsf T} e\f$
+ Decomposition<Size,Precision>& get_decomposition(){return
my_decomposition;} ///< Return the decomposition object used to compute
\f$(J^{\mathsf T} J + P)^{-1}\f$
+ const Decomposition<Size,Precision>& get_decomposition() const {return
my_decomposition;} ///< Return the decomposition object used to compute
\f$(J^{\mathsf T} J + P)^{-1}\f$
private:
Index: doc/documentation.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/documentation.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- doc/documentation.h 1 May 2009 09:47:16 -0000 1.25
+++ doc/documentation.h 9 Jun 2009 13:33:23 -0000 1.26
@@ -24,7 +24,7 @@
\section sIntro Introduction
The %TooN library is a set of C++ header files which provide basic numerics
facilities:
- - @link TooN::Vector address@hidden and @link TooN::Matrix
address@hidden
+ - @link TooN::Vector address@hidden, @link TooN::Matrix address@hidden
and @link gLinAlg etc @endlink
- @link gDecomps Matrix address@hidden
- @link gOptimize Function address@hidden
- @link gTransforms Parameterized matrices (eg transformations)@endlink
@@ -216,6 +216,7 @@
Vector.slice<>(start, end);
//Dynamic slice
Matrix.slice<RowStart, ColStart, NumRows, NumCols>(); //Static
slice
Matrix.slice<>(rowstart, colstart, numrows, numcols);
//Dynamic slice
+ Matrix.diagonal_slice(); //Get
the leading diagonal as a vector.
@endcode
See also \ref sSlices
@@ -366,20 +367,21 @@
\subsection sDecompos Which decomposisions are there?
For general size matrices (not necessarily square) there are:
- @link TooN::LU LU @endlink, @link TooN::SVD SVD @endlink and
gauss_jordan
+ @link TooN::LU LU @endlink, @link TooN::SVD SVD @endlink and
gauss_jordan()
For square symmetric matrices there are:
@link TooN::SymEigen SymEigen @endlink and @link TooN::Cholesky
Cholesky @endlink
- If all you want to do is solve a single Ax=b then you may want
gaussian_elimination
+ If all you want to do is solve a single Ax=b then you may want
gaussian_elimination()
\subsection sOtherStuff What other stuff is there:
- Optimization: WLS, IRLS, downhill_simplex, SO2, SE2, SO3, SE3
-
+ Look at the @link modules modules @endlink.
\subsection sHandyFuncs What handy functions are there (normalize,
identity, fill, etc...)?
+ See @link gLinAlg here @endlink.
+
\subsection sNoInplace Why don't functions work in place?
@@ -408,21 +410,7 @@
@endcode
to get func to accept the slice.
- Alternatively, you can observe that only TooN objects with the default
base
- class own the data. All other sorts are references, so copying them only
- copies the reference, and the referred data is the same. You could
therefore
- write a function to forward on TooN objects with the default base:
-
- @code
- template<class Base> void func(Vector<3, double, Base> v);
//This will operate in-place only on slices
-
- void func(Vector<3>& v) //This will catch any non-slices and
forward them on.
- {
- func(v.as_slice());
- }
- @endcode
-
- However, please consider writing functions that do not modify
structures in
+ You may also wish to consider writing functions that do not modify
structures in
place. The \c unit function of TooN computes a unit vector given an
input
vector. In the following context, the code:
@code
@@ -700,7 +688,5 @@
iterate function. This allows different sub algorithms (such as termination
conditions) to be substituted in if need be.
address@hidden gTooN Main parts of TooN
-
@defgroup gInternal TooN internals
*/
Index: internal/allocator.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/allocator.hh,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- internal/allocator.hh 29 Apr 2009 21:55:09 -0000 1.31
+++ internal/allocator.hh 9 Jun 2009 13:33:23 -0000 1.32
@@ -98,20 +98,30 @@
}
};
-
+///This allocator object sets aside memory for a statically sized object. It
will
+///put all the data on the stack if there are less then
TooN::max_bytes_on_stack of
+///data, otherwise it will use new/delete.
+///@ingroup gInternal
template<int Size, class Precision> class StaticSizedAllocator: public
StackOrHeap<Size, Precision, (sizeof(Precision)*Size>max_bytes_on_stack) >
{
};
+
+///Allocate memory for a Vector.
+///@ingroup gInternal
template<int Size, class Precision> struct VectorAlloc : public
StaticSizedAllocator<Size, Precision> {
+ ///Default constructor (only for statically sized vectors)
VectorAlloc() { }
+ ///Construction from a size (required by damic vectors, ignored
otherwise).
VectorAlloc(int /*s*/) { }
+ ///Construction from an Operator. See Operator::size().
template<class Op>
VectorAlloc(const Operator<Op>&) {}
+ ///Return the size of the vector.
int size() const {
return Size;
}
@@ -195,6 +205,9 @@
//
// A class similar to StrideHolder, but to hold the size information for
matrices.
+///This struct holds a size is the size is dynamic,
+///or simply recorcs the number in the type system if
+///the size is static.
template<int s> struct SizeHolder
{
//Constructors ignore superfluous arguments
@@ -218,6 +231,10 @@
};
+
+///This struct holds the number of rows, only allocating space if
+///necessary.
+///@ingroup gInternal
template<int S> struct RowSizeHolder: private SizeHolder<S>
{
RowSizeHolder(int i)
@@ -233,6 +250,9 @@
};
+///This struct holds the number of columns, only allocating space if
+///necessary.
+///@ingroup gInternal
template<int S> struct ColSizeHolder: private SizeHolder<S>
{
ColSizeHolder(int i)
Index: internal/config.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/config.hh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- internal/config.hh 13 May 2009 13:43:44 -0000 1.9
+++ internal/config.hh 9 Jun 2009 13:33:23 -0000 1.10
@@ -0,0 +1,12 @@
+/* internal/config.hh. Generated from config.hh.in by configure. */
+/* #undef TOON_TYPEOF_DECLTYPE */
+
+#define TOON_TYPEOF_TYPEOF 1
+
+/* #undef TOON_TYPEOF___TYPEOF__ */
+
+/* #undef TOON_TYPEOF_BOOST */
+
+/* #undef TOON_TYPEOF_BUILTIN */
+
+#define TOON_DEPRECATED_GCC 1
Index: internal/diagmatrix.h
===================================================================
RCS file: /cvsroot/toon/TooN/internal/diagmatrix.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- internal/diagmatrix.h 6 May 2009 14:51:17 -0000 1.4
+++ internal/diagmatrix.h 9 Jun 2009 13:33:23 -0000 1.5
@@ -34,7 +34,7 @@
/**
address@hidden DiagonalMatrix TooN/toon.h
address@hidden DiagonalMatrix
A diagonal matrix
Support is limited but diagonal matrices can be multiplied by vectors, matrices
@@ -55,6 +55,9 @@
template<int Size=Dynamic, typename Precision=DefaultPrecision, typename
Base=Internal::VBase>
struct DiagonalMatrix {
public:
+ ///@name Constructors
+ ///@{
+
inline DiagonalMatrix() {}
inline DiagonalMatrix(int size_in) : my_vector(size_in) {}
inline DiagonalMatrix(Precision* data) : my_vector(data) {}
@@ -62,9 +65,9 @@
inline DiagonalMatrix(Precision* data_in, int size_in, int stride_in,
Internal::Slicing)
: my_vector(data_in, size_in, stride_in, Internal::Slicing() )
{}
-
// constructors to allow return value optimisations
// construction from 0-ary operator
+ ///my_vector constructed from a TooN::Operator
template <class Op>
inline DiagonalMatrix(const Operator<Op>& op)
: my_vector (op)
@@ -79,16 +82,21 @@
{
my_vector=from;
}
+ ///@}
+
+ ///Index the leading elements on the diagonal
Precision& operator[](int i){return my_vector[i];}
+ ///Index the leading elements on the diagonal
const Precision& operator[](int i) const {return my_vector[i];}
+ ///Return the leading diagonal as a vector.
typename Vector<Size, Precision, Base>::as_slice_type diagonal_slice() {
return my_vector.as_slice();
}
-
+ ///The vector used to hold the leading diagonal.
Vector<Size,Precision,Base> my_vector;
};
Index: internal/objects.h
===================================================================
RCS file: /cvsroot/toon/TooN/internal/objects.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- internal/objects.h 22 May 2009 17:46:15 -0000 1.12
+++ internal/objects.h 9 Jun 2009 13:33:23 -0000 1.13
@@ -55,7 +55,12 @@
template<> struct Operator<Internal::SizedZero>;
template<> struct Operator<Internal::RCZero>;
+
+///Object which behaves like a block of zeros. See TooN::Zeros.
+///@ingroup gInternal
template<> struct Operator<Internal::Zero> {
+ ///@name Operator members
+ ///@{
template<int Size, class Precision, class Base>
void eval(Vector<Size, Precision, Base>& v) const {
for(int i=0; i < v.size(); i++) {
@@ -71,31 +76,46 @@
}
}
}
+ ///@}
+ ///Generate a sized Zero object for constructing dynamic vectors.
Operator<Internal::SizedZero> operator()(int s);
+ ///Generate a sized Zero object for constructing dynamic matrices.
Operator<Internal::RCZero> operator()(int r, int c);
};
+///Variant of the Zeros object which holds two sizes for
+///constructing dynamic matrices.
+///@ingroup gInternal
template<> struct Operator<Internal::RCZero> : public Operator<Internal::Zero>
{
Operator(int r, int c) : my_rows(r), my_cols(c) {}
const int my_rows;
const int my_cols;
+ ///@name Operator members
+ ///@{
int num_rows() const {return my_rows;}
int num_cols() const {return my_cols;}
+ ///@}
};
+///Variant of the Zeros object which holds a size for
+///constructing dynamic vectors.
+///@ingroup gInternal
template<> struct Operator<Internal::SizedZero> : public
Operator<Internal::Zero> {
Operator(int s) : my_size(s) {}
const int my_size;
+ ///@name Operator members
+ ///@{
int size() const {return my_size;}
int num_rows() const {return my_size;}
int num_cols() const {return my_size;}
+ ///@}
};
inline Operator<Internal::SizedZero> Operator<Internal::Zero>::operator()(int
s){
@@ -111,13 +131,16 @@
// Identity
//////////////
-//Operator to construct a new matrix with idendity added
+///Operator to construct a new matrix with idendity added
+///@ingroup gInternal
template<int R, int C, class P, class B, class Precision> struct
Operator<Internal::AddIdentity<R,C,P,B,Precision> >
{
const Precision s;
const Matrix<R,C,P,B>& m;
bool invert_m;
+ ///@name Operator members
+ ///@{
Operator(Precision s_, const Matrix<R,C,P,B>& m_, bool b)
:s(s_),m(m_),invert_m(b){}
template<int R1, int C1, class P1, class B1>
@@ -141,9 +164,11 @@
{
return m.num_cols();
}
+ ///@}
};
-
+///Object whioch behaves like an Identity matrix. See TooN::Identity.
+///@ingroup gInternal
template<class Pr> struct Operator<Internal::Identity<Pr> > {
typedef Pr Precision;
@@ -151,6 +176,8 @@
Operator(const Precision& v=1)
:val(v)
{}
+ ///@name Operator members
+ ///@{
template<int R, int C, class P, class B>
void eval(Matrix<R,C,P,B>& m) const {
@@ -196,20 +223,21 @@
return
Operator<Internal::AddIdentity<Rows,Cols,P1,B1,Precision> >(val, m, 1);
}
-
- Operator<Internal::SizedIdentity<Precision> > operator()(int s){
- return Operator<Internal::SizedIdentity<Precision> >(s);
- }
-
template<class Pout, class Pmult> Operator<Internal::Identity<Pout> >
scale_me(const Pmult& m) const
{
return Operator<Internal::Identity<Pout> >(val*m);
}
+ ///@}
+ Operator<Internal::SizedIdentity<Precision> > operator()(int s){
+ return Operator<Internal::SizedIdentity<Precision> >(s);
+ }
};
-
+///A variant of Identity which holds a size, allowing
+///dynamic matrices to be constructed
+///@ingroup gInternal
template<class Precision> struct Operator<Internal::SizedIdentity<Precision> >
: public Operator<Internal::Identity<Precision> > {
@@ -220,8 +248,11 @@
:Operator<Internal::Identity<Precision> > (v), my_size(s)
{}
+ ///@name Operator members
+ ///@{
int num_rows() const {return my_size;}
int num_cols() const {return my_size;}
+ ///@}
template<class Pout, class Pmult>
Operator<Internal::SizedIdentity<Pout> > scale_me(const Pmult& m) const
{
@@ -234,7 +265,8 @@
//
-//Operator to construct a new vector a a vector with a scalar added to every
element
+///Operator to construct a new vector a a vector with a scalar added to every
element
+///@ingroup gInternal
template<int S, class P, class B, class Precision> struct
Operator<Internal::ScalarsVector<S,P,B,Precision> >
{
const Precision s;
@@ -243,6 +275,8 @@
Operator(Precision s_, const Vector<S,P,B>& v_, bool inv)
:s(s_),v(v_),invert_v(inv){}
+ ///@name Operator members
+ ///@{
template<int S1, class P1, class B1>
void eval(Vector<S1,P1,B1>& vv) const{
for(int i=0; i < v.size(); i++)
@@ -256,14 +290,18 @@
{
return v.size();
}
+ ///@}
};
-//Operator to construct a new matrix a a matrix with a scalar added to every
element
+///Operator to construct a new matrix a a matrix with a scalar added to every
element
+///@ingroup gInternal
template<int R, int C, class P, class B, class Precision> struct
Operator<Internal::ScalarsMatrix<R,C,P,B,Precision> >
{
const Precision s;
const Matrix<R,C,P,B>& m;
const bool invert_m;
+ ///@name Operator members
+ ///@{
Operator(Precision s_, const Matrix<R,C,P,B>& m_, bool inv)
:s(s_),m(m_),invert_m(inv){}
template<int R1, int C1, class P1, class B1>
@@ -284,20 +322,27 @@
{
return m.num_cols();
}
+ ///@}
};
-//Generic scalars object. Knows how to be added, knows how to deal with +=
+///Generic scalars object. Knows how to be added, knows how to deal with +=
and so on.
+///See TooN::Ones
+///@ingroup gInternal
template<class P> struct Operator<Internal::Scalars<P> >
{
typedef P Precision;
const Precision s;
- Operator(Precision s_)
+ //Default argument in constructor, otherwise Doxygen mis-parses
+ //a static object with a constructor as a function.
+ Operator(Precision s_=1)
:s(s_){}
////////////////////////////////////////
//
// All applications for vector
//
+ ///@name Operator members
+ ///@{
template <int Size, typename P1, typename B1>
void eval(Vector<Size, P1, B1>& v) const
@@ -385,6 +430,7 @@
{
return
Operator<Internal::ScalarsMatrix<Rows,Cols,P1,B1,Precision> >(s, v, 1);
}
+ ///@}
////////////////////////////////////////
//
// Create sized versions for initialization
@@ -406,10 +452,15 @@
}
};
+///Variant of the Operator<Internal::Scalars> object which holds a size
+///to construct dynamic vectors.
+///@ingroup gInternal
template<class P> struct Operator<Internal::SizedScalars<P> >: public
Operator<Internal::Scalars<P> >
{
using Operator<Internal::Scalars<P> >::s;
const int my_size;
+ ///@name Operator members
+ ///@{
int size() const {
return my_size;
}
@@ -421,6 +472,7 @@
{
return Operator<Internal::SizedScalars<Pout> >(s*m, my_size);
}
+ ///@}
private:
void operator()(int);
@@ -428,10 +480,15 @@
};
-
+///Variant of Scalars (see TooN::Ones) which holds two
+///sizes to constructo dynamic matrices.
+///@ingroup gInternal
template<class P> struct Operator<Internal::RCScalars<P> >: public
Operator<Internal::Scalars<P> >
{
using Operator<Internal::Scalars<P> >::s;
+
+ ///@name Operator members
+ ///@{
const int my_rows, my_cols;
int num_rows() const {
return my_rows;
@@ -449,6 +506,7 @@
return Operator<Internal::RCScalars<Pout> >(s*m, my_rows,
my_cols);
}
+ ///@}
private:
void operator()(int);
void operator()(int,int);
@@ -489,7 +547,7 @@
}
-/**This function us used to add a scalar to every element of a vector or
+/**This function is used to add a scalar to every element of a vector or
matrix. For example:
@code
Vector<3> v;
@@ -498,10 +556,51 @@
v += Ones * 3; //Add 3 to every element of v;
@endcode
Both + and += are supported on vectors,matrices and slices.
+
+ For construction of dynamic vectors and matrices, a size needs to be given:
+ @code
+ Vector<3> v_static = Ones;
+ Vector<> v_dynamic = Ones(3); //Construct a 3x1 vector full one 1s
+ Matrix<3> m_static = Ones;
+ Matrix<> m_dynamic = Ones(3,4); //Construct a 3x4 matrix
+ @endcode
+ @ingroup gLinAlg
*/
+static const Operator<Internal::Scalars<DefaultPrecision> > Ones;
+
+/**This function is used to initialize vectors and matrices to zero.
+ For construction of dynamic vectors and matrices, a size needs to be given.
+ For example:
+ @code
+ Vector<3> v_static = Zeros;
+ Vector<> v_dynamic = Zeros(3); //Construct a 3x1 vector
+ Matrix<3> m_static = Zeros;
+ Matrix<> m_dynamic = Zeros(3,4); //Construct a 3x4 matrix
+ @endcode
+ @ingroup gLinAlg
+*/
static Operator<Internal::Zero> Zeros;
+
+/**This function is used to add a scalar to the diagonal of a matrix,
+ or to construct matrices.
+ For example:
+ @code
+ Matrix<3> v;
+ ...
+ ...
+ Matrix<3> u = v + Identity * 4;
+ @endcode
+ Both + and += are supported. For assignment, if the matrix is non-square,
+ then all elements off the leading diagonal are set to zero.
+ For construction of dynamic matrices, a size needs to be given:
+ @code
+ Matrix<3> m_static = Identity;
+ Matrix<> m_dynamic = Identity(3); //Construct a 3x3 matrix
+ @endcode
+ @ingroup gLinAlg
+*/
+
static Operator<Internal::Identity<DefaultPrecision> > Identity;
-static const Operator<Internal::Scalars<DefaultPrecision> > Ones(1);
}
Index: optimization/conjugate_gradient.h
===================================================================
RCS file: /cvsroot/toon/TooN/optimization/conjugate_gradient.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- optimization/conjugate_gradient.h 20 May 2009 14:53:11 -0000 1.5
+++ optimization/conjugate_gradient.h 9 Jun 2009 13:33:23 -0000 1.6
@@ -296,7 +296,7 @@
///- old_g
///- h
///- old_h
- ///@param The derivatives of the function at \e x
+ ///@param grad The derivatives of the function at \e x
void update_vectors_PR(const Vector<Size>& grad)
{
//Update the position, gradient and conjugate directions
Index: optimization/golden_section.h
===================================================================
RCS file: /cvsroot/toon/TooN/optimization/golden_section.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- optimization/golden_section.h 15 Apr 2009 15:50:36 -0000 1.4
+++ optimization/golden_section.h 9 Jun 2009 13:33:23 -0000 1.5
@@ -19,7 +19,7 @@
/// @param c The most positive point along the line.
/// @param func The functor to minimize
/// @param maxiterations Maximum number of iterations
- /// @param tolerance Tolerance at which the search should be stopped.
+ /// @param tol Tolerance at which the search should be stopped.
/// @return The minima position is returned as the first element of the
vector,
/// and the minimal value as the second element.
/// @ingroup gOptimize
@@ -98,7 +98,7 @@
/// @param c The most positive point along the line.
/// @param func The functor to minimize
/// @param maxiterations Maximum number of iterations
- /// @param tolerance Tolerance at which the search should be stopped.
+ /// @param tol Tolerance at which the search should be stopped.
/// @return The minima position is returned as the first element of the
vector,
/// and the minimal value as the second element.
/// @ingroup gOptimize
Index: util.h
===================================================================
RCS file: util.h
diff -N util.h
--- util.h 1 Aug 2008 20:37:02 -0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,102 +0,0 @@
-#ifndef UTIL_H
-#define UTIL_H
-
-#ifndef TOON_NO_NAMESPACE
-namespace TooN {
-#endif
- namespace util {
-
- template <bool Cond> struct Assert;
- template <> struct Assert<true> {};
-
- template <int B, int E, bool Valid=(B<=E)> struct Dot {
- template <class V1, class V2> static inline double eval(const V1&,
const V2&) { return 0; }
- };
-
- template <int B, int E> struct Dot<B,E,true> {
- template <class V1, class V2> static inline double eval(const V1&
v1, const V2& v2) { return v1[B]* v2[B] + Dot<B+1,E>::eval(v1,v2); }
- };
-
- template <int N> struct Dot<N,N,true> {
- template <class V1, class V2> static inline double eval(const V1&
v1, const V2& v2) { return v1[N]*v2[N]; }
- };
-
-
- template <int B, int E> struct AddV {
- template <class V1, class V2> static inline void eval(V1& v1, const
V2& v2) { v1[B]+=v2[B]; AddV<B+1,E>::eval(v1,v2); }
- };
-
- template <int N> struct AddV<N,N> {
- template <class V1, class V2> static inline void eval(V1& v1, const
V2& v2) { v1[N] += v2[N]; }
- };
-
-#if 0
- template <int A, int N, int B, int Row, int Col=0> struct
MatrixProductRow {
- template <class M1, class M2, class V> static inline void
eval(const M1& a, const M2& b, V& v) {
- v[Col] = Dot<0,N-1>::eval(a[Row], b[Col]);
- MatrixProductRow<A,N,B,Row,Col+1>::eval(a,b,v);
- }
- };
-
- template <int A, int N, int B, int Row> struct
MatrixProductRow<A,N,B,Row,B> {
- template <class M1, class M2, class V> static inline void
eval(const M1& a, const M2& b, V& v) {
- v[B] = Dot<0,N-1>::eval(a[Row], b[B]);
- }
- };
-
- template <int A, int N, int B, int Row=0> struct MatrixProduct {
- template <class M1, class M2, class M3> static inline void
eval(const M1& a, const M2& b, M3& m) {
- MatrixProductRow<A,N,B,Row>::eval(a,b,m[Row]);
- MatrixProduct<A,N,B,Row+1>::eval(a,b,m);
- }
- };
-
- template <int A, int N, int B> struct MatrixProduct<A,N,B,A> {
- template <class M1, class M2, class M3> static inline void
eval(const M1& a, const M2& b, M3& m) {
- MatrixProductRow<A,N,B,A>::eval(a,b,m[A]);
- }
- };
-
- template <int A, int N, int B, class M1, class M2, class M3> inline
void matrix_multiply(const M1& a, const M2& b, M3& m) {
- MatrixProduct<A-1,N,B-1>::eval(a,b.T(),m);
- }
-#endif
-
- template <int B, int Col=0> struct MatrixProductRow {
- template <class F, class M1, class M2, class V> static inline void
eval(const M1& a, const M2& b, V& v, int row) {
- F::eval(v[Col], a[row] * b[Col]);
- MatrixProductRow<B,Col+1>::template eval<F>(a,b,v, row);
- }
- };
-
- template <int B> struct MatrixProductRow<B,B> {
- template <class F, class M1, class M2, class V> static inline void
eval(const M1& a, const M2& b, V& v, int row) {
- F::eval(v[B], a[row] * b[B]);
- }
- };
- struct Assign { template <class LHS, class RHS> static inline void
eval(LHS& lhs, const RHS& rhs) { lhs = rhs; } };
- struct PlusEquals { template <class LHS, class RHS> static inline void
eval(LHS& lhs, const RHS& rhs) { lhs += rhs; } };
- struct MinusEquals { template <class LHS, class RHS> static inline void
eval(LHS& lhs, const RHS& rhs) { lhs -= rhs; } };
-
- template <class F, int A, int N, int B, class M1, class M2, class M3>
inline void matrix_multiply(const M1& a, const M2& b, M3& m) {
- for (int i=0; i<m.num_rows(); i++)
- MatrixProductRow<B-1>::template eval<F>(a,b.T(),m[i],i);
- }
-
- template <int A, int N, int B, class M1, class M2, class M3> inline
void matrix_multiply(const M1& a, const M2& b, M3& m) {
- matrix_multiply<Assign,A,N,B,M1,M2,M3>(a,b,m);
- }
-
- }
-
-
-
-#ifndef TOON_NO_NAMESPACE
-}
-#endif
-
-
-
-
-
-#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN Cholesky.h Doxyfile LU.h SVD.h SymEigen.h ...,
Edward Rosten <=