toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN TODO internal/allocator.hh internal/mbase....


From: Edward Rosten
Subject: [Toon-members] TooN TODO internal/allocator.hh internal/mbase....
Date: Sun, 08 Feb 2009 19:18:58 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/02/08 19:18:58

Modified files:
        .              : TODO 
        internal       : allocator.hh mbase.hh vbase.hh vector.hh 

Log message:
        Rewrote vector in the style of matrix. This also simplifies operator[] 
for
        matrix since the impedance mismatch between the classes is now gone.
        
        Bounds checking is not yet implemented.
        
        vec_test.cc compiles.
        
        Completely untested runtime operation.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/TODO?cvsroot=toon&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/allocator.hh?cvsroot=toon&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/mbase.hh?cvsroot=toon&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vbase.hh?cvsroot=toon&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vector.hh?cvsroot=toon&r1=1.8&r2=1.9

Patches:
Index: TODO
===================================================================
RCS file: /cvsroot/toon/TooN/TODO,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- TODO        7 Feb 2009 18:49:02 -0000       1.2
+++ TODO        8 Feb 2009 19:18:57 -0000       1.3
@@ -1,5 +1,5 @@
 const slices of vector
 const slices of matrices
 const vector indexing of matrices
-vector with static size and dynamic stride
 bounds checking for matrices
+.as_row() and .as_col() for vectors

Index: internal/allocator.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/allocator.hh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- internal/allocator.hh       7 Feb 2009 18:49:02 -0000       1.6
+++ internal/allocator.hh       8 Feb 2009 19:18:57 -0000       1.7
@@ -67,10 +67,61 @@
 
 
 
+template<int Size, class Precision> struct VectorAlloc: public 
StaticSizedAllocator<Size, Precision>{
 
+       int size() const {
+               return Size;
+       }
+};
+
+template<class Precision> struct VectorAlloc<-1, Precision> {
+       Precision * const my_data;
+       const int my_size;
+
+       VectorAlloc(int s)
+       :my_data(new Precision[s]), my_size(s)
+       { }
+
+       int size() const {
+               return my_size;
+       }
+
+       ~VectorAlloc(){
+               delete[] my_data;
+       }
 
+};
 
 
+template<int S, class Precision> struct VectorSlice
+{
+       int size() const {
+               return S;
+       }
+
+       //Optional Constructors
+       
+       Precision* const my_data;
+       VectorSlice(Precision* p)
+       :my_data(p){}
+
+       VectorSlice(Precision* p, int /*size*/)
+       :my_data(p){}
+};
+
+template<class Precision> struct VectorSlice<-1, Precision>
+{
+       Precision* const my_data;
+       const int my_size;
+
+       VectorSlice(Precision* d, int s)
+       :my_data(d), my_size(s)
+       { }
+
+       int size() const {
+               return my_size;
+       }
+};
 
 
 

Index: internal/mbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/mbase.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- internal/mbase.hh   7 Feb 2009 18:49:03 -0000       1.8
+++ internal/mbase.hh   8 Feb 2009 19:18:57 -0000       1.9
@@ -166,38 +166,6 @@
 // Row major matrix implementation
 //
 
-
-////////////////////////////////////////
-//
-// Given the rows, cols, and stride, 
-// what should the resulting vector type 
-// be?
-//
-
-template<int Rows, int Cols, typename Precision> struct RMVec
-{
-       typedef Vector<Cols, Precision, SVBase<Cols, 1, Precision> > Type;
-
-       static Type vec(Precision* d, int /*cols*/)
-       {
-               return Type(d);
-       }
-};
-
-template<typename Precision> struct RMVec<-1, -1, Precision>
-{
-       typedef Vector<-1, Precision, SDVBase<1, Precision> > Type;
-
-       static Type vec(Precision* d, int cols)
-       {
-               return Type(d, cols);
-       }
-};
-
-////////////////////////////////////////
-//
-//Generic access to Row Major data.
-//
 template<int Rows, int Cols, class Precision, int Stride, class Mem> struct 
GenericRowMajor: public Mem
 {
        //Slices can never have tied strides
@@ -246,10 +214,11 @@
                return my_data[r*stride() + c];
        }
        
-       typedef RMVec<Rows, Cols, Precision> Vec;
-       typename Vec::Type operator[](int r)
-       {
-               return Vec::vec(my_data + stride()* r, num_cols());
+
+       typedef Vector<Cols, Precision, SliceVBase<Cols, 1, Precision> > Vec;
+       
+       Vec operator[](int r) {
+               return Vec(my_data + stride()* r, num_cols(), 1, Slicing());
        }
 
        template<int Rstart, int Cstart, int Rlength, int Clength>
@@ -280,60 +249,6 @@
 // Column major matrix implementation
 //
 
-
-////////////////////////////////////////
-//
-// Given the rows, cols, and stride, 
-// what should the resulting vector type 
-// be?
-//
-
-template<int Rows, int Cols, int Stride, typename Precision> struct CMVec
-{
-       typedef Vector<Cols, Precision, SVBase<Cols, Stride, Precision> > Type;
-
-       static Type vec(Precision* d, int /*cols*/, int /*stride*/)
-       {
-               return Type(d);
-       }
-};
-
-template<int Rows, int Cols, typename Precision> struct CMVec<Rows, Cols, -1, 
Precision>
-{
-       //FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME 
FIXME FIXME
-       //There should be a statically sized, dynamically strided vector type
-       typedef Vector<-1, Precision, SDDVBase<Precision> > Type;
-
-       static Type vec(Precision* d, int /*cols*/, int stride)
-       {
-               return Type(d, Cols, stride);
-       }
-};
-
-template<int Stride, typename Precision> struct CMVec<-1, -1, Stride, 
Precision>
-{
-       typedef Vector<-1, Precision, SDVBase<Stride, Precision> > Type;
-
-       static Type vec(Precision* d, int cols, int /*stride*/)
-       {
-               return Type(d, cols);
-       }
-};
-
-template<typename Precision> struct CMVec<-1, -1, -1, Precision>
-{
-       typedef Vector<-1, Precision, SDDVBase<Precision> > Type;
-
-       static Type vec(Precision* d, int cols, int stride)
-       {
-               return Type(d, cols, stride);
-       }
-};
-
-////////////////////////////////////////
-//
-//Generic access to Col Major data.
-//
 template<int Rows, int Cols, class Precision, int Stride, class Mem> struct 
GenericColMajor: public Mem
 {
        //Slices can never have tied strides
@@ -382,10 +297,9 @@
                return my_data[c*stride() + r];
        }
        
-       typedef CMVec<Rows, Cols, Stride, Precision> Vec;
-       typename Vec::Type operator[](int r)
-       {
-               return Vec::vec(my_data + r, num_cols(), stride());
+       typedef Vector<Cols, Precision, SliceVBase<Cols, Stride, Precision> > 
Vec;
+       Vec operator[](int r) {
+               return Vec(my_data + r, num_cols(), stride(), Slicing());
        }
 
        template<int Rstart, int Cstart, int Rlength, int Clength>

Index: internal/vbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vbase.hh,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- internal/vbase.hh   7 Feb 2009 18:49:03 -0000       1.5
+++ internal/vbase.hh   8 Feb 2009 19:18:58 -0000       1.6
@@ -1,393 +1,112 @@
-//-*- c++ -*-
+template<int,class,class> class Vector;
+template<int Size, class Precision, int Stride, class Mem> struct GenericVBase;
+template<typename T> class Operator;
 
-// All the vector base classes go in this file
-// they have to provide the following capabilities:
-//
-// template<typename Precision> // and possibly more stuff
-// class VectorBase {
-//   // Constructors are only responsible for memory management
-//   // not for copying any data
-//   // in general the following constructors should exist:
-
-//   VectorBase(...) // basic constructor
-//   VectorBase(const VectorBase& from) // copy constructor
-  
-//   // construction from 1-ary operator
-//   template <class T, class Op>
-//   inline VectorBase(const T&, const Operator<Op>&);
-
-//   // constructor from 2-ary operator
-//   template <class LHS, class RHS, class Op>
-//   inline VectorBase(const LHS& lhs, const RHS& rhs, const Operator<Op>&);
-  
-//   // constructor from arbitrary vector
-//   template<int Size2, class Base2>
-//   inline VectorBase(const Vector<Size2, Precision, Base2>& from);
-
-//   Precision* data();
-//   const Precision* data() const;
-  
-//   static int size(); // returns the size of the vector
-//   static int stride(); // returns the stride
-
-//   Precision& operator[](int i); // return element i
-//   const Precision& operator[](int i) const; // ditto
-
-//   template <int Start, int Length>
-//   Vector<Length,Precision,...> slice(); // static slice
-//   Vector<-1, Precision, ...>  slice(int start, int length); // dynamic slice
-// };
-
-
-// forward declarations
-template<int Size, typename Precision, typename Base>
-class Vector;
-
-template<int Size, int Stride, typename Precision>
-class SVBase;
-
-// forward declaration
-template<typename T>
-class Operator;
-
-// VBase owns its data
-// Size is the static number of elements in the vector
-// Stride is the static gap between elements
-// Type is a hack so that x?y:z expressions work
-// Type=0 means the data is internal to the object
-// Type=1 means the data is external to the object
-template <int Size, int Type, typename Precision>
-class VBase;
-
-template<int Stride, typename Precision> 
-class SDVBase; //Sliced Dynamic VBase. No ownership of data, Static stride.
-
-template<int Size, typename Precision>
-class VBase<Size, 0, Precision> {
-public:
-  inline VBase(){}
-  inline VBase(const VBase& from){}
-  
-  // construction from 1-ary operator
-  template <class T, class Op>
-  inline VBase(const T&, const Operator<Op>&){}
-
-  // constructor from 2-ary operator
-  template <class LHS, class RHS, class Op>
-  inline VBase(const LHS& lhs, const RHS& rhs, const Operator<Op>&){}
-  
-  // constructor from arbitrary vector
-  template<int Size2, class Base2>
-  inline VBase(const Vector<Size2, Precision, Base2>&){}
-
-  Precision* data(){return my_data;}
-  const Precision* data() const {return my_data;}
-  
-  static int size(){return Size;}
-  static int stride(){return 1;}
-
-  Precision& operator[](int i){
-    Internal::check_index(Size, i);
-    return my_data[i];
-  }
-  const Precision& operator[](int i) const {
-    Internal::check_index(Size, i);
-    return my_data[i];
-  }
-
-  template <int Start, int Length>
-  Vector<Length, Precision, SVBase<Length,1,Precision> >
-  slice(){
-    Internal::CheckSlice<Size, Start, Length>::check();
-    return Vector<Length, Precision, SVBase<Length,1,Precision> 
>(&(my_data[Start]));
-  }
-
-  Vector<-1, Precision, SDVBase<1, Precision> >
-  slice(int start, int length);
-
-private:
-  Precision my_data[Size];
-};
 
-template<int Size, typename Precision>
-class VBase<Size,1, Precision>{
-public:
+////////////////////////////////////////////////////////////////////////////////
+//
+// A class similar to mem, but to hold the stride information. It is only 
needed
+// for -1. For +int and -2, the stride is part fo teh type, or implicit.
 
-  // Constructors
-  // For all these, the owning vector class is responsible
-  // for filling in any data that needs to go into the vector elements
+template<int s> struct VStrideHolder
+{
+       //Constructos ignore superfluous arguments
+       VStrideHolder(){}
+       VStrideHolder(int){}
 
-  VBase()
-    : my_data(new Precision[Size]){
+       int stride() const{
+               return s;
   }
+};
 
-  VBase(const VBase& from)
-    : my_data(new Precision[Size]){
-    }
+template<> struct VStrideHolder<-1>
+{
+       VStrideHolder(int s)
+       :my_stride(s){}
 
-  VBase(int size_in)
-    : my_data(new Precision[Size]){
+       const int my_stride;
+       int stride() const {
+               return my_stride;
   }
+};
   
-  // construction from 1-ary operator
-  template <class T, class Op>
-  inline VBase(const T&, const Operator<Op>&):
-    my_data(new Precision[Size]){}
-
-  // constructor from 2-ary operator
-  template <class LHS, class RHS, class Op>
-  inline VBase(const LHS& lhs, const RHS& rhs, const Operator<Op>&):
-    my_data(new Precision[Size]){}
-
-  // constructor from arbitrary vector
-  template<int Size2, typename Precision2, typename Base2>
-  inline VBase(const Vector<Size2,Precision2,Base2>& from):
-    my_data(new Precision[from.size()]) {}
-
-  ~VBase(){
-    delete[] my_data;
-  }
+////////////////////////////////////////////////////////////////////////////////
+//
+// Slice holding class
+//
 
-  Precision* data(){return my_data;}
-  const Precision* data() const {return my_data;}
+template<int Size, int Stride, class Precision> struct SliceVBase: public 
GenericVBase<Size, Precision, Stride, VectorSlice<Size, Precision> >{
   
-  static int size(){return Size;}
-  static int stride(){return 1;}
 
-  Precision& operator[](int i){
-    Internal::check_index(Size, i);
-    return my_data[i];
-  }
-  const Precision& operator[](int i) const {
-    Internal::check_index(Size, i);
-    return my_data[i];
+       SliceVBase(Precision* d, int stride)
+       :GenericVBase<Size, Precision, Stride, VectorSlice<Size, Precision> 
>(d, stride){
   }
 
-  template <int Start, int Length>
-  Vector<Length, Precision, SVBase<Length,1, Precision> >
-  slice(){
-    Internal::CheckSlice<Size, Start, Length>::check();
-    return Vector<Length, Precision, SVBase<Length,1,Precision> 
>(&(my_data[Start]));
+       SliceVBase(Precision* d, int length, int stride)
+       :GenericVBase<Size, Precision, Stride, VectorSlice<Size, Precision> 
>(d, length, stride){
   }
 
-  Vector<-1, Precision, SDVBase<1, Precision> >
-  slice(int start, int length);
-
-private:
-  Precision* const my_data;
 };
 
+////////////////////////////////////////////////////////////////////////////////
+//
+// Classes for Matrices owning memory
+//
 
-// SVBase does not own its data
-// and has a template stride parameter
-template<int Size, int Stride, typename Precision>
-class SVBase{
-public:
-  SVBase(Precision* data_in):
-    my_data(data_in){
-  }
-
-  SVBase(const SVBase& from):
-    my_data(from.my_data){
-  }
-
-  Precision* data(){return my_data;}
-  const Precision* data() const {return my_data;}
-  
-  int size() const {return Size;}
-  int stride() const {return Stride;}
+template<int Size, class Precision> struct VBase : public GenericVBase<Size, 
Precision, 1, VectorAlloc<Size, Precision> >{
+       //Optional 
 
-  Precision& operator[](int i){
-    Internal::check_index(Size, i);
-    return my_data[i*Stride];
-  }
-  const Precision& operator[](int i) const {
-    Internal::check_index(Size, i);
-    return my_data[i*Stride];
-  }
+       VBase(){}
 
-  template <int Start, int Length>
-  Vector<Length, Precision, SVBase<Length,Stride,Precision> >
-  slice(){
-    Internal::CheckSlice<Size, Start, Length>::check();
-    return Vector<Length, Precision, SVBase<Length,1,Precision> 
>(&(my_data[Start*Stride]));
+       VBase(int s)
+       :GenericVBase<Size, Precision, 1, VectorAlloc<Size, Precision> >(s)
+       {
   }
-
-  Vector<-1, Precision, SDVBase<Stride, Precision> >
-  slice(int start, int length);
-
-private:
-  Precision* const my_data;
 };
 
+////////////////////////////////////////////////////////////////////////////////
+//
+// Generic implementation
+//
 
-
-
-// DVBase is for vectors whose size is determined dynamically at runtime
-// They own their data
-template <typename Precision>
-class DVBase{
-public:
-  DVBase(int size_in):
-    my_data(new Precision[size_in]),
-    my_size(size_in){
-  }
-
-  DVBase(const DVBase& from):
-    my_data(new Precision[from.my_size]),
-    my_size(from.my_size) {
+template<int Size, typename Precision, int Stride, typename Mem> struct 
GenericVBase: public Mem
+{      
+       VStrideHolder<Stride> my_stride;
+       int stride() const{
+               return my_stride.stride();
   }
 
-  // construction from 1-ary operator
-  template <class T, class Op>
-  inline DVBase(const T& arg, const Operator<Op>&):
-    my_data(new Precision[Op::size(arg)]),
-    my_size(Op::size(arg)) {
-  }
+       //Optional constuctors
+       GenericVBase(){}
 
-  // constructor from 2-ary operator
-  template <class LHS, class RHS, class Op>
-  inline DVBase(const LHS& lhs, const RHS& rhs, const Operator<Op>&):
-    my_data(new Precision[Op::size(lhs,rhs)]),
-    my_size(Op::size(lhs,rhs)) {
-  }
+       GenericVBase(int s)
+       :Mem(s)
+       {}
 
-  // constructor from arbitrary vector
-  template<int Size2, class Base2>
-  inline DVBase(const Vector<Size2, Precision, Base2>& from):
-    my_data(new Precision[from.size()]),
-    my_size(from.size()) {
+       GenericVBase(Precision* d, int stride)
+       :Mem(d),my_stride(stride){
   }
 
-  ~DVBase(){
-    delete[] my_data;
+       GenericVBase(Precision* d, int length, int stride)
+       :Mem(d, length),my_stride(stride){
   }
 
-  Precision* data(){return my_data;}
-  const Precision* data() const {return my_data;}
-  
-  int size() const {return my_size;}
-  int stride() const {return 1;}
-
-  Precision& operator[](int i){
-    Internal::check_index(my_size, i);
-    return my_data[i];
-  }
-  const Precision& operator[](int i) const {
-    Internal::check_index(my_size, i);
-    return my_data[i];
-  }
+       using Mem::my_data;
 
-  template <int Start, int Length>
-  Vector<Length, Precision, SVBase<Length,1,Precision> >
-  slice(){
-    Internal::CheckSlice<-1, Start>::check(my_size, Start, Length);
-    return Vector<Length, Precision, SVBase<Length,1,Precision> 
>(&(my_data[Start]));
+       Precision& operator[](int i) {
+               return my_data[i * stride()];
   }
 
-  Vector<-1, Precision, SDVBase<1, Precision> >
-  slice(int start, int length);
-
-private:
-  Precision* const my_data;
-  int my_size;
-};
-
-// SDVBase is for dynamically sized vectors that do not own their data
-// They have an additional templated stride
-template <int Stride, typename Precision>
-class SDVBase{
-public:
-  SDVBase(Precision* data_in, int size_in):
-    my_data(data_in) {
-    my_size=size_in;
-  };
-
-  SDVBase(const SDVBase& from)
-    : my_data(from.my_data),
-      my_size(from.my_size){
-  }
-
-  Precision* data(){return my_data;}
-  const Precision* data() const {return my_data;}
-  
-  int size() const {return my_size;}
-  int stride() const {return Stride;}
-
-  Precision& operator[](int i){
-    Internal::check_index(my_size, i);
-    return my_data[i*Stride];
-  }
   const Precision& operator[](int i) const {
-    Internal::check_index(my_size, i);
-    return my_data[i*Stride];
+               return my_data[i * stride()];
   }
 
-  template <int Start, int Length>
-  Vector<Length, Precision, SVBase<Length,Stride,Precision> >
-  slice(){
-    Internal::CheckSlice<-1, Start>::check(my_size, Start, Length);
-    return Vector<Length, Precision, SVBase<Length,Stride,Precision> 
>(&(my_data[Start]));
+       template<int Start, int Length> 
+       Vector<Length, Precision, SliceVBase<Length, Stride, Precision> > 
slice(){
+               return Vector<Length, Precision, SliceVBase<Length, Stride, 
Precision> >(my_data + stride()*Start, stride(), Slicing());
   }
 
-  Vector<-1, Precision, SDVBase<Stride, Precision> >
-  slice(int start, int length);
-
-
-private:
-  Precision* const my_data;
-  int my_size;
-};
-
-// SDVBase is for dynamically sized vectors that do not own their data
-// They have an additional stride member
-template <typename Precision>
-class SDDVBase{
-public:
-  SDDVBase(Precision* data_in, int size_in, int stride_in):
-    my_data(data_in) {
-    my_size=size_in;
-    my_stride=stride_in;
-  };
-
-  SDDVBase(const SDDVBase& from)
-    : my_data(from.my_data),
-      my_size(from.my_size),
-      my_stride(from.my_stride){
-  }
-
-  Precision* data(){return my_data;}
-  const Precision* data() const {return my_data;}
-  
-  int size() const {return my_size;}
-  int stride() const {return my_stride;}
-
-  Precision& operator[](int i){
-    Internal::check_index(my_size, i);
-    return my_data[i*my_stride];
+       Vector<-1, Precision, SliceVBase<-1, Stride, Precision> > slice(int 
start, int length){
+               return Vector<-1, Precision, SliceVBase<-1, Stride, Precision> 
>(my_data + stride()*start, length, stride(), Slicing());
   }
-
-  const Precision& operator[](int i) const {
-    Internal::check_index(my_size, i);
-    return my_data[i*my_stride];
-  }
-private:
-  Precision* const my_data;
-  int my_size;
-  int my_stride;
-};
-
-// traits classes that help with building the vectors you actually
-// construct in code
-static const int MAX_SIZE=10;
-
-template<int Size, typename Precision>
-struct VectorSelector{
-  typedef VBase<Size, (Size>MAX_SIZE)?1:0, Precision > Type;
 };
-
-template<typename Precision>
-struct VectorSelector<-1, Precision>{
-  typedef DVBase<Precision> Type;
-};
-

Index: internal/vector.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vector.hh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- internal/vector.hh  10 Jan 2009 19:46:24 -0000      1.8
+++ internal/vector.hh  8 Feb 2009 19:18:58 -0000       1.9
@@ -1,7 +1,6 @@
 //-*- c++ -*-
 
-template<int Size=-1, typename Precision=double,
-        typename Base=typename VectorSelector<Size,Precision>::Type>
+template<int Size=-1, typename Precision=double, typename Base=VBase<Size, 
Precision> >
 class Vector : public Base {
 public:
   // sneaky hack: only one of these constructors will work with any given base
@@ -10,8 +9,8 @@
   inline Vector(){}
   inline Vector(Precision* data) : Base (data) {}
   inline Vector(int size_in) : Base(size_in) {}
-  inline Vector(Precision* data_in, int size_in, int stride_in) : 
Base(data_in, size_in, stride_in) {}
-  inline Vector(Precision* data_in, int size_in) : Base(data_in, size_in) {}
+  inline Vector(Precision* data_in, int size_in, int stride_in, Slicing) : 
Base(data_in, size_in, stride_in) {}
+  inline Vector(Precision* data_in, int stride_in, Slicing) : Base(data_in, 
stride_in) {}
 
 
   // constructors to allow return value optimisations
@@ -63,40 +62,3 @@
   }
 
 };
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// Fill in function calls, now everything is visible
-
-template<int Size, typename Precision>
-Vector<-1, Precision, SDVBase<1, Precision> > VBase<Size, 0, Precision>:: 
slice(int start, int length){
-  Internal::CheckSlice<>::check(Size, start, length);
-  return Vector<-1, Precision, SDVBase<1, Precision> >(my_data + start, 
length);
-}
-
-template<int Size, typename Precision>
-Vector<-1, Precision, SDVBase<1, Precision> > VBase<Size, 1, Precision>:: 
slice(int start, int length){
-  Internal::CheckSlice<>::check(Size, start, length);
-  return Vector<-1, Precision, SDVBase<1, Precision> >(my_data + start, 
length);
-}
-
-template<int Size, int Stride, typename Precision>
-Vector<-1, Precision, SDVBase<Stride, Precision> > SVBase<Size, Stride, 
Precision>:: slice(int start, int length){
-  Internal::CheckSlice<>::check(Size, start, length);
-  return Vector<-1, Precision, SDVBase<Stride, Precision> >(my_data + start, 
length);
-}
-
-
-template<typename Precision>
-Vector<-1, Precision, SDVBase<1, Precision> > DVBase<Precision>:: slice(int 
start, int length){
-  Internal::CheckSlice<>::check(my_size, start, length);
-  return Vector<-1, Precision, SDVBase<1, Precision> >(my_data + start, 
length);
-}
-
-
-template<int Stride, typename Precision>
-Vector<-1, Precision, SDVBase<Stride, Precision> > SDVBase<Stride, 
Precision>:: slice(int start, int length){
-  Internal::CheckSlice<>::check(my_size, start, length);
-  return Vector<-1, Precision, SDVBase<Stride, Precision> >(my_data + start, 
length);
-}
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]