toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN internal/vbase.hh helpers.h


From: Edward Rosten
Subject: [Toon-members] TooN internal/vbase.hh helpers.h
Date: Mon, 24 Aug 2009 13:25:57 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/08/24 13:25:57

Modified files:
        internal       : vbase.hh 
        .              : helpers.h 

Log message:
        Removed nasty normalization function which was an attempt to get around
        the C++ rule that temporaries can not be accessed as non-const.
        
        If you need to normalize a chunk of a vector in-place, use the .ref() 
method:
        
        normalize(v.slice<0,3>().ref());

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vbase.hh?cvsroot=toon&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.81&r2=1.82

Patches:
Index: internal/vbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vbase.hh,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- internal/vbase.hh   24 Aug 2009 13:00:15 -0000      1.29
+++ internal/vbase.hh   24 Aug 2009 13:25:57 -0000      1.30
@@ -169,13 +169,6 @@
                return Matrix<Size, 1, Precision, Slice<Stride,1> >(my_data, 
size(), 1, stride(), 1, Slicing());
        }
        
-       //This is a hack for in-place functions, so a const version is never 
required.
-       Vector<Size, Precision, SliceVBase<Stride> > as_slice(){
-               return Vector<Size, Precision, SliceVBase<Stride> >(my_data, 
size(), stride(), Slicing());
-       }
-
-       typedef Vector<Size, Precision, SliceVBase<Stride> > as_slice_type;
-
        DiagonalMatrix<Size,Precision, SliceVBase<Stride> > as_diagonal() {
                return DiagonalMatrix<Size, Precision, SliceVBase<Stride> > 
(my_data, size(), stride(), Slicing());
        }

Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- helpers.h   31 Jul 2009 16:43:03 -0000      1.81
+++ helpers.h   24 Aug 2009 13:25:57 -0000      1.82
@@ -86,27 +86,15 @@
                return v * (1/sqrt(v*v));
        }
        
-       //Note because of the overload later, this function will ONLY receive 
sliced vectors. Therefore
-       //a copy can be made, which is still a slice, so operating on the copy 
operates on the original
-       //data.
        ///Normalize a vector in place
        ///@param v Vector to normalize
        ///@ingroup gLinAlg
-       template<int Size, class Precision, class Base> inline void 
normalize(Vector<Size, Precision, Base> v)
+       template<int Size, class Precision, class Base> inline void 
normalize(Vector<Size, Precision, Base>& v)
        {
                using std::sqrt;
                v /= sqrt(v*v);
        }
        
-       //This overload is required to operate on non-slice vectors
-       /**
-               \overload
-       */  
-       template<int Size, class Precision> inline void normalize(Vector<Size, 
Precision> & v)
-       {
-               normalize(v.as_slice());
-       }
-
        ///For a vector \e v of length \e i, return \f$[v_1, v_2, \cdots, 
v_{i-1}] / v_i \f$
        ///@param v \e v
        ///@ingroup gLinAlg




reply via email to

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