[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN Doxyfile TooN.h test/svd_test.cc internal/...
From: |
Tom Drummond |
Subject: |
[Toon-members] TooN Doxyfile TooN.h test/svd_test.cc internal/... |
Date: |
Sat, 25 Apr 2009 19:42:29 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Tom Drummond <twd20> 09/04/25 19:42:29
Modified files:
. : Doxyfile TooN.h
test : svd_test.cc
Added files:
internal : diagmatrix.h
Removed files:
internal : diagmatrix.hh
Log message:
renamed file so that it is parsed by doxygen and change to Doxyfile to
scan internal directory
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/Doxyfile?cvsroot=toon&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/TooN/TooN.h?cvsroot=toon&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/diagmatrix.h?cvsroot=toon&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/diagmatrix.hh?cvsroot=toon&r1=1.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/test/svd_test.cc?cvsroot=toon&r1=1.1&r2=1.2
Patches:
Index: Doxyfile
===================================================================
RCS file: /cvsroot/toon/TooN/Doxyfile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Doxyfile 15 Apr 2009 15:50:30 -0000 1.1
+++ Doxyfile 25 Apr 2009 19:42:28 -0000 1.2
@@ -391,7 +391,7 @@
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = . doc optimization
+INPUT = . doc optimization internal
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
Index: TooN.h
===================================================================
RCS file: /cvsroot/toon/TooN/TooN.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- TooN.h 25 Apr 2009 15:08:19 -0000 1.35
+++ TooN.h 25 Apr 2009 19:42:28 -0000 1.36
@@ -94,7 +94,7 @@
#include <TooN/internal/make_vector.hh>
#include <TooN/internal/operators.hh>
- #include <TooN/internal/diagmatrix.hh>
+ #include <TooN/internal/diagmatrix.h>
}
Index: test/svd_test.cc
===================================================================
RCS file: /cvsroot/toon/TooN/test/svd_test.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- test/svd_test.cc 22 Apr 2009 15:42:27 -0000 1.1
+++ test/svd_test.cc 25 Apr 2009 19:42:29 -0000 1.2
@@ -5,18 +5,26 @@
int main()
{
- Matrix<4, 4> m = Zero;
+ Matrix<3, 4> m = Zero;
m[0] = makeVector(1, 2, 3, 4);
m[1] = makeVector(1, 1, 1, 1);
+ m[2] = makeVector(3, 2, 6, 7);
+
+ cout << m << endl;
+
+ SVD<-1, -1> svdm(m);
+
+ Matrix<3,4> temp =diagmult(svdm.get_diagonal(), svdm.get_VT());
+
+ cout << svdm.get_U() * temp << endl;
+
+ Matrix<4,3> m2 = m.T();
+ SVD<-1,-1> svdm2(m2);
+
+ cout << svdm2.get_U() * diagmult(svdm2.get_diagonal(), svdm2.get_VT())
<< endl;
+
- SVD<4, 4> svdm(m);
- cout << svdm.get_VT().num_rows() << endl;
- cout << svdm.get_VT().num_cols() << endl;
- cout << m[0] * svdm.get_VT()[2] << endl;
- cout << m[0] * svdm.get_VT()[3] << endl;
- cout << m[1] * svdm.get_VT()[2] << endl;
- cout << m[1] * svdm.get_VT()[3] << endl;
}
Index: internal/diagmatrix.h
===================================================================
RCS file: internal/diagmatrix.h
diff -N internal/diagmatrix.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ internal/diagmatrix.h 25 Apr 2009 19:42:28 -0000 1.1
@@ -0,0 +1,126 @@
+//-*- c++ -*-
+//
+// Copyright (C) 2009 Tom Drummond (address@hidden),
+// Ed Rosten (address@hidden)
+//
+// This file is part of the TooN Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+
+
+
+
+/**
address@hidden DiagonalMatrix TooN/toon.h
+A diagonal matrix
+Support is limited but diagonal matrices can be multiplied by vectors, matrices
+or diagonal matrices on either side.
+
+Diagonal matrices can be created from vectors by using the <code>
as_diagonal()
+</code> member function:
+
address@hidden
+Vector<3> v = makeVector(1,2,3);
+Vector<3> v2 = v.as_diagonal() * v; // v2 = (1,4,9)
address@hidden
+
+A vector can be obtained from the diagonal matrix by using the
+<code> diagonal_slice() </code> member function.
address@hidden gLinAlg
+ **/
+template<int Size=-1, typename Precision=DefaultPrecision, typename
Base=Internal::VBase>
+class DiagonalMatrix {
+public:
+ inline DiagonalMatrix() {}
+ inline DiagonalMatrix(int size_in) : my_vector(size_in) {}
+ inline DiagonalMatrix(Precision* data) : my_vector(data) {}
+ inline DiagonalMatrix(Precision* data, int size_in) :
my_vector(data,size_in) {}
+ 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
+ template <class Op>
+ inline DiagonalMatrix(const Operator<Op>& op)
+ : my_vector (op)
+ {
+ op.eval(my_vector);
+ }
+
+ // constructor from arbitrary vector
+ template<int Size2, typename Precision2, typename Base2>
+ inline DiagonalMatrix(const Vector<Size2,Precision2,Base2>& from)
+ : my_vector(from.size())
+ {
+ my_vector=from;
+ }
+
+
+ Precision& operator[](int i){return my_vector[i];}
+ const Precision& operator[](int i) const {return my_vector[i];}
+
+ typename Vector<Size, Precision, Base>::as_slice_type diagonal_slice() {
+ return my_vector.as_slice();
+ }
+
+
+ Vector<Size,Precision,Base> my_vector;
+};
+
+
+template<int S1, typename P1, typename B1, int S2, typename P2, typename B2>
+inline Vector<Internal::Sizer<S1,S2>::size, typename
Internal::MultiplyType<P1,P2>::type>
+operator*(const DiagonalMatrix<S1,P1,B1>& d, const Vector<S2,P2,B2>& v){
+ return diagmult(d.my_vector,v);
+}
+
+template<int S1, typename P1, typename B1, int S2, typename P2, typename B2>
+inline Vector<Internal::Sizer<S1,S2>::size, typename
Internal::MultiplyType<P1,P2>::type>
+operator*( const Vector<S1,P1,B1>& v, const DiagonalMatrix<S2,P2,B2>& d){
+ return diagmult(v,d.my_vector);
+}
+
+// perhaps not the safest way to do this as we're returning the same operator
used to normally make vectors
+template<int S1, typename P1, typename B1, int S2, typename P2, typename B2>
+inline DiagonalMatrix<Internal::Sizer<S1,S2>::size, typename
Internal::MultiplyType<P1,P2>::type>
+operator*( const DiagonalMatrix<S1,P1,B1>& d1, const DiagonalMatrix<S2,P2,B2>&
d2){
+ SizeMismatch<S1,S2>::test(d1.my_vector.size(),d2.my_vector.size());
+ return
Operator<Internal::VPairwise<Internal::Multiply,S1,P1,B1,S2,P2,B2>
>(d1.my_vector,d2.my_vector);
+}
+
+template<int R, int C, int Size, typename P1, typename P2, typename B1,
typename B2>
+Matrix<R, C, typename Internal::MultiplyType<P1,P2>::type>
+operator* (const Matrix<R, C, P1, B1>& m, const DiagonalMatrix<Size, P2, B2>&
d){
+ return diagmult(m,d.my_vector);
+}
+
+template<int R, int C, typename P1, typename B1, int Size, typename P2,
typename B2>
+Matrix<R, C, typename Internal::MultiplyType<P1,P2>::type>
+operator* (const DiagonalMatrix<Size,P1,B1>& d, const Matrix<R,C,P2,B2>& m)
+{
+ return diagmult(d.my_vector, m);
+}
Index: internal/diagmatrix.hh
===================================================================
RCS file: internal/diagmatrix.hh
diff -N internal/diagmatrix.hh
--- internal/diagmatrix.hh 25 Apr 2009 15:08:19 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,103 +0,0 @@
-//-*- c++ -*-
-//
-// Copyright (C) 2009 Tom Drummond (address@hidden),
-// Ed Rosten (address@hidden)
-//
-// This file is part of the TooN Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-template<int Size=-1, typename Precision=DefaultPrecision, typename
Base=Internal::VBase>
-class DiagonalMatrix {
-public:
- inline DiagonalMatrix() {}
- inline DiagonalMatrix(int size_in) : my_vector(size_in) {}
- inline DiagonalMatrix(Precision* data) : my_vector(data) {}
- inline DiagonalMatrix(Precision* data, int size_in) :
my_vector(data,size_in) {}
- 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
- template <class Op>
- inline DiagonalMatrix(const Operator<Op>& op)
- : my_vector (op)
- {
- op.eval(my_vector);
- }
-
- // constructor from arbitrary vector
- template<int Size2, typename Precision2, typename Base2>
- inline DiagonalMatrix(const Vector<Size2,Precision2,Base2>& from)
- : my_vector(from.size())
- {
- my_vector=from;
- }
-
-
- Precision& operator[](int i){return my_vector[i];}
- const Precision& operator[](int i) const {return my_vector[i];}
-
- typename Vector<Size, Precision, Base>::as_slice_type diagonal_slice() {
- return my_vector.as_slice();
- }
-
-
- Vector<Size,Precision,Base> my_vector;
-};
-
-
-template<int S1, typename P1, typename B1, int S2, typename P2, typename B2>
-inline Vector<Internal::Sizer<S1,S2>::size, typename
Internal::MultiplyType<P1,P2>::type>
-operator*(const DiagonalMatrix<S1,P1,B1>& d, const Vector<S2,P2,B2>& v){
- return diagmult(d.my_vector,v);
-}
-
-template<int S1, typename P1, typename B1, int S2, typename P2, typename B2>
-inline Vector<Internal::Sizer<S1,S2>::size, typename
Internal::MultiplyType<P1,P2>::type>
-operator*( const Vector<S1,P1,B1>& v, const DiagonalMatrix<S2,P2,B2>& d){
- return diagmult(v,d.my_vector);
-}
-
-// perhaps not the safest way to do this as we're returning the same operator
used to normally make vectors
-template<int S1, typename P1, typename B1, int S2, typename P2, typename B2>
-inline DiagonalMatrix<Internal::Sizer<S1,S2>::size, typename
Internal::MultiplyType<P1,P2>::type>
-operator*( const DiagonalMatrix<S1,P1,B1>& d1, const DiagonalMatrix<S2,P2,B2>&
d2){
- SizeMismatch<S1,S2>::test(d1.my_vector.size(),d2.my_vector.size());
- return
Operator<Internal::VPairwise<Internal::Multiply,S1,P1,B1,S2,P2,B2>
>(d1.my_vector,d2.my_vector);
-}
-
-template<int R, int C, int Size, typename P1, typename P2, typename B1,
typename B2>
-Matrix<R, C, typename Internal::MultiplyType<P1,P2>::type>
-operator* (const Matrix<R, C, P1, B1>& m, const DiagonalMatrix<Size, P2, B2>&
d){
- return diagmult(m,d.my_vector);
-}
-
-template<int R, int C, typename P1, typename B1, int Size, typename P2,
typename B2>
-Matrix<R, C, typename Internal::MultiplyType<P1,P2>::type>
-operator* (const DiagonalMatrix<Size,P1,B1>& d, const Matrix<R,C,P2,B2>& m)
-{
- return diagmult(d.my_vector, m);
-}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN Doxyfile TooN.h test/svd_test.cc internal/...,
Tom Drummond <=