toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN helpers.h doc/documentation.h


From: Edward Rosten
Subject: [Toon-members] TooN helpers.h doc/documentation.h
Date: Sun, 26 Apr 2009 12:07:32 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/04/26 12:07:32

Modified files:
        .              : helpers.h 
        doc            : documentation.h 

Log message:
        Added documentation for Scalars

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/helpers.h?cvsroot=toon&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/documentation.h?cvsroot=toon&r1=1.18&r2=1.19

Patches:
Index: helpers.h
===================================================================
RCS file: /cvsroot/toon/TooN/helpers.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- helpers.h   26 Apr 2009 11:55:40 -0000      1.54
+++ helpers.h   26 Apr 2009 12:07:32 -0000      1.55
@@ -473,6 +473,17 @@
                }
        };
 
+       /**This function us used to add a scalar to every element of a vector or
+       matrix. For example:
+       @code
+               Vector<> v;
+               ...
+               ...
+               v += Scalars(3); //Add 3 to every element of v;
+       @endcode
+       Both + and += are supported on vectors,matrices and slices.
+       @param  s Scalar to add.
+       */
        template<class P> Operator<Internal::Scalars<P> > Scalars(const P& s)
        {
                return Operator<Internal::Scalars<P> > (s);

Index: doc/documentation.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/documentation.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- doc/documentation.h 20 Apr 2009 17:29:32 -0000      1.18
+++ doc/documentation.h 26 Apr 2009 12:07:32 -0000      1.19
@@ -56,6 +56,7 @@
  - \ref sFunctionVector
  - \ref sGenericCode
  - \ref sElemOps
+ - \ref sScalars
  - \ref ssExamples
  - \ref sNoResize
  - \ref sDebug
@@ -145,11 +146,10 @@
                Assignments are performed using <code>=</code>. See also 
                \ref sNoResize.
 
-
                These operators apply to vectors or matrices and scalars. 
                The operator is applied to every element with the scalar.
                @code
-               +=, -=, *= /= +, -, *, / 
+               *=, /=, *, / 
                @endcode
                
                Vector and vectors or matrices and matrices:
@@ -214,6 +214,21 @@
 
                See also \ref sSlices
 
+       \subsection sScalars How do I add a scalar to every element of a 
vector/matrix? 
+               
+               Addition to every element is not an elementary operation in the 
same way
+               as multiplication by a scalar. It is supported throught the 
::Scalars
+               function:
+               
+               @code
+                       Vector<3> a, b;
+                       ...
+                       b = a + Scalars(3);   // b_i = a_i + 3
+                       a+=Scalars(3);        // a_i <- a_i + 3
+               @endcode
+
+               It is supported the same way on Matrix and slices.
+
        \subsection sNoResize Why does assigning mismatched dynamic vectors 
fail?
        
        Vectors are not generic containers, and dynamic vectors have been 
designed




reply via email to

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