45 mxError(
"noll_nm", MXE_INVALIDARG,
"The Noll index j cannot be less than 1 in the Zernike polynomials");
50 n = ceil(-1.5 + sqrt(0.25 + 2*j) - 1e-10);
52 int jrem = j - (n * (n+1)/2+1);
53 m = (jrem + (jrem % 2) * abs( (n % 2)-1) + fabs( (jrem % 2)-1) * (n % 2)) * (-
math::func::sign( (j % 2)-0.5));
58 int noll_j(
unsigned int n,
62 if( ((n-m) % 2) )
return -1;
67 if( m >= 0 && (mn == 2 || mn == 3)) dm = 1;
68 else if( m <= 0 && (mn == 0 || mn == 1)) dm = 1;
70 int j = (n*(n+1)) / 2 + abs(m) + dm;
75 int nZernRadOrd(
unsigned int n)
89 int zernikeRCoeffs<float>( std::vector<float> &
c,
int n,
int m);
92 int zernikeRCoeffs<double>( std::vector<double> &
c,
int n,
int m);
95 int zernikeRCoeffs<long double>( std::vector<long double> &
c,
int n,
int m);
99 int zernikeRCoeffs<__float128>( std::vector<__float128> &
c,
int n,
int m);
103 float zernikeR<float, double>(
float rho,
int n,
int m, std::vector<double> &
c);
106 double zernikeR<double, double>(
double rho,
int n,
int m, std::vector<double> &
c);
109 long double zernikeR<long double, long double>(
long double rho,
int n,
int m, std::vector<long double> &
c);
113 __float128 zernikeR<__float128,__float128>(__float128 rho,
int n,
int m, std::vector<__float128> &
c);
118 float zernikeR<float, double>(
float rho,
int n,
int m);
121 double zernikeR<double,double>(
double rho,
int n,
int m);
124 long double zernikeR<long double, long double>(
long double rho,
int n,
int m);
128 __float128 zernikeR<__float128, __float128>( __float128 rho,
int n,
int m);
132 float zernike<float,double>(
float rho,
float phi,
int n,
int m, std::vector<double> &
c);
135 double zernike<double,double>(
double rho,
double phi,
int n,
int m, std::vector<double> &
c);
138 long double zernike<long double, long double>(
long double rho,
long double phi,
int n,
int m, std::vector<long double> &
c);
142 __float128 zernike<__float128,__float128>(__float128 rho, __float128 phi,
int n,
int m, std::vector<__float128> &
c);
146 float zernike<float,double>(
float rho,
float phi,
int n,
int m);
149 double zernike<double,double>(
double rho,
double phi,
int n,
int m);
152 long double zernike<long double, long double>(
long double rho,
long double phi,
int n,
int m);
156 __float128 zernike<__float128,__float128>( __float128 rho, __float128 phi,
int n,
int m);
161 float zernike<float, double>(
float rho,
float phi,
int j);
164 double zernike<double, double>(
double rho,
double phi,
int j);
167 long double zernike<long double, long double>(
long double rho,
long double phi,
int j);
171 __float128 zernike<__float128, __float128>(__float128 rho, __float128 phi,
int j);
175 float zernikeQNorm<float>(
float k,
float phi,
int n,
int m);
178 double zernikeQNorm<double>(
double k,
double phi,
int n,
int m);
181 long double zernikeQNorm<long double>(
long double k,
long double phi,
int n,
int m);
185 __float128 zernikeQNorm<__float128>(__float128
k, __float128 phi,
int n,
int m);
constexpr units::realT c()
The speed of light.
constexpr units::realT k()
Boltzmann Constant.
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.
int noll_nm(int &n, int &m, int j)
Get the Zernike coefficients n,m corrresponding the Noll index j.
Working with the Zernike polynomials.