[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Toon-members] TooN/internal foreign_matrix.hh matrix.hh mbase...
From: |
Tom Drummond |
Subject: |
[Toon-members] TooN/internal foreign_matrix.hh matrix.hh mbase... |
Date: |
Sun, 12 Apr 2009 01:08:02 +0000 |
CVSROOT: /cvsroot/toon
Module name: TooN
Changes by: Tom Drummond <twd20> 09/04/12 01:08:02
Modified files:
internal : foreign_matrix.hh matrix.hh mbase.hh vbase.hh
vector.hh
Log message:
Vector uses VLayout, Matrix uses MLayout
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/foreign_matrix.hh?cvsroot=toon&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/matrix.hh?cvsroot=toon&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/mbase.hh?cvsroot=toon&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vbase.hh?cvsroot=toon&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vector.hh?cvsroot=toon&r1=1.34&r2=1.35
Patches:
Index: foreign_matrix.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/foreign_matrix.hh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- foreign_matrix.hh 11 Apr 2009 05:23:16 -0000 1.2
+++ foreign_matrix.hh 12 Apr 2009 01:08:00 -0000 1.3
@@ -10,24 +10,19 @@
struct RowMajor
{
- template<int Rows, int Cols, class Precision> struct Layout:
public Internal::GenericMBase<Rows, Cols, Precision, (Cols==-1?-2:Cols), 1,
Internal::MatrixSlice<Rows, Cols, Precision> >
+ template<int Rows, int Cols, class Precision> struct MLayout:
public Internal::GenericMBase<Rows, Cols, Precision, (Cols==-1?-2:Cols), 1,
Internal::MatrixSlice<Rows, Cols, Precision> >
{
- Layout(Precision* p, int r=0, int c=0)
+ MLayout(Precision* p, int r=0, int c=0)
: Internal::GenericMBase<Rows,Cols,Precision,
(Cols==-1?-2:Cols), 1, Internal::MatrixSlice<Rows, Cols, Precision> > (p, r, c,
0, 0)
{}
-
-// template<class T> Layout(Precision* p, SliceSpec<T>
spec)
-// :Internal::GenericMBase<Rows, Cols, Precision,
(Rows==-1?-2:Rows), 1, Internal::MatrixSlice<Rows, Cols, Precision> >(p, spec)
-// {
-// }
};
};
struct ColMajor
{
- template<int Rows, int Cols, class Precision> struct Layout:
public Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows==-1?-2:Rows),
Internal::MatrixSlice<Rows, Cols, Precision> >
+ template<int Rows, int Cols, class Precision> struct MLayout:
public Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows==-1?-2:Rows),
Internal::MatrixSlice<Rows, Cols, Precision> >
{
- Layout(Precision* p, int r=0, int c=0)
+ MLayout(Precision* p, int r=0, int c=0)
: Internal::GenericMBase<Rows, Cols, Precision,
1, (Rows==-1?-2:Rows), Internal::MatrixSlice<Rows, Cols, Precision> >(p, r, c,
0, 0)
{}
};
Index: matrix.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/matrix.hh,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- matrix.hh 12 Apr 2009 00:11:27 -0000 1.26
+++ matrix.hh 12 Apr 2009 01:08:01 -0000 1.27
@@ -1,37 +1,36 @@
template <int Rows=-1, int Cols=Rows, class Precision=double, class Layout =
RowMajor>
-class Matrix : public Layout::template Layout<Rows, Cols, Precision>
+class Matrix : public Layout::template MLayout<Rows, Cols, Precision>
{
public:
- using Layout::template Layout<Rows, Cols, Precision>::my_data;
-
- using Layout::template Layout<Rows, Cols, Precision>::num_rows;
- using Layout::template Layout<Rows, Cols, Precision>::num_cols;
+ using Layout::template MLayout<Rows, Cols, Precision>::my_data;
+ using Layout::template MLayout<Rows, Cols, Precision>::num_rows;
+ using Layout::template MLayout<Rows, Cols, Precision>::num_cols;
//Use Tom's sneaky constructor hack...
Matrix(){}
Matrix(int rows, int cols) :
- Layout::template Layout<Rows,Cols,Precision>(rows, cols)
+ Layout::template MLayout<Rows,Cols,Precision>(rows, cols)
{}
Matrix(Precision* p) :
- Layout::template Layout<Rows, Cols, Precision>(p)
+ Layout::template MLayout<Rows, Cols, Precision>(p)
{}
Matrix(Precision* p, int r, int c) :
- Layout::template Layout<Rows, Cols, Precision>(p, r, c)
+ Layout::template MLayout<Rows, Cols, Precision>(p, r, c)
{}
// Internal constructor used by GenericMBase::slice(...)
Matrix(Precision* data, int rows, int cols, int rowstride, int
colstride, Internal::Slicing)
- :Layout::template Layout<Rows, Cols, Precision>(data, rows, cols,
rowstride, colstride){}
+ :Layout::template MLayout<Rows, Cols, Precision>(data, rows, cols,
rowstride, colstride){}
//See vector.hh and allocator.hh for details about why the
//copy constructor should be default.
template <class Op>
inline Matrix(const Operator<Op>& op)
- :Layout::template Layout<Rows,Cols,Precision>(op)
+ :Layout::template MLayout<Rows,Cols,Precision>(op)
{
op.eval(*this);
}
@@ -40,7 +39,7 @@
// construction from 1-ary operator
template <class T, class Op>
inline Matrix(const T& arg, int rows, int cols, const Operator<Op>&)
- :Layout::template Layout<Rows,Cols,Precision>(rows, cols)
+ :Layout::template MLayout<Rows,Cols,Precision>(rows, cols)
{
Op::eval(*this,arg);
}
@@ -48,7 +47,7 @@
// constructor from 2-ary operator
template <class LHS, class RHS, class Op>
inline Matrix(const LHS& lhs, const RHS& rhs, int rows, int cols, const
Operator<Op>&)
- :Layout::template Layout<Rows,Cols,Precision>(rows, cols)
+ :Layout::template MLayout<Rows,Cols,Precision>(rows, cols)
{
Op::eval(*this,lhs,rhs);
}
@@ -56,7 +55,7 @@
// constructor from arbitrary matrix
template<int Rows2, int Cols2, typename Precision2, typename Base2>
inline Matrix(const Matrix<Rows2, Cols2,Precision2,Base2>& from)
- :Layout::template Layout<Rows,Cols,Precision>(from.num_rows(),
from.num_cols())
+ :Layout::template MLayout<Rows,Cols,Precision>(from.num_rows(),
from.num_cols())
{
operator=(from);
}
Index: mbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/mbase.hh,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- mbase.hh 12 Apr 2009 00:07:51 -0000 1.26
+++ mbase.hh 12 Apr 2009 01:08:01 -0000 1.27
@@ -1,3 +1,5 @@
+// -*- c++ -*-
+
namespace Internal
{
// As usual, a positive integer means static and -1 means dynamic.
@@ -13,9 +15,9 @@
template<int RowStride, int ColStride> struct Slice
{
- template<int Rows, int Cols, class Precision> struct Layout: public
GenericMBase<Rows, Cols, Precision, RowStride, ColStride, MatrixSlice<Rows,
Cols, Precision> >
+ template<int Rows, int Cols, class Precision> struct MLayout: public
GenericMBase<Rows, Cols, Precision, RowStride, ColStride, MatrixSlice<Rows,
Cols, Precision> >
{
- Layout(Precision* p, int rows, int cols, int rowstride, int
colstride)
+ MLayout(Precision* p, int rows, int cols, int rowstride, int
colstride)
:GenericMBase<Rows,Cols,Precision,RowStride,ColStride,MatrixSlice<Rows, Cols,
Precision> >(p, rows, cols, rowstride, colstride)
{
}
@@ -151,18 +153,18 @@
//
struct RowMajor
{
- template<int Rows, int Cols, class Precision> struct Layout: public
Internal::GenericMBase<Rows, Cols, Precision, (Cols==-1?-2:Cols), 1,
Internal::MatrixAlloc<Rows, Cols, Precision> >
+ template<int Rows, int Cols, class Precision> struct MLayout: public
Internal::GenericMBase<Rows, Cols, Precision, (Cols==-1?-2:Cols), 1,
Internal::MatrixAlloc<Rows, Cols, Precision> >
{
//Optional constructors.
- Layout(){}
+ MLayout(){}
- Layout(int rows, int cols)
+ MLayout(int rows, int cols)
:Internal::GenericMBase<Rows, Cols, Precision, (Cols ==
-1 ? -2 : Cols), 1, Internal::MatrixAlloc<Rows, Cols, Precision> >(rows, cols)
{}
template<class Op>
- Layout(const Operator<Op>& op)
+ MLayout(const Operator<Op>& op)
:Internal::GenericMBase<Rows, Cols, Precision, (Cols ==
-1 ? -2 : Cols), 1, Internal::MatrixAlloc<Rows, Cols, Precision> >(op)
{}
@@ -171,18 +173,18 @@
struct ColMajor
{
- template<int Rows, int Cols, class Precision> struct Layout: public
Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows==-1?-2:Rows),
Internal::MatrixAlloc<Rows, Cols, Precision> >
+ template<int Rows, int Cols, class Precision> struct MLayout: public
Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows==-1?-2:Rows),
Internal::MatrixAlloc<Rows, Cols, Precision> >
{
//Optional constructors.
- Layout(){}
+ MLayout(){}
- Layout(int rows, int cols)
+ MLayout(int rows, int cols)
:Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows == -1 ?
-2 : Rows), Internal::MatrixAlloc<Rows, Cols, Precision> >(rows, cols)
{}
template<class Op>
- Layout(const Operator<Op>& op)
+ MLayout(const Operator<Op>& op)
:Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows
== -1 ? -2 : Rows), Internal::MatrixAlloc<Rows, Cols, Precision> >(op)
{}
Index: vbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vbase.hh,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- vbase.hh 30 Mar 2009 20:01:32 -0000 1.21
+++ vbase.hh 12 Apr 2009 01:08:01 -0000 1.22
@@ -1,3 +1,5 @@
+// -*- c++ -*-
+
namespace Internal{
template<int Size, class Precision, int Stride, class Mem> struct GenericVBase;
@@ -12,20 +14,20 @@
// this class is really just a typedef
template<int Size, typename Precision>
- struct Layout
+ struct VLayout
: public GenericVBase<Size, Precision, Stride,
VectorSlice<Size, Precision> > {
- Layout(Precision* d, int stride)
+ VLayout(Precision* d, int stride)
:GenericVBase<Size, Precision, Stride,
VectorSlice<Size, Precision> >(d, stride){
}
- Layout(Precision* d, int length, int stride)
+ VLayout(Precision* d, int length, int stride)
:GenericVBase<Size, Precision, Stride,
VectorSlice<Size, Precision> >(d, length, stride){
}
template<class Op>
- Layout(const Operator<Op>& op)
+ VLayout(const Operator<Op>& op)
:GenericVBase<Size, Precision, Stride,
VectorSlice<Size, Precision> >(op) {}
};
@@ -40,17 +42,17 @@
// this class is really just a typedef
template<int Size, class Precision>
- struct Layout
+ struct VLayout
: public GenericVBase<Size, Precision, 1, VectorAlloc<Size,
Precision> > {
- Layout(){}
+ VLayout(){}
- Layout(int s)
+ VLayout(int s)
:GenericVBase<Size, Precision, 1, VectorAlloc<Size,
Precision> >(s)
{}
template<class Op>
- Layout(const Operator<Op>& op)
+ VLayout(const Operator<Op>& op)
:GenericVBase<Size, Precision, 1, VectorAlloc<Size,
Precision> >(op) {}
};
};
Index: vector.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vector.hh,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- vector.hh 31 Mar 2009 02:57:46 -0000 1.34
+++ vector.hh 12 Apr 2009 01:08:01 -0000 1.35
@@ -1,22 +1,22 @@
//-*- c++ -*-
template<int Size=-1, typename Precision=double, typename Base=Internal::VBase>
-class Vector : public Base::template Layout<Size, Precision> {
+class Vector : public Base::template VLayout<Size, Precision> {
public:
// sneaky hack: only one of these constructors will work with any given base
// class but they don't generate errors unless the user tries to use one of
them
// although the error message may be less than helpful - maybe this can be
changed?
inline Vector(){}
- // inline Vector(Precision* data) : Base::template Layout<Size,
Precision> (data) {}
- inline Vector(int size_in) : Base::template Layout<Size,
Precision>(size_in) {}
- inline Vector(Precision* data_in, int size_in, int stride_in,
Internal::Slicing) : Base::template Layout<Size, Precision>(data_in, size_in,
stride_in) {}
+ // inline Vector(Precision* data) : Base::template VLayout<Size,
Precision> (data) {}
+ inline Vector(int size_in) : Base::template VLayout<Size,
Precision>(size_in) {}
+ inline Vector(Precision* data_in, int size_in, int stride_in,
Internal::Slicing) : Base::template VLayout<Size, Precision>(data_in, size_in,
stride_in) {}
- using Base::template Layout<Size, Precision>::size;
+ using Base::template VLayout<Size, Precision>::size;
// constructors to allow return value optimisations
// construction from 0-ary operator
template <class Op>
inline Vector(const Operator<Op>& op)
- : Base::template Layout<Size, Precision> (op)
+ : Base::template VLayout<Size, Precision> (op)
{
op.eval(*this);
}
@@ -24,14 +24,14 @@
// constructors to allow return value optimisations
// construction from 1-ary operator
template <class T, class Op>
- inline Vector(const T& arg, int size, const Operator<Op>&) :
Base::template Layout<Size, Precision>(size) {
+ inline Vector(const T& arg, int size, const Operator<Op>&) :
Base::template VLayout<Size, Precision>(size) {
Op::eval(*this,arg);
}
// constructor from 2-ary operator
template <class LHS, class RHS, class Op>
inline Vector(const LHS& lhs, const RHS& rhs, int size, const
Operator<Op>&)
- : Base::template Layout<Size, Precision>(size) {
+ : Base::template VLayout<Size, Precision>(size) {
Op::eval(*this,lhs,rhs);
}
@@ -47,7 +47,7 @@
// constructor from arbitrary vector
template<int Size2, typename Precision2, typename Base2>
inline Vector(const Vector<Size2,Precision2,Base2>& from):
- Base::template Layout<Size, Precision>(from.size()) {
+ Base::template VLayout<Size, Precision>(from.size()) {
operator=(from);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Toon-members] TooN/internal foreign_matrix.hh matrix.hh mbase...,
Tom Drummond <=