toon-members
[Top][All Lists]
Advanced

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

[Toon-members] TooN/internal planar_complex.hh


From: Edward Rosten
Subject: [Toon-members] TooN/internal planar_complex.hh
Date: Mon, 01 Feb 2010 19:35:03 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        10/02/01 19:35:03

Added files:
        internal       : planar_complex.hh 

Log message:
        Basic support for planar complex numbers as returned by some LAPACK 
functions.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/planar_complex.hh?cvsroot=toon&rev=1.1

Patches:
Index: planar_complex.hh
===================================================================
RCS file: planar_complex.hh
diff -N planar_complex.hh
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ planar_complex.hh   1 Feb 2010 19:35:02 -0000       1.1
@@ -0,0 +1,62 @@
+namespace TooN{
+       namespace Internal{
+               
+               ///@internal
+               ///@brief A simple smart pointer type representing planar 
complex data.
+               ///Not resizable. Also, only the minimum number of smart pointer
+               ///functionality has been implemented to make Vector work. The 
class returns
+               ///reference types, so it can represent mutable data.
+               ///@ingroup gInternal
+               template<class Precision> struct PointerToPlanarComplex;
+               template<class Precision> struct 
PointerToPlanarComplex<std::complex<Precision> >
+               {
+                       const Precision* const re;
+                       const Precision* const im;
+               
+                       PointerToPlanarComplex(std::pair<Precision*, 
Precision*> d)
+                       :re(d.first),im(d.second)
+                       {}
+
+                       PointerToPlanarComplex(std::pair<const Precision*, 
const Precision*> d)
+                       :re(d.first),im(d.second)
+                       {}
+
+                       PointerToPlanarComplex<std::complex<Precision> > 
operator+(int i) const
+                       {
+                               return 
PointerToPlanarComplex<std::complex<Precision> >(std::make_pair(re+i, im+i));
+                       }
+
+                       const std::complex<Precision> operator[](int i) const
+                       {
+                               return std::complex<Precision>(re[i], im[i]);
+                       }
+
+               };
+       }
+
+       
+       struct ReferencePlanarComplex
+       {
+               template<int Size, typename Precision>
+               struct VLayout;
+
+               template<int Size, typename Precision>
+               struct VLayout<Size, std::complex<Precision> >: 
+                 public Internal::GenericVBase<Size, std::complex<Precision>, 
1, Internal::VectorSlice<Size, std::complex<Precision>, 
Internal::PointerToPlanarComplex<std::complex<double> >,
+                                                           
Internal::PointerToPlanarComplex<std::complex<double> >,
+                                                           const 
std::complex<double>,
+                                                           const 
std::complex<double> > >
+               {
+                       
VLayout(Internal::PointerToPlanarComplex<std::complex<Precision> > p, int sz=0)
+                       :Internal::GenericVBase<Size, std::complex<Precision>, 
1, Internal::VectorSlice<Size, std::complex<Precision>, 
Internal::PointerToPlanarComplex<std::complex<double> >,
+                                                           
Internal::PointerToPlanarComplex<std::complex<double> >,
+                                                           const 
std::complex<double>,
+                                                           const 
std::complex<double> > >(p, sz, 1)
+                       {}
+
+                       
+               };
+
+       };
+}
+




reply via email to

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