27 #include <wrap_fftw.h> 28 #include <makeweights.h> 29 #include <s2_primitive.h> 30 #include <s2_cospmls.h> 31 #include <s2_legendreTransforms.h> 32 #include <s2_semi_fly.h> 33 #include <rotate_so3_utils.h> 34 #include <utils_so3.h> 35 #include <soft_fftw.h> 36 #include <rotate_so3_fftw.h> 42 #include <rvapi_interface.h> 61 if ( !this->_eulerAnglesFound )
63 std::cerr <<
"!!! ProSHADE ERROR !!! Error in file comparison !!! Attempted to get Wigner d matrices without computing the Euler angles first. Call the getEulerAngles function BEFORE the generateWignerMatrices function." << std::endl;
67 std::stringstream hlpSS;
68 hlpSS <<
"<font color=\"red\">" <<
"Attempted to get Wigner d matrices without computing the Euler angles first. This looks like an internal bug, please report this case." <<
"</font>";
69 rvapi_set_text ( hlpSS.str().c_str(),
84 unsigned int noOrders = 0;
85 unsigned int arrConvIter = 0;
98 double angAlpha = this->_eulerAngles[0];
99 double angBeta = this->_eulerAngles[1];
100 double angGamma = this->_eulerAngles[2];
102 if ( angAlpha < 0.0 ) { angAlpha = M_PI + ( angAlpha - M_PI ); }
103 if ( angBeta < 0.0 ) { angBeta = M_PI + ( angBeta - M_PI ); }
104 if ( angGamma < 0.0 ) { angGamma = M_PI + ( angGamma - M_PI ); }
107 this->_wignerMatrices = std::vector< std::vector< std::vector< std::array<double,2> > > > ( this->_bandwidthLimit );
110 double *matIn =
new double[
static_cast<unsigned int> ( 4 * pow( this->_bandwidthLimit, 2.0 ) - 4 * this->_bandwidthLimit + 1 )];
111 double *matOut =
new double[
static_cast<unsigned int> ( 4 * pow( this->_bandwidthLimit, 2.0 ) - 4 * this->_bandwidthLimit + 1 )];
112 double *sqrts =
new double[
static_cast<unsigned int> ( 2 * this->_bandwidthLimit )];
113 double *workspace =
new double[
static_cast<unsigned int> ( 4 * pow( this->_bandwidthLimit, 2.0 ) )];
114 double *exponentAlphaReal =
new double[
static_cast<unsigned int> ( 2 * this->_bandwidthLimit - 1 )];
115 double *exponentAlphaImag =
new double[
static_cast<unsigned int> ( 2 * this->_bandwidthLimit - 1 )];
116 double *exponentGammaReal =
new double[
static_cast<unsigned int> ( 2 * this->_bandwidthLimit - 1 )];
117 double *exponentGammaImag =
new double[
static_cast<unsigned int> ( 2 * this->_bandwidthLimit - 1 )];
120 for (
unsigned int iter = 0; iter < static_cast<unsigned int> ( 2 * this->_bandwidthLimit ); iter++ )
122 sqrts[iter] =
static_cast<double> ( sqrt ( static_cast<double> ( iter ) ) );
126 trigVals[0] =
static_cast<double> ( cos ( 0.5 * -angBeta ) );
127 trigVals[1] =
static_cast<double> ( sin ( 0.5 * -angBeta ) );
130 genExp ( this->_bandwidthLimit, angAlpha, exponentAlphaReal, exponentAlphaImag );
131 genExp ( this->_bandwidthLimit, angGamma, exponentGammaReal, exponentGammaImag );
134 for (
unsigned int bandIter = 0; bandIter < this->_bandwidthLimit; bandIter++ )
137 noOrders = 2 * bandIter + 1;
141 expARStart = &exponentAlphaReal[ (this->_bandwidthLimit - 1) - bandIter ];
142 expAIStart = &exponentAlphaImag[ (this->_bandwidthLimit - 1) - bandIter ];
143 expGRStart = &exponentGammaReal[ (this->_bandwidthLimit - 1) - bandIter ];
144 expGIStart = &exponentGammaImag[ (this->_bandwidthLimit - 1) - bandIter ];
149 this->_wignerMatrices.at(bandIter) = std::vector< std::vector< std::array<double,2> > > ( noOrders );
150 for (
unsigned int iter = 0; iter < noOrders; iter++ )
152 this->_wignerMatrices.at(bandIter).at(iter) = std::vector< std::array<double,2> > ( noOrders );
156 wignerdmat ( bandIter, matIn, matOut, trigVals, sqrts, workspace );
159 for (
unsigned int d1Iter = 0; d1Iter < noOrders; d1Iter++ )
161 eARi = expARStart[d1Iter];
162 eAIi = expAIStart[d1Iter];
164 for (
unsigned int d2Iter = 0; d2Iter < noOrders; d2Iter++ )
166 Dij = matOut[arrConvIter];
167 eGRj = expGRStart[d2Iter];
168 eGIj = expGIStart[d2Iter];
170 this->_wignerMatrices.at(bandIter).at(d1Iter).at(d2Iter)[0] = ( Dij * eGRj * eARi - Dij * eGIj * eAIi ) * rSign;
171 this->_wignerMatrices.at(bandIter).at(d1Iter).at(d2Iter)[1] = ( Dij * eGRj * eAIi + Dij * eGIj * eARi ) * iSign;
180 memcpy ( matIn, matOut,
sizeof (
double ) * ( noOrders * noOrders ) );
188 delete[] exponentAlphaReal;
189 delete[] exponentAlphaImag;
190 delete[] exponentGammaReal;
191 delete[] exponentGammaImag;
194 this->_wignerMatricesComputed =
true;
210 if ( !this->_eulerAnglesFound )
212 std::cerr <<
"!!! ProSHADE ERROR !!! Error in file comparison !!! Attempted to get Wigner d matrices without computing the Euler angles first. Call the getEulerAngles function BEFORE the generateWignerMatrices function." << std::endl;
216 std::stringstream hlpSS;
217 hlpSS <<
"<font color=\"red\">" <<
"Attempted to get Wigner d matrices without computing the Euler angles first. This looks like an internal bug, please report this case." <<
"</font>";
218 rvapi_set_text ( hlpSS.str().c_str(),
233 unsigned int noOrders;
234 unsigned int arrConvIter;
251 int localComparisonBandLim;
253 std::vector< std::vector< std::vector< std::array<double,2> > > > wignerMatricesHlp;
254 std::vector< std::vector< std::array<double,2> > > wignerMatricesHlpHlp;
256 for (
unsigned int strIt = 0; strIt < static_cast<unsigned int> ( this->all->size() ); strIt++ )
265 angAlpha = this->_eulerAngles.at(strIt)[0];
266 angBeta = this->_eulerAngles.at(strIt)[1];
267 angGamma = this->_eulerAngles.at(strIt)[2];
269 wignerMatricesHlp.clear ( );
270 wignerMatricesHlpHlp.clear ( );
273 localComparisonBandLim = std::min ( this->one->_bandwidthLimit, this->all->at(strIt)->_bandwidthLimit );
276 double *matIn =
new double[
static_cast<unsigned int> ( 4 * pow( localComparisonBandLim, 2.0 ) - 4 * localComparisonBandLim + 1 )];
277 double *matOut =
new double[
static_cast<unsigned int> ( 4 * pow( localComparisonBandLim, 2.0 ) - 4 * localComparisonBandLim + 1 )];
278 double *sqrts =
new double[
static_cast<unsigned int> ( 2 * localComparisonBandLim )];
279 double *workspace =
new double[
static_cast<unsigned int> ( 4 * pow( localComparisonBandLim, 2.0 ) )];
280 double *exponentAlphaReal =
new double[
static_cast<unsigned int> ( 2 * localComparisonBandLim - 1 )];
281 double *exponentAlphaImag =
new double[
static_cast<unsigned int> ( 2 * localComparisonBandLim - 1 )];
282 double *exponentGammaReal =
new double[
static_cast<unsigned int> ( 2 * localComparisonBandLim - 1 )];
283 double *exponentGammaImag =
new double[
static_cast<unsigned int> ( 2 * localComparisonBandLim - 1 )];
286 for (
unsigned int iter = 0; iter < static_cast<unsigned int> ( 2 * localComparisonBandLim ); iter++ )
288 sqrts[iter] =
static_cast<double> ( sqrt ( static_cast<double> ( iter ) ) );
292 trigVals[0] =
static_cast<double> ( cos ( 0.5 * -angBeta ) );
293 trigVals[1] =
static_cast<double> ( sin ( 0.5 * -angBeta ) );
296 genExp ( localComparisonBandLim, angAlpha, exponentAlphaReal, exponentAlphaImag );
297 genExp ( localComparisonBandLim, angGamma, exponentGammaReal, exponentGammaImag );
300 for (
int bandIter = 0; bandIter < localComparisonBandLim; bandIter++ )
303 noOrders = 2 * bandIter + 1;
307 expARStart = &exponentAlphaReal[ (localComparisonBandLim - 1) - bandIter ];
308 expAIStart = &exponentAlphaImag[ (localComparisonBandLim - 1) - bandIter ];
309 expGRStart = &exponentGammaReal[ (localComparisonBandLim - 1) - bandIter ];
310 expGIStart = &exponentGammaImag[ (localComparisonBandLim - 1) - bandIter ];
315 wignerMatricesHlpHlp = std::vector< std::vector< std::array<double,2> > > ( noOrders );
316 for (
unsigned int iter = 0; iter < noOrders; iter++ )
318 wignerMatricesHlpHlp.at(iter) = std::vector< std::array<double,2> > ( noOrders );
322 wignerdmat ( bandIter, matIn, matOut, trigVals, sqrts, workspace );
325 for (
unsigned int d1Iter = 0; d1Iter < noOrders; d1Iter++ )
327 eARi = expARStart[d1Iter];
328 eAIi = expAIStart[d1Iter];
330 for (
unsigned int d2Iter = 0; d2Iter < noOrders; d2Iter++ )
332 Dij = matOut[arrConvIter];
333 eGRj = expGRStart[d2Iter];
334 eGIj = expGIStart[d2Iter];
336 wignerMatricesHlpHlp.at(d1Iter).at(d2Iter)[0] = ( Dij * eGRj * eARi - Dij * eGIj * eAIi ) * rSign;
337 wignerMatricesHlpHlp.at(d1Iter).at(d2Iter)[1] = ( Dij * eGRj * eAIi + Dij * eGIj * eARi ) * iSign;
346 memcpy ( matIn, matOut,
sizeof (
double ) * ( noOrders * noOrders ) );
349 wignerMatricesHlp.emplace_back ( wignerMatricesHlpHlp );
357 delete[] exponentAlphaReal;
358 delete[] exponentAlphaImag;
359 delete[] exponentGammaReal;
360 delete[] exponentGammaImag;
363 this->_wignerMatrices.emplace_back ( wignerMatricesHlp );
367 this->_wignerMatricesComputed =
true;
void generateWignerMatrices(ProSHADE::ProSHADE_settings *settings)
This function is responsible for computing the Wigner D matrices for symmetry detection purposes...
void generateWignerMatrices(ProSHADE::ProSHADE_settings *settings)
This function is responsible for computing the Wigner D matrices for full rotation function distance ...
bool htmlReport
Should HTML report for the run be created?
The main header file containing all declarations the user of the library needs.
The main header file containing all declarations for the innter workings of the library.
int htmlReportLineProgress
Iterator for current HTML line in the progress bar.
This class stores all the settings and is passed to the executive classes instead of multitude of par...