43 n = ceil( -1.5 + sqrt( 0.25 + 2 * j ) - 1e-10 );
45 int jrem = j - ( n * ( n + 1 ) / 2 + 1 );
46 m = ( jrem + ( jrem % 2 ) * abs( ( n % 2 ) - 1 ) + fabs( ( jrem % 2 ) - 1 ) * ( n % 2 ) ) *
52int noll_j(
unsigned int n,
int m )
54 if( ( ( n - m ) % 2 ) )
60 if( m >= 0 && ( mn == 2 || mn == 3 ) )
62 else if( m <= 0 && ( mn == 0 || mn == 1 ) )
65 int j = ( n * ( n + 1 ) ) / 2 + abs( m ) + dm;
@ invalidarg
An argument was invalid.
error_t mxlib_error_report(const error_t &code, const std::string &expl, const std::source_location &loc=std::source_location::current())
Print a report to stderr given an mxlib error_t code and explanation and return the code.
T sign(T x)
The sign function.
int noll_j(unsigned n, int m)
Get the Noll index j corresponding to Zernike coefficients n,m.
realT zernikeR(realT rho, int n, int m, std::vector< calcRealT > &c)
Calculate the value of a Zernike radial polynomial at a given separation.
realT zernike(realT rho, realT phi, int n, int m, std::vector< calcRealT > &c)
Calculate the value of a Zernike radial polynomial at a given radius and angle.
int nZernRadOrd(unsigned n)
Get the number of Zernikes up to and including a radial order.
int noll_nm(int &n, int &m, int j)
Get the Zernike coefficients n,m corrresponding the Noll index j.
realT zernikeQNorm(realT k, realT phi, int n, int m)
Calculate the square-normed Fourier transform of a Zernike polynomial at position (k,...
int zernikeRCoeffs(std::vector< realT > &c, int n, int m)
Calculate the coefficients of a Zernike radial polynomial.
Working with the Zernike polynomials.