toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN/doc documentation.h


From: Edward Rosten
Subject: [Toon-members] TooN/doc documentation.h
Date: Fri, 26 Feb 2010 19:11:07 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        10/02/26 19:11:07

Modified files:
        doc            : documentation.h 

Log message:
        Documentation on how to return slices from functions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/documentation.h?cvsroot=toon&r1=1.46&r2=1.47

Patches:
Index: documentation.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/documentation.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- documentation.h     9 Feb 2010 13:43:19 -0000       1.46
+++ documentation.h     26 Feb 2010 19:11:06 -0000      1.47
@@ -67,6 +67,7 @@
  - \ref sResize
  - \ref sDebug
  - \ref sSlices
+ - \ref sFuncSlices
  - \ref sPrecision
  - \ref sSolveLinear
  - \ref sOtherStuff
@@ -502,6 +503,8 @@
 
        Slices are usually strange types. See \ref sFunctionVector
 
+       See also \sFuncSlices
+
        \subsection sPrecision Can I have a precision other than double?
 
        Yes!
@@ -523,6 +526,31 @@
        rules. The result of multiplying a <code>Matrix<double></code> by a 
        <code>Vector<float></code> is a <code>Vector<double></code>.
 
+
+       \subsection sFuncSlices How do I return a slice from a function?
+
+       Each vector has a <code>SliceBase</code> type indicating the type of a 
slice.
+
+       They can be slightly tricky to use:
+       @code
+               Vector<2, double, Vector<4>::SliceBase> sliceof(Vector<4>& v)
+               {
+                       return v.slice<1,2>();
+               }
+
+               template<int S, class P, class B>
+               Vector<2, P, Vector<S, P, B>::SliceBase> sliceof(Vector<S, P, 
B>& v)
+               {
+                       return v.template slice<1,2>();
+               }
+
+               template<int S, class P, class B>
+               const Vector<2, const P, typename Vector<S, P, 
B>::ConstSliceBase > foo(const Vector<S, P, B>& v)
+               {
+                       return v.template slice<1,2>();
+               }
+       @endcode
+
        \subsection sSolveLinear How do I invert a matrix / solve linear 
equations?
        
        You use the decomposition objects (see \ref sDecompos "below"), for 
example to solve Ax=b:




reply via email to

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