LCOV - code coverage report
Current view: top level - operators - FourierTransform.cpp (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 0 27 0.0 %
Date: 2022-08-04 03:43:28 Functions: 0 10 0.0 %

          Line data    Source code
       1             : #include "FourierTransform.h"
       2             : 
       3             : #include "Error.h"
       4             : #include "ExpressionPredicates.h"
       5             : #include "Timer.h"
       6             : 
       7             : #include <iostream>
       8             : 
       9             : namespace elsa
      10             : {
      11             :     template <typename data_t>
      12           0 :     FourierTransform<data_t>::FourierTransform(const DataDescriptor& domainDescriptor, FFTNorm norm)
      13           0 :         : B(domainDescriptor, domainDescriptor), norm{norm}
      14             :     {
      15           0 :     }
      16             : 
      17             :     template <typename data_t>
      18           0 :     void FourierTransform<data_t>::applyImpl(const DataContainer<data_t>& x,
      19             :                                              DataContainer<data_t>& Ax) const
      20             :     {
      21             : 
      22           0 :         Timer timeguard("FourierTransform", "apply()");
      23             : 
      24             :         // TODO: if domain and range descriptors dont match,
      25             :         //       resize the datacontainer appropriately.
      26           0 :         auto x_values = x.getDataDescriptor().getNumberOfCoefficientsPerDimension();
      27           0 :         assert(x_values == this->_domainDescriptor->getNumberOfCoefficientsPerDimension());
      28             : 
      29             :         // copy the input and fouriertransform it
      30           0 :         Ax = x;
      31           0 :         Ax.fft(this->norm);
      32           0 :     }
      33             : 
      34             :     template <typename data_t>
      35           0 :     void FourierTransform<data_t>::applyAdjointImpl(const DataContainer<data_t>& x,
      36             :                                                     DataContainer<data_t>& Atx) const
      37             :     {
      38           0 :         Timer timeguard("FourierTransform", "applyAdjoint()");
      39             : 
      40             :         // TODO: same as applyImpl
      41           0 :         auto x_values = x.getDataDescriptor().getNumberOfCoefficientsPerDimension();
      42           0 :         assert(x_values == this->_domainDescriptor->getNumberOfCoefficientsPerDimension());
      43             : 
      44             :         // copy the input and inverse-fouriertransform it
      45           0 :         Atx = x;
      46           0 :         Atx.ifft(this->norm);
      47           0 :     }
      48             : 
      49             :     template <typename data_t>
      50           0 :     FourierTransform<data_t>* FourierTransform<data_t>::cloneImpl() const
      51             :     {
      52           0 :         auto& domainDescriptor = static_cast<const DataDescriptor&>(*this->_domainDescriptor);
      53             : 
      54           0 :         return new FourierTransform(domainDescriptor);
      55             :     }
      56             : 
      57             :     template <typename data_t>
      58           0 :     bool FourierTransform<data_t>::isEqual(const B& other) const
      59             :     {
      60           0 :         if (!B::isEqual(other))
      61           0 :             return false;
      62             : 
      63           0 :         auto otherOP = dynamic_cast<const FourierTransform*>(&other);
      64           0 :         if (!otherOP)
      65           0 :             return false;
      66             : 
      67             :         // fourier transforms have no configuration yet
      68           0 :         return true;
      69             :     }
      70             : 
      71             :     template class FourierTransform<complex<float>>;
      72             :     template class FourierTransform<complex<double>>;
      73             : } // namespace elsa

Generated by: LCOV version 1.14