toon-members
[Top][All Lists]
Advanced

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

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


From: Edward Rosten
Subject: [Toon-members] TooN TooN.h doc/documentation.h
Date: Mon, 01 Feb 2010 18:49:06 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        10/02/01 18:49:06

Modified files:
        .              : TooN.h 
        doc            : documentation.h 

Log message:
        Support complex numbers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/TooN.h?cvsroot=toon&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/TooN/doc/documentation.h?cvsroot=toon&r1=1.44&r2=1.45

Patches:
Index: TooN.h
===================================================================
RCS file: /cvsroot/toon/TooN/TooN.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- TooN.h      18 Jan 2010 12:15:31 -0000      1.59
+++ TooN.h      1 Feb 2010 18:49:06 -0000       1.60
@@ -37,6 +37,7 @@
 #include <new>
 #include <utility>
 #include <vector>
+#include <complex>
 #include <TooN/internal/config.hh>
 #include <TooN/internal/typeof.hh>
 #include <TooN/internal/deprecated.hh>
@@ -80,6 +81,20 @@
        using std::numeric_limits;
        ///Is a number a field? ie, +, -, *, / defined.
        ///Specialize this to make TooN work properly with new types.
+       ///The primary reason for this is to allow SFINAE to work properly.
+       ///This is required if there are the following two functions:
+       ///@code 
+       ///   Vector<> * X  //Generic type X
+       ///   Vector<> * DiagonalMatrix<>
+       ///@endcode
+       ///If one of the functions is a substitution failure, then it will be
+       ///ignored, allowing the functions to coexist happily. However, not all
+       ///types of failure are substitution failures. TooN's type deduction 
happens
+       ///when determining the return type of the function. This is too early, 
so
+       ///the wrong kind of error in the return type deduction causes an 
error, rather
+       ///than a substitution failure. The IsField mechanism makes it the 
right kind of
+       ///error, thereby allowing a substitution failuer to occur.
+       ///
        ///@internal
        ///Internal::Field determines if two classes are in the same field.
        ///@ingroup gLinAlg
@@ -88,6 +103,11 @@
                static const int value = numeric_limits<C>::is_specialized; 
///<Is C a field?
        };
        
+       template<class C> struct IsField<std::complex<C> >
+       {
+               static const int value = numeric_limits<C>::is_specialized; 
///<Is C a field?
+       };
+       
        ///Specialized for const types
        ///@internal
        ///Internal::Field determines if two classes are in the same field.

Index: doc/documentation.h
===================================================================
RCS file: /cvsroot/toon/TooN/doc/documentation.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- doc/documentation.h 18 Jan 2010 15:32:13 -0000      1.44
+++ doc/documentation.h 1 Feb 2010 18:49:06 -0000       1.45
@@ -498,6 +498,7 @@
        @code
                Vector<3, float> v;          //Static sized vector of floats
                Vector<Dynamic, float> v(4); //Dynamic sized vector of floats
+               Vector<Dynamic, std::complex<double> > v(4); //Dynamic sized 
vector of complex numbers
        @endcode
 
        Likewise for matrix. By default, TooN supports all builtin types




reply via email to

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