toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN accessorexceptions.hh blasoperators.hh lin...


From: Tom Drummond
Subject: [Toon-members] TooN accessorexceptions.hh blasoperators.hh lin...
Date: Wed, 07 Jan 2009 14:20:50 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Tom Drummond <twd20>    09/01/07 14:20:50

Removed files:
        .              : accessorexceptions.hh blasoperators.hh 
                         linoperators.hh maccessor.debug.hh maccessor.hh 
                         mbase.hh numerics.h numhelpers.h vaccessor.hh 
                         vbase.hh vclasses.hh vmagic.hh 

Log message:
        Clean out old toon code ready for insertion of new toon2 code

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/accessorexceptions.hh?cvsroot=toon&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/blasoperators.hh?cvsroot=toon&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/linoperators.hh?cvsroot=toon&r1=1.22&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/maccessor.debug.hh?cvsroot=toon&r1=1.4&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/maccessor.hh?cvsroot=toon&r1=1.11&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/mbase.hh?cvsroot=toon&r1=1.12&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/numerics.h?cvsroot=toon&r1=1.7&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/numhelpers.h?cvsroot=toon&r1=1.5&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/vaccessor.hh?cvsroot=toon&r1=1.14&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/vbase.hh?cvsroot=toon&r1=1.17&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/vclasses.hh?cvsroot=toon&r1=1.25&r2=0
http://cvs.savannah.gnu.org/viewcvs/TooN/vmagic.hh?cvsroot=toon&r1=1.1&r2=0

Patches:
Index: accessorexceptions.hh
===================================================================
RCS file: accessorexceptions.hh
diff -N accessorexceptions.hh
--- accessorexceptions.hh       9 Jun 2005 09:31:54 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,36 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __ACCESSOREXCEPTIONS_HH
-#define __ACCESSOREXCEPTIONS_HH
-
-namespace TooNError
-{
-       class BadRowIndex{};
-       class BadColIndex{};
-       class BadIndex{};
-       class BadSliceStart{};
-       class SliceTooBig{};
-       class SillySlice{};
-};
-
-
-
-
-#endif

Index: blasoperators.hh
===================================================================
RCS file: blasoperators.hh
diff -N blasoperators.hh
--- blasoperators.hh    9 Jun 2005 09:31:54 -0000       1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,64 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __BLASOPERATORS_H
-#define __BLASOPERATORS_H
-
-extern "C" {
-  void dgemm_(const char* TRANSA, const char* TRANSB, int* width, int* height, 
int* inter,
-             double* alpha, const double* A, int *lda, const double* B, int 
*ldb,
-             double* beta, double* C, int *ldc);  
-}
-
-
-
-
-template <class RET, class LHS, class RHS>
-inline void blasmmmult(RET& ret, const LHS& lhs, const RHS& rhs){
-
-  // This awkwardness is the only way I can figure out to get at
-  // the is_rowmajor() static function in the layout classes
-  typedef typename RET::layout retlayout;
-  typedef typename LHS::layout lhslayout;
-  typedef typename RHS::layout rhslayout;
-
-  const bool CM = !retlayout::is_rowmajor();
-  const bool LCM = !lhslayout::is_rowmajor();
-  const bool RCM = !rhslayout::is_rowmajor();
-
-  int width = CM ? ret.num_cols():ret.num_rows();
-  int height = CM ? ret.num_rows():ret.num_cols();
-  int inter = lhs.num_cols();
-  double alpha = 1;
-  int lda = CM ? lhs.num_skip() : rhs.num_skip();
-  int ldb = CM ? rhs.num_skip() : lhs.num_skip();
-  double beta = 0;
-  int ldc = ret.num_skip();
-  const char* TrA = CM ? (LCM ? "N" : "T") : (RCM ? "T" : "N");
-  const char* TrB = CM ? (RCM ? "N" : "T") : (LCM ? "T" : "N");
-  
-  dgemm_(TrA,TrB,&width,&height,&inter,&alpha,
-        CM ? lhs.get_data_ptr() : rhs.get_data_ptr(),&lda,
-        CM ? rhs.get_data_ptr() : lhs.get_data_ptr(),&ldb,
-        &beta, ret.get_data_ptr(), &ldc);
-}
-  
-
-
-#endif

Index: linoperators.hh
===================================================================
RCS file: linoperators.hh
diff -N linoperators.hh
--- linoperators.hh     24 Jul 2008 21:34:27 -0000      1.22
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,1232 +0,0 @@
-
-/*
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __LINOPERATORS_HH
-#define __LINOPERATORS_HH
-
-inline RefMatrixRM DynamicVAccessor::as_row(){
-  return makeRefMatrixRM(1,my_size,my_values);
-}
-
-inline RefMatrixCM DynamicVAccessor::as_col(){
-  return makeRefMatrixCM(my_size,1,my_values);
-}
-
-inline RefSkipMatrixCM DynamicSkipAccessor::as_row(){
-  return makeRefSkipMatrixCM(1,my_size,my_skip,my_values);
-}
-
-inline RefSkipMatrixRM DynamicSkipAccessor::as_col(){
-  return makeRefSkipMatrixRM(my_size,1,my_skip,my_values);
-}
-
-//////////////////////
-// unary operator - //
-//    -Vector       //
-//////////////////////
-
-template<int Size, class Accessor>
-struct FixedVectorNeg{
-  inline static void eval(Vector<Size>& ret, const FixedVector<Size,Accessor>& 
arg){
-    for(int i=0; i<Size; i++){
-      ret[i]=-arg[i];
-    }
-  }
-};
-
-template<int Size, class Accessor> inline
-Vector<Size> operator-(const FixedVector<Size,Accessor>& arg){
-  return Vector<Size>(arg,Operator<FixedVectorNeg<Size,Accessor> >());
-}
-
-template <class Accessor>
-struct DynamicVectorNeg : public VSizer {
-  inline static void eval(Vector<>& ret, const DynamicVector<Accessor>& arg){
-    const int Size = arg.size();
-    set_size(ret,Size);
-    for(int i=0; i<Size; i++){
-      ret[i]=-arg[i];
-    }
-  }
-};
-
-
-template <class Accessor>
-Vector<> operator-(const DynamicVector<Accessor>& arg){
-  return Vector<>(arg,Operator<DynamicVectorNeg<Accessor> >());
-}
-
-/////////////////////
-//                 //
-//   operator ==   //
-//   operator !=   //
-// Vector == Vector//
-/////////////////////
-
-
-template<int Size, class Accessor1, class Accessor2>
-inline bool operator==(const FixedVector<Size, Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
-  for(int i=0; i < Size; i++)
-       if(lhs[i] != rhs[i])
-               return 0;
-  return 1;
-}
-
-template<int Size, class Accessor1, class Accessor2>
-inline bool operator==(const FixedVector<Size, Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(rhs.size() == Size);
-  for(int i=0; i < Size; i++)
-       if(lhs[i] != rhs[i])
-               return 0;
-  return 1;
-}
-
-template<class Accessor1, class Accessor2>
-inline bool operator==(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(rhs.size() == lhs.size());
-  for(int i=0; i < rhs.size(); i++)
-       if(lhs[i] != rhs[i])
-               return 0;
-  return 1;
-}
-
-template<int Size, class Accessor1, class Accessor2>
-inline bool operator==(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
-  assert(Size == lhs.size());
-  for(int i=0; i < Size; i++)
-       if(lhs[i] != rhs[i])
-               return 0;
-  return 1;
-}
-
-
-
-template<int Size, class Accessor1, class Accessor2>
-inline bool operator!=(const FixedVector<Size, Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
-  for(int i=0; i < Size; i++)
-       if(lhs[i] != rhs[i])
-               return 1;
-  return 0;
-}
-
-template<int Size, class Accessor1, class Accessor2>
-inline bool operator!=(const FixedVector<Size, Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(rhs.size() == Size);
-  for(int i=0; i < Size; i++)
-       if(lhs[i] != rhs[i])
-               return 1;
-  return 0;
-}
-
-template<class Accessor1, class Accessor2>
-inline bool operator!=(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(rhs.size() == lhs.size());
-  for(int i=0; i < rhs.size(); i++)
-       if(lhs[i] != rhs[i])
-               return 1;
-  return 0;
-}
-
-template<int Size, class Accessor1, class Accessor2>
-inline bool operator!=(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size, Accessor2>& rhs){
-  assert(Size == lhs.size());
-  for(int i=0; i < Size; i++)
-       if(lhs[i] != rhs[i])
-               return 1;
-  return 0;
-}
-
-
-
-
-/////////////////////
-//                 //
-//   operator +    //
-// Vector + Vector //
-/////////////////////
-
-template <int Size, class LHS, class RHS>
-struct FixedVAdd {
-  inline static void eval(Vector<Size>& ret,
-                  const LHS& lhs,
-                  const RHS& rhs){
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i]+rhs[i];
-    }
-  }
-};
-
-
-template <int Size, class Accessor1, class Accessor2>
-inline Vector<Size> operator+(const FixedVector<Size,Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs) {
-  return Vector<Size>(lhs, rhs,
-                     Operator<FixedVAdd<Size,
-                     FixedVector<Size,Accessor1>,
-                     FixedVector<Size,Accessor2> > >());
-}
-
-
-template <class LHS, class RHS>
-struct DynamicVAdd : public VSizer{
-  static void eval(Vector<>& ret,
-                  const LHS& lhs,
-                  const RHS& rhs){
-    assert(lhs.size() == rhs.size());
-    const int Size = lhs.size();
-    set_size(ret,Size);
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i]+rhs[i];
-    }
-  }
-};
-
-// have to specify operator + three more times
-// for any combination of Fixed and Dynamic except Fixed-Fixed
-
-template <class Accessor1,class Accessor2>
-inline Vector<> operator+(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  return Vector<>(lhs,rhs,
-                 Operator<DynamicVAdd<
-                 DynamicVector<Accessor1>,
-                 DynamicVector<Accessor2> > >());
-}
-
-template <int Size, class Accessor1,class Accessor2>
-inline Vector<Size> operator+(const FixedVector<Size,Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-    assert(Size == rhs.size());
-    return Vector<Size>(lhs,rhs,
-                 Operator<FixedVAdd<Size,
-                 FixedVector<Size,Accessor1>,
-                 DynamicVector<Accessor2> > >());
-}
-
-template <class Accessor1, int Size, class Accessor2>
-inline Vector<Size> operator+(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs){
-  assert(Size == lhs.size());
-  return Vector<Size>(lhs,rhs,
-                 Operator<FixedVAdd<Size,
-                 DynamicVector<Accessor1>,
-                 FixedVector<Size,Accessor2> > >());
-}
-
-//////////////////////
-//                  //
-// operator +=      //
-// Vector += Vector //
-//                  //
-//////////////////////
-
-template <int Size, class LHAccessor, class RHAccessor>
-inline FixedVector<Size,LHAccessor>& operator+= (FixedVector<Size,LHAccessor>& 
lhs,
-                                                const 
FixedVector<Size,RHAccessor>& rhs){
-    util::AddV<0,Size-1>::eval(lhs,rhs);
-    return lhs;
-}
-
-template <int Size, class LHAccessor, class RHAccessor>
-inline FixedVector<Size,LHAccessor>& operator+= (FixedVector<Size,LHAccessor>& 
lhs,
-                                                const 
DynamicVector<RHAccessor>& rhs){
-    assert(rhs.size() == Size);
-    util::AddV<0,Size-1>::eval(lhs,rhs);
-    return lhs;
-}
-
-template <int Size, class LHAccessor, class RHAccessor>
-inline DynamicVector<LHAccessor>& operator+= (DynamicVector<LHAccessor>& lhs,
-                                             const 
FixedVector<Size,RHAccessor>& rhs){
-  assert(lhs.size()==Size);
-  util::AddV<0,Size-1>::eval(lhs,rhs);
-  return lhs;
-}
-
-template <class LHAccessor, class RHAccessor>
-inline DynamicVector<LHAccessor>& operator+= (DynamicVector<LHAccessor>& lhs,
-                                             const DynamicVector<RHAccessor>& 
rhs){
-  assert(lhs.size()==rhs.size());
-  for(int i=0; i<lhs.size(); i++){
-    lhs[i]+=rhs[i];
-  }
-  return lhs;
-}
-
-
-////////////////
-//            //
-// operator - //
-//            //
-////////////////
-
-template <int Size, class LHS, class RHS>
-struct FixedVSub {
-  static void eval(Vector<Size>& ret,
-                  const LHS& lhs,
-                  const RHS& rhs){
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i]-rhs[i];
-    }
-  }
-};
-
-
-template <int Size, class Accessor1, class Accessor2>
-inline Vector<Size> operator-(const FixedVector<Size,Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs) {
-  return Vector<Size>(lhs, rhs,
-                     Operator<FixedVSub<Size,
-                     FixedVector<Size,Accessor1>,
-                     FixedVector<Size,Accessor2> > >());
-}
-
-
-template <class LHS, class RHS>
-struct DynamicVSub : public VSizer{
-  static void eval(Vector<>& ret,
-                  const LHS& lhs,
-                  const RHS& rhs){
-    assert(lhs.size() == rhs.size());
-    const int Size = lhs.size();
-    set_size(ret,Size);
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i]-rhs[i];
-    }
-  }
-};
-
-// have to specify operator - three more times
-// for any combination of Fixed and Dynamic except Fixed-Fixed
-
-template <class Accessor1,class Accessor2>
-inline Vector<> operator-(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  return Vector<>(lhs,rhs,
-                 Operator<DynamicVSub<
-                 DynamicVector<Accessor1>,
-                 DynamicVector<Accessor2> > >());
-}
-
-template <int Size, class Accessor1,class Accessor2>
-inline Vector<Size> operator-(const FixedVector<Size,Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(Size == rhs.size());
-  return Vector<Size>(lhs,rhs,
-                 Operator<FixedVSub<Size,
-                 FixedVector<Size,Accessor1>,
-                 DynamicVector<Accessor2> > >());
-}
-
-template <class Accessor1, int Size, class Accessor2>
-inline Vector<Size> operator-(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs){
-  assert(Size == lhs.size());
-  return Vector<Size>(lhs,rhs,
-                 Operator<FixedVSub<Size,
-                 DynamicVector<Accessor1>,
-                 FixedVector<Size,Accessor2> > >());
-}
-
-
-/////////////////
-//             //
-// operator -= //
-//             //
-/////////////////
-
-template <int Size, class LHAccessor, class RHAccessor>
-inline FixedVector<Size,LHAccessor>& operator-= (FixedVector<Size,LHAccessor>& 
lhs,
-                                                const 
FixedVector<Size,RHAccessor>& rhs){
-  for(int i=0; i<Size; i++){
-    lhs[i]-=rhs[i];
-  }
-  return lhs;
-}
-
-template <int Size, class LHAccessor, class RHAccessor>
-inline FixedVector<Size,LHAccessor>& operator-= (FixedVector<Size,LHAccessor>& 
lhs,
-                                                const 
DynamicVector<RHAccessor>& rhs){
-  assert(rhs.size() == Size);
-  for(int i=0; i<Size; i++){
-    lhs[i]-=rhs[i];
-  }
-  return lhs;
-}
-
-template <int Size, class LHAccessor, class RHAccessor>
-inline DynamicVector<LHAccessor>& operator-= (DynamicVector<LHAccessor>& lhs,
-                                             const 
FixedVector<Size,RHAccessor>& rhs){
-  assert(lhs.size()==Size);
-  for(int i=0; i<Size; i++){
-    lhs[i]-=rhs[i];
-  }
-  return lhs;
-}
-
-template <class LHAccessor, class RHAccessor>
-inline DynamicVector<LHAccessor>& operator-= (DynamicVector<LHAccessor>& lhs,
-                                             const DynamicVector<RHAccessor>& 
rhs){
-  assert(lhs.size()==rhs.size());
-  for(int i=0; i<lhs.size(); i++){
-    lhs[i]-=rhs[i];
-  }
-  return lhs;
-}
-
-
-/////////////////////
-// operator *      //
-// Vector * double //
-// (or v.v.)       //
-/////////////////////
-
-template <int Size, class Accessor>
-struct FixedVdMult {
-  static inline void eval(Vector<Size>& ret, const FixedVector<Size,Accessor>& 
lhs, double rhs){
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i] * rhs;
-    }
-  }
-};
-
-template <int Size, class Accessor>
-inline Vector<Size> operator*(const FixedVector<Size,Accessor>& lhs, double 
rhs){
-  return Vector<Size>(lhs,rhs,
-                     Operator<FixedVdMult<Size,Accessor> >());
-}
-template <int Size, class Accessor>
-inline Vector<Size> operator*(double lhs, const FixedVector<Size,Accessor>& 
rhs){
-  return Vector<Size>(rhs,lhs,
-                     Operator<FixedVdMult<Size,Accessor> >());
-}
-
-template <class Accessor>
-struct DynamicVdMult : public VSizer{
-  static inline void eval(Vector<>& ret, const DynamicVector<Accessor>& lhs, 
double rhs){
-    set_size(ret,lhs.size());
-    for(int i=0; i<lhs.size(); i++){
-      ret[i] = lhs[i] * rhs;
-    }
-  }
-};
-
-template <class Accessor>
-inline Vector<> operator*(const DynamicVector<Accessor>& lhs, double rhs){
-  return Vector<>(lhs,rhs,
-                 Operator<DynamicVdMult<Accessor> >());
-}
-template <class Accessor>
-inline Vector<> operator*(double lhs, const DynamicVector<Accessor>& rhs){
-  return Vector<>(rhs,lhs,
-                 Operator<DynamicVdMult<Accessor> >());
-}
-
-//////////////////////
-// operator *=      //
-// Vector *= double //
-//////////////////////
-
-template <int Size, class Accessor>
-inline FixedVector<Size,Accessor>& operator*=(FixedVector<Size,Accessor>& lhs, 
const double& rhs){
-  for(int i=0; i<Size; i++){
-    lhs[i]*=rhs;
-  }
-  return lhs;
-}
-
-template <class Accessor>
-inline DynamicVector<Accessor>& operator*=(DynamicVector<Accessor>& lhs, const 
double& rhs){
-  const int Size = lhs.size();
-  for(int i=0; i<Size; i++){
-    lhs[i]*=rhs;
-  }
-  return lhs;
-}
-
-/////////////////////
-// operator /      //
-// Vector / double //
-/////////////////////
-
-template <int Size, class Accessor>
-inline Vector<Size> operator/(const FixedVector<Size,Accessor>& lhs, double 
rhs){
-  return Vector<Size>(lhs,1/rhs,
-                     Operator<FixedVdMult<Size,Accessor> >());
-}
-
-template <class Accessor>
-inline Vector<> operator/(const DynamicVector<Accessor>& lhs, double rhs){
-  return Vector<>(lhs,1/rhs,
-                 Operator<DynamicVdMult<Accessor> >());
-}
-
-
-//////////////////////
-// operator /=      //
-// Vector /= double //
-//////////////////////
-
-template <int Size, class Accessor>
-inline FixedVector<Size,Accessor>& operator/=(FixedVector<Size,Accessor>& lhs, 
const double& rhs){
-  return lhs*=(1/rhs);
-}
-
-template <class Accessor>
-inline DynamicVector<Accessor>& operator/=(DynamicVector<Accessor>& lhs, const 
double& rhs){
-  return lhs*=(1/rhs);
-}
-
-///////////////////
-//  operator *   //
-// (dot product) //
-///////////////////
-
-template <int Size, class Accessor1, class Accessor2>
-inline double operator*(const FixedVector<Size,Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs) {
-    return util::Dot<0,Size-1>::eval(lhs,rhs);
-}
-
-template <class Accessor1,class Accessor2>
-inline double operator*(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(lhs.size() == rhs.size());
-  double dot=0;
-  for(int i=0; i<lhs.size(); i++){
-      dot += lhs[i]*rhs[i];
-  }
-  return dot;
-}
-
-template <int Size, class Accessor1,class Accessor2>
-inline double operator*(const FixedVector<Size,Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(lhs.size() == rhs.size());
-  return util::Dot<0,Size-1>::eval(lhs,rhs);
-}
-
-template <class Accessor1,int Size,class Accessor2>
-inline double operator*(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs){
-  assert(lhs.size() == rhs.size());
-  return util::Dot<0,Size-1>::eval(lhs,rhs);
-}
-
-///////////////////////////
-// operator ^            //
-// Vector<3> ^ Vector<3> //
-// cross product         //
-///////////////////////////
-
-template<class Acc1, class Acc2>
-struct VXProduct {
-  inline static void eval(Vector<3>& ret, const FixedVector<3,Acc1>& lhs, 
const FixedVector<3,Acc2>& rhs){
-    ret[0] = lhs[1]*rhs[2] - lhs[2]*rhs[1];
-    ret[1] = lhs[2]*rhs[0] - lhs[0]*rhs[2];
-    ret[2] = lhs[0]*rhs[1] - lhs[1]*rhs[0];
-  }
-};
-
-template<class Acc1, class Acc2>
-Vector<3> operator^(const FixedVector<3,Acc1>& lhs, const FixedVector<3,Acc2>& 
rhs){
-  return Vector<3>(lhs,rhs,Operator<VXProduct<Acc1,Acc2> >());
-}
-
-
-
-/////////////////////
-// operator *      //
-// Matrix * Vector //
-/////////////////////
-
-template <int Rows, int Cols, class LHS, class RHS>
-struct FixedMVMult {
-  inline static void eval(Vector<Rows>& ret, const LHS& lhs, const RHS& rhs){
-    for(int r=0; r<Rows; r++){
-       ret[r]=lhs[r]*rhs;
-    }
-  }
-};
-
-template <int Rows, int Cols, class MAccessor, class VAccessor>
-inline Vector<Rows> operator*(const FixedMatrix<Rows, Cols, MAccessor>& lhs,
-                             const FixedVector<Cols, VAccessor>& rhs){
-  return Vector<Rows>(lhs,rhs,
-                     Operator<FixedMVMult<Rows,Cols,
-                     FixedMatrix<Rows, Cols, MAccessor>,
-                     FixedVector<Cols, VAccessor> > >());
-}
-
-
-template <class LHS, class RHS>
-struct DynamicMVMult : public VSizer {
-  inline static void eval(Vector<>& ret, const LHS& lhs, const RHS& rhs){
-    set_size(ret,lhs.num_rows());
-    for(int r=0; r<lhs.num_rows(); r++){
-      ret[r]=0;
-      for(int c=0; c<lhs.num_cols(); c++){
-       ret[r]+=lhs(r,c)*rhs[c];
-      }
-    }
-  }
-};
-
-template <int Rows, int Cols, class MAccessor, class VAccessor>
-inline Vector<Rows> operator*(const FixedMatrix<Rows,Cols,MAccessor>& lhs,
-                         const DynamicVector<VAccessor>& rhs){
-  assert(rhs.size() == Cols);
-  return Vector<Rows>(lhs,rhs,
-                 Operator<FixedMVMult<Rows, Cols,
-                 FixedMatrix<Rows,Cols,MAccessor>,
-                 DynamicVector<VAccessor> > >());
-
-}
-
-
-template <int Size, class MAccessor, class VAccessor>
-inline Vector<> operator*(const DynamicMatrix<MAccessor>& lhs,
-                         const FixedVector<Size,VAccessor>& rhs){
-  assert(lhs.num_cols() == Size);
-  return Vector<>(lhs,rhs,
-                 Operator<DynamicMVMult<
-                 DynamicMatrix<MAccessor>,
-                 FixedVector<Size,VAccessor> > >());
-}
-
-template <class MAccessor, class VAccessor>
-inline Vector<> operator*(const DynamicMatrix<MAccessor>& lhs,
-                         const DynamicVector<VAccessor>& rhs){
-  assert(lhs.num_cols() == rhs.size());
-  return Vector<>(lhs,rhs,
-                 Operator<DynamicMVMult<
-                 DynamicMatrix<MAccessor>,
-                 DynamicVector<VAccessor> > >());
-}
-
-
-/////////////////////
-// operator *      //
-// Vector * Matrix //
-/////////////////////
-
-template <int Rows, int Cols, class MAccessor, class VAccessor>
-inline Vector<Cols> operator*(const FixedVector<Rows, VAccessor>& lhs,
-                             const FixedMatrix<Rows, Cols, MAccessor>& rhs){
-  return (rhs.T() * lhs);
-}
-
-
-
-template <int Rows, int Cols, class MAccessor, class VAccessor>
-inline Vector<Cols> operator*(const DynamicVector<VAccessor>& lhs,
-                         const FixedMatrix<Rows,Cols,MAccessor>& rhs){
-  return (rhs.T()*lhs);
-}
-
-
-template <int Size, class MAccessor, class VAccessor>
-inline Vector<> operator*(const FixedVector<Size,VAccessor>& lhs,
-                         const DynamicMatrix<MAccessor>& rhs){
-  return (rhs.T()*lhs);
-}
-
-template <class MAccessor, class VAccessor>
-inline Vector<> operator*(const DynamicVector<VAccessor>& lhs,
-                         const DynamicMatrix<MAccessor>& rhs){
-  return (rhs.T()*lhs);
-}
-
-
-
-
-/////////////////////
-// operator *      //
-// Matrix * double //
-// (and v.v.)      //
-/////////////////////
-
-template <int Rows, int Cols, class Accessor>
-struct FixedMdMult {
-  inline static void eval(Matrix<Rows,Cols>& ret, const 
FixedMatrix<Rows,Cols,Accessor>& lhs, double rhs){
-    for(int r=0; r<Rows; r++){
-      for(int c=0; c<Cols; c++){
-       ret[r][c]=lhs[r][c]*rhs;
-      }
-    }
-  }
-};
-
-template <int Rows, int Cols, class Accessor>
-inline Matrix<Rows,Cols> operator*(const FixedMatrix<Rows,Cols,Accessor>& lhs, 
double rhs){
-  return Matrix<Rows,Cols>(lhs,rhs, Operator<FixedMdMult<Rows,Cols,Accessor> 
>());
-}
-
-template <int Rows, int Cols, class Accessor>
-inline Matrix<Rows,Cols> operator*(double lhs, const 
FixedMatrix<Rows,Cols,Accessor>& rhs){
-  return Matrix<Rows,Cols>(rhs,lhs, Operator<FixedMdMult<Rows,Cols,Accessor> 
>());
-}
-
-
-template <class Accessor>
-struct DynamicMdMult : public MSizer {
-  inline static void eval(Matrix<>& ret, const DynamicMatrix<Accessor>& lhs, 
double rhs){
-    set_size(ret,lhs.num_rows(),lhs.num_cols());
-    for(int r=0; r<lhs.num_rows(); r++){
-      for(int c=0; c<lhs.num_cols(); c++){
-       ret[r][c]=lhs[r][c]*rhs;
-      }
-    }
-  }
-};
-
-
-template <class Accessor>
-inline Matrix<> operator*(const DynamicMatrix<Accessor>& lhs, double rhs){
-  return Matrix<>(lhs,rhs, Operator<DynamicMdMult<Accessor> >());
-}
-
-template <class Accessor>
-inline Matrix<> operator*(double lhs, const DynamicMatrix<Accessor>& rhs){
-  return Matrix<>(rhs,lhs, Operator<DynamicMdMult<Accessor> >());
-}
-
-
-//////////////////////
-// operator *=      //
-// Matrix *= double //
-//////////////////////
-
-
-template <class Accessor>
-inline void operator*=(MatrixBase<Accessor>& lhs, double rhs){
-  for(int r=0; r<lhs.num_rows(); r++){
-    for(int c=0; c<lhs.num_cols(); c++){
-      lhs[r][c]*=rhs;
-    }
-  }
-}
-
-/////////////////////
-// operator /      //
-// Matrix / double //
-/////////////////////
-
-template <int Rows, int Cols, class Accessor>
-inline Matrix<Rows,Cols> operator/(const FixedMatrix<Rows,Cols,Accessor>& lhs, 
double rhs){
-  return lhs * (1.0/rhs);
-}
-
-template <class Accessor>
-inline Matrix<> operator/(const DynamicMatrix<Accessor>& lhs, double rhs){
-  return lhs * (1.0/rhs);
-}
-
-
-//////////////////////
-// operator /=      //
-// Matrix /= double //
-//////////////////////
-
-template <class Accessor>
-inline void operator/=(MatrixBase<Accessor>& lhs, double rhs){
-  lhs*=(1.0/rhs);
-}
-
-/////////////////////
-// operator +      //
-// Matrix + Matrix //
-/////////////////////
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-struct FixedMMSum {
-  inline static void eval(Matrix<Rows,Cols>& ret,
-                         const FixedMatrix<Rows,Cols,LHAccessor>& lhs,
-                         const FixedMatrix<Rows,Cols,RHAccessor>& rhs){
-    for(int r=0; r<Rows; r++){
-      for(int c=0; c<Cols; c++){
-       ret[r][c]= lhs[r][c]+rhs[r][c];
-      }
-    }
-  }
-};
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-Matrix<Rows,Cols> operator+(const FixedMatrix<Rows,Cols,LHAccessor>& lhs,
-                           const FixedMatrix<Rows,Cols,RHAccessor>& rhs){
-  return Matrix<Rows,Cols>(lhs,rhs, 
Operator<FixedMMSum<Rows,Cols,LHAccessor,RHAccessor> >());
-}
-
-template <class LHS, class RHS>
-struct DynamicMMSum : public MSizer {
-  inline static void eval(Matrix<>& ret, const LHS& lhs, const RHS& rhs){
-    set_size(ret,lhs.num_rows(),lhs.num_cols());
-    for(int r=0; r<lhs.num_rows(); r++){
-      for(int c=0; c<lhs.num_cols(); c++){
-       ret[r][c]= lhs[r][c]+rhs[r][c];
-      }
-    }
-  }
-};
-
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-Matrix<> operator+(const FixedMatrix<Rows,Cols,LHAccessor>& lhs,
-                  const DynamicMatrix<RHAccessor>& rhs){
-  assert(rhs.num_rows()==Rows && rhs.num_cols()==Cols);
-  return Matrix<> (lhs,rhs,
-                  Operator<DynamicMMSum<
-                  FixedMatrix<Rows,Cols,LHAccessor>,
-                  DynamicMatrix<RHAccessor> > >());
-}
-
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-Matrix<> operator+(const DynamicMatrix<LHAccessor>& lhs,
-                  const FixedMatrix<Rows,Cols,RHAccessor>& rhs){
-  assert(lhs.num_rows()==Rows && lhs.num_cols()==Cols);
-  return Matrix<> (lhs,rhs,
-                  Operator<DynamicMMSum<
-                  DynamicMatrix<LHAccessor>,
-                  FixedMatrix<Rows,Cols,RHAccessor> > >());
-}
-
-template <class LHAccessor, class RHAccessor>
-Matrix<> operator+(const DynamicMatrix<LHAccessor>& lhs,
-                  const DynamicMatrix<RHAccessor>& rhs){
-  assert(lhs.num_rows()==rhs.num_rows() && lhs.num_cols()==rhs.num_cols());
-  return Matrix<> (lhs,rhs,
-                  Operator<DynamicMMSum<
-                  DynamicMatrix<LHAccessor>,
-                  DynamicMatrix<RHAccessor> > >());
-}
-
-//////////////////////
-// operator +=, -=  //
-// Matrix += Matrix //
-//////////////////////
-
-//fixed fixed
-//fixed dynamic
-//dynamic fixed
-//dynamic dynamic
-//RefCM fixed
-//RefCM dynamic
-//RefRM fixed
-//RefRM dynamic
-
-#define TOON_MAKE_ELEMENT_OPS(OP) \
- \
-template <int Rows, int Cols, class MAccessor1, class MAccessor2> inline 
FixedMatrix<Rows,Cols,MAccessor1>& operator OP ( 
FixedMatrix<Rows,Cols,MAccessor1>& lhs, const 
FixedMatrix<Rows,Cols,MAccessor2>& rhs){ \
-    for(int r=0; r<Rows; r++) \
-               lhs[r] OP rhs[r]; \
-    return lhs; \
-} \
-\
-template <int Rows, int Cols, class MAccessor1, class MAccessor2> inline 
FixedMatrix<Rows,Cols,MAccessor1>& operator OP ( 
FixedMatrix<Rows,Cols,MAccessor1>& lhs, const DynamicMatrix<MAccessor2>& rhs){ \
-  assert(rhs.num_rows() == Rows && rhs.num_cols() == Cols); \
-  for(int r=0; r<Rows; r++) \
-      lhs[r] OP rhs[r]; \
-  return lhs; \
-} \
- \
-template <int Rows, int Cols, class MAccessor1, class MAccessor2> inline 
DynamicMatrix<MAccessor1>& operator OP ( DynamicMatrix<MAccessor1>& lhs, const 
FixedMatrix<Rows,Cols,MAccessor2>& rhs){ \
-  assert(lhs.num_rows() == Rows && lhs.num_cols() == Cols); \
-  for(int r=0; r<Rows; r++){ \
-      lhs[r] OP rhs[r]; \
-  } \
-  return lhs; \
-} \
- \
-template <class MAccessor1, class MAccessor2> inline 
DynamicMatrix<MAccessor1>& operator OP ( DynamicMatrix<MAccessor1>& lhs, const 
DynamicMatrix<MAccessor2>& rhs){ \
-  assert(lhs.num_rows() == rhs.num_rows() && lhs.num_cols() == 
rhs.num_cols()); \
-  for(int r=0; r<lhs.num_rows(); r++) \
-    for(int c=0; c <lhs.num_cols(); c++) \
-      lhs[r][c] OP rhs[r][c]; \
-  return lhs; \
-} \
- \
-template <int Rows, int Cols, class MAccessor> inline RefSkipMatrixRM operator 
OP (RefSkipMatrixRM lhs, const FixedMatrix<Rows,Cols,MAccessor>& rhs) \
-{ \
-  assert(lhs.num_rows() == Rows && lhs.num_cols() == Cols); \
-  for(int r=0; r<Rows; r++) \
-         for(int c=0; c<Cols; c++) \
-                 lhs[r][c] OP rhs[r][c]; \
-   \
-  return lhs; \
-} \
- \
-template <class MAccessor> inline RefSkipMatrixRM operator OP (RefSkipMatrixRM 
lhs, const DynamicMatrix<MAccessor>& rhs) \
-{ \
-  assert(lhs.num_rows() == rhs.num_rows() && lhs.num_cols() == 
rhs.num_cols()); \
-  for(int r=0; r < lhs.num_rows(); r++) \
-         for(int c=0; c< lhs.num_cols(); c++) \
-      lhs[r][c] OP rhs[r][c]; \
-   \
-  return lhs; \
-} \
- \
- \
-template <int Rows, int Cols, class MAccessor> inline RefSkipMatrixCM operator 
OP (RefSkipMatrixCM lhs, const FixedMatrix<Rows,Cols,MAccessor>& rhs) { \
-  assert(lhs.num_rows() == Rows && lhs.num_cols() == Cols); \
-  for(int r=0; r<Rows; r++) \
-         for(int c=0; c<Cols; c++) \
-      lhs[r][c] OP rhs[r][c]; \
-   \
-  return lhs; \
-} \
- \
-template <class MAccessor> inline RefSkipMatrixCM operator OP (RefSkipMatrixCM 
lhs, const DynamicMatrix<MAccessor>& rhs) \
-{ \
-  assert(lhs.num_rows() == rhs.num_rows() && lhs.num_cols() == 
rhs.num_cols()); \
-  for(int r=0; r < lhs.num_rows(); r++) \
-         for(int c=0; c< lhs.num_cols(); c++) \
-      lhs[r][c] OP rhs[r][c]; \
-   \
-  return lhs; \
-} 
-
-TOON_MAKE_ELEMENT_OPS(+=)
-TOON_MAKE_ELEMENT_OPS(-=)
-
-
-
-
-
-/////////////////////
-// operator -      //
-// Matrix - Matrix //
-/////////////////////
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-struct FixedMMSub {
-  inline static void eval(Matrix<Rows,Cols>& ret,
-                         const FixedMatrix<Rows,Cols,LHAccessor>& lhs,
-                         const FixedMatrix<Rows,Cols,RHAccessor>& rhs){
-    for(int r=0; r<Rows; r++){
-      for(int c=0; c<Cols; c++){
-       ret[r][c]= lhs[r][c]-rhs[r][c];
-      }
-    }
-  }
-};
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor> inline
-Matrix<Rows,Cols> operator-(const FixedMatrix<Rows,Cols,LHAccessor>& lhs,
-                           const FixedMatrix<Rows,Cols,RHAccessor>& rhs){
-  return Matrix<Rows,Cols>(lhs,rhs, 
Operator<FixedMMSub<Rows,Cols,LHAccessor,RHAccessor> >());
-}
-
-template <class LHS, class RHS>
-struct DynamicMMSub : public MSizer {
-  inline static void eval(Matrix<>& ret, const LHS& lhs, const RHS& rhs){
-    set_size(ret,lhs.num_rows(),lhs.num_cols());
-    for(int r=0; r<lhs.num_rows(); r++){
-      for(int c=0; c<lhs.num_cols(); c++){
-       ret[r][c]= lhs[r][c]-rhs[r][c];
-      }
-    }
-  }
-};
-
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-Matrix<Rows, Cols> operator-(const FixedMatrix<Rows,Cols,LHAccessor>& lhs,
-                  const DynamicMatrix<RHAccessor>& rhs){
-  assert(rhs.num_rows()==Rows && rhs.num_cols()==Cols);
-  return Matrix<Rows, Cols> (lhs,rhs,
-                  Operator<FixedMMSub<Rows, Cols,
-                  FixedMatrix<Rows,Cols,LHAccessor>,
-                  DynamicMatrix<RHAccessor> > >());
-}
-
-
-template <int Rows, int Cols, class LHAccessor, class RHAccessor>
-Matrix<Rows, Cols> operator-(const DynamicMatrix<LHAccessor>& lhs,
-                  const FixedMatrix<Rows,Cols,RHAccessor>& rhs){
-  assert(lhs.num_rows()==Rows && lhs.num_cols()==Cols);
-  return Matrix<Rows, Cols> (lhs,rhs,
-                  Operator<FixedMMSub<Rows, Cols,
-                  DynamicMatrix<LHAccessor>,
-                  FixedMatrix<Rows,Cols,RHAccessor> > >());
-}
-
-template <class LHAccessor, class RHAccessor>
-Matrix<> operator-(const DynamicMatrix<LHAccessor>& lhs,
-                  const DynamicMatrix<RHAccessor>& rhs){
-  assert(lhs.num_rows()==rhs.num_rows() && lhs.num_cols()==rhs.num_cols());
-  return Matrix<> (lhs,rhs,
-                  Operator<DynamicMMSub<
-                  DynamicMatrix<LHAccessor>,
-                  DynamicMatrix<RHAccessor> > >());
-}
-
-/////////////////////
-// operator *      //
-// Matrix * Matrix //
-/////////////////////
-
-template <class RET, class LHS, class RHS>
-inline void cppmmmult (RET& ret, const LHS& lhs, const RHS& rhs){
-  const int Rows = lhs.num_rows();
-  const int Cols = rhs.num_cols();
-  const int Inter = lhs.num_cols();
-  for(int r=0; r<Rows; r++){
-    for(int c=0; c<Cols; c++){
-      double temp=0;
-      for(int i=0; i<Inter; i++){
-       temp+=lhs(r,i)*rhs(i,c);
-      }
-      ret(r,c)=temp;
-    }
-  }
-}
-
-
-template <int Rows, int Inter, int Cols, class LHS, class RHS, int MultPolicy>
-struct FixedMMMult;
-
-template <int Rows, int Inter, int Cols, class LHS, class RHS>
-struct FixedMMMult<Rows,Inter,Cols,LHS,RHS,NUMERICS::BlasMult> {
-  inline static void eval(Matrix<Rows,Cols>& ret, const LHS& lhs, const RHS& 
rhs){
-
-    //blasmmmult(ret,lhs,rhs);
-      //cppmmmult(ret, lhs, rhs);
-      util::matrix_multiply<Rows,Inter,Cols>(lhs, rhs, ret);
-  }
-};
-
-template <int Rows, int Inter, int Cols, class LHS, class RHS>
-struct FixedMMMult<Rows,Inter,Cols,LHS,RHS,NUMERICS::CPPMult> {
-  inline static void eval(Matrix<Rows,Cols>& ret, const LHS& lhs, const RHS& 
rhs){
-      //cppmmmult(ret,lhs,rhs);
-      util::matrix_multiply<Rows,Inter,Cols>(lhs, rhs, ret);
-  }
-};
-
-
-template <int Rows, int Inter, int Cols, class LMAccessor, class RMAccessor>
-inline Matrix<Rows,Cols> operator*(const FixedMatrix<Rows,Inter,LMAccessor>& 
lhs,
-                                  const FixedMatrix<Inter,Cols,RMAccessor>& 
rhs){
-  return Matrix<Rows,Cols>(lhs,rhs,
-                          Operator<FixedMMMult<Rows,Inter,Cols,
-                          FixedMatrix<Rows,Inter,LMAccessor>,
-                          FixedMatrix<Inter,Cols,RMAccessor>,
-                          (Rows*Inter*Cols>NUMERICS::MaxCPPMultCount ? 
NUMERICS::BlasMult : NUMERICS::CPPMult) > >());
-}
-
-
-template<class LHS, class RHS>
-struct DynamicMMMult : public MSizer{
-  inline static void eval(Matrix<>& ret, const LHS& lhs, const RHS& rhs){
-    set_size(ret,lhs.num_rows(),rhs.num_cols());
-    //if(lhs.num_rows()*lhs.num_cols()*rhs.num_cols() > 
NUMERICS::MaxCPPMultCount){
-     // blasmmmult(ret,lhs,rhs);
-    //} else {
-      cppmmmult(ret,lhs,rhs);
-    //}
-  }
-};
-
-template<int Rows, int Cols, class LMAccessor, class RMAccessor>
-inline Matrix<> operator*(const FixedMatrix<Rows,Cols,LMAccessor>& lhs,
-                         const DynamicMatrix<RMAccessor>& rhs){
-  assert(rhs.num_rows()==Cols);
-  return Matrix<>(lhs,rhs,
-                 Operator<DynamicMMMult<
-                 FixedMatrix<Rows,Cols,LMAccessor>,
-                 DynamicMatrix<RMAccessor> > > ());
-}
-
-
-template<int Rows, int Cols, class LMAccessor, class RMAccessor>
-inline Matrix<> operator*(const DynamicMatrix<LMAccessor>& lhs,
-                         const FixedMatrix<Rows,Cols,RMAccessor>& rhs){
-  assert(lhs.num_cols()==Rows);
-  return Matrix<>(lhs,rhs,
-                 Operator<DynamicMMMult<
-                 DynamicMatrix<LMAccessor>,
-                 FixedMatrix<Rows,Cols,RMAccessor> > > ());
-}
-
-template <class LMAccessor, class RMAccessor>
-inline Matrix<> operator*(const DynamicMatrix<LMAccessor>& lhs,
-                         const DynamicMatrix<RMAccessor>& rhs){
-  assert(lhs.num_cols() == rhs.num_rows());
-  return Matrix<>(lhs,rhs,
-                 Operator<DynamicMMMult<
-                 DynamicMatrix<LMAccessor>,
-                 DynamicMatrix<RMAccessor> > >());
-}
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////
-// Multiplication treating a vector as a diagonal matrix
-
-/////////////////////////
-//                     //
-// diagmult()          //
-// Vector * Vector     //
-//                     //
-/////////////////////////
-
-template <class LHS, class RHS, int Size>
-struct DiagVVMult {
-  inline static void eval(Vector<Size>& ret, const LHS& lhs, const RHS& rhs){
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i]*rhs[i];
-    }
-  }
-};
-
-template <class Accessor1, class Accessor2, int Size>
-Vector<Size> diagmult(const FixedVector<Size,Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs){
-  return 
Vector<Size>(lhs,rhs,Operator<DiagVVMult<FixedVector<Size,Accessor1>,FixedVector<Size,Accessor2>,Size>
 >());
-}
-
-
-template<class LHS, class RHS>
-struct DynamicDiagVVMult : public VSizer {
-  inline static void eval(Vector<>& ret, const LHS& lhs, const RHS& rhs){
-    assert(lhs.size() == rhs.size());
-    const int Size = lhs.size();
-    set_size(ret,Size);
-    for(int i=0; i<Size; i++){
-      ret[i] = lhs[i] * rhs[i];
-    }
-  }
-};
-
-template<class Accessor1, class Accessor2>
-Vector<> diagmult(const DynamicVector<Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  return 
Vector<>(lhs,rhs,Operator<DynamicDiagVVMult<DynamicVector<Accessor1>,DynamicVector<Accessor2>
 > >());
-}
-
-template<class Accessor1, class Accessor2, int Size>
-Vector<Size> diagmult(const FixedVector<Size,Accessor1>& lhs, const 
DynamicVector<Accessor2>& rhs){
-  assert(lhs.size() == rhs.size());
-  return 
Vector<Size>(lhs,rhs,Operator<DiagVVMult<FixedVector<Size,Accessor1>,DynamicVector<Accessor2>,
 Size > >());
-}
-
-template<class Accessor1, class Accessor2, int Size>
-Vector<Size> diagmult(const DynamicVector<Accessor1>& lhs, const 
FixedVector<Size,Accessor2>& rhs){
-  assert(lhs.size() == rhs.size());
-  return 
Vector<Size>(lhs,rhs,Operator<DiagVVMult<DynamicVector<Accessor1>,FixedVector<Size,Accessor2>,
 Size > >());
-}
-
-/////////////////////////
-//                     //
-// diagmult()          //
-// Vector * Matrix     //
-//                     //
-/////////////////////////
-
-
-template <class LHS, class RHS, int Rows, int Cols>
-struct DiagVMMult {
-  inline static void eval(Matrix<Rows,Cols>& ret, const LHS& lhs, const RHS& 
rhs){
-    for(int c=0; c<Cols; c++){
-      ret.T()[c] = diagmult(lhs,rhs.T()[c]);
-    }
-  }
-};
-
-template <class Accessor1, class Accessor2, int Rows, int Cols>
-inline Matrix<Rows,Cols> diagmult(const FixedVector<Rows, Accessor1>& lhs, 
const FixedMatrix<Rows,Cols,Accessor2>& rhs){
-  return Matrix<Rows,Cols> (lhs,rhs,Operator<DiagVMMult<FixedVector<Rows, 
Accessor1>,FixedMatrix<Rows,Cols,Accessor2>,Rows,Cols> >());
-}
-
-
-
-template<class LHS, class RHS>
-struct DynamicDiagVMMult : public MSizer {
-  inline static void eval(Matrix<>& ret, const LHS& lhs, const RHS& rhs){
-    assert(lhs.size() == rhs.num_rows());
-    const int Rows = rhs.num_rows();
-    const int Cols = rhs.num_cols();
-    set_size(ret,Rows,Cols);
-    for(int r=0; r<Rows; r++){
-      for(int c=0; c<Cols; c++){
-       ret(r,c) = lhs[r] * rhs(r,c);
-      }
-    }
-  }
-};
-
-template<class Accessor1, class Accessor2>
-inline Matrix<> diagmult(const DynamicVector<Accessor1>& lhs, const 
DynamicMatrix<Accessor2>& rhs){
-  return 
Matrix<>(lhs,rhs,Operator<DynamicDiagVMMult<DynamicVector<Accessor1>,DynamicMatrix<Accessor2>
 > >());
-}
-
-template<class Accessor1, class Accessor2, int Size>
-inline Matrix<> diagmult(const FixedVector<Size,Accessor1>& lhs, const 
DynamicMatrix<Accessor2>& rhs){
-  return 
Matrix<>(lhs,rhs,Operator<DynamicDiagVMMult<FixedVector<Size,Accessor1>,DynamicMatrix<Accessor2>
 > >());
-}
-
-template<class Accessor1, class Accessor2, int Rows, int Cols>
-inline Matrix<Rows, Cols> diagmult(const DynamicVector<Accessor1>& lhs, const 
FixedMatrix<Rows,Cols,Accessor2>& rhs){
-  assert(lhs.size() == Rows);
-  return Matrix<Rows, 
Cols>(lhs,rhs,Operator<DiagVMMult<DynamicVector<Accessor1>,FixedMatrix<Rows,Cols,Accessor2>,Rows,Cols
 > >());
-}
-
-/////////////////////////
-//                     //
-// diagmult()          //
-// Matrix * Vector     //
-//                     //
-/////////////////////////
-
-
-template <class LHS, class RHS, int Rows, int Cols>
-struct DiagMVMult {
-  inline static void eval(Matrix<Rows,Cols>& ret, const LHS& lhs, const RHS& 
rhs){
-    for(int r=0; r<Rows; r++){
-      ret[r] = diagmult(lhs[r],rhs);
-    }
-  }
-};
-
-template <class Accessor1, class Accessor2, int Rows, int Cols>
-inline Matrix<Rows,Cols> diagmult(const FixedMatrix<Rows,Cols,Accessor1>& lhs, 
const FixedVector<Cols,Accessor2>& rhs){
-  return Matrix<Rows,Cols> 
(lhs,rhs,Operator<DiagMVMult<FixedMatrix<Rows,Cols,Accessor1>,FixedVector<Cols,Accessor2>,Rows,Cols
 > >());
-}
-
-
-
-template<class LHS, class RHS>
-struct DynamicDiagMVMult : public MSizer {
-  inline static void eval(Matrix<>& ret, const LHS& lhs, const RHS& rhs){
-    assert(rhs.size() == lhs.num_cols());
-    const int Rows = lhs.num_rows();
-    const int Cols = lhs.num_cols();
-    set_size(ret,Rows,Cols);
-    for(int r=0; r<Rows; r++){
-      for(int c=0; c<Cols; c++){
-       ret(r,c) = lhs(r,c) * rhs[c];
-      }
-    }
-  }
-};
-
-template<class Accessor1, class Accessor2>
-inline Matrix<> diagmult(const DynamicMatrix<Accessor1>& lhs,  const 
DynamicVector<Accessor2>& rhs){
-  return Matrix<>(lhs,rhs,Operator<DynamicDiagMVMult<DynamicMatrix<Accessor1>, 
DynamicVector<Accessor2> > >());
-}
-
-template<class Accessor1, class Accessor2, int Size>
-inline Matrix<> diagmult(const DynamicMatrix<Accessor1>& lhs,  const 
FixedVector<Size,Accessor2>& rhs){
-  return Matrix<>(lhs,rhs,Operator<DynamicDiagMVMult<DynamicMatrix<Accessor1>, 
FixedVector<Size,Accessor2> > >());
-}
-
-template<class Accessor1, class Accessor2, int Rows, int Cols>
-inline Matrix<Rows, Cols> diagmult(const FixedMatrix<Rows,Cols,Accessor1>& 
lhs,  const DynamicVector<Accessor2>& rhs){
-  assert(rhs.size() == Cols);
-  return Matrix<Rows, 
Cols>(lhs,rhs,Operator<DiagMVMult<FixedMatrix<Rows,Cols,Accessor1>, 
DynamicVector<Accessor2>,Rows,Cols > >());
-}
-
-#endif

Index: maccessor.debug.hh
===================================================================
RCS file: maccessor.debug.hh
diff -N maccessor.debug.hh
--- maccessor.debug.hh  9 Jun 2005 09:31:54 -0000       1.4
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,475 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __MACCESSOR_HH
-#define __MACCESSOR_HH
-
-
-///////////////////////////////
-//                           //
-//  Matrix Accessor classes  //
-//                           //
-///////////////////////////////
-
-#define TOON_CHECK_ROW TOON_ASSERT(r < Rows && r >= 0, TooNError::BadRowIndex)
-#define TOON_CHECK_COL TOON_ASSERT(c < Cols && c >= 0, TooNError::BadColIndex)
-
-//TODO: error checking in slices
-
-
-template <int Rows,int Cols, class AllocZone>
-class FixedMAccessor<Rows,Cols,RowMajor,AllocZone> : public AllocZone {
- public:
-  inline FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& operator[](int 
r) TOON_THROW {
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > 
>&>(my_values[r*Cols]);
-  }
-  inline const FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& 
operator[](int r) const TOON_THROW {
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const 
FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >&>(my_values[r*Cols]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*Cols+c];
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*Cols+c];
-  }
-
-  static inline int num_rows() throw() {return Rows;}
-  static inline int num_cols() throw() {return Cols;}
-  static inline int num_skip() throw() {return Cols;}
-  typedef RowMajor layout;
-
-  // Transpose operations
-  inline 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> > >& 
T() {
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols>
 > >&>(*my_values);
-  }
-  inline const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> > >& 
T() const {
-    return reinterpret_cast<const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> > 
>&>(*my_values);
-  }
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> >& 
slice(){
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor>
 >&>
-      (my_values[Rstart*Cols+Cstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> >& slice() 
const {
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> >&>
-      (my_values[Rstart*Cols+Cstart]);
-  }
-};
-
-
-
-template <int Rows,int Cols, class AllocZone>
-class FixedMAccessor<Rows,Cols,ColMajor,AllocZone> : public AllocZone {
- public:
-  FixedVector<Cols, SkipAccessor<Cols, Rows> >& operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols, SkipAccessor<Cols, Rows> 
>&>(my_values[r]);
-  }
-
-  const FixedVector<Cols, SkipAccessor<Cols, Rows> >& operator[](int r) const 
TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const FixedVector<Cols, SkipAccessor<Cols, Rows> 
>&>(my_values[r]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*Rows+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*Rows+r];
-  }
-
-  static inline int num_rows(){return Rows;}
-  static inline int num_cols(){return Cols;}
-  static inline int num_skip(){return Rows;}
-  typedef ColMajor layout;
-
-  // Transpose operations
-  inline 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> > >& 
T() {
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols>
 > >&>(*my_values);
-  }
-  inline const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> > >& 
T() const {
-    return reinterpret_cast<const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> > 
>&>(*my_values);
-  }
-
-  // slice()
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> >& 
slice(){
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor>
 >&>
-      (my_values[Cstart*Rows+Rstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> >& 
slice()const{
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> >&>
-      (my_values[Cstart*Rows+Rstart]);
-  }
-};
-
-
-
-
-
-template<int Rows, int Cols, int Skip>
-class SkipMAccessor<Rows,Cols,Skip,RowMajor> {
-public:
-  inline FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& operator[](int 
r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > 
>&>(my_values[r*Skip]);
-  }
-  inline const FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& 
operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const 
FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >&>(my_values[r*Skip]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*Skip+c];
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*Skip+c];
-  }
-
-  static inline int num_rows(){return Rows;}
-  static inline int num_cols(){return Cols;}
-  static inline int num_skip(){return Skip;}
-  typedef RowMajor layout;
-
-  // Transpose operations
-  inline FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> >& T() {
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> 
>&>(*this); 
-  }
-
-  inline const FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> >& 
T() const {
-    return reinterpret_cast<const 
FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> >&>(*this);
-  }
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> >& 
slice(){
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor>
 >&>
-      (my_values[Rstart*Skip+Cstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> >& slice() 
const {
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> >&>
-      (my_values[Rstart*Skip+Cstart]);
-  }
-
- protected:
-  double my_values[Rows*Skip];
-};
-
-template<int Rows, int Cols, int Skip> 
-class SkipMAccessor<Rows, Cols, Skip, ColMajor> {
-public:
-
-  inline FixedVector<Cols, SkipAccessor<Cols, Skip> >& operator[](int r)  
TOON_THROW
-  {
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols, SkipAccessor<Cols, Skip> 
>&>(my_values[r]);
-  }
-
-  inline const FixedVector<Cols, SkipAccessor<Cols, Skip> >& operator[](int r) 
const TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const FixedVector<Cols, SkipAccessor<Cols, Skip> 
>&>(my_values[r]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*Skip+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*Skip+r];
-  }
-
-  static inline int num_rows(){return Rows;}
-  static inline int num_cols(){return Cols;}
-  static inline int num_skip(){return Skip;}
-  typedef ColMajor layout;
-
-  // Transpose operations
-  inline FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> >& T() {
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> 
>&>(*this); 
-  }
-
-  inline const FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> >& 
T() const {
-    return reinterpret_cast<const 
FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> >&>(*this);
-  }
-
-  // slice()
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor> >& 
slice(){
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor>
 >&>
-      (my_values[Cstart*Skip+Rstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor> >& 
slice()const{
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor> >&>
-      (my_values[Cstart*Skip+Rstart]);
-  }
-
- protected:
-  double my_values[Cols*Skip];
-};
-
-
-/////////////////////////
-//                     //
-//  Dynamic Accessors  //
-//                     //
-/////////////////////////
-#undef TOON_CHECK_ROW
-#undef TOON_CHECK_COL
-#define TOON_CHECK_ROW TOON_ASSERT(r < my_rows && r >= 0, 
TooNError::BadRowIndex)
-#define TOON_CHECK_COL TOON_ASSERT(c < my_cols && c >= 0, 
TooNError::BadColIndex)
-
-template <>
-class DynamicMAccessor<RowMajor> {
- public:
-  const RefVector operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return RefVector(my_num_cols,my_values+r*my_num_cols);
-  }
-
-  RefVector operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return RefVector(my_num_cols,my_values+r*my_num_cols);
-  }
-
-  inline double& operator()(int r, int c)TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*my_num_cols+c];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*my_num_cols+c];
-  }
-
-  int num_rows()const{return my_num_rows;}
-  int num_cols()const{return my_num_cols;}
-  int num_skip()const{return my_num_cols;}
-  typedef RowMajor layout;
-
-  inline DynamicMatrix<DynamicMAccessor<ColMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
-  }
-  inline const DynamicMatrix<DynamicMAccessor<ColMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
-  }
-
- protected:
-  int my_num_rows;
-  int my_num_cols;
-  double* my_values;
-};
-
-template <>
-class DynamicMAccessor<ColMajor> {
- public:  
-  const RefSkipVector operator[](int r) const TOON_THROW{ 
-       TOON_CHECK_ROW;
-    return RefSkipVector(my_num_cols,my_num_rows,my_values+r);
-  }
-
-  RefSkipVector operator[](int r) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-    return RefSkipVector(my_num_cols,my_num_rows,my_values+r);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*my_num_rows+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*my_num_rows+r];
-  }
-
-  int num_rows()const{return my_num_rows;}
-  int num_cols()const{return my_num_cols;}
-  int num_skip()const{return my_num_rows;}
-  typedef ColMajor layout;
-
-  inline DynamicMatrix<DynamicMAccessor<RowMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<DynamicMAccessor<RowMajor> 
>&>(*this);
-  }
-  inline const DynamicMatrix<DynamicMAccessor<RowMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<DynamicMAccessor<RowMajor> 
>&>(*this);
-  }
-
- protected:
-  int my_num_cols;  // representation of rows and cols transposed from above
-  int my_num_rows;  // so that transpose operation is a simple cast
-  double* my_values;
-};
-
-///////// RefSkipMAccessor ////////////
-
-template <>
-class RefSkipMAccessor<RowMajor> {
-  friend class RefSkipVector;
- public:
-  RefSkipMAccessor(){};
-  
-  const RefVector operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return RefVector(my_num_cols,my_values+r*my_skip);
-  }
-
-  RefVector operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return RefVector(my_num_cols,my_values+r*my_skip);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW{
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*my_skip+c];  
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[r*my_skip+c];  
-  }
-
-  int num_rows()const{return my_num_rows;}
-  int num_cols()const{return my_num_cols;}
-  int num_skip()const{return my_skip;}
-  typedef RowMajor layout;
-
-  inline DynamicMatrix<RefSkipMAccessor<ColMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
-  }
-
-  inline const DynamicMatrix<RefSkipMAccessor<ColMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
-  }
-
-
- protected:
-  int my_num_rows;
-  int my_num_cols;
-  int my_skip;
-  double* my_values;
-};
-
-template <>
-class RefSkipMAccessor<ColMajor> {
-  friend class RefSkipVector;
- public:
-  RefSkipMAccessor(){};
-  
-  const RefSkipVector operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return RefSkipVector(my_num_cols,my_skip,my_values+r);
-  }
-
-  RefSkipVector operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return RefSkipVector(my_num_cols,my_skip,my_values+r);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {    
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*my_skip+r];
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW
-  {    
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*my_skip+r];
-
-  int num_rows()const{return my_num_rows;}
-  int num_cols()const{return my_num_cols;}
-  int num_skip()const{return my_skip;}
-  typedef ColMajor layout;
-
-  inline DynamicMatrix<RefSkipMAccessor<RowMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<RefSkipMAccessor<RowMajor> 
>&>(*this);
-  }
-
-  inline const DynamicMatrix<RefSkipMAccessor<RowMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<RefSkipMAccessor<RowMajor> 
>&>(*this);
-  }
-
-
- protected:
-  int my_num_cols;  // representation of rows and cols transposed from above
-  int my_num_rows;  // so that transpose operation is a simple cast
-  int my_skip;
-  double* my_values;
-};
-
-
-
-
-#undef TOON_CHECK_ROW
-#undef TOON_CHECK_COL
-
-
-#endif

Index: maccessor.hh
===================================================================
RCS file: maccessor.hh
diff -N maccessor.hh
--- maccessor.hh        12 Dec 2007 15:59:43 -0000      1.11
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,637 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __MACCESSOR_HH
-#define __MACCESSOR_HH
-
-
-///////////////////////////////
-//                           //
-//  Matrix Accessor classes  //
-//                           //
-///////////////////////////////
-
-/////////////////////////
-//                     //
-//  Dynamic Accessors  //
-//                     //
-/////////////////////////
-#define TOON_CHECK_ROW TOON_ASSERT(r < my_num_rows && r >= 0, 
TooNError::BadRowIndex)
-#define TOON_CHECK_COL TOON_ASSERT(c < my_num_cols && c >= 0, 
TooNError::BadColIndex)
-
-
-///////// RefSkipMAccessor ////////////
-
-template <>
-class RefSkipMAccessor<RowMajor> {
- public:
-  typedef DynamicMatrix<RefSkipMAccessor<RowMajor> > RefSkipMatrixRM;
-  RefSkipMAccessor(){};
-  
-  const RefVector operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return makeRefVector(my_num_cols,this->my_values+r*my_skip);
-  }
-
-  RefVector operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return makeRefVector(my_num_cols,this->my_values+r*my_skip);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW{
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*my_skip+c];    
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW{
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*my_skip+c];    
-  }
-
-  int num_rows()const throw() {return my_num_rows;}
-  int num_cols()const throw() {return my_num_cols;}
-  int num_skip()const throw() {return my_skip;}
-  typedef RowMajor layout;
-
-  inline DynamicMatrix<RefSkipMAccessor<ColMajor> >& T();
-
-  inline const DynamicMatrix<RefSkipMAccessor<ColMajor> >& T() const;
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline RefSkipMatrixRM slice(){
-    RefSkipMatrixRM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + 
Rstart*this->my_skip + Cstart);
-    return ret;
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const RefSkipMatrixRM slice() const {
-    RefSkipMatrixRM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + 
Rstart*this->my_skip + Cstart);
-    return ret;
-  }
-
-  inline RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    RefSkipMatrixRM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + 
Rstart*this->my_skip + Cstart);
-    return ret;
-  }
-
-  inline const RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    RefSkipMatrixRM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + 
Rstart*this->my_skip + Cstart);
-    return ret;
-  }
-  inline void set(int nr, int nc, int sk, double* v) { my_num_rows = nr; 
my_num_cols = nc; my_skip = sk; my_values = v; }
- protected:
-  int my_num_rows;
-  int my_num_cols;
-  int my_skip;
-  double* my_values;
-};
-
-template <>
-class RefSkipMAccessor<ColMajor> {
- public:
-  typedef DynamicMatrix<RefSkipMAccessor<ColMajor> > RefSkipMatrixCM;
-
-  RefSkipMAccessor(){};
-  
-  const RefSkipVector operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return makeRefSkipVector(my_num_cols,my_skip,this->my_values+r);
-  }
-
-  RefSkipVector operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return makeRefSkipVector(my_num_cols,my_skip,this->my_values+r);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {    
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*my_skip+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*my_skip+r];
-  }
-
-
-  int num_rows()const throw() {return my_num_rows;}
-  int num_cols()const throw() {return my_num_cols;}
-  int num_skip()const throw() {return my_skip;}
-  typedef ColMajor layout;
-
-  inline DynamicMatrix<RefSkipMAccessor<RowMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<RefSkipMAccessor<RowMajor> 
>&>(*this);
-  }
-
-  inline const DynamicMatrix<RefSkipMAccessor<RowMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<RefSkipMAccessor<RowMajor> 
>&>(*this);
-  }
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline RefSkipMatrixCM slice(){
-    RefSkipMatrixCM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + Rstart + 
Cstart*this->my_skip);
-    return ret;
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const RefSkipMatrixCM slice() const {
-    RefSkipMatrixCM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + Rstart + 
Cstart*this->my_skip);
-    return ret;
-  }
-
-  inline RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    RefSkipMatrixCM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + Rstart + 
Cstart*this->my_skip);
-    return ret;
-  }
-
-  inline const RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    RefSkipMatrixCM ret;
-    ret.set(Rsize, Csize, this->my_skip, this->my_values + Rstart + 
Cstart*this->my_skip);
-    return ret;
-  }
-  inline void set(int nr, int nc, int sk, double* v) { my_num_rows = nr; 
my_num_cols = nc; my_skip = sk; my_values = v; }
-
- protected:
-  int my_num_cols;  // representation of rows and cols transposed from above
-  int my_num_rows;  // so that transpose operation is a simple cast
-  int my_skip;
-  double* my_values;
-};
-
-inline DynamicMatrix<RefSkipMAccessor<ColMajor> >& 
RefSkipMAccessor<RowMajor>::T() {
-    return reinterpret_cast<DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
-}
-
-inline const DynamicMatrix<RefSkipMAccessor<ColMajor> >& 
RefSkipMAccessor<RowMajor>::T() const {
-    return reinterpret_cast<const DynamicMatrix<RefSkipMAccessor<ColMajor> 
>&>(*this);
-}
-
-typedef RefSkipMAccessor<RowMajor>::RefSkipMatrixRM RefSkipMatrixRM;
-typedef RefSkipMAccessor<ColMajor>::RefSkipMatrixCM RefSkipMatrixCM;
-inline RefSkipMatrixRM makeRefSkipMatrixRM(int nr, int nc, int sk, double* v) 
{ RefSkipMatrixRM ret; ret.set(nr,nc,sk,v); return ret; }
-inline RefSkipMatrixCM makeRefSkipMatrixCM(int nr, int nc, int sk, double* v) 
{ RefSkipMatrixCM ret; ret.set(nr,nc,sk,v); return ret; }
-
-template <>
-class DynamicMAccessor<RowMajor> {
- public:
-  const RefVector operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return makeRefVector(my_num_cols,this->my_values+r*my_num_cols);
-  }
-
-  RefVector operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return makeRefVector(my_num_cols,this->my_values+r*my_num_cols);
-  }
-
-  inline double& operator()(int r, int c)TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*my_num_cols+c];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*my_num_cols+c];
-  }
-
-  int num_rows()const throw() {return my_num_rows;}
-  int num_cols()const throw() {return my_num_cols;}
-  int num_skip()const throw() {return my_num_cols;}
-  typedef RowMajor layout;
-
-  inline DynamicMatrix<DynamicMAccessor<ColMajor> >& T();
-  inline const DynamicMatrix<DynamicMAccessor<ColMajor> >& T() const;
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline RefSkipMatrixRM slice(){
-    return makeRefSkipMatrixRM(Rsize, Csize, this->my_num_cols, 
this->my_values + Rstart*this->my_num_cols + Cstart);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const RefSkipMatrixRM slice() const {
-    return makeRefSkipMatrixRM(Rsize, Csize, this->my_num_cols, 
this->my_values + Rstart*this->my_num_cols + Cstart);
-  }
-
-  inline RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    return makeRefSkipMatrixRM(Rsize, Csize, this->my_num_cols, 
this->my_values + Rstart*this->my_num_cols + Cstart);
-  }
-
-  inline const RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    return makeRefSkipMatrixRM(Rsize, Csize, this->my_num_cols, 
this->my_values + Rstart*this->my_num_cols + Cstart);
-  }
-  inline void set(int nr, int nc, double* v) { my_num_rows = nr; my_num_cols = 
nc; my_values = v; }
- protected:
-  int my_num_rows;
-  int my_num_cols;
-  double* my_values;
-};
-
-template <>
-class DynamicMAccessor<ColMajor> {
- public:  
-  const RefSkipVector operator[](int r) const TOON_THROW{ 
-       TOON_CHECK_ROW;
-    return makeRefSkipVector(my_num_cols,my_num_rows,this->my_values+r);
-  }
-
-  RefSkipVector operator[](int r) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-    return makeRefSkipVector(my_num_cols,my_num_rows,this->my_values+r);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*my_num_rows+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*my_num_rows+r];
-  }
-
-  int num_rows()const throw() {return my_num_rows;}
-  int num_cols()const throw() {return my_num_cols;}
-  int num_skip()const throw() {return my_num_rows;}
-  typedef ColMajor layout;
-
-  inline DynamicMatrix<DynamicMAccessor<RowMajor> >& T() {
-    return reinterpret_cast<DynamicMatrix<DynamicMAccessor<RowMajor> 
>&>(*this);
-  }
-  inline const DynamicMatrix<DynamicMAccessor<RowMajor> >& T() const {
-    return reinterpret_cast<const DynamicMatrix<DynamicMAccessor<RowMajor> 
>&>(*this);
-  }
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline RefSkipMatrixCM slice(){
-    return makeRefSkipMatrixCM(Rsize, Csize, this->my_num_rows, 
this->my_values + Rstart + Cstart*this->my_num_rows);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const RefSkipMatrixCM slice() const {
-    return makeRefSkipMatrixCM(Rsize, Csize, this->my_num_rows, 
this->my_values + Rstart + Cstart*this->my_num_rows);
-  }
-
-  inline RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    return makeRefSkipMatrixCM(Rsize, Csize, this->my_num_rows, 
this->my_values + Rstart + Cstart*this->my_num_rows);
-  }
-
-  inline const RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    return makeRefSkipMatrixCM(Rsize, Csize, this->my_num_rows, 
this->my_values + Rstart + Cstart*this->my_num_rows);
-  }
-
-  inline void set(int nr, int nc, double* v) { my_num_rows = nr; my_num_cols = 
nc; my_values = v; }
- protected:
-  int my_num_cols;  // representation of rows and cols transposed from above
-  int my_num_rows;  // so that transpose operation is a simple cast
-  double* my_values;
-};
-
-inline DynamicMatrix<DynamicMAccessor<ColMajor> >& 
DynamicMAccessor<RowMajor>::T() {
-    return reinterpret_cast<DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
-}
-inline const DynamicMatrix<DynamicMAccessor<ColMajor> >& 
DynamicMAccessor<RowMajor>::T() const {
-    return reinterpret_cast<const DynamicMatrix<DynamicMAccessor<ColMajor> 
>&>(*this);
-}
-
-
-typedef DynamicMatrix<DynamicMAccessor<RowMajor> > RefMatrixRM;
-typedef DynamicMatrix<DynamicMAccessor<ColMajor> > RefMatrixCM;
-inline RefMatrixRM makeRefMatrixRM(int nr, int nc, double* v) { RefMatrixRM 
ret; ret.set(nr,nc,v); return ret; }
-inline RefMatrixCM makeRefMatrixCM(int nr, int nc, double* v) { RefMatrixCM 
ret; ret.set(nr,nc,v); return ret; }
-
-#undef TOON_CHECK_ROW
-#undef TOON_CHECK_COL
-#define TOON_CHECK_ROW TOON_ASSERT(r < Rows && r >= 0, TooNError::BadRowIndex)
-#define TOON_CHECK_COL TOON_ASSERT(c < Cols && c >= 0, TooNError::BadColIndex)
-
-
-
-
-template<int Rows, int Cols, int Skip>
-class SkipMAccessor<Rows,Cols,Skip,RowMajor> {
-public:
-  inline FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& operator[](int 
r) TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > 
>&>(this->my_values[r*Skip]);
-  }
-  inline const FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& 
operator[](int r) const TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const 
FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >&>(this->my_values[r*Skip]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*Skip+c];
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*Skip+c];
-  }
-
-  static inline int num_rows() throw() {return Rows;}
-  static inline int num_cols() throw() {return Cols;}
-  static inline int num_skip() throw() {return Skip;}
-  typedef RowMajor layout;
-
-  // Transpose operations
-  inline FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> >& T() {
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> 
>&>(*this); 
-  }
-
-  inline const FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> >& 
T() const {
-     return reinterpret_cast<const 
FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,ColMajor> >&>(*this);
-  }
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> >& 
slice() {
-      FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> 
>::dummy();
-     util::Assert<(Rstart+Rsize <= Rows)>();
-     util::Assert<(Cstart+Csize <= Cols)>();
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor>
 >&>
-      (this->my_values[Rstart*Skip+Cstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> >& slice() 
const {
-     FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> 
>::dummy();
-     util::Assert<(Rstart+Rsize <= Rows)>();
-     util::Assert<(Cstart+Csize <= Cols)>();
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,RowMajor> >&>
-      (this->my_values[Rstart*Skip+Cstart]);
-  }
-
-  inline RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    return makeRefSkipMatrixRM(Rsize, Csize, Skip, this->my_values + 
Rstart*Skip + Cstart);
-  }
-
-  inline const RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    return makeRefSkipMatrixRM(Rsize, Csize, Skip, this->my_values + 
Rstart*Skip + Cstart);
-  }
-
-
- protected:
-  double my_values[Rows*Skip];
-};
-
-template<int Rows, int Cols, int Skip> 
-class SkipMAccessor<Rows, Cols, Skip, ColMajor> {
-public:
-
-  inline FixedVector<Cols, SkipAccessor<Cols, Skip> >& operator[](int r)  
TOON_THROW
-  {
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols, SkipAccessor<Cols, Skip> 
>&>(this->my_values[r]);
-  }
-
-  inline const FixedVector<Cols, SkipAccessor<Cols, Skip> >& operator[](int r) 
const TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const FixedVector<Cols, SkipAccessor<Cols, Skip> 
>&>(this->my_values[r]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return my_values[c*Skip+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*Skip+r];
-  }
-
-  static inline int num_rows() throw() {return Rows;}
-  static inline int num_cols() throw() {return Cols;}
-  static inline int num_skip() throw() {return Skip;}
-  typedef ColMajor layout;
-
-  // Transpose operations
-  inline FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> >& T() {
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> 
>&>(*this); 
-  }
-
-  inline const FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> >& 
T() const {
-    return reinterpret_cast<const 
FixedMatrix<Cols,Rows,SkipMAccessor<Cols,Rows,Skip,RowMajor> >&>(*this);
-  }
-
-  // slice()
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor> >& 
slice(){
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor>
 >&>
-      (this->my_values[Cstart*Skip+Rstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor> >& 
slice()const{
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Skip,ColMajor> >&>
-      (this->my_values[Cstart*Skip+Rstart]);
-  }
-
-  inline RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    return makeRefSkipMatrixCM(Rsize, Csize, Skip, this->my_values + Rstart + 
Cstart*Skip);
-  }
-
-  inline const RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    return makeRefSkipMatrixCM(Rsize, Csize, Skip, this->my_values + Rstart + 
Cstart*Skip);
-  }
-
- protected:
-  double my_values[Cols*Skip];
-};
-
-
-template <int Rows,int Cols, class AllocZone>
-class FixedMAccessor<Rows,Cols,RowMajor,AllocZone> : public AllocZone {
- public:
-  inline FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& operator[](int 
r) TOON_THROW {
-       TOON_CHECK_ROW;
-    return reinterpret_cast<FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > 
>&>(this->my_values[r*Cols]);
-  }
-  inline const FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >& 
operator[](int r) const TOON_THROW {
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const 
FixedVector<Cols,FixedVAccessor<Cols,Stack<Cols> > >&>(this->my_values[r*Cols]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*Cols+c];
-  }
-
-  inline const double& operator()(int r, int c) const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[r*Cols+c];
-  }
-
-  static inline int num_rows() throw() {return Rows;}
-  static inline int num_cols() throw() {return Cols;}
-  static inline int num_skip() throw() {return Cols;}
-  typedef RowMajor layout;
-
-  // Transpose operations
-  inline 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> > >& 
T() {
-      FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> 
> >::dummy();
-    return 
reinterpret_cast<FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols>
 > >&>(*this->my_values);
-  }
-  inline const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> > >& 
T() const {
-      FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> 
> >::dummy();
-      return reinterpret_cast<const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,ColMajor,Stack<Rows*Cols> > 
>&>(*this->my_values);
-  }
-
-  // slice
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> >& 
slice(){
-      typedef FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> 
> ST;
-      util::Assert<(Rstart+Rsize <= Rows)>();
-      util::Assert<(Cstart+Csize <= Cols)>();
-      ST::dummy();
-      return reinterpret_cast<ST&>(this->my_values[Rstart*Cols+Cstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> >& slice() 
const {
-      util::Assert<(Rstart+Rsize <= Rows)>();
-      util::Assert<(Cstart+Csize <= Cols)>();
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Cols,RowMajor> >&>
-      (this->my_values[Rstart*Cols+Cstart]);
-  }
-
-  inline RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    return makeRefSkipMatrixRM(Rsize, Csize, Cols, this->my_values + 
Rstart*Cols + Cstart);
-  }
-
-  inline const RefSkipMatrixRM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    return makeRefSkipMatrixRM(Rsize, Csize, Cols, this->my_values + 
Rstart*Cols + Cstart);
-  }
-
-};
-
-
-
-template <int Rows,int Cols, class AllocZone>
-class FixedMAccessor<Rows,Cols,ColMajor,AllocZone> : public AllocZone {
- public:
-  FixedVector<Cols, SkipAccessor<Cols, Rows> >& operator[](int r) TOON_THROW{
-       TOON_CHECK_ROW;
-       FixedVector<Cols, SkipAccessor<Cols, Rows> >::dummy();
-       return reinterpret_cast<FixedVector<Cols, SkipAccessor<Cols, Rows> 
>&>(this->my_values[r]);
-  }
-
-  const FixedVector<Cols, SkipAccessor<Cols, Rows> >& operator[](int r) const 
TOON_THROW{
-       TOON_CHECK_ROW;
-    return reinterpret_cast<const FixedVector<Cols, SkipAccessor<Cols, Rows> 
>&>(this->my_values[r]);
-  }
-
-  inline double& operator()(int r, int c) TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*Rows+r];
-  }
-
-  inline const double& operator()(int r, int c)const TOON_THROW
-  {
-       TOON_CHECK_ROW;
-       TOON_CHECK_COL;
-       return this->my_values[c*Rows+r];
-  }
-
-  static inline int num_rows() throw() {return Rows;}
-  static inline int num_cols() throw() {return Cols;}
-  static inline int num_skip() throw() {return Rows;}
-  typedef ColMajor layout;
-
-  // Transpose operations
-  inline 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> > >& 
T() {
-      FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> 
> >::dummy();
-      return 
reinterpret_cast<FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols>
 > >&>(*this->my_values);
-  }
-  inline const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> > >& 
T() const {
-      FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> 
> >::dummy();
-      return reinterpret_cast<const 
FixedMatrix<Cols,Rows,FixedMAccessor<Cols,Rows,RowMajor,Stack<Rows*Cols> > 
>&>(*this->my_values);
-  }
-
-  // slice()
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> >& 
slice(){
-      FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> 
>::dummy();
-    return 
reinterpret_cast<FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor>
 >&>
-      (this->my_values[Cstart*Rows+Rstart]);
-  }
-
-  template<int Rstart, int Cstart, int Rsize, int Csize>
-  inline const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> >& 
slice()const{
-      FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> 
>::dummy();
-    return reinterpret_cast<const 
FixedMatrix<Rsize,Csize,SkipMAccessor<Rsize,Csize,Rows,ColMajor> >&>
-      (this->my_values[Cstart*Rows+Rstart]);
-  }
-
-  inline RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int Csize) {
-    return makeRefSkipMatrixCM(Rsize, Csize, Rows, this->my_values + Rstart + 
Cstart*Rows);
-  }
-
-  inline const RefSkipMatrixCM slice(int Rstart, int Cstart, int Rsize, int 
Csize) const {
-    return makeRefSkipMatrixCM(Rsize, Csize, Rows, this->my_values + Rstart + 
Cstart*Rows);
-  }
-
-};
-
-
-
-#undef TOON_CHECK_ROW
-#undef TOON_CHECK_COL
-
-
-#endif

Index: mbase.hh
===================================================================
RCS file: mbase.hh
diff -N mbase.hh
--- mbase.hh    12 Dec 2007 15:59:43 -0000      1.12
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,140 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __MBASE_HH
-#define __MBASE_HH
-
-template <class Accessor>
-class MatrixBase : public Accessor {
- public:
-  const double* get_data_ptr()const{return this->my_values;}
-  double* get_data_ptr(){return this->my_values;}
-
-  DynamicMatrix<Accessor>& down_cast() {return 
reinterpret_cast<DynamicMatrix<Accessor>&> (*this);}
-  const DynamicMatrix<Accessor>& down_cast() const {return 
reinterpret_cast<const DynamicMatrix<Accessor>&> (*this);}
-};
-
-// operator ostream& <<
-template <class Accessor>
-std::ostream& operator << (std::ostream& os, const MatrixBase<Accessor>& m){
-  for(int r=0; r<m.num_rows(); r++){
-    os << m[r] << std::endl;
-  }
-  return os;
-}
-
-// operator istream& >>
-template <class Accessor>
-std::istream& operator >> (std::istream& is, MatrixBase<Accessor>& m){
-  for(int r=0; r<m.num_rows(); r++){
-    is >> m[r];
-  }
-  return is;
-}
-
-// Data copying
-
-template <class Accessor1, class Accessor2>
-struct MatrixCopy {
-  inline static void eval(MatrixBase<Accessor1>& to, const 
MatrixBase<Accessor2>& from){
-    for(int r=0; r<from.num_rows(); r++){
-      for(int c=0; c<from.num_cols(); c++){
-       to(r,c)=from(r,c);
-      }
-    }
-  }
-};
-
-template<int Rows, int Cols, class Layout, class Zone1, class Zone2>
-struct 
MatrixCopy<FixedMAccessor<Rows,Cols,Layout,Zone1>,FixedMAccessor<Rows,Cols,Layout,Zone2>
 > {
-  inline static void eval(MatrixBase<FixedMAccessor<Rows,Cols,Layout,Zone1> >& 
to,
-                         const 
MatrixBase<FixedMAccessor<Rows,Cols,Layout,Zone2> >& from) {
-    memcpy(to.get_data_ptr(), from.get_data_ptr(), Rows*Cols*sizeof(double));
-  }
-};
-
-template<class Layout>
-struct MatrixCopy<DynamicMAccessor<Layout>,DynamicMAccessor<Layout> > {
-  inline static void eval(MatrixBase<DynamicMAccessor<Layout> >& to,
-                         const MatrixBase<DynamicMAccessor<Layout> >& from){
-    memcpy(to.get_data_ptr(), from.get_data_ptr(), 
from.num_rows()*from.num_cols()*sizeof(double));
-  }
-};
-
-
-////////////////////////////////////////////////////////
-//                                                    //
-// Fixed and Dynamic Matrix classes                   //
-// all the arithmetic and assignment                  //
-// operations are applied to these                    //
-//                                                    //
-////////////////////////////////////////////////////////
-
-template<int Rows, int Cols, class Accessor>
-class FixedMatrix : public MatrixBase<Accessor> {
-public:
-  // assignment from correct sized FixedMatrix
-  template<class Accessor2>
-  inline FixedMatrix& operator=(const FixedMatrix<Rows,Cols,Accessor2>& from){
-    MatrixCopy<Accessor, Accessor2>::eval(*this,from);
-    return *this;
-  }
-
-  // copy assignment
-  inline FixedMatrix& operator=(const FixedMatrix& from){
-    MatrixCopy<Accessor,Accessor>::eval(*this,from);
-    return *this;
-  }
-  
-  // assignment from any DynamicMatrix
-  template<class Accessor2>
-    inline FixedMatrix& operator=(const DynamicMatrix<Accessor2>& from){
-    assert(from.num_rows() == Rows && from.num_cols() == Cols);
-    MatrixCopy<Accessor,Accessor2>::eval(*this,from);
-    return *this;
-  }
-    static void dummy() {}
-};
-
-template<class Accessor>
-class DynamicMatrix : public MatrixBase<Accessor> {
-public:
-  // assignment from any MatrixBase
-  template<class Accessor2>
-  DynamicMatrix& operator=(const MatrixBase<Accessor2>& from){
-    assert(from.num_rows() == this->num_rows() && from.num_cols() == 
this->num_cols());
-    MatrixCopy<Accessor,Accessor2>::eval(*this,from);
-    return *this;
-  }
-
-
-  // repeated for explicit copy assignment
-  DynamicMatrix& operator=(const DynamicMatrix& from){
-    assert(from.num_rows() == this->num_rows() && from.num_cols() == 
this->num_cols());
-    MatrixCopy<Accessor,Accessor>::eval(*this,from);
-    return *this;
-  }
-
-    operator DynamicMatrix& () { return *this; }
-    operator const DynamicMatrix& () const { return *this; }
-
-};
-
-
-#endif

Index: numerics.h
===================================================================
RCS file: numerics.h
diff -N numerics.h
--- numerics.h  16 Sep 2005 10:40:15 -0000      1.7
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,23 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include <TooN/TooN.h>
-#ifndef TOON_NO_NAMESPACE
-using namespace TooN;
-#endif

Index: numhelpers.h
===================================================================
RCS file: numhelpers.h
diff -N numhelpers.h
--- numhelpers.h        9 Jun 2005 09:31:54 -0000       1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#include <TooN/helpers.h>
-

Index: vaccessor.hh
===================================================================
RCS file: vaccessor.hh
diff -N vaccessor.hh
--- vaccessor.hh        12 Dec 2007 15:59:43 -0000      1.14
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,457 +0,0 @@
-
-/*                       
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __VACCESSOR_HH
-#define __VACCESSOR_HH
-
-
-///////////////////////////////
-//                           //
-//  Vector Accessor classes  //
-//                           //
-///////////////////////////////
-
-template <int Size, class AllocZone> class FixedVAccessor;
-
-/////////////  DYNAMIC SIZED ACCESSORS ////////////////
-
-class DynamicVAccessor {
-  friend struct VSizer;
-public:
-  typedef DynamicVector<DynamicVAccessor> RefVector;
-    
-  template<int Start, int Length>
-  inline FixedVector<Length, FixedVAccessor<Length, Stack<Length> > >& slice() 
-  {
-    return reinterpret_cast<FixedVector<Length, FixedVAccessor<Length, 
Stack<Length> > >&> (my_values[Start]);
-  }
-
-  template<int Start, int Length>
-  inline const FixedVector<Length, FixedVAccessor<Length, Stack<Length> > >& 
slice() const 
-  {
-    return reinterpret_cast<const FixedVector<Length, FixedVAccessor<Length, 
Stack<Length> > >&> (my_values[Start]);
-  }
-
-  inline RefVector slice(int start, int size) 
-  {
-    assert(0 <= start && start < this->my_size && size >=0 && start+size <= 
this->my_size);
-    RefVector ret;
-    ret.set(size,this->my_values + start);
-    return ret;
-  }
-
-  inline const RefVector slice(int start, int size) const 
-  {
-    assert(0 <= start && start < this->my_size && size >=0 && start+size <= 
this->my_size);
-    RefVector ret;
-    ret.set(size,this->my_values + start);
-    return ret;
-  }
-  inline const double& operator[] (int i)const 
-  {
-    return my_values[i];
-  }
-
-  inline double& operator[] (int i) 
-  {
-    return my_values[i];
-  }
-
-  inline int size() const 
-  {
-    return my_size;
-  }
-
-  inline DynamicMatrix<DynamicMAccessor<RowMajor> > as_row(); // implemented 
in linoperators.hh
-  inline DynamicMatrix<DynamicMAccessor<ColMajor> > as_col(); //
-  inline void set(int size, double* values) { my_size = size;  my_values = 
values; }
-
-  typedef double* iterator;
-  typedef const double* const_iterator;
-
-  iterator begin()
-  {
-       return my_values;
-  }
-
-  iterator end()
-  {
-       return my_values + my_size;
-  }
-
-  const_iterator begin() const
-  {
-       return my_values;
-  }    
-  const_iterator end() const
-  {
-       return my_values + my_size;
-  }
-  
- protected:  
-  int my_size;
-  double* my_values;
-};
-
-typedef DynamicVAccessor::RefVector RefVector;
-inline RefVector makeRefVector(int size, double* values) { RefVector ret; 
ret.set(size,values); return ret; }
-
-class DynamicSkipAccessor{
-public:
-  typedef DynamicVector<DynamicSkipAccessor> RefSkipVector;
-  
-  //CHECK THIS
-  template<int Start, int Length>
-  inline DynamicVector<DynamicSkipAccessor> slice() 
-  {
-    //DynamicSkipAccessors do not own memory, so destruction of one will not 
free it 
-       
-       DynamicVector<DynamicSkipAccessor> r;
-
-       r.my_size = Length;
-       r.my_skip = my_skip;
-       r.my_values = my_values + my_skip * Start;
-       
-       return r;
-  }
-
-  template<int Start, int Length>
-  inline const DynamicVector<DynamicSkipAccessor> slice() const 
-  {
-    //DynamicSkipAccessors do not own memory, so destruction of one will not 
free it 
-       
-       DynamicVector<DynamicSkipAccessor> r;
-       r.my_size = Length;
-       r.my_skip = my_skip;
-       r.my_values = my_values + my_skip * Start;
-       
-       return r;
-  }
-
-  inline RefSkipVector slice(int start, int size) 
-  {
-    assert(0 <= start && start < this->my_size && size >=0 && start+size <= 
this->my_size);
-    RefSkipVector ret;
-    ret.set(size,my_skip,this->my_values + start*my_skip);
-    return ret;
-  }
-
-  inline const RefSkipVector slice(int start, int size) const 
-  {
-    assert(0 <= start && start < this->my_size && size >=0 && start+size <= 
this->my_size);
-    RefSkipVector ret;
-    ret.set(size,my_skip,this->my_values + start*my_skip);
-    return ret;
-  }
-
-  inline const double& operator[] (int i)const 
-  {
-    return my_values[i*my_skip];
-  }
-
-  inline double& operator[] (int i) 
-  {
-    return my_values[i*my_skip];       
-  }
-  
-  inline int size() const 
-  {
-    return my_size;
-  }
-
-  inline DynamicMatrix<RefSkipMAccessor<ColMajor> > as_row(); // implemented 
in linoperators.hh
-  inline DynamicMatrix<RefSkipMAccessor<RowMajor> > as_col(); //
-
-  inline void set(int size, int skip, double* values) { my_size = size; 
my_skip = skip; my_values = values; }
-
-  private:
-         template<class T> class It: public 
std::iterator<std::random_access_iterator_tag, double>
-         {
-               private:
-                 T* d;
-                 int skip;
-               public:
-                 bool operator!=(const It&i){return d != i.d;}
-                 bool operator==(const It&i){return d == i.d;}
-                 bool operator<=(const It&i){return d <= i.d;}
-                 bool operator>=(const It&i){return d >= i.d;}
-                 bool operator<(const It&i){return d < i.d;}
-                 bool operator>(const It&i){return d > i.d;}
-                 It& operator+=(ptrdiff_t i) {d += i*skip;return *this;}
-                 It& operator-=(ptrdiff_t i) {d -= i*skip;return *this;}
-                 It& operator++() {d += skip;return *this;}
-                 It& operator--() {d -= skip;return *this;}
-                 It operator++(int) {T* t=d;d += skip;return iterator(t,skip);}
-                 It operator--(int) {T* t=d;d -= skip;return iterator(t,skip);}
-                 It operator+(ptrdiff_t i) {return It(d + i*skip,skip);}
-                 It operator-(ptrdiff_t i) {return It(d - i*skip,skip);}
-                 ptrdiff_t operator-(const It& i) {return (d - i.d)/skip;};
-                 T& operator*(){return *d;}
-                 It(T*a, int s):d(a),skip(s){}
-         };
-
-  public:
-
-  typedef It<double> iterator;
-  typedef It<const double> const_iterator;
-
-  iterator begin()
-  {
-       return iterator(my_values, my_skip);
-  }
-
-  iterator end()
-  {
-       return iterator(my_values, my_skip) + my_size;
-  }
-
-  const_iterator begin() const
-  {
-       return const_iterator(my_values, my_skip);
-  }    
-  const_iterator end() const
-  {
-       return const_iterator(my_values, my_skip) + my_size;
-  }
-
- protected:
-  int my_size;
-  int my_skip;
-  double* my_values;
-};
-
-typedef DynamicSkipAccessor::RefSkipVector RefSkipVector;
-
-inline RefSkipVector makeRefSkipVector(int size, int skip, double* values) { 
RefSkipVector ret; ret.set(size,skip,values); return ret; }
-
-
-/////////////  FIXED SIZED ACCESSORS ////////////////
-template <int Size, class AllocZone>
-class FixedVAccessor : public AllocZone {
- public:
-  typedef AllocZone parent;
-  inline const double& operator[] (int i)const 
-  {
-    return parent::my_values[i];
-  }
-
-  inline double& operator[] (int i) 
-  {
-    return parent::my_values[i];
-  }
-
-
-  inline static int size() {return Size;}
-
-  template<int Start, int Length>
-  inline FixedVector<Length,FixedVAccessor<Length,Stack<Length> > >& slice()
-  {
-      util::Assert<(Start+Length <= Size)>();
-      FixedVector<Length,FixedVAccessor<Length,Stack<Length> > >::dummy();
-      return 
reinterpret_cast<FixedVector<Length,FixedVAccessor<Length,Stack<Length> > >&> 
(parent::my_values[Start]);
-  }
-
-  typedef FixedVAccessor<Size,AllocZone> this_type;
-  inline RefVector slice(int start, int size) 
-  {
-    assert(0 <= start && start < Size && size >=0 && start+size <= Size);
-    return makeRefVector(size, parent::my_values + start);
-  }
-
-  inline const RefVector slice(int start, int size) const
-  {
-    assert(0 <= start && start < Size && size >=0 && start+size <= Size);
-    return makeRefVector(size, const_cast<double*>( parent::my_values + 
start));
-  }
-  
-  template<int Start, int Length>
-  inline const FixedVector<Length,FixedVAccessor<Length,Stack<Length> > >& 
slice() const 
-  {
-      util::Assert<(Start+Length <= Size)>();
-    return reinterpret_cast<const 
FixedVector<Length,FixedVAccessor<Length,Stack<Length> > >&> 
(parent::my_values[Start]);
-  }
-
-  // convert to Matrices
-  inline FixedMatrix<Size,1,FixedMAccessor<Size,1,ColMajor,Stack<Size> > >& 
as_col() 
-  {
-      FixedMatrix<Size,1,FixedMAccessor<Size,1,ColMajor,Stack<Size> > 
>::dummy();
-    return 
reinterpret_cast<FixedMatrix<Size,1,FixedMAccessor<Size,1,ColMajor,Stack<Size> 
> >&>(*parent::my_values);
-  }
-
-  inline const FixedMatrix<Size,1,FixedMAccessor<Size,1,ColMajor,Stack<Size> > 
>& as_col() const 
-  {
-      FixedMatrix<Size,1,FixedMAccessor<Size,1,ColMajor,Stack<Size> > 
>::dummy();
-    return reinterpret_cast<const 
FixedMatrix<Size,1,FixedMAccessor<Size,1,ColMajor,Stack<Size> > >&> 
(*parent::my_values);
-  }
-
-  inline FixedMatrix<1,Size,FixedMAccessor<1,Size,RowMajor,Stack<Size> > >& 
as_row() 
-  {
-      FixedMatrix<1,Size,FixedMAccessor<1,Size,RowMajor,Stack<Size> > 
>::dummy();
-    return 
reinterpret_cast<FixedMatrix<1,Size,FixedMAccessor<1,Size,RowMajor,Stack<Size> 
> >&> (*parent::my_values);
-  }
-  
-  inline const FixedMatrix<1,Size,FixedMAccessor<1,Size,RowMajor,Stack<Size> > 
>& as_row() const 
-  {
-      FixedMatrix<1,Size,FixedMAccessor<1,Size,RowMajor,Stack<Size> > 
>::dummy();
-    return reinterpret_cast<const 
FixedMatrix<1,Size,FixedMAccessor<1,Size,RowMajor,Stack<Size> > >&> 
(*parent::my_values);
-  }
-  
-  typedef double* iterator;
-  typedef const double* const_iterator;
-
-  iterator begin()
-  {
-       return parent::my_values;
-  }
-
-  iterator end()
-  {
-       return parent::my_values + Size;
-  }
-
-  const_iterator begin() const
-  {
-       return parent::my_values;
-  }    
-  const_iterator end() const
-  {
-       return parent::my_values + Size;
-  }
-
-};
-
-
-template <int Size, int Skip>
-class SkipAccessor : public Stack<Size*Skip>{
- public:
-  typedef Stack<Size*Skip> parent;
-  typedef SkipAccessor<Size,Skip> this_type;
-  inline const double& operator[] (int i) const  
-  {
-    return parent::my_values[i*Skip];
-  }
-
-  inline double& operator[] (int i) 
-  {
-       return parent::my_values[i*Skip];
-  }
-
-  inline static int size() 
-  {
-    return Size;
-  }
-
-  template<int Start, int Length>
-  inline FixedVector<Length, SkipAccessor<Size, Skip> >& slice() 
-  {
-      util::Assert<(Start+Length <= Size)>();
-      return reinterpret_cast<FixedVector<Length, SkipAccessor<Size, Skip> 
>&>(parent::my_values[Start*Skip]);
-  }
-
-  template<int Start, int Length>
-  inline const FixedVector<Length, SkipAccessor<Size, Skip> >& slice() const 
-  {
-      util::Assert<(Start+Length <= Size)>();
-    return reinterpret_cast<const FixedVector<Length, SkipAccessor<Size, Skip> 
>&>(parent::my_values[Start*Skip]);
-  }
-
-  RefSkipVector slice(int start, int size) 
-  {
-    assert(0 <= start && start < Size && size >=0 && start+size <= Size);
-    return makeRefSkipVector(size, Skip, parent::my_values + start*Skip);
-  }
-  const RefSkipVector slice(int start, int size) const 
-  {
-    assert(0 <= start && start < Size && size >=0 && start+size <= Size);
-    return makeRefSkipVector(size, Skip, parent::my_values + start*Skip);
-  }
-  // convert to Matrices
-  inline FixedMatrix<Size,1,SkipMAccessor<Size,1,Skip,RowMajor> >& as_col() 
-  {
-    return 
reinterpret_cast<FixedMatrix<Size,1,SkipMAccessor<Size,1,Skip,RowMajor> 
>&>(*parent::my_values);
-  }
-
-  inline const FixedMatrix<Size,1,SkipMAccessor<Size,1,Skip,RowMajor> >& 
as_col() const 
-  {
-    return 
reinterpret_cast<FixedMatrix<Size,1,SkipMAccessor<Size,1,Skip,RowMajor> 
>&>(*parent::my_values);
-  }
-
-  inline FixedMatrix<1,Size,SkipMAccessor<1,Size,Skip,ColMajor> >& as_row() 
-  {
-    return 
reinterpret_cast<FixedMatrix<1,Size,SkipMAccessor<1,Size,Skip,ColMajor> 
>&>(*parent::my_values);
-  }
-
-  inline const FixedMatrix<1,Size,SkipMAccessor<1,Size,Skip,ColMajor> >& 
as_row() const 
-  {
-    return reinterpret_cast<const 
FixedMatrix<1,Size,SkipMAccessor<1,Size,Skip,ColMajor> >&>(*parent::my_values);
-  }
-
-  private:
-         template<class T> class It: public 
std::iterator<std::random_access_iterator_tag, double>
-         {
-               private:
-                 T* d;
-               public:
-                 bool operator!=(const It&i){return d != i.d;}
-                 bool operator==(const It&i){return d == i.d;}
-                 bool operator<=(const It&i){return d <= i.d;}
-                 bool operator>=(const It&i){return d >= i.d;}
-                 bool operator<(const It&i){return d < i.d;}
-                 bool operator>(const It&i){return d > i.d;}
-                 It& operator+=(ptrdiff_t i) {d += i*Skip;return *this;}
-                 It& operator-=(ptrdiff_t i) {d -= i*Skip;return *this;}
-                 It& operator++() {d += Skip;return *this;}
-                 It& operator--() {d -= Skip;return *this;}
-                 It operator++(int) {T* t=d;d += Skip;return iterator(t);}
-                 It operator--(int) {T* t=d;d -= Skip;return iterator(t);}
-                 It operator+(ptrdiff_t i) {return It(d + i*Skip);}
-                 It operator-(ptrdiff_t i) {return It(d - i*Skip);}
-                 ptrdiff_t operator-(const It& i) {return (d - i.d)/Skip;};
-                 T& operator*(){return *d;}
-                 It(T*a):d(a){}
-         };
-
-  public:
-
-  typedef It<double> iterator;
-  typedef It<const double> const_iterator;
-
-  iterator begin()
-  {
-       return iterator(parent::my_values);
-  }
-
-  iterator end()
-  {
-       return iterator(parent::my_values) + Size;
-  }
-
-  const_iterator begin() const
-  {
-       return iterator(parent::my_values);
-  }    
-  const_iterator end() const
-  {
-       return iterator(parent::my_values) + Size;
-  }
-
-};
-
-
-#endif

Index: vbase.hh
===================================================================
RCS file: vbase.hh
diff -N vbase.hh
--- vbase.hh    12 Dec 2007 15:59:43 -0000      1.17
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,187 +0,0 @@
-
-/*
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc.
-     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-#ifndef __VBASE_HH
-#define __VBASE_HH
-
-// VectorBase //
-
-template <class Accessor>
-class VectorBase : public Accessor {
-public:
-  const double* get_data_ptr()const{return Accessor::my_values;}
-  double* get_data_ptr(){return Accessor::my_values;}
-
-};
-
-// operator ostream& <<
-template <class Accessor>
-std::ostream& operator << (std::ostream& os, const VectorBase<Accessor>& v){
-  for (int i=0; i<v.size(); i++){
-    os << std::setw(12) << v[i] << "  ";
-  }
-  return os;
-}
-
-// operator istream& >>
-template <class Accessor>
-std::istream& operator >> (std::istream& is, VectorBase<Accessor>& v){
-  for (int i=0; i<v.size(); i++){
-    is >>  v[i];
-  }
-  return is;
-}
-
-template <class Accessor1, class Accessor2> struct VectorCopy;
-
-////////////////////////////////////////////////////////
-//                                                    //
-// Fixed and Dynamic Vector classes                   //
-// all the arithmetic and assignment                  //
-// operations are applied to these                    //
-//                                                    //
-////////////////////////////////////////////////////////
-
-template <int Size, class Accessor>
-class FixedVector : public VectorBase<Accessor> {
-public:
-  // assignment from correct sized FixedVector
-  template<class Accessor2>
-  inline FixedVector& operator=(const FixedVector<Size,Accessor2>& from){
-    VectorCopy<Accessor, Accessor2>::eval(*this,from);
-    return *this;
-  }
-
-  // copy assignment
-  inline FixedVector& operator=(const FixedVector& from){
-    VectorCopy<Accessor,Accessor>::eval(*this,from);
-    return *this;
-  }
-
-  // assignment from any DynamicVector
-  template<class Accessor2>
-    inline FixedVector& operator=(const DynamicVector<Accessor2>& from){
-    assert(from.size() == Size);
-    VectorCopy<Accessor, Accessor2>::eval(*this, from);
-    return *this;
-  }
-
-  // assignment from a double - uses vector magic
-  VectorMagic::VectorFiller<1,Size, FixedVector<Size, Accessor>, 
VectorMagic::CommaStyle> operator=(double t) {
-    (*this)[0] = t;
-    return VectorMagic::VectorFiller<1,Size, FixedVector<Size, Accessor>, 
VectorMagic::CommaStyle>(*this);
-  }
-
-  // insertion operators - uses vector magic
-  VectorMagic::VectorFiller<1,Size, FixedVector<Size,Accessor>, 
VectorMagic::InsertionStyle> operator<<(double t) {
-    (*this)[0] = t;
-    return VectorMagic::VectorFiller<1,Size, FixedVector<Size,Accessor>, 
VectorMagic::InsertionStyle>(*this);
-  }
-
-  template <int N> VectorMagic::VectorFiller<N,Size, 
FixedVector<Size,Accessor>, VectorMagic::InsertionStyle> operator<<(const 
VectorMagic::ComponentPlaceHolder<N>& t) {
-    return VectorMagic::VectorFiller<N,Size, FixedVector<Size,Accessor>, 
VectorMagic::InsertionStyle>(*this);
-  }
-
-  template <int N> VectorMagic::VectorFiller<N,Size, 
FixedVector<Size,Accessor>, VectorMagic::InsertionStyle> operator<<(const 
Vector<N>& t) {
-    (*this).template slice<0,N>() = t;
-    return VectorMagic::VectorFiller<N,Size, FixedVector<Size,Accessor>, 
VectorMagic::InsertionStyle>(*this);
-  }
-
-    static void dummy() {}
-
-  template<class A, int I> FixedVector<Size, Accessor>& operator=(const 
VectorMagic::VectorCreator<A,I>& v)
-  {
-    v.assign(*this);
-    return *this;
-  }
-
-};
-
-template <class Accessor>
-class DynamicVector : public VectorBase<Accessor>{
-  typedef VectorBase<Accessor> parent;
-
-public:
-  // assignment from any VectorBase
-  template<class Accessor2>
-  DynamicVector& operator=(const VectorBase<Accessor2>& from){
-    assert(parent::my_size == from.size());
-    VectorCopy<Accessor,Accessor2>::eval(*this,from);
-    return *this;
-  }
-
-  // repeated for explicit copy assignment
-  DynamicVector& operator=(const DynamicVector& from){
-    assert(parent::my_size == from.size());
-    VectorCopy<Accessor,Accessor>::eval(*this,from);
-    return *this;
-  }
-    operator DynamicVector& () { return *this; }
-    operator const DynamicVector& () const { return *this; }
-
-  template<class A, int I> DynamicVector<Accessor> & operator=(const 
VectorMagic::VectorCreator<A,I>& v)
-  {
-    v.assign(*this);
-    return *this;
-  }
-
-};
-
-
-// Special kinds of DynamicVector only constructed internally
-// e.g. from DynamicMAccessor<>::operator[]
-
-template <class V> struct NonConst : public V {
-  inline operator const V&() const { return *this; }
-  inline operator V&() { return *this; }
-  template <class T> inline NonConst& operator=(const T& t) { V::operator=(t); 
 return *this; }
-};
-
-#include <TooN/vaccessor.hh>
-
-
-// Data copying //
-
-template <class Accessor1, class Accessor2>
-struct VectorCopy {
-  inline static void eval(VectorBase<Accessor1>& to, const 
VectorBase<Accessor2>& from){
-    for(int i=0; i<from.size(); i++){
-      to[i]=from[i];
-    }
-  }
-};
-
-template <int Size, class Zone1, class Zone2>
-struct VectorCopy<FixedVAccessor<Size,Zone1>,FixedVAccessor<Size,Zone2> > {
-  inline static void eval(VectorBase<FixedVAccessor<Size,Zone1> >& to,
-                         const VectorBase<FixedVAccessor<Size,Zone2> >& from){
-    memcpy(to.get_data_ptr(),from.get_data_ptr(),Size*sizeof(double));
-  }
-};
-
-template<>
-struct VectorCopy<DynamicVAccessor,DynamicVAccessor>{
-  inline static void eval(VectorBase<DynamicVAccessor>& to,
-                         const VectorBase<DynamicVAccessor>& from){
-    memcpy(to.get_data_ptr(),from.get_data_ptr(),from.size()*sizeof(double));
-  }
-};
-
-
-#endif

Index: vclasses.hh
===================================================================
RCS file: vclasses.hh
diff -N vclasses.hh
--- vclasses.hh 12 Dec 2007 15:59:43 -0000      1.25
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,158 +0,0 @@
-
-/*
-        Copyright (C) 2005 Tom Drummond
-
-     This library is free software; you can redistribute it and/or
-     modify it under the terms of the GNU Lesser General Public
-     License as published by the Free Software Foundation; either
-     version 2.1 of the License, 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
-     Lesser General Public License for more details.
-
-     You should have received a copy of the GNU Lesser General Public
-     License along with this library; if not, write to the Free Software
-     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-#ifndef __VCLASSES_HH
-#define __VCLASSES_HH
-
-///////////////////////////
-//                       //
-// Actual Vector classes //
-//                       //
-///////////////////////////
-
-template <int Size>
-class Vector : public FixedVector<Size, FixedVAccessor<Size,typename 
SizeTraits<Size>::get_zone> > {
- public:
-  // default constructor does nothing
-  inline Vector(){}
-
-  // constructor from c-style array
-  inline Vector(const double from[Size]){
-    memcpy(this->my_values,from,Size*sizeof(double));
-  }
-
-  // constructor from 1-ary operator
-  template <class T, class Op>
-    inline Vector(const T& arg, const Operator<Op>&){Op::eval(*this,arg);}
-
-  // constructor from 2-ary operator
-  template <class LHS, class RHS, class Op>
-    inline Vector(const LHS& lhs, const RHS& rhs, const 
Operator<Op>&){Op::eval(*this,lhs,rhs);}
-
-  // constructor from correct sized FixedVector
-  template<class Accessor>
-  inline Vector(const FixedVector<Size,Accessor>& from){
-    FixedVector<Size, FixedVAccessor<Size,typename SizeTraits<Size>::get_zone> 
>::operator=(from);
-  }
-
-  // constructor from any DynamicVector
-  template<class Accessor>
-    inline Vector(const DynamicVector<Accessor>& from){
-    assert(from.size() == Size);
-    FixedVector<Size, FixedVAccessor<Size,typename SizeTraits<Size>::get_zone> 
>::operator=(from);
-  }
-
-  template <class Accessor> inline Vector<Size>& operator=(const 
FixedVector<Size,Accessor>& fv) {
-    *this = Vector<Size>(fv);
-    return *this;
-  }
-
-  template <class Accessor> inline Vector<Size>& operator=(const 
DynamicVector<Accessor>& dv) {
-    *this = Vector<Size>(dv);
-    return *this;
-  }
-
-  // vector magic assignment operators (uses comma style) - insertion style 
defined in vbase.hh
-  VectorMagic::VectorFiller<1,Size, Vector<Size>, VectorMagic::CommaStyle> 
operator=(double t) {
-    (*this)[0] = t;
-    return VectorMagic::VectorFiller<1,Size, Vector<Size>, 
VectorMagic::CommaStyle>(*this);
-  }
-
-  template <int N> VectorMagic::VectorFiller<N,Size, 
Vector<Size>,VectorMagic::CommaStyle> operator=(const 
VectorMagic::ComponentPlaceHolder<N>& t) {
-    return VectorMagic::VectorFiller<N,Size, 
Vector<Size>,VectorMagic::CommaStyle>(*this);
-  }
-
-};
-
-
-
-
-
-template <>
-class Vector<> : public DynamicVector<DynamicVAccessor> {
- public:
-  Vector(){
-       this->my_size = 0;
-       this->my_values = NULL;
-  }
-
-  inline void resize(int new_size)
-  {
-       if(this->my_size != new_size)
-       {
-               delete[] this->my_values;
-               this->my_size = new_size;
-               this->my_values = new double[this->my_size];
-       }
-  }
-
-    template <class Accessor> inline void assign(const VectorBase<Accessor>& 
v) {
-       resize(v.size());
-       DynamicVector<DynamicVAccessor>::operator=(v);
-    }
-  Vector(int Size) {
-    this->my_size=Size; this->my_values = new double[Size];
-  }
-
-  inline Vector(int Size, double* from){
-    this->my_size=Size;
-    this->my_values = new double[Size];
-    memcpy(this->my_values,from,Size*sizeof(double));
-  }
-
-  inline ~Vector(){
-    delete[] this->my_values;
-  }
-
-  // constructor from 1-ary operator
-  template <class T, class Op>
-  Vector(const T& arg, const Operator<Op>&){
-    Op::eval(*this,arg);
-  }
-
-  // constructor from 2-ary operator
-  template <class LHS, class RHS, class Op>
-  Vector(const LHS& lhs, const RHS& rhs, const Operator<Op>&){
-    Op::eval(*this,lhs,rhs);
-  }
-
-  // constructor from any VectorBase
-  template<class Accessor>
-  Vector(const VectorBase<Accessor>& from){
-    this->my_size = from.size();
-    this->my_values = new double[this->my_size];
-    DynamicVector<DynamicVAccessor>::operator=(from);
-  }
-
-  // trap copy constructor here
-  Vector(const Vector& from){
-    this->my_size = from.my_size;
-    this->my_values = new double[this->my_size];
-    memcpy(this->my_values,from.my_values,this->my_size*sizeof(double));
-  }
-};
-
-struct VSizer{
-  static inline void set_size(Vector<>& v, int size){
-    v.my_size=size;
-    v.my_values=new double[size];
-  }
-};
-
-
-#endif

Index: vmagic.hh
===================================================================
RCS file: vmagic.hh
diff -N vmagic.hh
--- vmagic.hh   17 Jul 2006 14:15:50 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,107 +0,0 @@
-
-namespace VectorMagic {
-  template <int N=1>
-  struct ComponentPlaceHolder {
-  };
-
-  struct InsertionStyle {};
-  struct CommaStyle {};
-
-
-  template<bool Good> struct sentinel
-  {
-       typedef int too_many_elements_inserted;
-  };
-
-  template<> struct sentinel<false>
-  {
-  };
-
-  template <int Index, int Limit, class Vec, class Style> struct VectorFiller;
-  template <int Index, int Limit, class Vec> struct 
VectorFiller<Index,Limit,Vec,CommaStyle> {
-
-
-    // a static assertion
-    typedef typename sentinel<(Limit >= Index)>::too_many_elements_inserted 
dummy; 
-  
-    Vec& v;
-    bool final_initializer_but_Vector_not_filled;
-    inline VectorFiller(Vec& vec) : v(vec), 
final_initializer_but_Vector_not_filled(Index!=Limit) {}
-
-    inline VectorFiller<Index+1,Limit,Vec,CommaStyle> operator,(double t) {
-      v[Index] = t;
-      final_initializer_but_Vector_not_filled = false;
-      return VectorFiller<Index+1,Limit,Vec,CommaStyle>(v);
-    }
-    template <int N> inline VectorFiller<Index+N,Limit,Vec,CommaStyle> 
operator,(const ComponentPlaceHolder<N>& ph) {
-      final_initializer_but_Vector_not_filled = false;
-      return (VectorFiller<Index+1,Limit,Vec,CommaStyle>(v), 
ComponentPlaceHolder<N-1>());
-    }
-    inline VectorFiller<Index+1,Limit,Vec,CommaStyle> operator,(const 
ComponentPlaceHolder<1>& ph) {
-      final_initializer_but_Vector_not_filled = false;
-      return VectorFiller<Index+1,Limit,Vec,CommaStyle>(v);
-    }
-    inline ~VectorFiller() {
-      assert(!final_initializer_but_Vector_not_filled);
-    }
-    inline operator Vec () const { return v; }
-  };
-  
-  template <int Index, int Limit, class Vec> struct 
VectorFiller<Index,Limit,Vec,InsertionStyle> {
-       typedef typename sentinel<(Limit >= Index)>::too_many_elements_inserted 
dummy; 
-    Vec& v;
-    inline VectorFiller(Vec& vec) : v(vec){}
-
-    template <int N> inline VectorFiller<Index+N,Limit,Vec,InsertionStyle> 
operator<<(const Vector<N>& t) {
-      v.template slice<Index,N>() = t;
-      return VectorFiller<Index+N,Limit,Vec,InsertionStyle>(v);
-    }
-
-    inline VectorFiller<Index+1,Limit,Vec,InsertionStyle> operator<<(double t) 
{
-      v[Index] = t;
-      return VectorFiller<Index+1,Limit,Vec,InsertionStyle>(v);
-    }
-    template <int N> inline VectorFiller<Index+N,Limit,Vec,InsertionStyle> 
operator<<(const ComponentPlaceHolder<N>& ph) {
-      return (VectorFiller<Index+1,Limit,Vec,InsertionStyle>(v) << 
ComponentPlaceHolder<N-1>());
-    }
-    inline VectorFiller<Index+1,Limit,Vec,InsertionStyle> operator<<(const 
ComponentPlaceHolder<1>& ph) {
-      return VectorFiller<Index+1,Limit,Vec,InsertionStyle>(v);
-    }
-    inline operator Vec () const { return v; }
-  };
-
-
-  template <class Left, int Size> struct VectorCreator
-  {
-    const Left& left;
-    double val;
-    VectorCreator(const Left& l, double v) : left(l), val(v) { }
-    VectorCreator<VectorCreator<Left,Size>, Size+1> operator,(double t) const {
-      return VectorCreator<VectorCreator<Left,Size>, Size+1>(*this, t);
-    }
-    template <class V> void assign(V& v) const { v[Size-1] = val; 
left.assign(v); }
-    operator Vector<Size> () const {
-      Vector<Size> v;
-      assign(v);
-      return v;
-    }
-  };
-
-  struct BaseVectorCreator
-  {
-    inline VectorCreator<BaseVectorCreator, 1> operator,(double t) const {
-      return VectorCreator<BaseVectorCreator, 1>(*this, t);
-    }
-    template <class V> inline void assign(V& ) const {}
-  };
-}
-
-static VectorMagic::BaseVectorCreator make_Vector;
-
-namespace VectorMagic 
-{
-  inline void dummy_make_Vector_user() { int i; make_Vector.assign(i); }
-}
-
-template <int N> VectorMagic::ComponentPlaceHolder<N> no_change() { return 
VectorMagic::ComponentPlaceHolder<N>(); }
-inline VectorMagic::ComponentPlaceHolder<1> no_change() { return 
VectorMagic::ComponentPlaceHolder<1>(); }




reply via email to

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