![]() |
ProSHADE
0.7.6.1 (AUG 2021)
Protein Shape Detection
|
This namespace contains the internal functions for common mathematical operations. More...
Classes | |
class | BicubicInterpolator |
Functions | |
void | complexMultiplication (proshade_double *r1, proshade_double *i1, proshade_double *r2, proshade_double *i2, proshade_double *retReal, proshade_double *retImag) |
Function to multiply two complex numbers. More... | |
void | complexMultiplicationConjug (proshade_double *r1, proshade_double *i1, proshade_double *r2, proshade_double *i2, proshade_double *retReal, proshade_double *retImag) |
Function to multiply two complex numbers by using the second number's conjugate. More... | |
proshade_double | complexMultiplicationRealOnly (proshade_double *r1, proshade_double *i1, proshade_double *r2, proshade_double *i2) |
Function to multiply two complex numbers and return the real part only. More... | |
proshade_double | complexMultiplicationConjugRealOnly (proshade_double *r1, proshade_double *i1, proshade_double *r2, proshade_double *i2) |
Function to conjuggate multiply two complex numbers and return the real part only. More... | |
void | vectorMeanAndSD (std::vector< proshade_double > *vec, proshade_double *&ret) |
Function to get vector mean and standard deviation. More... | |
void | vectorMedianAndIQR (std::vector< proshade_double > *vec, proshade_double *&ret) |
Function to get vector median and inter-quartile range. More... | |
void | arrayMedianAndIQR (proshade_double *vec, proshade_unsign vecSize, proshade_double *&ret) |
Function to get array median and inter-quartile range. More... | |
proshade_double | pearsonCorrCoeff (proshade_double *valSet1, proshade_double *valSet2, proshade_unsign length) |
Function for computing the Pearson's correlation coefficient. More... | |
void | getLegendreAbscAndWeights (proshade_unsign order, proshade_double *abscissas, proshade_double *weights, proshade_unsign taylorSeriesCap) |
Function to prepare abscissas and weights for Gauss-Legendre integration. More... | |
void | getGLPolyAtZero (proshade_unsign order, proshade_double *polyValue, proshade_double *deriValue) |
This function obtains the Legendre polynomial values and its derivative at zero for any positive integer order polynomial. More... | |
void | getGLFirstEvenRoot (proshade_double polyAtZero, proshade_unsign order, proshade_double *abscAtZero, proshade_double *weighAtZero, proshade_unsign taylorSeriesCap) |
This function finds the first root for Legendre polynomials of odd order. More... | |
proshade_double | evaluateGLSeries (proshade_double *series, proshade_double target, proshade_unsign terms) |
This function evaluates the Taylor expansion. More... | |
proshade_double | advanceGLPolyValue (proshade_double from, proshade_double to, proshade_double valAtFrom, proshade_unsign noSteps, proshade_unsign taylorSeriesCap) |
This function finds the next value of the polynomial. More... | |
void | completeLegendreSeries (proshade_unsign order, proshade_double *abscissa, proshade_double *weights, proshade_unsign taylorSeriesCap) |
This function completes the Legendre polynomial series assuming you have obtained the first values. More... | |
proshade_double | gaussLegendreIntegrationReal (proshade_double *vals, proshade_unsign valsSize, proshade_unsign order, proshade_double *abscissas, proshade_double *weights, proshade_double integralOverRange, proshade_double maxSphereDists) |
Function to compute real part of the Gauss-Legendre integration over spherical harmonic values in different shells. More... | |
void | gaussLegendreIntegration (proshade_complex *vals, proshade_unsign valsSize, proshade_unsign order, proshade_double *abscissas, proshade_double *weights, proshade_double integralOverRange, proshade_double maxSphereDists, proshade_double *retReal, proshade_double *retImag) |
Function to compute the complete complex Gauss-Legendre integration over spherical harmonic values in different shells. More... | |
void | complexMatrixSVDSigmasOnly (proshade_complex **mat, int dim, double *&singularValues) |
Function to compute the complete complex matrix SVD and return only the sigmas. More... | |
void | complexMatrixSVDUandVOnly (proshade_double *mat, int dim, proshade_double *uAndV, bool fail=true) |
Function to compute the real matrix SVD and return the U and V matrices. More... | |
void | getEulerZXZFromSOFTPosition (proshade_signed band, proshade_signed x, proshade_signed y, proshade_signed z, proshade_double *eulerAlpha, proshade_double *eulerBeta, proshade_double *eulerGamma) |
Function to find Euler angles (ZXZ convention) from index position in the inverse SOFT map. More... | |
void | getSOFTPositionFromEulerZXZ (proshade_signed band, proshade_double eulerAlpha, proshade_double eulerBeta, proshade_double eulerGamma, proshade_double *x, proshade_double *y, proshade_double *z) |
Function to find the index position in the inverse SOFT map from given Euler angles (ZXZ convention). More... | |
void | getRotationMatrixFromEulerZXZAngles (proshade_double eulerAlpha, proshade_double eulerBeta, proshade_double eulerGamma, proshade_double *matrix) |
Function to find the rotation matrix from Euler angles (ZXZ convention). More... | |
void | getRotationMatrixFromEulerZXZAngles (proshade_single eulerAlpha, proshade_single eulerBeta, proshade_single eulerGamma, proshade_single *matrix) |
Function to find the rotation matrix from Euler angles (ZXZ convention). More... | |
void | getAxisAngleFromRotationMatrix (proshade_double *rotMat, proshade_double *x, proshade_double *y, proshade_double *z, proshade_double *ang) |
This function converts rotation matrix to the axis-angle representation. More... | |
void | getAxisAngleFromRotationMatrix (std::vector< proshade_double > *rotMat, proshade_double *x, proshade_double *y, proshade_double *z, proshade_double *ang) |
This function converts rotation matrix to the axis-angle representation. More... | |
void | getRotationMatrixFromAngleAxis (proshade_double *rotMat, proshade_double x, proshade_double y, proshade_double z, proshade_double ang) |
This function converts the axis-angle representation to the rotation matrix representation. More... | |
void | getRotationMatrixFromAngleAxis (proshade_single *rotMat, proshade_double x, proshade_double y, proshade_double z, proshade_double ang) |
This function converts the axis-angle representation to the rotation matrix representation. More... | |
void | getEulerZXZFromRotMatrix (proshade_double *rotMat, proshade_double *eA, proshade_double *eB, proshade_double *eG) |
This function converts rotation matrix to the Euler ZXZ angles representation. More... | |
void | getEulerZXZFromAngleAxis (proshade_double axX, proshade_double axY, proshade_double axZ, proshade_double axAng, proshade_double *eA, proshade_double *eB, proshade_double *eG) |
This function converts angle-axis representation to the Euler ZXZ angles representation. More... | |
void | multiplyTwoSquareMatrices (proshade_double *A, proshade_double *B, proshade_double *res, proshade_unsign dim=3) |
Function to compute matrix multiplication. More... | |
std::vector< proshade_signed > | primeFactorsDecomp (proshade_signed number) |
Function to find prime factors of an integer. More... | |
proshade_double | normalDistributionValue (proshade_double mean, proshade_double standardDev, proshade_double value) |
Function to the heiht of normal distribution given by mean and standard deviation for a given value. More... | |
proshade_double | computeDotProduct (proshade_double *x1, proshade_double *y1, proshade_double *z1, proshade_double *x2, proshade_double *y2, proshade_double *z2) |
Simple 3D vector dot product computation. More... | |
proshade_double | computeDotProduct (proshade_double x1, proshade_double y1, proshade_double z1, proshade_double x2, proshade_double y2, proshade_double z2) |
Simple 3D vector dot product computation. More... | |
proshade_double * | computeCrossProduct (proshade_double *x1, proshade_double *y1, proshade_double *z1, proshade_double *x2, proshade_double *y2, proshade_double *z2) |
Simple 3D vector cross product computation. More... | |
proshade_double * | compute3x3MatrixMultiplication (proshade_double *mat1, proshade_double *mat2) |
Function for computing a 3x3 matrix multiplication. More... | |
proshade_double * | compute3x3MatrixVectorMultiplication (proshade_double *mat, proshade_double x, proshade_double y, proshade_double z) |
Function for computing a 3x3 matrix to 3x1 vector multiplication. More... | |
proshade_single * | compute3x3MatrixVectorMultiplication (proshade_single *mat, proshade_single x, proshade_single y, proshade_single z) |
Function for computing a 3x3 matrix to 3x1 vector multiplication. More... | |
proshade_double * | compute3x3MatrixInverse (proshade_double *mat) |
Function for computing a 3x3 matrix inverse. More... | |
void | transpose3x3MatrixInPlace (proshade_double *mat) |
Transposes 3x3 matrix in place. More... | |
proshade_double * | findRotMatMatchingVectors (proshade_double x1, proshade_double y1, proshade_double z1, proshade_double x2, proshade_double y2, proshade_double z2) |
Computation of rotation matrix rotating one vector onto the other. More... | |
std::vector< proshade_double > | findVectorFromTwoVAndTwoD (proshade_double x1, proshade_double y1, proshade_double z1, proshade_double x2, proshade_double y2, proshade_double z2, proshade_double dot1, proshade_double dot2) |
Function for finding a vector which would have a given two dot products to two other vectors. More... | |
std::vector< proshade_double > | findVectorFromThreeVAndThreeD (proshade_double x1, proshade_double y1, proshade_double z1, proshade_double x2, proshade_double y2, proshade_double z2, proshade_double x3, proshade_double y3, proshade_double z3, proshade_double dot1, proshade_double dot2, proshade_double dot3) |
Function for finding a vector which would have a given three dot products to three other vectors. More... | |
std::vector< proshade_double > | multiplyGroupElementMatrices (std::vector< proshade_double > *el1, std::vector< proshade_double > *el2) |
This function computes matrix multiplication using the ProSHADE group element matrix format as input and output. More... | |
bool | rotationMatrixSimilarity (std::vector< proshade_double > *mat1, std::vector< proshade_double > *mat2, proshade_double tolerance=0.1) |
This function compares the distance between two rotation matrices and decides if they are similar using tolerance. More... | |
bool | vectorOrientationSimilarity (proshade_double a1, proshade_double a2, proshade_double a3, proshade_double b1, proshade_double b2, proshade_double b3, proshade_double tolerance=0.1) |
This function compares two vectors using cosine distance and decides if they are similar using tolerance. More... | |
bool | vectorOrientationSimilaritySameDirection (proshade_double a1, proshade_double a2, proshade_double a3, proshade_double b1, proshade_double b2, proshade_double b3, proshade_double tolerance=0.1) |
This function compares two vectors using cosine distance and decides if they are similar using tolerance. More... | |
void | optimiseAxisBiCubicInterpolation (proshade_double *bestLattitude, proshade_double *bestLongitude, proshade_double *bestSum, std::vector< proshade_unsign > *sphereList, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > *sphereMappedRotFun, proshade_double step=0.05) |
This function provides axis optimisation given starting lattitude and longitude indices. More... | |
void | prepareBiCubicInterpolatorsMinusMinus (proshade_double bestLattitude, proshade_double bestLongitude, std::vector< proshade_unsign > *sphereList, std::vector< ProSHADE_internal_maths::BicubicInterpolator * > *interpols, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > *sphereMappedRotFun) |
This function prepares the interpolation objects for the bi-cubic interpolation. More... | |
void | prepareBiCubicInterpolatorsMinusPlus (proshade_double bestLattitude, proshade_double bestLongitude, std::vector< proshade_unsign > *sphereList, std::vector< ProSHADE_internal_maths::BicubicInterpolator * > *interpols, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > *sphereMappedRotFun) |
This function prepares the interpolation objects for the bi-cubic interpolation. More... | |
void | prepareBiCubicInterpolatorsPlusMinus (proshade_double bestLattitude, proshade_double bestLongitude, std::vector< proshade_unsign > *sphereList, std::vector< ProSHADE_internal_maths::BicubicInterpolator * > *interpols, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > *sphereMappedRotFun) |
This function prepares the interpolation objects for the bi-cubic interpolation. More... | |
void | prepareBiCubicInterpolatorsPlusPlus (proshade_double bestLattitude, proshade_double bestLongitude, std::vector< proshade_unsign > *sphereList, std::vector< ProSHADE_internal_maths::BicubicInterpolator * > *interpols, std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > *sphereMappedRotFun) |
This function prepares the interpolation objects for the bi-cubic interpolation. More... | |
bool | isAxisUnique (std::vector< proshade_double * > *CSymList, proshade_double *axis, proshade_double tolerance=0.1, bool improve=false) |
This function checks if new axis is unique, or already detected. More... | |
bool | isAxisUnique (std::vector< proshade_double * > *CSymList, proshade_double X, proshade_double Y, proshade_double Z, proshade_double fold, proshade_double tolerance) |
This function checks if new axis is unique, or already detected. More... | |
std::vector< proshade_unsign > | findAllPrimes (proshade_unsign upTo) |
This function finds all prime numbers up to the supplied limit. More... | |
proshade_double | computeGaussian (proshade_double val, proshade_double sigma) |
This function computes a Gaussian (normal) distribution value given distance from mean and sigma. More... | |
std::vector< proshade_double > | smoothen1D (proshade_double step, proshade_signed windowSize, proshade_double sigma, std::vector< proshade_double > data) |
This function takes a 1D vector and computes smoothened version based on the parameters. More... | |
proshade_single | getResolutionOfReflection (proshade_single h, proshade_single k, proshade_single l, proshade_single xDim, proshade_single yDim, proshade_single zDim) |
This function computes the resolution of a particular reflection. More... | |
void | binReciprocalSpaceReflections (proshade_unsign xInds, proshade_unsign yInds, proshade_unsign zInds, proshade_signed *noBin, proshade_signed *&binIndexing) |
This function does binning of the reciprocal space reflections. More... | |
proshade_double | computeFSC (fftw_complex *fCoeffs1, fftw_complex *fCoeffs2, proshade_unsign xInds, proshade_unsign yInds, proshade_unsign zInds, proshade_signed noBins, proshade_signed *binIndexing, proshade_double **&binData, proshade_signed *&binCounts) |
This function computes the FSC. More... | |
This namespace contains the internal functions for common mathematical operations.
The ProSHADE_internal_maths namespace contains a set of common mathematical operations used in many places by ProSHADE. These typically include complex number operations and angle conversions.
proshade_double ProSHADE_internal_maths::advanceGLPolyValue | ( | proshade_double | from, |
proshade_double | to, | ||
proshade_double | valAtFrom, | ||
proshade_unsign | noSteps, | ||
proshade_unsign | taylorSeriesCap | ||
) |
This function finds the next value of the polynomial.
Given the previous value of the polynomial, the distance to proceed and the number of steps to take, this function finds the next value of the polynomial using the Taylor series.
[in] | from | Current polynomial position. |
[in] | to | Polynomial position to move to. |
[in] | valAtFrom | The current value of the polynomial at the <from> position. |
[in] | noSteps | Number of steps in which to reach the <to> position. |
[in] | taylorSeriesCap | The limit on the Taylor series. |
[out] | X | The polynomial value at the <to> position. |
Definition at line 479 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::arrayMedianAndIQR | ( | proshade_double * | vec, |
proshade_unsign | vecSize, | ||
proshade_double *& | ret | ||
) |
Function to get array median and inter-quartile range.
This function takes a pointer to a array of proshade_double's and returns the median and the inter-quartile range of such vector.
[in] | vec | Pointer to an array of proshade_double's for which median and IQR should be obtained. |
[in] | vecSize | The length of the array. |
[in] | ret | Pointer to array of 2 proshade_double's, which will be the return values - first median and second IQR. |
Definition at line 200 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::binReciprocalSpaceReflections | ( | proshade_unsign | xInds, |
proshade_unsign | yInds, | ||
proshade_unsign | zInds, | ||
proshade_signed * | noBin, | ||
proshade_signed *& | binIndexing | ||
) |
This function does binning of the reciprocal space reflections.
This funcion uses the knowledge of the cell dimensions to firstly decide which dimension is the limitting one in terms of FSC binning and then it proceeds to compute the bins, their positions in terms of distance from F000. Finally, it uses this information to compute a "mask" map, where each position has the value corresponding to the appropriate bin index, thus allowing fast binning of any map with the same dimensions as supplied to this function.
[in] | xInds | The number of indices along the x-axis. |
[in] | yInds | The number of indices along the y-axis. |
[in] | zInds | The number of indices along the z-axis. |
[in] | noBin | Variable to which the number of binds found will be saved into. |
[in] | binIndexing | A pointer to which the map of bin belonging for each reflection will be saved into. |
Definition at line 2939 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::completeLegendreSeries | ( | proshade_unsign | order, |
proshade_double * | abscissas, | ||
proshade_double * | weights, | ||
proshade_unsign | taylorSeriesCap | ||
) |
This function completes the Legendre polynomial series assuming you have obtained the first values.
Given that the polynomial value at zero is known, this function will complete the Legendre polynomial and with it the absicassas and weights for the Gauss-Legendre integration using the other functions defined above.
[in] | order | The positive integer value of the polynomial order. |
[in] | abscissas | Pointer to an array of abscissas containing the first value. |
[in] | weights | Pointer to an array of weights containing the first value. |
[in] | taylorSeriesCap | The limit on the Taylor series. |
Definition at line 523 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::complexMatrixSVDSigmasOnly | ( | proshade_complex ** | mat, |
int | dim, | ||
double *& | singularValues | ||
) |
Function to compute the complete complex matrix SVD and return only the sigmas.
This function converts the input proshade_complex matrix of dimensions dim onto the LAPACK compatible std::complex<double> matrix. It then proceeds to create a dummy variables for the U and V matrices for saving the SVD results as well as other required variables. It finally proceeds to call LAPACK ZGESDD function to compute the SVD of the complex matrix input, checks the results and terminates. Note that this function does not make use of most of the LAPACK capabilities and is limitted onto square matrices.
[in] | mat | Pointer to a complex square matrix with dimensions dim * dim. |
[in] | dim | The dimension of the complex matrix. |
[in] | singularValues | Empty array of size dim where the singular values will be saved. |
Definition at line 804 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::complexMatrixSVDUandVOnly | ( | proshade_double * | mat, |
int | dim, | ||
proshade_double * | uAndV, | ||
bool | fail = true |
||
) |
Function to compute the real matrix SVD and return the U and V matrices.
This function converts the input proshade_double array of dimensions dim*dim onto the LAPACK compatible std::complex<double> matrix. It then proceeds to create a dummy variables for the U and V matrices for saving the SVD results as well as other required variables. It finally proceeds to call LAPACK ZGESDD function to compute the SVD of the real matrix input, checks the results and saves the U and V matrices for output. Note that this function does not make use of most of the LAPACK capabilities and is limitted onto square matrices.
[in] | mat | Pointer to a real square matrix with dimensions dim * dim. |
[in] | dim | The dimension of the real matrix. |
[in] | uAndV | Empty and allocated array of size dim*6 where the U and V matrices will be saved. |
[in] | fail | If true and an error is encountered (typically algorithm not converging), this function will stop the program (useful for distances computations). However, if false, the function will simply return -777 as the first matrix element and not fail. |
Definition at line 871 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::complexMultiplication | ( | proshade_double * | r1, |
proshade_double * | i1, | ||
proshade_double * | r2, | ||
proshade_double * | i2, | ||
proshade_double * | retReal, | ||
proshade_double * | retImag | ||
) |
Function to multiply two complex numbers.
This function takes pointers to the real and imaginary parts of two complex numbers and returns the result of their multiplication.
[in] | r1 | Pointer to the real value of number 1. |
[in] | i1 | Pointer to the imaginary value of number 1. |
[in] | r2 | Pointer to the real value of number 2. |
[in] | i2 | Pointer to the imaginary value of number 2. |
[in] | retReal | Pointer to the real part of the complex variable to which the result will be saved. |
[in] | retImag | Pointer to the imaginary part of the complex variable to which the result will be saved. |
Definition at line 38 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::complexMultiplicationConjug | ( | proshade_double * | r1, |
proshade_double * | i1, | ||
proshade_double * | r2, | ||
proshade_double * | i2, | ||
proshade_double * | retReal, | ||
proshade_double * | retImag | ||
) |
Function to multiply two complex numbers by using the second number's conjugate.
This function takes pointers to the real and imaginary parts of two complex numbers and returns the result of their multiplication, while using the conjugate of the second complex number.
[in] | r1 | Pointer to the real value of number 1. |
[in] | i1 | Pointer to the imaginary value of number 1. |
[in] | r2 | Pointer to the real value of number 2. |
[in] | i2 | Pointer to the imaginary value of number 2. |
[in] | retReal | Pointer to the real part of the complex variable to which the result will be saved. |
[in] | retImag | Pointer to the imaginary part of the complex variable to which the result will be saved. |
Definition at line 62 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::complexMultiplicationConjugRealOnly | ( | proshade_double * | r1, |
proshade_double * | i1, | ||
proshade_double * | r2, | ||
proshade_double * | i2 | ||
) |
Function to conjuggate multiply two complex numbers and return the real part only.
This function takes pointers to the real and imaginary parts of two complex numbers and returns the real part of the result of their conjugate multiplication.
[in] | r1 | Pointer to the real value of number 1. |
[in] | i1 | Pointer to the imaginary value of number 1. |
[in] | r2 | Pointer to the real value of number 2. |
[in] | i2 | Pointer to the imaginary value of number 2. |
Definition at line 103 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::complexMultiplicationRealOnly | ( | proshade_double * | r1, |
proshade_double * | i1, | ||
proshade_double * | r2, | ||
proshade_double * | i2 | ||
) |
Function to multiply two complex numbers and return the real part only.
This function takes pointers to the real and imaginary parts of two complex numbers and returns the real part of the result of their multiplication.
[in] | r1 | Pointer to the real value of number 1. |
[in] | i1 | Pointer to the imaginary value of number 1. |
[in] | r2 | Pointer to the real value of number 2. |
[in] | i2 | Pointer to the imaginary value of number 2. |
Definition at line 83 of file ProSHADE_maths.cpp.
proshade_double * ProSHADE_internal_maths::compute3x3MatrixInverse | ( | proshade_double * | mat | ) |
Function for computing a 3x3 matrix inverse.
[in] | mat | The matrix to be inverted. |
[out] | inverse | The inverse of matrix mat. |
Definition at line 1902 of file ProSHADE_maths.cpp.
proshade_double * ProSHADE_internal_maths::compute3x3MatrixMultiplication | ( | proshade_double * | mat1, |
proshade_double * | mat2 | ||
) |
Function for computing a 3x3 matrix multiplication.
[in] | mat1 | The matrix to multiply mat2. |
[in] | mat2 | The matrix to be multiplied by mat1. |
[out] | ret | The matrix resulting from matrix multiplication of mat1 and mat2 in this order. |
Definition at line 1827 of file ProSHADE_maths.cpp.
proshade_double * ProSHADE_internal_maths::compute3x3MatrixVectorMultiplication | ( | proshade_double * | mat, |
proshade_double | x, | ||
proshade_double | y, | ||
proshade_double | z | ||
) |
Function for computing a 3x3 matrix to 3x1 vector multiplication.
[in] | mat | The matrix to multiply the vector with.. |
[in] | x | The x-axis element of the vector which is to be multiplied by the matrix. |
[in] | y | The x-axis element of the vector which is to be multiplied by the matrix. |
[in] | z | The x-axis element of the vector which is to be multiplied by the matrix. |
[out] | ret | The vector resulting from matrix multiplication of mat and the vector in this order. |
Definition at line 1857 of file ProSHADE_maths.cpp.
proshade_single * ProSHADE_internal_maths::compute3x3MatrixVectorMultiplication | ( | proshade_single * | mat, |
proshade_single | x, | ||
proshade_single | y, | ||
proshade_single | z | ||
) |
Function for computing a 3x3 matrix to 3x1 vector multiplication.
[in] | mat | The matrix to multiply the vector with.. |
[in] | x | The x-axis element of the vector which is to be multiplied by the matrix. |
[in] | y | The x-axis element of the vector which is to be multiplied by the matrix. |
[in] | z | The x-axis element of the vector which is to be multiplied by the matrix. |
[out] | ret | The vector resulting from matrix multiplication of mat and the vector in this order. |
Definition at line 1881 of file ProSHADE_maths.cpp.
proshade_double * ProSHADE_internal_maths::computeCrossProduct | ( | proshade_double * | x1, |
proshade_double * | y1, | ||
proshade_double * | z1, | ||
proshade_double * | x2, | ||
proshade_double * | y2, | ||
proshade_double * | z2 | ||
) |
Simple 3D vector cross product computation.
[in] | x1 | The x-axis element of the first vector. |
[in] | y1 | The y-axis element of the first vector. |
[in] | z1 | The z-axis element of the first vector. |
[in] | x2 | The x-axis element of the second vector. |
[in] | y2 | The y-axis element of the second vector. |
[in] | z2 | The z-axis element of the second vector. |
[out] | crossProd | The vector representing the cross product of the two input vectors. |
Definition at line 1805 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::computeDotProduct | ( | proshade_double * | x1, |
proshade_double * | y1, | ||
proshade_double * | z1, | ||
proshade_double * | x2, | ||
proshade_double * | y2, | ||
proshade_double * | z2 | ||
) |
Simple 3D vector dot product computation.
[in] | x1 | The x-axis element of the first vector. |
[in] | y1 | The y-axis element of the first vector. |
[in] | z1 | The z-axis element of the first vector. |
[in] | x2 | The x-axis element of the second vector. |
[in] | y2 | The y-axis element of the second vector. |
[in] | z2 | The z-axis element of the second vector. |
[out] | X | The dot product of the two input vectors. |
Definition at line 1773 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::computeDotProduct | ( | proshade_double | x1, |
proshade_double | y1, | ||
proshade_double | z1, | ||
proshade_double | x2, | ||
proshade_double | y2, | ||
proshade_double | z2 | ||
) |
Simple 3D vector dot product computation.
[in] | x1 | The x-axis element of the first vector. |
[in] | y1 | The y-axis element of the first vector. |
[in] | z1 | The z-axis element of the first vector. |
[in] | x2 | The x-axis element of the second vector. |
[in] | y2 | The y-axis element of the second vector. |
[in] | z2 | The z-axis element of the second vector. |
[out] | X | The dot product of the two input vectors. |
Definition at line 1789 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::computeFSC | ( | fftw_complex * | fCoeffs1, |
fftw_complex * | fCoeffs2, | ||
proshade_unsign | xInds, | ||
proshade_unsign | yInds, | ||
proshade_unsign | zInds, | ||
proshade_signed | noBins, | ||
proshade_signed * | binIndexing, | ||
proshade_double **& | binData, | ||
proshade_signed *& | binCounts | ||
) |
This function computes the FSC.
This funcion computes the Fourier Shell Correlation weighted average from two identically sized arrays of Fourier coefficients. It requires these to have been pre-computed as well as the number of bins and bin mapping to be pre-computed (using the binReciprocalSpaceReflections function). Given all these inputs, this function simply computes all the required sums for each bin, processes them and outputs the weighted average FSC over all bins.
[in] | fCoeffs1 | The Fourier coefficients of the first map. |
[in] | fCoeffs2 | The Fourier coefficients of the second map. |
[in] | xInds | The number of indices along the x-axis. |
[in] | yInds | The number of indices along the y-axis. |
[in] | zInds | The number of indices along the z-axis. |
[in] | noBin | Number of bins. |
[in] | binIndexing | The map of bin belonging for each reflection. |
[in] | binData | Array of arrays for holding temporary results of the FSC computation. It needs to have been already allocated and have dimensions of noBins x 12. This array is modified by the function in case the caller would like access to these. |
[in] | binCounts | Array of counts for each bin. It needs to be pre-allocated and have dimension of noBins. This array is modified by the function in case the caller would like access to these. |
[out] | fsc | The Fourier Shell Correlation between the two supplied Fourier coefficient maps. |
Definition at line 3086 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::computeGaussian | ( | proshade_double | val, |
proshade_double | sigma | ||
) |
This function computes a Gaussian (normal) distribution value given distance from mean and sigma.
This function simply returns the height of a normal distribution with a given sigma for a value specific distance from the mean.
[in] | val | The distance from the mean for which the Gaussian height should be computed. |
[in] | sigma | The standard deviation of the Gaussian for which the computation is done. |
[out] | height | The height of the Gaussian distribution as desctibed by the sigma. |
Definition at line 2843 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::evaluateGLSeries | ( | proshade_double * | series, |
proshade_double | target, | ||
proshade_unsign | terms | ||
) |
This function evaluates the Taylor expansion.
This function takes the series array, the target value and the cap on Taylor expansion and proceeds to evaluate the series. The main use of this is to evaluate the series twice, one where the series evaluation 'overshoots' and once where it 'undershoots' and taking value in between those, thus adding accuracy.
[in] | series | Pointer to array with the series values. |
[in] | target | The target location on the series value. |
[in] | terms | The Taylor expansion cap. |
[out] | X | The value of the series at the target location. |
Definition at line 449 of file ProSHADE_maths.cpp.
std::vector< proshade_unsign > ProSHADE_internal_maths::findAllPrimes | ( | proshade_unsign | upTo | ) |
This function finds all prime numbers up to the supplied limit.
This function uses the sieve of Eratosthenes algorithm to find all prime numbers from 2 to the supplied limit. This is not the fastest algorithm and it may become slow when the limit is high, but it is fine for small numbers and given that we will use it for symmetry folds, which should not got much over 20, this should be more than fast enough.
[in] | upTo | The limit to which prime numbers should be sought. |
Definition at line 2798 of file ProSHADE_maths.cpp.
proshade_double * ProSHADE_internal_maths::findRotMatMatchingVectors | ( | proshade_double | x1, |
proshade_double | y1, | ||
proshade_double | z1, | ||
proshade_double | x2, | ||
proshade_double | y2, | ||
proshade_double | z2 | ||
) |
Computation of rotation matrix rotating one vector onto the other.
This function starts by normalising both input vectors to have magnitude of 1.0. Then, it computes the cosine and sine of the angle between the two vectors (using the magnitude of the cross product and the dot product); these are then sufficient to build the rotation matrix for rotation in plane on which both of the vectors lie.
It then proceeds to compute the change of basis matrix and its inverse, which are in turn sufficient to to compute the rotation matrix in the original basis. This rotation matrix is then returned.
[in] | x1 | The x-axis element of the first vector. |
[in] | y1 | The y-axis element of the first vector. |
[in] | z1 | The z-axis element of the first vector. |
[in] | x2 | The x-axis element of the second vector. |
[in] | y2 | The y-axis element of the second vector. |
[in] | z2 | The z-axis element of the second vector. |
[out] | rotMat | Rotation matrix optimally rotating x1 ; y1 ; z1 to match x2 ; y2 ; z2. |
Definition at line 1975 of file ProSHADE_maths.cpp.
std::vector< proshade_double > ProSHADE_internal_maths::findVectorFromThreeVAndThreeD | ( | proshade_double | x1, |
proshade_double | y1, | ||
proshade_double | z1, | ||
proshade_double | x2, | ||
proshade_double | y2, | ||
proshade_double | z2, | ||
proshade_double | x3, | ||
proshade_double | y3, | ||
proshade_double | z3, | ||
proshade_double | dot1, | ||
proshade_double | dot2, | ||
proshade_double | dot3 | ||
) |
Function for finding a vector which would have a given three dot products to three other vectors.
This function takes three vectors and three dot product values. It then basically solves the following set of equations for x, y and z:
solX*x1 + solY*y1 + solZ*z1 = dot1 solX*x2 + solY*y2 + solZ*z2 = dot2 solX*x3 + solY*y3 + solZ*z3 = dot3
This should result in a vector, which has the required angles to all input vectors and is normalised (this is done later as part of this function). The equations are courtesy of https://www.wolframalpha.com/input/?i=Solve%5B%7Ba+x+%2B+b+y+%2B+c+z+%3D%3D+f%2C+u+x+%2B+v+y+%2B+w+z+%3D%3D+g%2C+k+x+%2B+l+y+%2B+m+z+%3D%3D+h%7D%2C+%7Bx%2C+y%2C+z%7D%5D webpage of Wolfram Alpha. If in doubt, do not fear to derive yourself :-).
[in] | x1 | The x-axis element of the first vector. |
[in] | y1 | The y-axis element of the first vector. |
[in] | z1 | The z-axis element of the first vector. |
[in] | x2 | The x-axis element of the second vector. |
[in] | y2 | The y-axis element of the second vector. |
[in] | z2 | The z-axis element of the second vector. |
[in] | dot1 | The dot product specifying the angle between the sought vector and the first input vector. |
[in] | dot2 | The dot product specifying the angle between the sought vector and the second input vectors. |
[out] | vec | A std::vector containing the three elements of the sought vector. |
Definition at line 2197 of file ProSHADE_maths.cpp.
std::vector< proshade_double > ProSHADE_internal_maths::findVectorFromTwoVAndTwoD | ( | proshade_double | x1, |
proshade_double | y1, | ||
proshade_double | z1, | ||
proshade_double | x2, | ||
proshade_double | y2, | ||
proshade_double | z2, | ||
proshade_double | dot1, | ||
proshade_double | dot2 | ||
) |
Function for finding a vector which would have a given two dot products to two other vectors.
This function takes two vectors and two dot product values. It then basically solves the following set of equations for x, y and z:
solX*x1 + solY*y1 + solZ*z1 = dot1 solX*x2 + solY*y2 + solZ*z2 = dot2 sqrt ( solX^2 + solY^2 + solZ^2 ) = 1.0
This should result in a vector, which has the required angles to both input vectors and is normalised (this is done by the third equation, which is required to obtain system of three equations with three unkonwns). The equations are courtesy of https://www.wolframalpha.com/input/?i=Solve%5B%7Ba+x+%2B+b+y+%2B+c+z+%3D%3D+f%2C+k+x+%2B+l+y+%2B+m+z+%3D%3D+g%2C+Sqrt%5Bx%5E2+%2B+y%5E2+%2B+z%5E2%5D+%3D%3D+1%7D%2C+%7Bx%2C+y%2C+z%7D%5D webpage of Wolfram Alpha. If in doubt, do not fear to derive yourself :-).
[in] | x1 | The x-axis element of the first vector. |
[in] | y1 | The y-axis element of the first vector. |
[in] | z1 | The z-axis element of the first vector. |
[in] | x2 | The x-axis element of the second vector. |
[in] | y2 | The y-axis element of the second vector. |
[in] | z2 | The z-axis element of the second vector. |
[in] | dot1 | The dot product specifying the angle between the sought vector and the first input vector. |
[in] | dot2 | The dot product specifying the angle between the sought vector and the second input vectors. |
[out] | vec | A std::vector containing the three elements of the sought vector. |
Definition at line 2051 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::gaussLegendreIntegration | ( | proshade_complex * | vals, |
proshade_unsign | valsSize, | ||
proshade_unsign | order, | ||
proshade_double * | abscissas, | ||
proshade_double * | weights, | ||
proshade_double | integralOverRange, | ||
proshade_double | maxSphereDists, | ||
proshade_double * | retReal, | ||
proshade_double * | retImag | ||
) |
Function to compute the complete complex Gauss-Legendre integration over spherical harmonic values in different shells.
This function takes the real parts of the spherical harmonics value in different shells and proceeds to compute the Gauss-Legendre integration over them. It uses the shell positions to appropriately place abscissas and their weights, which it assumes were pre-computed by the getLegendreAbscAndWeights() function.
[in] | vals | Pointer to a complex array of values over which the integration to be done. |
[in] | valsSize | The length of the input array. |
[in] | order | The integration order value. |
[in] | abscissas | The allocated array for holding the abscissa values. |
[in] | weights | The allocated array for holding the weight values. |
[in] | integralOverRange | The range of the intgral. If progressive shell mapping is used, this will not be max shell radius. |
[in] | maxSphereDists | Distance between two shells. |
[in] | retReal | The real part of the complex result of Gauss-Legendre integration over the shperical harmonics values. |
[in] | retImag | The imaginary part of the complex result of Gauss-Legendre integration over the shperical harmonics values. |
Definition at line 711 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::gaussLegendreIntegrationReal | ( | proshade_double * | vals, |
proshade_unsign | valsSize, | ||
proshade_unsign | order, | ||
proshade_double * | abscissas, | ||
proshade_double * | weights, | ||
proshade_double | integralOverRange, | ||
proshade_double | maxSphereDists | ||
) |
Function to compute real part of the Gauss-Legendre integration over spherical harmonic values in different shells.
This function takes the real parts of the spherical harmonics value in different shells and proceeds to compute the Gauss-Legendre integration over them. It uses the shell positions to appropriately place abscissas and their weights, which it assumes were pre-computed by the getLegendreAbscAndWeights() function.
[in] | vals | Pointer to an array of values over which the integration to be done. |
[in] | valsSize | The length of the input array. |
[in] | order | The integration order value. |
[in] | abscissas | The allocated array for holding the abscissa values. |
[in] | weights | The allocated array for holding the weight values. |
[in] | integralOverRange | The range of the intgral. If progressive shell mapping is used, this will not be max shell radius. |
[in] | maxSphereDists | Distance between two shells. |
[out] | X | The real part of Gauss-Legendre integration over the shperical harmonics values. |
Definition at line 621 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getAxisAngleFromRotationMatrix | ( | proshade_double * | rotMat, |
proshade_double * | x, | ||
proshade_double * | y, | ||
proshade_double * | z, | ||
proshade_double * | ang | ||
) |
This function converts rotation matrix to the axis-angle representation.
This function takes a rotation matrix as an array of 9 numbers and converts it to the Angle-Axis representation, which is the main rotation representation used in ProSHADE. This function deals with both the North and South pole singularity of the rotation matrices.
[in] | rotMat | Rotation matrix as an array of 9 values. |
[in] | x | Pointer to which the x-axis value of the axis vector will be saved. |
[in] | y | Pointer to which the y-axis value of the axis vector will be saved. |
[in] | z | Pointer to which the z-axis value of the axis vector will be saved. |
[in] | ang | Pointer to which the angle value will be saved. |
Definition at line 1124 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getAxisAngleFromRotationMatrix | ( | std::vector< proshade_double > * | rotMat, |
proshade_double * | x, | ||
proshade_double * | y, | ||
proshade_double * | z, | ||
proshade_double * | ang | ||
) |
This function converts rotation matrix to the axis-angle representation.
This function takes a rotation matrix as a pointer to a vector of doubles and converts it to the Angle-Axis representation, which is the main rotation representation used in ProSHADE. This function deals with both the North and South pole singularity of the rotation matrices.
[in] | rotMat | Rotation matrix as a pointer to a vector of doubles. |
[in] | x | Pointer to which the x-axis value of the axis vector will be saved. |
[in] | y | Pointer to which the y-axis value of the axis vector will be saved. |
[in] | z | Pointer to which the z-axis value of the axis vector will be saved. |
[in] | ang | Pointer to which the angle value will be saved. |
Definition at line 1287 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getEulerZXZFromAngleAxis | ( | proshade_double | axX, |
proshade_double | axY, | ||
proshade_double | axZ, | ||
proshade_double | axAng, | ||
proshade_double * | eA, | ||
proshade_double * | eB, | ||
proshade_double * | eG | ||
) |
This function converts angle-axis representation to the Euler ZXZ angles representation.
This function does the angle-axis to Euler ZXZ conversion and if a problem around the Z axis arises, it deal with it.
[in] | axX | Angle-axis representation axis x element. |
[in] | axY | Angle-axis representation axis y element. |
[in] | axZ | Angle-axis representation axis z element. |
[in] | axAng | Angle-axis representation angle. |
[in] | eA | Pointer to which the Euler angle alpha value will be saved. |
[in] | eB | Pointer to which the Euler angle beta value will be saved. |
[in] | eG | Pointer to which the Euler angle gamma value will be saved. |
Definition at line 1598 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getEulerZXZFromRotMatrix | ( | proshade_double * | rotMat, |
proshade_double * | eA, | ||
proshade_double * | eB, | ||
proshade_double * | eG | ||
) |
This function converts rotation matrix to the Euler ZXZ angles representation.
[in] | rotMat | Rotation matrix as an array of 9 values. |
[in] | eA | Pointer to which the Euler angle alpha value will be saved. |
[in] | eB | Pointer to which the Euler angle beta value will be saved. |
[in] | eG | Pointer to which the Euler angle gamma value will be saved. |
Definition at line 1547 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getEulerZXZFromSOFTPosition | ( | proshade_signed | band, |
proshade_signed | x, | ||
proshade_signed | y, | ||
proshade_signed | z, | ||
proshade_double * | eulerAlpha, | ||
proshade_double * | eulerBeta, | ||
proshade_double * | eulerGamma | ||
) |
Function to find Euler angles (ZXZ convention) from index position in the inverse SOFT map.
This function proceeds to convert the inverse SOFT map x, y and z position to Euler ZXZ convention angles, saving these into the supplied pointers.
[in] | band | The maximum bandwidth of the computation. |
[in] | x | The x-axis position in the inverse SOFT map. |
[in] | y | The y-axis position in the inverse SOFT map. |
[in] | z | The z-axis position in the inverse SOFT map. |
[in] | eulerAlpha | Pointer to where the Euler alpha angle will be saved. |
[in] | eulerBeta | Pointer to where the Euler beta angle will be saved. |
[in] | eulerGamma | Pointer to where the Euler gamma angle will be saved. |
Definition at line 963 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getGLFirstEvenRoot | ( | proshade_double | polyAtZero, |
proshade_unsign | order, | ||
proshade_double * | abscAtZero, | ||
proshade_double * | weighAtZero, | ||
proshade_unsign | taylorSeriesCap | ||
) |
This function finds the first root for Legendre polynomials of odd order.
The Legendre polynomials with odd order have zero as the first root, but the even oder polenomials have different value and this function serves the purpose of finding this value (i.e. the first root of the polynomial if the order is even).
[in] | polyAtZero | The value of the polynomial at zero. |
[in] | order | The positive integer value of the polynomial order. |
[in] | abscAtZero | Pointer to variable storing the abscissa value at zero. |
[in] | weightAtZero | Pointer to variable storing the weight value at zero. |
[in] | taylorSeriesCap | The limit on the Taylor series. |
Definition at line 386 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getGLPolyAtZero | ( | proshade_unsign | order, |
proshade_double * | polyValue, | ||
proshade_double * | deriValue | ||
) |
This function obtains the Legendre polynomial values and its derivative at zero for any positive integer order polynomial.
This function takes the positive integer order of the Legendre polynomial and uses the recursive properties of the polynomials to work up to the order, computing the value at zero and its derivative for all lesser orders. It then returns the final values.
[in] | order | Positive integer order of the Legendre polynomial which value at zero we want. |
[in] | polyValue | Pointer to variable which will store the resulting polynomial value at zero. |
[in] | deriValue | Pointer to variable which will store the derivative of the zero value. |
Definition at line 349 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getLegendreAbscAndWeights | ( | proshade_unsign | order, |
proshade_double * | abscissas, | ||
proshade_double * | weights, | ||
proshade_unsign | taylorSeriesCap | ||
) |
Function to prepare abscissas and weights for Gauss-Legendre integration.
This function fills in the Gauss-Legendre interpolation points positions (abscissas) and their weights vectors, which will then be used for computing the Gauss-Legendre interpolation.
[in] | order | The order to which the abscissas and weights should be prepared. |
[in] | abscissas | The array holding the abscissa values. |
[in] | weights | The array holding the weight values. |
[in] | taylorSeriesCap | The limit on the Taylor series. |
Definition at line 289 of file ProSHADE_maths.cpp.
proshade_single ProSHADE_internal_maths::getResolutionOfReflection | ( | proshade_single | h, |
proshade_single | k, | ||
proshade_single | l, | ||
proshade_single | xDim, | ||
proshade_single | yDim, | ||
proshade_single | zDim | ||
) |
This function computes the resolution of a particular reflection.
[in] | h | The index of the reflection in reciprocal space along the x-axis. |
[in] | k | The index of the reflection in reciprocal space along the y-axis. |
[in] | l | The index of the reflection in reciprocal space along the z-axis. |
[in] | xDim | The dimension of the cell along the x-axis in Angstroms. |
[in] | yDim | The dimension of the cell along the y-axis in Angstroms. |
[in] | zDim | The dimension of the cell along the z-axis in Angstroms. |
[out] | ret | The resolution of the particular reflection. |
Definition at line 2905 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getRotationMatrixFromAngleAxis | ( | proshade_double * | rotMat, |
proshade_double | x, | ||
proshade_double | y, | ||
proshade_double | z, | ||
proshade_double | ang | ||
) |
This function converts the axis-angle representation to the rotation matrix representation.
[in] | rotMat | Rotation matrix as an array of 9 values will be saved to this pointer, must already be allocated. |
[in] | x | The x-axis value of the axis vector. |
[in] | y | The y-axis value of the axis vector. |
[in] | z | The z-axis value of the axis vector. |
[in] | angThe | angle value. |
Definition at line 1444 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getRotationMatrixFromAngleAxis | ( | proshade_single * | rotMat, |
proshade_double | x, | ||
proshade_double | y, | ||
proshade_double | z, | ||
proshade_double | ang | ||
) |
This function converts the axis-angle representation to the rotation matrix representation.
[in] | rotMat | Rotation matrix as an array of 9 values will be saved to this pointer, must already be allocated. |
[in] | x | The x-axis value of the axis vector. |
[in] | y | The y-axis value of the axis vector. |
[in] | z | The z-axis value of the axis vector. |
[in] | angThe | angle value. |
Definition at line 1496 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles | ( | proshade_double | eulerAlpha, |
proshade_double | eulerBeta, | ||
proshade_double | eulerGamma, | ||
proshade_double * | matrix | ||
) |
Function to find the rotation matrix from Euler angles (ZXZ convention).
[in] | eulerAlpha | The Euler alpha angle value. |
[in] | eulerBeta | The Euler beta angle value. |
[in] | eulerGamma | The Euler gamma angle value. |
[in] | matrix | A pointer to array of 9 values to which the results of the function will be saved. |
Definition at line 1007 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getRotationMatrixFromEulerZXZAngles | ( | proshade_single | eulerAlpha, |
proshade_single | eulerBeta, | ||
proshade_single | eulerGamma, | ||
proshade_single * | matrix | ||
) |
Function to find the rotation matrix from Euler angles (ZXZ convention).
[in] | eulerAlpha | The Euler alpha angle value. |
[in] | eulerBeta | The Euler beta angle value. |
[in] | eulerGamma | The Euler gamma angle value. |
[in] | matrix | A pointer to array of 9 values to which the results of the function will be saved. |
Definition at line 1063 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::getSOFTPositionFromEulerZXZ | ( | proshade_signed | band, |
proshade_double | eulerAlpha, | ||
proshade_double | eulerBeta, | ||
proshade_double | eulerGamma, | ||
proshade_double * | x, | ||
proshade_double * | y, | ||
proshade_double * | z | ||
) |
Function to find the index position in the inverse SOFT map from given Euler angles (ZXZ convention).
This function does the conversion from Euler angles ZXZ convention to the SOFT map x, y and z position. It is not limitted to the SOFT map indices and instead if given Euler agnles between two indices will return a decimal point for the indices.
[in] | band | The maximum bandwidth of the computation. |
[in] | eulerAlpha | The Euler alpha angle value. |
[in] | eulerBeta | The Euler beta angle value. |
[in] | eulerGamma | The Euler gamma angle value. |
[in] | x | Pointer to where the closest x-axis position in the inverse SOFT map will be saved to (position may be decimal!). |
[in] | y | Pointer to where the closest y-axis position in the inverse SOFT map will be saved to (position may be decimal!). |
[in] | z | Pointer to where the closest z-axis position in the inverse SOFT map will be saved to (position may be decimal!). |
Definition at line 988 of file ProSHADE_maths.cpp.
bool ProSHADE_internal_maths::isAxisUnique | ( | std::vector< proshade_double * > * | CSymList, |
proshade_double * | axis, | ||
proshade_double | tolerance = 0.1 , |
||
bool | improve = false |
||
) |
This function checks if new axis is unique, or already detected.
This function compares the supplied axis against all members of the axes vector. If the axis has the same fold and very similar axis vector (i.e. all three elements are within tolerance), then the function returns false. If no such match is found, true is returned.
[in] | CSymList | A vector containing the already detected Cyclic symmetries. |
[in] | axis | The axis to be checked against CSymList to see if it not already present. |
[in] | tolerance | The allowed error on each dimension of the axis. |
[in] | improve | If a similar axis is found and if this already existing axis has lower peak height, should the CSymList be updated with the higher peak height axis? |
[out] | ret | Boolean specifying whether a similar axis was found or not. |
Definition at line 2717 of file ProSHADE_maths.cpp.
bool ProSHADE_internal_maths::isAxisUnique | ( | std::vector< proshade_double * > * | CSymList, |
proshade_double | X, | ||
proshade_double | Y, | ||
proshade_double | Z, | ||
proshade_double | fold, | ||
proshade_double | tolerance | ||
) |
This function checks if new axis is unique, or already detected.
This function compares the supplied axis against all members of the axes vector. If the axis has the same fold and very similar axis vector (i.e. all three elements are within tolerance), then the function returns false. If no such match is found, true is returned.
[in] | CSymList | A vector containing the already detected Cyclic symmetries. |
[in] | X | The axis x-element to be checked against CSymList to see if it not already present. |
[in] | Y | The axis x-element to be checked against CSymList to see if it not already present. |
[in] | Z | The axis x-element to be checked against CSymList to see if it not already present. |
[in] | tolerance | The allowed error on each dimension of the axis. |
[out] | ret | Boolean specifying whether a similar axis was found or not. |
Definition at line 2766 of file ProSHADE_maths.cpp.
std::vector< proshade_double > ProSHADE_internal_maths::multiplyGroupElementMatrices | ( | std::vector< proshade_double > * | el1, |
std::vector< proshade_double > * | el2 | ||
) |
This function computes matrix multiplication using the ProSHADE group element matrix format as input and output.
[in] | el1 | Group element as rotation matrix in the group element matrix format. |
[in] | el2 | Group element as rotation matrix in the group element matrix format. |
[out] | ret | Matrix in the group element format resulting from the input matrices multiplication. |
Definition at line 2241 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::multiplyTwoSquareMatrices | ( | proshade_double * | A, |
proshade_double * | B, | ||
proshade_double * | res, | ||
proshade_unsign | dim = 3 |
||
) |
Function to compute matrix multiplication.
[in] | A | The left matrix of the matrix multiplication to be solved. |
[in] | B | The right matrix of the matrix multiplication to be solved. (Assuming it already has been transposed). |
[in] | res | Matrix containing the results. |
[in] | dim | The dimension of all the matrices (i.e. assuming square dim*dim matrices). |
Definition at line 1681 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::normalDistributionValue | ( | proshade_double | mean, |
proshade_double | standardDev, | ||
proshade_double | value | ||
) |
Function to the heiht of normal distribution given by mean and standard deviation for a given value.
[in] | mean | The mean of the normal distribution. |
[in] | standardDev | The standard deviation of the normal distribution. |
[in] | value | The value on the axis for which the height of the normal distribution is to be obtained. |
[out] | X | The height of the normal distribution at point given by the value. |
Definition at line 1756 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::optimiseAxisBiCubicInterpolation | ( | proshade_double * | bestLattitude, |
proshade_double * | bestLongitude, | ||
proshade_double * | bestSum, | ||
std::vector< proshade_unsign > * | sphereList, | ||
std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > * | sphereMappedRotFun, | ||
proshade_double | step = 0.05 |
||
) |
This function provides axis optimisation given starting lattitude and longitude indices.
This function takes the initial lattitude and longitude indices as well as the current best sum over all appropriate spheres and the list of the spheres and proceeds to use bi-cubic interpolation and a sort of gradient ascend algorithm to search the space around the given indices for interpolated values, which would have higher sum of the rotation function values than the initial position. If any improvement is found, it will over-write the input variables.
[in] | bestLattitude | Proshade double pointer to variable containing the best lattitude index value and to which the optimised result will be saved into. |
[in] | bestLongitude | Proshade double pointer to variable containing the best longitude index value and to which the optimised result will be saved into. |
[in] | bestSum | Proshade double pointer to variable containing the best position rotation function values sum and to which the optimised result will be saved into. |
[in] | sphereList | A vector containing the list of spheres which form the set for this symmetry. |
[in] | step | The size of the step. |
Definition at line 2396 of file ProSHADE_maths.cpp.
proshade_double ProSHADE_internal_maths::pearsonCorrCoeff | ( | proshade_double * | valSet1, |
proshade_double * | valSet2, | ||
proshade_unsign | length | ||
) |
Function for computing the Pearson's correlation coefficient.
This function takes two numerical arrays of same length and proceeds to compute the Pearson's correlation coefficient, which it then returns.
[in] | valSet1 | This is the set of x-values. |
[in] | valSet2 | This is the set of y-values. |
[in] | length | The length of both arrays (both arrays have to have the same length). |
[out] | X | The Pearson's correlation coefficient value. |
Definition at line 246 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::prepareBiCubicInterpolatorsMinusMinus | ( | proshade_double | bestLattitude, |
proshade_double | bestLongitude, | ||
std::vector< proshade_unsign > * | sphereList, | ||
std::vector< ProSHADE_internal_maths::BicubicInterpolator * > * | interpols, | ||
std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > * | sphereMappedRotFun | ||
) |
This function prepares the interpolation objects for the bi-cubic interpolation.
This function takes the position around which the interpolation is to be done and proceeds to create the interpolator objects for bi-cubic interpolation in the – direction (i.e. when both interpolated values will be lower than the best lattitude and longitude) using the correct spheres in the correct ranges.
[in] | bestLattitude | The lattitude index value around which interpolation is to be prepared. |
[in] | bestLongitude | The longitude index value around which interpolation is to be prepared. |
[in] | sphereList | A vector containing the list of spheres which form the set for this symmetry. |
[in] | interpols | A pointer to a vector of ProSHADE interpolator objects to which the interpolators will be saved into. |
Definition at line 2497 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::prepareBiCubicInterpolatorsMinusPlus | ( | proshade_double | bestLattitude, |
proshade_double | bestLongitude, | ||
std::vector< proshade_unsign > * | sphereList, | ||
std::vector< ProSHADE_internal_maths::BicubicInterpolator * > * | interpols, | ||
std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > * | sphereMappedRotFun | ||
) |
This function prepares the interpolation objects for the bi-cubic interpolation.
This function takes the position around which the interpolation is to be done and proceeds to create the interpolator objects for bi-cubic interpolation in the -+ direction (i.e. when interpolated lattitude is lower than best lattitude, but interpolated longitude is higher than best longitude) using the correct spheres in the correct ranges.
[in] | bestLattitude | The lattitude index value around which interpolation is to be prepared. |
[in] | bestLongitude | The longitude index value around which interpolation is to be prepared. |
[in] | sphereList | A vector containing the list of spheres which form the set for this symmetry. |
[in] | interpols | A pointer to a vector of ProSHADE interpolator objects to which the interpolators will be saved into. |
Definition at line 2552 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::prepareBiCubicInterpolatorsPlusMinus | ( | proshade_double | bestLattitude, |
proshade_double | bestLongitude, | ||
std::vector< proshade_unsign > * | sphereList, | ||
std::vector< ProSHADE_internal_maths::BicubicInterpolator * > * | interpols, | ||
std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > * | sphereMappedRotFun | ||
) |
This function prepares the interpolation objects for the bi-cubic interpolation.
This function takes the position around which the interpolation is to be done and proceeds to create the interpolator objects for bi-cubic interpolation in the +- direction (i.e. when interpolated lattitude is higher than best lattitude, but interpolated longitude is lower than best longitude) using the correct spheres in the correct ranges.
[in] | bestLattitude | The lattitude index value around which interpolation is to be prepared. |
[in] | bestLongitude | The longitude index value around which interpolation is to be prepared. |
[in] | sphereList | A vector containing the list of spheres which form the set for this symmetry. |
[in] | interpols | A pointer to a vector of ProSHADE interpolator objects to which the interpolators will be saved into. |
Definition at line 2607 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::prepareBiCubicInterpolatorsPlusPlus | ( | proshade_double | bestLattitude, |
proshade_double | bestLongitude, | ||
std::vector< proshade_unsign > * | sphereList, | ||
std::vector< ProSHADE_internal_maths::BicubicInterpolator * > * | interpols, | ||
std::vector< ProSHADE_internal_spheres::ProSHADE_rotFun_sphere * > * | sphereMappedRotFun | ||
) |
This function prepares the interpolation objects for the bi-cubic interpolation.
This function takes the position around which the interpolation is to be done and proceeds to create the interpolator objects for bi-cubic interpolation in the ++ direction (i.e. when both interpolated values will be larger than the best lattitude and longitude) using the correct spheres in the correct ranges.
[in] | bestLattitude | The lattitude index value around which interpolation is to be prepared. |
[in] | bestLongitude | The longitude index value around which interpolation is to be prepared. |
[in] | sphereList | A vector containing the list of spheres which form the set for this symmetry. |
[in] | interpols | A pointer to a vector of ProSHADE interpolator objects to which the interpolators will be saved into. |
Definition at line 2662 of file ProSHADE_maths.cpp.
std::vector< proshade_signed > ProSHADE_internal_maths::primeFactorsDecomp | ( | proshade_signed | number | ) |
Function to find prime factors of an integer.
[in] | number | A single integer number to be decomposed into its prime factors. |
Definition at line 1707 of file ProSHADE_maths.cpp.
bool ProSHADE_internal_maths::rotationMatrixSimilarity | ( | std::vector< proshade_double > * | mat1, |
std::vector< proshade_double > * | mat2, | ||
proshade_double | tolerance = 0.1 |
||
) |
This function compares the distance between two rotation matrices and decides if they are similar using tolerance.
This function computes the distance between two rotation matrices, specifically by computing the trace of (R1 * R2^T). This measure will be 3.0 if the two matrices are identical and will decrease the more the rotation matrices difference diverges from identity. Therefore, from this trace 3.0 is subtracted and the absolute value of the result is compared to the tolerance. If the difference is less than the tolerance, true is returned, while false is returned otherwise.
[in] | mat1 | Vector of 9 numbers representing first rotation matrix. |
[in] | mat1 | Vector of 9 numbers representing second rotation matrix. |
[in] | tolerance | Double number representing the maximum allowed error on the distance. |
[out] | res | Boolean decision if the two matrices are similar or not. |
Definition at line 2295 of file ProSHADE_maths.cpp.
std::vector< proshade_double > ProSHADE_internal_maths::smoothen1D | ( | proshade_double | step, |
proshade_signed | windowSize, | ||
proshade_double | sigma, | ||
std::vector< proshade_double > | data | ||
) |
This function takes a 1D vector and computes smoothened version based on the parameters.
This function firstly computes the Gaussian weights for each position in a window size accordingly to the parameters amd then proceeds to compute the weighted sum for each position created by sliding this window along the data. This results in smoothening of the data in accordance with the parameters.
[in] | step | The size of the step on scale from 0.0 to 1.0 including boarders. |
[in] | windowSize | The size of the averaged over window. It is assumed to be odd. |
[in] | sigma | The standard deviation of the Gaussian to be used for smoothening. |
[in] | data | The data to be smoothened. |
[out] | smoothened | A vector of smoothened values for the input data with length hist.size() - (windowSize - 1). |
Definition at line 2869 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::transpose3x3MatrixInPlace | ( | proshade_double * | mat | ) |
Transposes 3x3 matrix in place.
[in] | mat | The matrix to be transposed. |
Definition at line 1935 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::vectorMeanAndSD | ( | std::vector< proshade_double > * | vec, |
proshade_double *& | ret | ||
) |
Function to get vector mean and standard deviation.
This function takes a pointer to a vector of proshade_double's and returns the mean and standard deviation of such vector.
[in] | vec | Pointer to a vector of proshade_double's for which mean and sd should be obtained. |
[in] | ret | Pointer to array of 2 proshade_double's, which will be the return values - first mean and second sd. |
Definition at line 121 of file ProSHADE_maths.cpp.
void ProSHADE_internal_maths::vectorMedianAndIQR | ( | std::vector< proshade_double > * | vec, |
proshade_double *& | ret | ||
) |
Function to get vector median and inter-quartile range.
This function takes a pointer to a vector of proshade_double's and returns the median and the inter-quartile range of such vector.
[in] | vec | Pointer to a vector of proshade_double's for which median and IQR should be obtained. |
[in] | ret | Pointer to array of 2 proshade_double's, which will be the return values - first median and second IQR. |
Definition at line 149 of file ProSHADE_maths.cpp.
bool ProSHADE_internal_maths::vectorOrientationSimilarity | ( | proshade_double | a1, |
proshade_double | a2, | ||
proshade_double | a3, | ||
proshade_double | b1, | ||
proshade_double | b2, | ||
proshade_double | b3, | ||
proshade_double | tolerance = 0.1 |
||
) |
This function compares two vectors using cosine distance and decides if they are similar using tolerance.
This function computes the distance between two vectors, specifically by computing the cosine distance ( ( dot( A, B ) ) / ( mag(A) x mag(B) ) ). This measure will be 1.0 if the two vectors are identically oriented, 0.0 if they are perpendicular and -1.0 if they have opposite direction. Given that opposite direction must be regarded as same direction with opposite angles for symmetry axes detection purposes, this function uses the absolute value of this measure and checks if the two supplied vectors (supplied element by element) have cosine distance within 1.0 - tolerance, returning true if they do and false otherwise.
[in] | a1 | The first element of the first vector. |
[in] | a2 | The second element of the first vector. |
[in] | a3 | The third element of the first vector. |
[in] | b1 | The first element of the second vector. |
[in] | b2 | The second element of the second vector. |
[in] | b3 | The third element of the second vector. |
[in] | tolerance | The allowed difference of the distance measure from the 1.0 for the vectors to still be considered similar. |
[out] | res | Boolean decision if the two vectors are similar or not. |
Definition at line 2332 of file ProSHADE_maths.cpp.
bool ProSHADE_internal_maths::vectorOrientationSimilaritySameDirection | ( | proshade_double | a1, |
proshade_double | a2, | ||
proshade_double | a3, | ||
proshade_double | b1, | ||
proshade_double | b2, | ||
proshade_double | b3, | ||
proshade_double | tolerance = 0.1 |
||
) |
This function compares two vectors using cosine distance and decides if they are similar using tolerance.
This function computes the distance between two vectors, specifically by computing the cosine distance ( ( dot( A, B ) ) / ( mag(A) x mag(B) ) ). This measure will be 1.0 if the two vectors are identically oriented, 0.0 if they are perpendicular and -1.0 if they have opposite direction. Given that opposite direction must be regarded as different vector for peak detection purposes (spheres with different angles are covered separately), this function does not use the absolute value of this measure and checks if the two supplied vectors (supplied element by element) have cosine distance within 1.0 - tolerance, returning true if they do and false otherwise.
[in] | a1 | The first element of the first vector. |
[in] | a2 | The second element of the first vector. |
[in] | a3 | The third element of the first vector. |
[in] | b1 | The first element of the second vector. |
[in] | b2 | The second element of the second vector. |
[in] | b3 | The third element of the second vector. |
[in] | tolerance | The allowed difference of the distance measure from the 1.0 for the vectors to still be considered similar. |
[out] | res | Boolean decision if the two vectors are similar or not. |
Definition at line 2366 of file ProSHADE_maths.cpp.