Commit de1d3704 authored by COULAUD Olivier's avatar COULAUD Olivier

Move complex in interpolation kernels to std::complex. Add imag() and real()...

Move complex in interpolation kernels to std::complex. Add imag() and real() methods for FComplex (compatibility with std::complex
parent 7890ce20
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
#ifndef FUNIFCELL_HPP #ifndef FUNIFCELL_HPP
#define FUNIFCELL_HPP #define FUNIFCELL_HPP
#include "Utils/stdComplex.hpp"
#include "./FUnifTensor.hpp" #include "./FUnifTensor.hpp"
#include "../../Components/FBasicCell.hpp" #include "../../Components/FBasicCell.hpp"
#include "../../Extensions/FExtendCellType.hpp" #include "../../Extensions/FExtendCellType.hpp"
#include "../../Utils/FComplex.hpp"
/** /**
* @author Pierre Blanchard (pierre.blanchard@inria.fr) * @author Pierre Blanchard (pierre.blanchard@inria.fr)
...@@ -35,15 +35,15 @@ public: ...@@ -35,15 +35,15 @@ public:
struct exp_impl { struct exp_impl {
FReal exp[N * NVALS * VectorSize]; //< Multipole expansion FReal exp[N * NVALS * VectorSize]; //< Multipole expansion
// Multipole expansion in Fourier space // Multipole expansion in Fourier space
FComplex<FReal> transformed_exp[N * NVALS * TransformedVectorSize]; stdComplex<FReal> transformed_exp[N * NVALS * TransformedVectorSize];
const FReal* get(const int inRhs) const const FReal* get(const int inRhs) const
{ return this->exp + inRhs*VectorSize; } { return this->exp + inRhs*VectorSize; }
FReal* get(const int inRhs) FReal* get(const int inRhs)
{ return this->exp + inRhs*VectorSize; } { return this->exp + inRhs*VectorSize; }
const FComplex<FReal>* getTransformed(const int inRhs) const const stdComplex<FReal>* getTransformed(const int inRhs) const
{ return this->transformed_exp + inRhs*TransformedVectorSize; } { return this->transformed_exp + inRhs*TransformedVectorSize; }
FComplex<FReal>* getTransformed(const int inRhs) stdComplex<FReal>* getTransformed(const int inRhs)
{ return this->transformed_exp + inRhs*TransformedVectorSize; } { return this->transformed_exp + inRhs*TransformedVectorSize; }
constexpr int getVectorSize() const { constexpr int getVectorSize() const {
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
FSize getSavedSize() const { FSize getSavedSize() const {
return N * NVALS * VectorSize * (FSize) sizeof(FReal) return N * NVALS * VectorSize * (FSize) sizeof(FReal)
+ N * NVALS * TransformedVectorSize * (FSize) sizeof(FComplex<FReal>); + N * NVALS * TransformedVectorSize * (FSize) sizeof(stdComplex<FReal>);
} }
}; };
......
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
const FReal scale(MatrixKernel->getScaleFactor(CellWidth)); const FReal scale(MatrixKernel->getScaleFactor(CellWidth));
for(int idxRhs = 0 ; idxRhs < NVALS ; ++idxRhs){ for(int idxRhs = 0 ; idxRhs < NVALS ; ++idxRhs){
FComplex<FReal> *const TransformedLocalExpansion = TargetExpansion->getTransformed(idxRhs); stdComplex<FReal> *const TransformedLocalExpansion = TargetExpansion->getTransformed(idxRhs);
for(int idxExistingNeigh = 0 ; idxExistingNeigh < inSize ; ++idxExistingNeigh){ for(int idxExistingNeigh = 0 ; idxExistingNeigh < inSize ; ++idxExistingNeigh){
const int idxNeigh = neighborPositions[idxExistingNeigh]; const int idxNeigh = neighborPositions[idxExistingNeigh];
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "Utils/FDft.hpp" #include "Utils/FDft.hpp"
#include "Utils/FSmartPointer.hpp" #include "Utils/FSmartPointer.hpp"
#include "Utils/FComplex.hpp" #include "Utils/stdComplex.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp" #include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "FUnifTensor.hpp" #include "FUnifTensor.hpp"
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/*! Precomputation of the 316 interactions by evaluation of the matrix kernel on the uniform grid and transformation into Fourier space. /*! Precomputation of the 316 interactions by evaluation of the matrix kernel on the uniform grid and transformation into Fourier space.
PB: Compute() does not belong to the M2LHandler like it does in the Chebyshev kernel. This allows much nicer specialization of the M2LHandler class with respect to the homogeneity of the kernel of interaction like in the ChebyshevSym kernel.*/ PB: Compute() does not belong to the M2LHandler like it does in the Chebyshev kernel. This allows much nicer specialization of the M2LHandler class with respect to the homogeneity of the kernel of interaction like in the ChebyshevSym kernel.*/
template < class FReal,int ORDER, typename MatrixKernelClass> template < class FReal,int ORDER, typename MatrixKernelClass>
static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal CellWidth, FComplex<FReal>* &FC, const int SeparationCriterion = 1) static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal CellWidth, stdComplex<FReal>* &FC, const int SeparationCriterion = 1)
{ {
// allocate memory and store compressed M2L operators // allocate memory and store compressed M2L operators
if (FC) throw std::runtime_error("M2L operators are already set"); if (FC) throw std::runtime_error("M2L operators are already set");
...@@ -41,19 +41,19 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel ...@@ -41,19 +41,19 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel
// allocate memory and compute 316 m2l operators (342 if separation equals 0, 343 if separation equals -1) // allocate memory and compute 316 m2l operators (342 if separation equals 0, 343 if separation equals -1)
FReal *_C; FReal *_C;
FComplex<FReal> *_FC; stdComplex<FReal> *_FC;
// reduce storage from nnodes^2=order^6 to (2order-1)^3 // reduce storage from nnodes^2=order^6 to (2order-1)^3
const unsigned int rc = (2*order-1)*(2*order-1)*(2*order-1); const unsigned int rc = (2*order-1)*(2*order-1)*(2*order-1);
_C = new FReal [rc]; _C = new FReal [rc];
_FC = new FComplex<FReal> [rc * ninteractions]; _FC = new stdComplex<FReal> [rc * ninteractions];
// initialize root node ids pairs // initialize root node ids pairs
unsigned int node_ids_pairs[rc][2]; unsigned int node_ids_pairs[rc][2];
TensorType::setNodeIdsPairs(node_ids_pairs); TensorType::setNodeIdsPairs(node_ids_pairs);
// init Discrete Fourier Transformator // init Discrete Fourier Transformator
const int dimfft = 1; // unidim FFT since fully circulant embedding const int dimfft = 1; // unidim FFT since fully circulant embedding
FFftw<FReal,FComplex<FReal>,dimfft> Dft(rc); FFftw<FReal,stdComplex<FReal>,dimfft> Dft(rc);
// get first column of K via permutation // get first column of K via permutation
unsigned int perm[rc]; unsigned int perm[rc];
TensorType::setStoragePermutation(perm); TensorType::setStoragePermutation(perm);
...@@ -104,7 +104,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel ...@@ -104,7 +104,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, const FReal Cel
// reduce storage if real valued kernel // reduce storage if real valued kernel
const unsigned int opt_rc = rc/2+1; const unsigned int opt_rc = rc/2+1;
// allocate M2L // allocate M2L
FC = new FComplex<FReal>[343 * opt_rc]; FC = new stdComplex<FReal>[343 * opt_rc];
for (int i=-3; i<=3; ++i) for (int i=-3; i<=3; ++i)
for (int j=-3; j<=3; ++j) for (int j=-3; j<=3; ++j)
...@@ -159,10 +159,10 @@ public: ...@@ -159,10 +159,10 @@ public:
// DFT specific // DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator typedef FFftw<FReal,stdComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator
private: private:
/// M2L Operators (stored in Fourier space) /// M2L Operators (stored in Fourier space)
FSmartPointer< FComplex<FReal>,FSmartArrayMemory> FC; FSmartPointer< stdComplex<FReal>,FSmartArrayMemory> FC;
/// Utils /// Utils
unsigned int node_diff[nnodes*nnodes]; unsigned int node_diff[nnodes*nnodes];
...@@ -223,12 +223,12 @@ public: ...@@ -223,12 +223,12 @@ public:
if (FC) throw std::runtime_error("M2L operator already set"); if (FC) throw std::runtime_error("M2L operator already set");
// Compute matrix of interactions // Compute matrix of interactions
const FReal ReferenceCellWidth = FReal(2.); const FReal ReferenceCellWidth = FReal(2.);
FComplex<FReal>* pFC = NULL; stdComplex<FReal>* pFC = NULL;
Compute<FReal,order>(MatrixKernel,ReferenceCellWidth,pFC,LeafLevelSeparationCriterion); Compute<FReal,order>(MatrixKernel,ReferenceCellWidth,pFC,LeafLevelSeparationCriterion);
FC.assign(pFC); FC.assign(pFC);
// Compute memory usage // Compute memory usage
unsigned long sizeM2L = 343*opt_rc*sizeof(FComplex<FReal>); unsigned long sizeM2L = 343*opt_rc*sizeof(stdComplex<FReal>);
// write info // write info
...@@ -237,7 +237,7 @@ public: ...@@ -237,7 +237,7 @@ public:
} }
unsigned long long getMemory() const { unsigned long long getMemory() const {
return 343*opt_rc*sizeof(FComplex<FReal>); return 343*opt_rc*sizeof(stdComplex<FReal>);
} }
/** /**
...@@ -247,7 +247,7 @@ public: ...@@ -247,7 +247,7 @@ public:
* @param[in] X transformed local expansion of size \f$r\f$ * @param[in] X transformed local expansion of size \f$r\f$
* @param[out] x local expansion of size \f$\ell^3\f$ * @param[out] x local expansion of size \f$\ell^3\f$
*/ */
void unapplyZeroPaddingAndDFT(const FComplex<FReal> *const FX, FReal *const x) const void unapplyZeroPaddingAndDFT(const stdComplex<FReal> *const FX, FReal *const x) const
{ {
FReal Px[rc]; FReal Px[rc];
FBlas::setzero(rc,Px); FBlas::setzero(rc,Px);
...@@ -273,13 +273,16 @@ public: ...@@ -273,13 +273,16 @@ public:
* @param[in] CellWidth needed for the scaling of the compressed M2L operators which are based on a homogeneous matrix kernel computed for the reference cell width \f$w=2\f$, ie in \f$[-1,1]^3\f$. * @param[in] CellWidth needed for the scaling of the compressed M2L operators which are based on a homogeneous matrix kernel computed for the reference cell width \f$w=2\f$, ie in \f$[-1,1]^3\f$.
*/ */
void applyFC(const unsigned int idx, const unsigned int, const FReal scale, void applyFC(const unsigned int idx, const unsigned int, const FReal scale,
const FComplex<FReal> *const FY, FComplex<FReal> *const FX) const const stdComplex<FReal> *const FY, stdComplex<FReal> *const FX) const
{ {
// Perform entrywise product manually // Perform entrywise product manually
for (unsigned int j=0; j<opt_rc; ++j){ for (unsigned int j=0; j<opt_rc; ++j){
FX[j].addMul(FComplex<FReal>(scale*FC[idx*opt_rc + j].getReal(), // FX[j].addMul(newFComplex<FReal>(scale*FC[idx*opt_rc + j].real(),
scale*FC[idx*opt_rc + j].getImag()), // scale*FC[idx*opt_rc + j].imag()),
FY[j]); // FY[j]);
FX[j] += stdComplex<FReal>(scale*FC[idx*opt_rc + j].real(),
scale*FC[idx*opt_rc + j].imag())
*FY[j];
} }
} }
...@@ -291,7 +294,7 @@ public: ...@@ -291,7 +294,7 @@ public:
* @param[in] y multipole expansion of size \f$\ell^3\f$ * @param[in] y multipole expansion of size \f$\ell^3\f$
* @param[out] Y transformed multipole expansion of size \f$r\f$ * @param[out] Y transformed multipole expansion of size \f$r\f$
*/ */
void applyZeroPaddingAndDFT(FReal *const y, FComplex<FReal> *const FY) const void applyZeroPaddingAndDFT(FReal *const y, stdComplex<FReal> *const FY) const
{ {
FReal Py[rc]; FReal Py[rc];
FBlas::setzero(rc,Py); FBlas::setzero(rc,Py);
...@@ -303,7 +306,7 @@ public: ...@@ -303,7 +306,7 @@ public:
} }
const FComplex<FReal>& getFc(const int i, const int j) const{ const stdComplex<FReal>& getFc(const int i, const int j) const{
return FC[i*opt_rc + j]; return FC[i*opt_rc + j];
} }
}; };
...@@ -319,7 +322,7 @@ class FUnifM2LHandler<FReal,ORDER,NON_HOMOGENEOUS> ...@@ -319,7 +322,7 @@ class FUnifM2LHandler<FReal,ORDER,NON_HOMOGENEOUS>
rc = (2*ORDER-1)*(2*ORDER-1)*(2*ORDER-1)}; rc = (2*ORDER-1)*(2*ORDER-1)*(2*ORDER-1)};
/// M2L Operators (stored in Fourier space for each level) /// M2L Operators (stored in Fourier space for each level)
FSmartPointer< FComplex<FReal>*,FSmartArrayMemory> FC; FSmartPointer< stdComplex<FReal>*,FSmartArrayMemory> FC;
/// Homogeneity specific variables /// Homogeneity specific variables
const unsigned int TreeHeight; const unsigned int TreeHeight;
const FReal RootCellWidth; const FReal RootCellWidth;
...@@ -328,7 +331,7 @@ class FUnifM2LHandler<FReal,ORDER,NON_HOMOGENEOUS> ...@@ -328,7 +331,7 @@ class FUnifM2LHandler<FReal,ORDER,NON_HOMOGENEOUS>
unsigned int node_diff[nnodes*nnodes]; unsigned int node_diff[nnodes*nnodes];
/// DFT specific /// DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast real-valued Discrete Fourier Transformator typedef FFftw<FReal,stdComplex<FReal>,dimfft> DftClass; // Fast real-valued Discrete Fourier Transformator
DftClass Dft; DftClass Dft;
const unsigned int opt_rc; // specific to real valued kernel const unsigned int opt_rc; // specific to real valued kernel
...@@ -357,7 +360,7 @@ public: ...@@ -357,7 +360,7 @@ public:
TensorType::setNodeIdsDiff(node_diff); TensorType::setNodeIdsDiff(node_diff);
// init M2L operators // init M2L operators
FC = new FComplex<FReal>*[TreeHeight]; FC = new stdComplex<FReal>*[TreeHeight];
FC[0] = NULL; FC[1] = NULL; FC[0] = NULL; FC[1] = NULL;
for (unsigned int l=2; l<TreeHeight; ++l) FC[l] = NULL; for (unsigned int l=2; l<TreeHeight; ++l) FC[l] = NULL;
...@@ -412,7 +415,7 @@ public: ...@@ -412,7 +415,7 @@ public:
} }
// Compute memory usage // Compute memory usage
unsigned long sizeM2L = (TreeHeight-2)*343*opt_rc*sizeof(FComplex<FReal>); unsigned long sizeM2L = (TreeHeight-2)*343*opt_rc*sizeof(stdComplex<FReal>);
// write info // write info
std::cout << "Compute and set M2L operators ("<< long(sizeM2L/**1e-6*/) <<" B) in " std::cout << "Compute and set M2L operators ("<< long(sizeM2L/**1e-6*/) <<" B) in "
...@@ -420,7 +423,7 @@ public: ...@@ -420,7 +423,7 @@ public:
} }
unsigned long long getMemory() const { unsigned long long getMemory() const {
return (TreeHeight-2)*343*opt_rc*sizeof(FComplex<FReal>); return (TreeHeight-2)*343*opt_rc*sizeof(stdComplex<FReal>);
} }
/** /**
...@@ -430,7 +433,7 @@ public: ...@@ -430,7 +433,7 @@ public:
* @param[in] X transformed local expansion of size \f$r\f$ * @param[in] X transformed local expansion of size \f$r\f$
* @param[out] x local expansion of size \f$\ell^3\f$ * @param[out] x local expansion of size \f$\ell^3\f$
*/ */
void unapplyZeroPaddingAndDFT(const FComplex<FReal> *const FX, FReal *const x) const void unapplyZeroPaddingAndDFT(const stdComplex<FReal> *const FX, FReal *const x) const
{ {
FReal Px[rc]; FReal Px[rc];
FBlas::setzero(rc,Px); FBlas::setzero(rc,Px);
...@@ -456,11 +459,12 @@ public: ...@@ -456,11 +459,12 @@ public:
* @param[in] CellWidth needed for the scaling of the compressed M2L operators which are based on a homogeneous matrix kernel computed for the reference cell width \f$w=2\f$, ie in \f$[-1,1]^3\f$. * @param[in] CellWidth needed for the scaling of the compressed M2L operators which are based on a homogeneous matrix kernel computed for the reference cell width \f$w=2\f$, ie in \f$[-1,1]^3\f$.
*/ */
void applyFC(const unsigned int idx, const unsigned int TreeLevel, const FReal, void applyFC(const unsigned int idx, const unsigned int TreeLevel, const FReal,
const FComplex<FReal> *const FY, FComplex<FReal> *const FX) const const stdComplex<FReal> *const FY, stdComplex<FReal> *const FX) const
{ {
// Perform entrywise product manually // Perform entrywise product manually
for (unsigned int j=0; j<opt_rc; ++j){ for (unsigned int j=0; j<opt_rc; ++j){
FX[j].addMul(FC[TreeLevel][idx*opt_rc + j],FY[j]); // FX[j].addMul(FC[TreeLevel][idx*opt_rc + j],FY[j]);
FX[j] += (FC[TreeLevel][idx*opt_rc + j]*FY[j]);
} }
} }
...@@ -472,7 +476,7 @@ public: ...@@ -472,7 +476,7 @@ public:
* @param[in] y multipole expansion of size \f$\ell^3\f$ * @param[in] y multipole expansion of size \f$\ell^3\f$
* @param[out] Y transformed multipole expansion of size \f$r\f$ * @param[out] Y transformed multipole expansion of size \f$r\f$
*/ */
void applyZeroPaddingAndDFT(FReal *const y, FComplex<FReal> *const FY) const void applyZeroPaddingAndDFT(FReal *const y, stdComplex<FReal> *const FY) const
{ {
FReal Py[rc]; FReal Py[rc];
FBlas::setzero(rc,Py); FBlas::setzero(rc,Py);
...@@ -483,7 +487,7 @@ public: ...@@ -483,7 +487,7 @@ public:
Dft.applyDFT(Py,FY); Dft.applyDFT(Py,FY);
} }
const FComplex<FReal>& getFc(const int i, const int j) const{ const stdComplex<FReal>& getFc(const int i, const int j) const{
return FC[i*opt_rc + j]; return FC[i*opt_rc + j];
} }
......
...@@ -172,7 +172,7 @@ public: ...@@ -172,7 +172,7 @@ public:
const int idxLoc = idxV*nLhs + idxLhs; const int idxLoc = idxV*nLhs + idxLhs;
// load transformed local expansion // load transformed local expansion
FComplex<FReal> *const TransformedLocalExpansion = TargetExpansion->getTransformed(idxLoc); stdComplex<FReal> *const TransformedLocalExpansion = TargetExpansion->getTransformed(idxLoc);
// update idxRhs // update idxRhs
const int idxRhs = idxLhs % nPV; const int idxRhs = idxLhs % nPV;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "Utils/FTic.hpp" #include "Utils/FTic.hpp"
#include "Utils/FDft.hpp" #include "Utils/FDft.hpp"
#include "Utils/FComplex.hpp" #include "Utils/stdComplex.hpp"
#include "FUnifTensor.hpp" #include "FUnifTensor.hpp"
...@@ -27,7 +27,7 @@ template < class FReal, int ORDER, class MatrixKernelClass> ...@@ -27,7 +27,7 @@ template < class FReal, int ORDER, class MatrixKernelClass>
static void Compute(const MatrixKernelClass *const MatrixKernel, static void Compute(const MatrixKernelClass *const MatrixKernel,
const FReal CellWidth, const FReal CellWidth,
const FReal CellWidthExtension, const FReal CellWidthExtension,
FComplex<FReal>** &FC, stdComplex<FReal>** &FC,
const int SeparationCriterion = 1) const int SeparationCriterion = 1)
{ {
// dimensions of operators // dimensions of operators
...@@ -51,16 +51,16 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, ...@@ -51,16 +51,16 @@ static void Compute(const MatrixKernelClass *const MatrixKernel,
// allocate memory and compute 316 m2l operators // allocate memory and compute 316 m2l operators
FReal** _C; FReal** _C;
FComplex<FReal>** _FC; stdComplex<FReal>** _FC;
// reduce storage from nnodes^2=order^6 to (2order-1)^3 // reduce storage from nnodes^2=order^6 to (2order-1)^3
const unsigned int rc = (2*order-1)*(2*order-1)*(2*order-1); const unsigned int rc = (2*order-1)*(2*order-1)*(2*order-1);
_C = new FReal* [ncmp]; _C = new FReal* [ncmp];
_FC = new FComplex<FReal>* [ncmp]; _FC = new stdComplex<FReal>* [ncmp];
for (unsigned int d=0; d<ncmp; ++d) for (unsigned int d=0; d<ncmp; ++d)
_C[d] = new FReal[rc]; _C[d] = new FReal[rc];
for (unsigned int d=0; d<ncmp; ++d) for (unsigned int d=0; d<ncmp; ++d)
_FC[d] = new FComplex<FReal>[rc * ninteractions]; _FC[d] = new stdComplex<FReal>[rc * ninteractions];
// initialize root node ids pairs // initialize root node ids pairs
unsigned int node_ids_pairs[rc][2]; unsigned int node_ids_pairs[rc][2];
...@@ -68,7 +68,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, ...@@ -68,7 +68,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel,
// init Discrete Fourier Transformator // init Discrete Fourier Transformator
const int dimfft = 1; // unidim FFT since fully circulant embedding const int dimfft = 1; // unidim FFT since fully circulant embedding
FFftw<FReal,FComplex<FReal>,dimfft> Dft(rc); FFftw<FReal,stdComplex<FReal>,dimfft> Dft(rc);
// get first column of K via permutation // get first column of K via permutation
unsigned int perm[rc]; unsigned int perm[rc];
...@@ -110,7 +110,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, ...@@ -110,7 +110,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel,
Dft.applyDFT(_C[d],_FC[d]+counter*rc); Dft.applyDFT(_C[d],_FC[d]+counter*rc);
// increment interaction counter // increment interaction counter
counter++; ++counter;
} }
} }
} }
...@@ -131,7 +131,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, ...@@ -131,7 +131,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel,
const unsigned int opt_rc = rc/2+1; const unsigned int opt_rc = rc/2+1;
// allocate M2L // allocate M2L
for (unsigned int d=0; d<ncmp; ++d) for (unsigned int d=0; d<ncmp; ++d)
FC[d] = new FComplex<FReal>[343 * opt_rc]; FC[d] = new stdComplex<FReal>[343 * opt_rc];
for (int i=-3; i<=3; ++i) for (int i=-3; i<=3; ++i)
for (int j=-3; j<=3; ++j) for (int j=-3; j<=3; ++j)
...@@ -141,7 +141,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel, ...@@ -141,7 +141,7 @@ static void Compute(const MatrixKernelClass *const MatrixKernel,
for (unsigned int d=0; d<ncmp; ++d) for (unsigned int d=0; d<ncmp; ++d)
FBlas::c_copy(opt_rc, reinterpret_cast<FReal*>(_FC[d] + counter*rc), FBlas::c_copy(opt_rc, reinterpret_cast<FReal*>(_FC[d] + counter*rc),
reinterpret_cast<FReal*>(FC[d] + idx*opt_rc)); reinterpret_cast<FReal*>(FC[d] + idx*opt_rc));
counter++; ++counter;
} else { } else {
for (unsigned int d=0; d<ncmp; ++d) for (unsigned int d=0; d<ncmp; ++d)
FBlas::c_setzero(opt_rc, reinterpret_cast<FReal*>(FC[d] + idx*opt_rc)); FBlas::c_setzero(opt_rc, reinterpret_cast<FReal*>(FC[d] + idx*opt_rc));
...@@ -181,7 +181,7 @@ class FUnifTensorialM2LHandler<FReal, ORDER,MatrixKernelClass,HOMOGENEOUS> ...@@ -181,7 +181,7 @@ class FUnifTensorialM2LHandler<FReal, ORDER,MatrixKernelClass,HOMOGENEOUS>
ncmp = MatrixKernelClass::NCMP}; ncmp = MatrixKernelClass::NCMP};
/// M2L Operators (stored in Fourier space for each component of tensor) /// M2L Operators (stored in Fourier space for each component of tensor)
FSmartPointer< FComplex<FReal>*,FSmartArrayMemory> FC; FSmartPointer< stdComplex<FReal>*,FSmartArrayMemory> FC;
const FReal CellWidthExtension; //<! extension of cells width const FReal CellWidthExtension; //<! extension of cells width
...@@ -191,7 +191,7 @@ class FUnifTensorialM2LHandler<FReal, ORDER,MatrixKernelClass,HOMOGENEOUS> ...@@ -191,7 +191,7 @@ class FUnifTensorialM2LHandler<FReal, ORDER,MatrixKernelClass,HOMOGENEOUS>
/// DFT specific /// DFT specific
static const int dimfft = 1; // unidim FFT since fully circulant embedding static const int dimfft = 1; // unidim FFT since fully circulant embedding
typedef FFftw<FReal,FComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator typedef FFftw<FReal,stdComplex<FReal>,dimfft> DftClass; // Fast Discrete Fourier Transformator
DftClass Dft; DftClass Dft;
const unsigned int opt_rc; // specific to real valued kernel const unsigned int opt_rc; // specific to real valued kernel
...@@ -215,7 +215,7 @@ public: ...@@ -215,7 +215,7 @@ public:
{ {
// allocate FC // allocate FC
FC = new FComplex<FReal>*[ncmp]; FC = new stdComplex<FReal>*[ncmp];
for (unsigned int d=0; d<ncmp; ++d) for (unsigned int d=0; d<ncmp; ++d)
FC[d]=nullptr; FC[d]=nullptr;
...@@ -264,7 +264,7 @@ public: ...@@ -264,7 +264,7 @@ public:
Compute<FReal,order>(MatrixKernel,ReferenceCellWidth, 0., FC, LeafLevelSeparationCriterion); Compute<FReal,order>(MatrixKernel,ReferenceCellWidth, 0., FC, LeafLevelSeparationCriterion);
// Compute memory usage // Compute memory usage
unsigned long sizeM2L = 343*ncmp*opt_rc*sizeof(FComplex<FReal>); unsigned long sizeM2L = 343*ncmp*opt_rc*sizeof(stdComplex<FReal>);
// write info // write info
std::cout << "Compute and set M2L operators ("<< long(sizeM2L/**1e-6*/) <<" B) in " std::cout << "Compute and set M2L operators ("<< long(sizeM2L/**1e-6*/) <<" B) in "
...@@ -272,7 +272,7 @@ public: ...@@ -272,7 +272,7 @@ public:
} }
unsigned long long getMemory() const { unsigned long long getMemory() const {
return 343*ncmp*opt_rc*sizeof(FComplex<FReal>); return 343*ncmp*opt_rc*sizeof(stdComplex<FReal>);
} }
/** /**
...@@ -282,7 +282,7 @@ public: ...@@ -282,7 +282,7 @@ public: