TooN: internal/planar_complex.hh Source File

TooN 2.0.0-beta8

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List

internal/planar_complex.hh

    00001 namespace TooN{
    00002     namespace Internal{
    00003
    00004         ///@internal
    00005         ///@brief A simple smart pointer type representing planar complex data.
    00006         ///Not resizable. Also, only the minimum number of smart pointer
    00007         ///functionality has been implemented to make Vector work. The class returns
    00008         ///reference types, so it can represent mutable data.
    00009         ///@ingroup gInternal
    00010         template<class Precision> struct PointerToPlanarComplex;
    00011         template<class Precision> struct PointerToPlanarComplex<std::complex<Precision> >
    00012         {
    00013             const Precision* const re;
    00014             const Precision* const im;
    00015
    00016             PointerToPlanarComplex(std::pair<Precision*, Precision*> d)
    00017             :re(d.first),im(d.second)
    00018             {}
    00019
    00020             PointerToPlanarComplex(std::pair<const Precision*, const Precision*> d)
    00021             :re(d.first),im(d.second)
    00022             {}
    00023
    00024             PointerToPlanarComplex<std::complex<Precision> > operator+(int i) const
    00025             {
    00026                 return PointerToPlanarComplex<std::complex<Precision> >(std::make_pair(re+i, im+i));
    00027             }
    00028
    00029             const std::complex<Precision> operator[](int i) const
    00030             {
    00031                 return std::complex<Precision>(re[i], im[i]);
    00032             }
    00033
    00034         };
    00035     }
    00036
    00037
    00038     struct ReferencePlanarComplex
    00039     {
    00040         template<int Size, typename Precision>
    00041         struct VLayout;
    00042
    00043         template<int Size, typename Precision>
    00044         struct VLayout<Size, std::complex<Precision> >:
    00045           public Internal::GenericVBase<Size, std::complex<Precision>, 1, Internal::VectorSlice<Size, std::complex<Precision>, Internal::PointerToPlanarComplex<std::complex<double> >,
    00046                                                         Internal::PointerToPlanarComplex<std::complex<double> >,
    00047                                                         const std::complex<double>,
    00048                                                         const std::complex<double> > >
    00049         {
    00050             VLayout(Internal::PointerToPlanarComplex<std::complex<Precision> > p, int sz=0)
    00051             :Internal::GenericVBase<Size, std::complex<Precision>, 1, Internal::VectorSlice<Size, std::complex<Precision>, Internal::PointerToPlanarComplex<std::complex<double> >,
    00052                                                         Internal::PointerToPlanarComplex<std::complex<double> >,
    00053                                                         const std::complex<double>,
    00054                                                         const std::complex<double> > >(p, sz, 1)
    00055             {}
    00056
    00057
    00058         };
    00059
    00060     };
    00061 }
    00062