00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 namespace TooN {
00032
00034
00035
00036
00037
00038 struct Reference
00039 {
00040
00041 template<int Size, typename Precision>
00042 struct VLayout
00043 : public Internal::GenericVBase<Size, Precision, 1, Internal::VectorSlice<Size, Precision> >
00044 {
00045
00046 VLayout(Precision* p, int sz=0)
00047 : Internal::GenericVBase<Size, Precision, 1, Internal::VectorSlice<Size, Precision> >(p, sz, 0)
00048 {}
00049 };
00050
00051
00052 struct RowMajor
00053 {
00054 template<int Rows, int Cols, class Precision>
00055 struct MLayout
00056 : public Internal::GenericMBase<Rows, Cols, Precision, (Cols==-1?-2:Cols), 1, Internal::MatrixSlice<Rows, Cols, Precision> >
00057 {
00058
00059 MLayout(Precision* p)
00060 : Internal::GenericMBase<Rows,Cols,Precision, (Cols==-1?-2:Cols), 1, Internal::MatrixSlice<Rows, Cols, Precision> > (p)
00061 {}
00062 MLayout(Precision* p, int r, int c)
00063 : Internal::GenericMBase<Rows,Cols,Precision, (Cols==-1?-2:Cols), 1, Internal::MatrixSlice<Rows, Cols, Precision> > (p, r, c, 0, 0)
00064 {}
00065 };
00066 };
00067
00068 struct ColMajor
00069 {
00070 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> >
00071 {
00072 MLayout(Precision* p)
00073 : Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows==-1?-2:Rows), Internal::MatrixSlice<Rows, Cols, Precision> >(p)
00074 {}
00075 MLayout(Precision* p, int r, int c)
00076 : Internal::GenericMBase<Rows, Cols, Precision, 1, (Rows==-1?-2:Rows), Internal::MatrixSlice<Rows, Cols, Precision> >(p, r, c, 0, 0)
00077 {}
00078 };
00079 };
00080 };
00081
00082
00083 inline Vector<Dynamic, double, Reference> wrapVector(double* data, int size) { return Vector<Dynamic, double, Reference>(data, size); }
00084 inline const Vector<Dynamic, const double, Reference> wrapVector(const double* data, int size) { return Vector<Dynamic, const double, Reference>(data, size); }
00085 template<int Size> inline Vector<Size, double, Reference> wrapVector(double* data) { return Vector<Size, double, Reference>(data); }
00086 template<int Size> inline const Vector<Size, const double, Reference> wrapVector(const double* data) { return Vector<Size, const double, Reference>(data); }
00087 template<class Precision> inline Vector<Dynamic, Precision, Reference> wrapVector(Precision* data, int size) { return Vector<Dynamic, Precision, Reference>(data, size); }
00088 template<class Precision> inline const Vector<Dynamic, const Precision, Reference> wrapVector(const Precision* data, int size) { return Vector<Dynamic, const Precision, Reference>(data, size); }
00089 template<int Size, class Precision> inline Vector<Size, Precision, Reference> wrapVector(Precision* data) { return Vector<Size, Precision, Reference>(data); }
00090 template<int Size, class Precision> inline const Vector<Size, const Precision, Reference> wrapVector(const Precision* data) { return Vector<Size, const Precision, Reference>(data); }
00091
00097
00098 template<int Rows, int Cols> inline Matrix<Rows, Cols, double, Reference::RowMajor> wrapMatrix(double* data) { return Matrix<Rows, Cols, double, Reference::RowMajor>(data);}
00099 template<int Rows, int Cols> inline const Matrix<Rows, Cols, const double, Reference::RowMajor> wrapMatrix(const double* data) { return Matrix<Rows, Cols, const double, Reference::RowMajor>(data);}
00100 template<int Rows, int Cols, class Precision> inline Matrix<Rows, Cols, Precision, Reference::RowMajor> wrapMatrix(Precision* data) { return Matrix<Rows, Cols, Precision, Reference::RowMajor>(data);}
00101 template<int Rows, int Cols, class Precision> inline const Matrix<Rows, Cols, const Precision, Reference::RowMajor> wrapMatrix(const Precision* data) { return Matrix<Rows, Cols, const Precision, Reference::RowMajor>(data);}
00102
00103 template<int Rows, int Cols> inline Matrix<Rows, Cols, double, Reference::RowMajor> wrapMatrix(double* data, int rows, int cols) { return Matrix<Rows, Cols, double, Reference::RowMajor>(data, rows, cols);}
00104 template<int Rows, int Cols> inline const Matrix<Rows, Cols, const double, Reference::RowMajor> wrapMatrix(const double* data, int rows, int cols) { return Matrix<Rows, Cols, const double, Reference::RowMajor>(data, rows, cols);}
00105 template<int Rows, int Cols, class Precision> inline Matrix<Rows, Cols, Precision, Reference::RowMajor> wrapMatrix(Precision* data, int rows, int cols) { return Matrix<Rows, Cols, Precision, Reference::RowMajor>(data, rows, cols);}
00106 template<int Rows, int Cols, class Precision> inline const Matrix<Rows, Cols, const Precision, Reference::RowMajor> wrapMatrix(const Precision* data, int rows, int cols) { return Matrix<Rows, Cols, const Precision, Reference::RowMajor>(data, rows, cols);}
00107
00108 inline Matrix<Dynamic, Dynamic, double, Reference::RowMajor> wrapMatrix(double* data, int rows, int cols) { return Matrix<Dynamic, Dynamic, double, Reference::RowMajor>(data, rows, cols);}
00109 inline const Matrix<Dynamic, Dynamic, const double, Reference::RowMajor> wrapMatrix(const double* data, int rows, int cols) { return Matrix<Dynamic, Dynamic, const double, Reference::RowMajor>(data, rows, cols);}
00110 template<class Precision> inline Matrix<Dynamic, Dynamic, Precision, Reference::RowMajor> wrapMatrix(Precision* data, int rows, int cols) { return Matrix<Dynamic, Dynamic, Precision, Reference::RowMajor>(data, rows, cols);}
00111 template<class Precision> inline const Matrix<Dynamic, Dynamic, const Precision, Reference::RowMajor> wrapMatrix(const Precision* data, int rows, int cols) { return Matrix<Dynamic, Dynamic, const Precision, Reference::RowMajor>(data, rows, cols);}
00113 }