EOSAM 2025
Open Access
Issue
J. Eur. Opt. Society-Rapid Publ.
Volume 22, Number 1, 2026
EOSAM 2025
Article Number 31
Number of page(s) 15
DOI https://doi.org/10.1051/jeos/2026023
Published online 05 May 2026

© The Author(s), published by EDP Sciences, 2026

Licence Creative CommonsThis is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

1 Introduction

Zernike polynomials play a key role in many optical applications [13] due to their two main features: 1. the orthogonality between individual polynomial components and 2. the direct correspondence with optical Seidel aberrations. Zernike polynomials are usually defined as z n ± m ( ρ , φ ) = R n m ( ρ ) { cos ( )   for   + m sin ( )   for   - m , Mathematical equation: $$ {z}_n^{\pm m}(\rho,\phi )={R}_n^m(\rho )\left\{\begin{array}{ccc}\mathrm{cos}({m\phi })& \enspace \mathrm{for}\enspace & +m\\ \mathrm{sin}({m\phi })& \enspace \mathrm{for}\enspace & -m\end{array}\right., $$(1) R n m = k = 0 ( n - m ) / 2 ( ( - 1 ) k ( n - k ) ! k ! ( n + m 2 - k ) ! ( n - m 2 - k ) ! ρ n - 2 k ) , Mathematical equation: $$ {R}_n^m=\sum_{k=0}^{(n-m)/2}\left(\frac{(-1{)}^k(n-k)!}{k!\left(\frac{n+m}{2}-k\right)!\left(\frac{n-m}{2}-k\right)!}{\rho }^{n-2k}\right), $$(2)

where R n m Mathematical equation: $ {R}_n^m$ is called the Zernike radial polynomial. The above equations appear in the literature [4, 5] with different notations for the m-term. This work adopts the ±m notation since this notation provides an explicit and convenient way to divide Zernike components of order n into their even part (±m = ±2l), and their odd part ±m = ± (2l + 1), and to subdivide each part into distinct cos and sin subparts. Incidentally, all odd parts of the components for the even order (n = 2j) and all even parts of the components for the odd order (n = 2j + 1) are discarded to avoid non-integer factorials in Zernike radial polynomials (Eq. (2)), and all index terms n, m, l, j, k in this work are non-negative integers, and l ≤ j and k ≤ (j − l).

If the polynomial order is not high, the calculation of Zernike polynomials is usually satisfied by the definition formulas. For Zernike radial polynomials a three-term-recurrence-relation (TTRR) exists and has been applied component-wise to higher-order recursive Zernike calculations [6, 7]: R n m = ρ ( R n - 1 | m - 1 | ( ρ ) + R n - 1 m + 1 ( ρ ) ) - R n - 2 m ( ρ ) . Mathematical equation: $$ {R}_n^m=\rho \left({R}_{n-1}^{|m-1|}(\rho )+{R}_{n-1}^{m+1}(\rho )\right)-{R}_{n-2}^m(\rho ). $$(3)

On the other hand, Zernike polynomials are essentially one of the orthogonalized versions of the homogeneous bivariate polynomials in a Cartesian coordinate system with a unit circle and a coordinate center. In practice, the computation of Zernike polynomials is often based on a look-up-table (LUT) of the corresponding Cartesian forms of the individual Zernike components [3, 8, 9], although the complexity of such Cartesian forms increases sharply with polynomial order.

To achieve greater flexibility compared to component-wise recursive computations, and to lower the limits of polynomial order and complexity in Cartesian form based computations, this work uncovers two cases of block-wise recurrence in Zernike computations1 and offers both a direct block-wise transformation method and a block-wise recursive method for matrix-form Zernike computations. The application of such block-wise methods promises higher computational speed and lower memory footprint without compromising accuracy.

The rest of this paper is organized as follows: The next section presents two hidden block-wise recurrences along with their close relationship to an n-row Pascal’s triangle; subsequently Section 3 explores a new computation scheme for Zernike polynomials, which covers basis function computation, coefficient determination, polar/Cartesian coordinate conversion, and application specific derivative analysis, among others; further technical discussions can be found in Section 4, where a preliminary performance evaluation is conducted in term of computational complexity, accuracy stability, memory requirements, and application flexibility; finally, Section 5 concludes this paper with an outlook on future works.

2 Zernike polynomials supported by one Pascal’s triangle

2.1 Pascal triangle supported block-wise recurrence

The Zernike radial polynomials of the first n ≤ 6 orders can be expressed in matrix form, where all radial polynomials of an order are obtained by multiplying a coordinate value irrelevant factor matrix by a power vector of the radial coordinate values, as: { R 0 0 ( ρ ) = 1 R 1 1 ( ρ ) = ρ R 2 0 ( ρ ) = 2 ρ 2 - 1 R 2 2 ( ρ ) = ρ 2 R 3 1 ( ρ ) = 3 ρ 3 - 2 ρ R 3 3 ( ρ ) = ρ 3 R 4 0 ( ρ ) = 6 ρ 4 - 6 ρ 2 + 1 R 4 2 ( ρ ) = 4 ρ 4 - 3 ρ 2 R 4 4 ( ρ ) = ρ 4 R 5 1 ( ρ ) = 10 ρ 5 - 12 ρ 3 + 3 ρ R 5 3 ( ρ ) = 5 ρ 5 - 4 ρ 3 R 5 5 ( ρ ) = ρ 5 R 6 0 ( ρ ) = 20 ρ 6 - 30 ρ 4 + 12 ρ 2 - 1 R 6 2 ( ρ ) = 15 ρ 6 - 20 ρ 4 + 6 ρ 2 R 6 4 ( ρ ) = 6 ρ 6 - 5 ρ 4 R 6 6 ( ρ ) = ρ 6 { R 0 { m } = 1 × ρ 0 R 1 { m } = 1 × ρ 1 R 2 { m } = [ 2 - 1 1 0 ] × [ ρ 2 ρ 0 ] R 3 { m } = [ 3 - 2 1 0 ] × [ ρ 3 ρ 1 ] R 4 { m } = [ 6 - 6 1 4 - 3 0 1 0 0 ] × [ ρ 4 ρ 2 ρ 0 ] R 5 { m } = [ 10 - 12 3 5 - 4 0 1 0 0 ] × [ ρ 5 ρ 3 ρ 1 ] R 6 { m } = [ 20 - 30 12 - 1 15 - 20 6 0 6 - 5 0 0 1 0 0 0 ] × [ ρ 6 ρ 4 ρ 2 ρ 0 ] Mathematical equation: $$ \left\{\begin{array}{ll}{R}_0^0(\rho )& =1\\ {R}_1^1(\rho )& =\rho \\ {R}_2^0(\rho )& =2{\rho }^2-1\\ {R}_2^2(\rho )& ={\rho }^2\\ {R}_3^1(\rho )& =3{\rho }^3-2\rho \\ {R}_3^3(\rho )& ={\rho }^3\\ {R}_4^0(\rho )& =6{\rho }^4-6{\rho }^2+1\\ {R}_4^2(\rho )& =4{\rho }^4-3{\rho }^2\\ {R}_4^4(\rho )& ={\rho }^4\\ {R}_5^1(\rho )& =10{\rho }^5-12{\rho }^3+3\rho \\ {R}_5^3(\rho )& =5{\rho }^5-4{\rho }^3\\ {R}_5^5(\rho )& ={\rho }^5\\ {R}_6^0(\rho )& =20{\rho }^6-30{\rho }^4+12{\rho }^2-1\\ {R}_6^2(\rho )& =15{\rho }^6-20{\rho }^4+6{\rho }^2\\ {R}_6^4(\rho )& =6{\rho }^6-5{\rho }^4\\ {R}_6^6(\rho )& ={\rho }^6\end{array}\right.\Longrightarrow \left\{\begin{array}{ll}{R}_0^{\{m\}}& =1\times {\rho }^0\\ {R}_1^{\{m\}}& =1\times {\rho }^1\\ {R}_2^{\{m\}}& =\left[\begin{array}{ll}2& -1\\ 1& 0\end{array}\right]\times \left[\begin{array}{l}{\rho }^2\\ {\rho }^0\end{array}\right]\\ {R}_3^{\{m\}}& =\left[\begin{array}{ll}3& -2\\ 1& 0\end{array}\right]\times \left[\begin{array}{l}{\rho }^3\\ {\rho }^1\end{array}\right]\\ {R}_4^{\{m\}}& =\left[\begin{array}{lll}6& -6& 1\\ 4& -3& 0\\ 1& 0& 0\end{array}\right]\times \left[\begin{array}{l}{\rho }^4\\ {\rho }^2\\ {\rho }^0\end{array}\right]\\ {R}_5^{\{m\}}& =\left[\begin{array}{lll}10& -12& 3\\ 5& -4& 0\\ 1& 0& 0\end{array}\right]\times \left[\begin{array}{l}{\rho }^5\\ {\rho }^3\\ {\rho }^1\end{array}\right]\\ {R}_6^{\{m\}}& =\left[\begin{array}{llll}20& -30& 12& -1\\ 15& -20& 6& 0\\ 6& -5& 0& 0\\ 1& 0& 0& 0\end{array}\right]\times \left[\begin{array}{l}{\rho }^6\\ {\rho }^4\\ {\rho }^2\\ {\rho }^0\end{array}\right]\end{array}\right. $$(4)

where R n { m } Mathematical equation: $ {R}_n^{\{m\}}$ denotes a column vector [ R 2 j 0 R 2 j 2 R 2 j 2 j ] T Mathematical equation: $ {\left[\begin{array}{llll}{R}_{2j}^0& {R}_{2j}^2& \cdots & {R}_{2j}^{2j}\end{array}\right]}^T$ for even orders (n = 2j) or [ R 2 j + 1 1 R 2 j + 1 3 R 2 j + 1 2 j + 1 ] T Mathematical equation: $ {\left[\begin{array}{llll}{R}_{2j+1}^1& {R}_{2j+1}^3& \cdots & {R}_{2j+1}^{2j+1}\end{array}\right]}^T$ for odd orders (n = 2j + 1).

From the above equation seven weight vectors, { w n { k }   | n = 0,1 , . . . , 6 } Mathematical equation: $ \{{w}_n^{\left\{k\right\}}\enspace |n=\mathrm{0,1},...,6\}$ with 0 ≤ k ≤ j, can be extracted from the corresponding order-specific factor matrices (Eq. (5)). A block-wise recurrence among the de-weighted factor matrices ({T n |n = 0, 1, …, 6}) can be observed: the 0th order de-weighted factor matrix appears in the 2nd order de-weighted factor matrix, while the later subsequentially appears in the 4th order de-weighted factor matrix, which in turn appears in the 6th order de-weighted factor matrix. The same applies to odd orders from the 1st order to the 5th order, as follows: { R 0 { m } = 1 × diag ( 1 ) × ρ 0 R 1 { m } = 1 × diag ( 1 ) × ρ 1 R 2 { m } = [ 2 1 1 0 ] × diag ( [ 1 - 1 ] T ) × [ ρ 2 ρ 0 ] R 3 { m } = [ 3 1 1 0 ] × diag ( [ 1 - 2 ] T ) × [ ρ 3 ρ 1 ] R 4 { m } = [ 6 2 1 4 1 0 1 0 0 ] × diag ( [ 1 - 3 1 ] T ) × [ ρ 4 ρ 2 ρ 0 ] R 5 { m } = [ 10 3 1 5 1 0 1 0 0 ] × diag ( [ 1 - 4 3 ] T ) × [ ρ 5 ρ 3 ρ 1 ] R 6 { m } = [ 20 6 2 1 15 4 1 0 6 1 0 0 1 0 0 0 ] × diag ( [ 1 - 5 6 - 1 ] T ) × [ ρ 6 ρ 4 ρ 2 ρ 0 ] R n 6 { m } = T n × diag ( w n { k } ) × [ ρ n ρ n - 2 ρ ( n mod 2 ) ] , Mathematical equation: $$ \left\{\begin{array}{ll}{R}_0^{\{m\}}& =1\times \mathrm{diag}(1)\times {\rho }^0\\ {R}_1^{\{m\}}& =1\times \mathrm{diag}(1)\times {\rho }^1\\ {R}_2^{\{m\}}& =\left[\begin{array}{ll}2& 1\\ 1& 0\end{array}\right]\times \mathrm{diag}\left({\left[\begin{array}{l}1\\ -1\end{array}\right]}^T\right)\times \left[\begin{array}{l}{\rho }^2\\ {\rho }^0\end{array}\right]\\ {R}_3^{\{m\}}& =\left[\begin{array}{ll}3& 1\\ 1& 0\end{array}\right]\times \mathrm{diag}\left({\left[\begin{array}{l}1\\ -2\end{array}\right]}^T\right)\times \left[\begin{array}{l}{\rho }^3\\ {\rho }^1\end{array}\right]\\ {R}_4^{\{m\}}& =\left[\begin{array}{lll}6& 2& 1\\ 4& 1& 0\\ 1& 0& 0\end{array}\right]\times \mathrm{diag}\left({\left[\begin{array}{l}1\\ -3\\ 1\end{array}\right]}^T\right)\times \left[\begin{array}{l}{\rho }^4\\ {\rho }^2\\ {\rho }^0\end{array}\right]\\ {R}_5^{\{m\}}& =\left[\begin{array}{lll}10& 3& 1\\ 5& 1& 0\\ 1& 0& 0\end{array}\right]\times \mathrm{diag}\left({\left[\begin{array}{l}1\\ -4\\ 3\end{array}\right]}^T\right)\times \left[\begin{array}{l}{\rho }^5\\ {\rho }^3\\ {\rho }^1\end{array}\right]\\ {R}_6^{\{m\}}& =\left[\begin{array}{llll}20& 6& 2& 1\\ 15& 4& 1& 0\\ 6& 1& 0& 0\\ 1& 0& 0& 0\end{array}\right]\times \mathrm{diag}\left({\left[\begin{array}{l}1\\ -5\\ 6\\ -1\end{array}\right]}^T\right)\times \left[\begin{array}{l}{\rho }^6\\ {\rho }^4\\ {\rho }^2\\ {\rho }^0\end{array}\right]\end{array}\right.\Longrightarrow {R}_{n\le 6}^{\{m\}}={T}_n\times \mathrm{diag}({w}_n^{\{k\}})\times \left[\begin{array}{l}{\rho }^n\\ {\rho }^{n-2}\\ \vdots \\ {\rho }^{(n\mathrm{mod}2)}\end{array}\right], $$(5)

where diag ( w n { k } ) Mathematical equation: $ \mathrm{diag}({w}_n^{\{k\}})$ denotes the diagonalization of a vector to a diagonal matrix, as diag ( w n { k } ) = [ w n 0 0 0 0 w n 1 0 0 0 w n j ] . Mathematical equation: $$ \mathrm{diag}({w}_n^{\{k\}})=\left[\begin{array}{llll}{w}_n^0& 0& \cdots & 0\\ 0& {w}_n^1& \cdots & 0\\ \vdots & \vdots & \ddots & \vdots \\ 0& 0& \cdots & {w}_n^j\end{array}\right]. $$(6)

It appears that for order n ≥ 2, the de-weighted factor matrix T n can be interpreted as an extended T n−2, with zero-padding at the bottom and a factor vector t n { m } Mathematical equation: $ {t}_n^{\{m\}}$ attached to its left side, as described in the following equation: { T 0 = 1 T 1 = 1 T n 6 = [ t n { m } [ T n - 2 0 ] ] . Mathematical equation: $$ \left\{\begin{array}{ll}{T}_0& =1\\ {T}_1& =1\\ {T}_{n\le 6}& =\left[\begin{array}{ll}{t}_n^{\{m\}}& \left[\begin{array}{l}{T}_{n-2}\\ 0\end{array}\right]\end{array}\right]\end{array}\right.. $$(7)

Note that both the extracted weight vector w n { k } Mathematical equation: $ {w}_n^{\{k\}}$ and the de-weighted factor vector t n { m } Mathematical equation: $ {t}_n^{\{m\}}$ are closely related to an n-row Pascal triangle. In particular, t n { m } Mathematical equation: $ {t}_n^{\{m\}}$ corresponds to the right half of the nth row vector in a standard Pascal triangle (Table 1), i.e., here we have t 6 { m } = [ 20 15 6 1 ] T Mathematical equation: $ {t}_6^{\{m\}}=[\begin{array}{llll}20& 15& 6& 1\end{array}{]}^T$, t 5 { m } = [ 10 5 1 ] T Mathematical equation: $ {t}_5^{\{m\}}=[\begin{array}{lll}10& 5& 1\end{array}{]}^T$, t 4 { m } = [ 6 4 1 ] T Mathematical equation: $ {t}_4^{\{m\}}=[\begin{array}{lll}6& 4& 1\end{array}{]}^T$, t 3 { m } = [ 3 1 ] T Mathematical equation: $ {t}_3^{\{m\}}=[\begin{array}{ll}3& 1\end{array}{]}^T$, t 2 { m } = [ 2 1 ] T Mathematical equation: $ {t}_2^{\{m\}}=[\begin{array}{ll}2& 1\end{array}{]}^T$, t 1 { m } = 1 Mathematical equation: $ {t}_1^{\{m\}}=1$ and t 0 { m } = 1 Mathematical equation: $ {t}_0^{\{m\}}=1$ for radial polynomials of orders n ≤ 6; On the other hand, all extracted weight vectors w n { k } Mathematical equation: $ {w}_n^{\{k\}}$ can be found as corresponding anti-diagonal vectors in the left-aligned Pascal triangle (Table 2), as w 0,1 { k } = 1 Mathematical equation: $ {w}_{\mathrm{0,1}}^{\{k\}}=1$, w 2 { k } = [ 1 - 1 ] Mathematical equation: $ {w}_2^{\{k\}}=[\begin{array}{ll}1& -1\end{array}]$, w 3 { k } = [ 1 - 2 ] Mathematical equation: $ {w}_3^{\{k\}}=[\begin{array}{ll}1& -2\end{array}]$, w 4 { k } = [ 1 - 3 1 ] Mathematical equation: $ {w}_4^{\{k\}}=[\begin{array}{lll}1& -3& 1\end{array}]$, w 5 { k } = [ 1 - 4 3 ] Mathematical equation: $ {w}_5^{\{k\}}=[\begin{array}{lll}1& -4& 3\end{array}]$, w 6 { k } = [ 1 - 5 6 - 1 ] Mathematical equation: $ {w}_6^{\{k\}}=[\begin{array}{llll}1& -5& 6& -1\end{array}]$, where all odd elements (numbered from 0 onwards) are additionally assigned a negative sign.

Table 1

A standard 6-row Pascal triangle and its right half vectors.

Table 2

A left-aligned 6-row Pascal triangle and its anti-diagonal vectors.

To our knowledge, the above-mentioned discoveries are rarely discussed in the literature. Therefore, it is necessary to prove that these discoveries, i.e., the separation of coordinate-relevant and -irrelevant computations (Eq. (4)), the extraction of order-specific weight vectors (Eq. (5)), the block-wise recurrence within de-weighted factor matrices (Eq. (7)), and the close relationship to an n-row Pascal triangle (Tables 1 and 2), hold for Zernike radial polynomials without order limit (i.e., ∀n > 6); if possible and expected, this also holds for complete Zernike polynomials (i.e., radial × azimuth polynomials).

2.2 From canonical to block-wise Zernike calculation

The canonical definition of Zernike radial polynomials, equation (2), has its binomial form: R n m = k = 0 ( n - m ) / 2 ( - 1 ) k ( n - k k ) ( n - 2 k n - m 2 - k ) ρ n - 2 k . Mathematical equation: $$ {R}_n^m=\sum_{k=0}^{(n-m)/2}(-1{)}^k\left(\begin{array}{l}n-k\\ k\end{array}\right)\left(\begin{array}{l}n-2k\\ \frac{n-m}{2}-k\end{array}\right){\rho }^{n-2k}. $$(8)

If we swap the terms m and k in the second binomial term, we obtain R n m = k = 0 ( n - m ) / 2 ( - 1 ) k ( n - k k ) ( n - 2 k n - 2 k 2 - m 2 ) ρ n - 2 k . Mathematical equation: $$ {R}_n^m=\sum_{k=0}^{(n-m)/2}(-1{)}^k\left(\begin{array}{l}n-k\\ k\end{array}\right)\left(\begin{array}{l}n-2k\\ \frac{n-2k}{2}-\frac{m}{2}\end{array}\right){\rho }^{n-2k}. $$(9)

In this equation, the term ( n - k k ) Mathematical equation: $ \left(\begin{array}{l}n-k\\ k\end{array}\right)$ explicitly denotes the anti-diagonal vectors in a left-aligned Pascal triangle, and the term ( n - 2 k n - 2 k 2 - m 2 ) Mathematical equation: $ \left(\begin{array}{l}n-2k\\ \frac{n-2k}{2}-\frac{m}{2}\end{array}\right)$ denotes the left and right halves of the (n − 2k)th-row in a standard Pascal triangle, since Pascal’s triangle has its mirror symmetry with respect to its center position n - 2 k 2 Mathematical equation: $ \frac{n-2k}{2}$.

By Combining de Moivre’s formula (cos + isin) = (cosφ + isinφ)m with the radial polynomials and converting the coordinate system from polar to Cartesian coordinates, we obtain a direct block-wise transformation method for calculating Zernike basis functions in the Cartesian coordinate system. If we define X j { q } = [ x 2 j y 0 x 2 j - 2 y 2 x 0 y 2 j ] T Mathematical equation: $ {X}_j^{\{q\}}={\left[\begin{array}{llll}{x}^{2j}{y}^0& {x}^{2j-2}{y}^2& \cdots & {x}^0{y}^{2j}\end{array}\right]}^T$, and set w n k = ( - 1 ) k ( n - k k ) Mathematical equation: $ {w}_n^k=(-1{)}^k\left(\begin{array}{l}n-k\\ k\end{array}\right)$ and t n { l = m / 2 } = ( n - 2 k n - 2 k 2 - { m } 2 ) Mathematical equation: $ {t}_n^{\{l=m/2\}}=\left(\begin{array}{l}n-2k\\ \frac{n-2k}{2}-\frac{\{m\}}{2}\end{array}\right)$, where {l} denotes the index vector as { l } = [ 0 1 n / 2 ] T Mathematical equation: $ \{l\}=[\begin{array}{llll}0& 1& \cdots & n/2\end{array}{]}^T$ for even orders or { l } = [ 0 1 ( n - 1 ) / 2 ] T Mathematical equation: $ \{l\}=[\begin{array}{llll}0& 1& \cdots & (n-1)/2\end{array}{]}^T$ for odd orders, then such a direct block-wise transformation is represented as a transformation of homogeneous bivariate (xy) polynomials into complete Zernike polynomials, as the following: { z 2 j - { 2 l } = k = 0 j w 2 j k ( t 2 ( j - k ) { l } B 2 ( j - k ) - ) × X ( j - k ) { q } x - 1 y z 2 j + { 2 l } = k = 0 j w 2 j k ( t 2 ( j - k ) { l } B 2 ( j - k ) + ) × X ( j - k ) { q } z 2 j + 1 - { 2 l + 1 } = k = 0 j w 2 j + 1 k ( t 2 ( j - k ) + 1 { l } B 2 ( j - k ) + 1 - ) × X ( j - k ) { q } y z 2 j + 1 + { 2 l + 1 } = k = 0 j w 2 j + 1 k ( t 2 ( j - k ) + 1 { l } B 2 ( j - k ) + 1 + ) × X ( j - k ) { q } x , Mathematical equation: $$ \left\{\begin{array}{ll}{z}_{2j}^{-\{2l\}}=& \sum_{k=0}^j {w}_{2j}^k\left({t}_{2(j-k)}^{\{l\}}\odot {B}_{2(j-k)}^{-}\right)\times {X}_{(j-k)}^{\{q\}}{x}^{-1}y\\ {z}_{2j}^{+\{2l\}}=& \sum_{k=0}^j {w}_{2j}^k\left({t}_{2(j-k)}^{\{l\}}\odot {B}_{2(j-k)}^{+}\right)\times {X}_{(j-k)}^{\{q\}}\\ {z}_{2j+1}^{-\{2l+1\}}=& \sum_{k=0}^j {w}_{2j+1}^k\left({t}_{2(j-k)+1}^{\{l\}}\odot {B}_{2(j-k)+1}^{-}\right)\times {X}_{(j-k)}^{\{q\}}y\\ {z}_{2j+1}^{+\{2l+1\}}=& \sum_{k=0}^j {w}_{2j+1}^k\left({t}_{2(j-k)+1}^{\{l\}}\odot {B}_{2(j-k)+1}^{+}\right)\times {X}_{(j-k)}^{\{q\}}x\\ & \end{array}\right., $$(10)

where the terms of B 2 j - , B 2 j + , B 2 j + 1 - Mathematical equation: $ {B}_{2j}^{-},{B}_{2j}^{+},{B}_{2j+1}^{-}$ and B 2 j + 1 + Mathematical equation: $ {B}_{2j+1}^{+}$ denote four coordinate transformation matrices from the polar coordinate system to the Cartesian coordinate system for corresponding cos/sin components in Zernike basis functions of even and odd order. These four transformation matrices form the second block-wise recurrence in Zernike computations, since the following recursion relation holds: 2 { B 0 - = 0 , B 0 + = 1 , B 1 - = 1 , B 1 + = 1 B 2 j - = [ 0 0 B 2 j - 1 + + B 2 j - 1 - 0 ] B 2 j + = [ [ B 2 j - 1 + 0 ] + [ 0 B 2 j - 1 - ] [ B 2 j - 1 + ( j - 1 ) 0 ] - [ 0 B 2 j - 1 - ( j - 1 ) ] ] B 2 j + 1 - = B 2 j + + B 2 j - B 2 j + 1 + = B 2 j + - [ 0 B 2 j - { 0 k j - 1 } ] , Mathematical equation: $$ \left\{\begin{array}{ll}{B}_0^{-}& =0,{B}_0^{+}=1,{B}_1^{-}=1,{B}_1^{+}=1\\ {B}_{2j}^{-}& =\left[\begin{array}{ll}0& 0\\ {B}_{2j-1}^{+}+{B}_{2j-1}^{-}& 0\end{array}\right]\\ {B}_{2j}^{+}& =\left[\begin{array}{l}\left[\begin{array}{ll}{B}_{2j-1}^{+}& 0\end{array}\right]+\left[\begin{array}{ll}0& {B}_{2j-1}^{-}\end{array}\right]\\ \left[\begin{array}{ll}{B}_{2j-1}^{+(j-1)}& 0\end{array}\right]-\left[\begin{array}{ll}0& {B}_{2j-1}^{-(j-1)}\end{array}\right]\end{array}\right]\\ {B}_{2j+1}^{-}& ={B}_{2j}^{+}+{B}_{2j}^{-}\\ {B}_{2j+1}^{+}& ={B}_{2j}^{+}-\left[\begin{array}{ll}0& {B}_{2j}^{-\{0\le k\le j-1\}}\end{array}\right]\end{array}\right., $$(11)

which is fully supported by the recursive nature of Pascal’s triangle, as are w n { k } Mathematical equation: $ {w}_n^{\{k\}}$ and t n { l } Mathematical equation: $ {t}_n^{\{l\}}$. By expanding the expressions w n { k } , t n { l } Mathematical equation: $ {w}_n^{\{k\}},{t}_n^{\{l\}}$ and B n Mathematical equation: $ {B}_n^{\mp }$ in equation (10) with their corresponding recursive forms, we obtain a block-wise recursive computation method for Zernike basis functions: { z 0 - = 0 , z 0 + = 1 , z 1 - = y , z 1 + = x z 2 j - = x [ 0 O + ( z 2 j - 1 - ) ] - y [ 0 O - ( z 2 j - 1 + ) ] - [ z 2 j - 2 - 0 ] z 2 j + = x [ 2 z 2 j - 1 + 0 O + ( z 2 j - 1 + ) ] + y [ 2 z 2 j - 1 - 0 O - ( z 2 j - 1 - ) ] - [ z 2 j - 2 + 0 ] z 2 j + 1 - = x O + ( z 2 j - ) - y O - ( z 2 j + ) - [ z 2 j - 1 - 0 ] z 2 j + 1 + = x O + ( z 2 j + ) + y O - ( z 2 j - ) - [ z 2 j - 1 + 0 ] , Mathematical equation: $$ \left\{\begin{array}{ll}{z}_0^{-}& =0,{z}_0^{+}=1,{z}_1^{-}=y,{z}_1^{+}=x\\ {z}_{2j}^{-}& =x\left[\begin{array}{l}0\\ {\mathcal{O}}_{+}({z}_{2j-1}^{-})\end{array}\right]-y\left[\begin{array}{l}0\\ {\mathcal{O}}_{-}({z}_{2j-1}^{+})\end{array}\right]-\left[\begin{array}{l}{z}_{2j-2}^{-}\\ 0\end{array}\right]\\ {z}_{2j}^{+}& =x\left[\begin{array}{l}2{z}_{2j-1}^{+0}\\ {\mathcal{O}}_{+}({z}_{2j-1}^{+})\end{array}\right]+y\left[\begin{array}{l}2{z}_{2j-1}^{-0}\\ {\mathcal{O}}_{-}({z}_{2j-1}^{-})\end{array}\right]-\left[\begin{array}{l}{z}_{2j-2}^{+}\\ 0\end{array}\right]\\ {z}_{2j+1}^{-}& =x{\mathcal{O}}_{+}({z}_{2j}^{-})-y{\mathcal{O}}_{-}({z}_{2j}^{+})-\left[\begin{array}{l}{z}_{2j-1}^{-}\\ 0\end{array}\right]\\ {z}_{2j+1}^{+}& =x{\mathcal{O}}_{+}({z}_{2j}^{+})+y{\mathcal{O}}_{-}({z}_{2j}^{-})-\left[\begin{array}{l}{z}_{2j-1}^{+}\\ 0\end{array}\right]\\ & \end{array}\right., $$(12)

where z 2 j z 2 j { 0 l j } z n = 2 j { m = 2 l } Mathematical equation: $ {z}_{2j}^{\mp }\equiv {z}_{2j}^{\mp \{0\le l\le j\}}\equiv {z}_{n=2j}^{\mp \{m=2l\}}$ denotes a column vector of the Zernike basis function of order n = 2j with j + 1 elements at position (x, y), and analogously z 2 j + 1 Mathematical equation: $ {z}_{2j+1}^{\mp }$ for an odd order 2j + 1. The two vector operators O + Mathematical equation: $ {\mathcal{O}}_{+}$ and O - Mathematical equation: $ {\mathcal{O}}_{-}$ are defined as follows: { O + ( z n ) = [ z n { < } 0 ] + z n O - ( z n ) = [ z n { < } 0 ] - z n z n { < } = [ z n 0 z n 1 z n 2 z n j ] T = [ z n 1 z n 2 z n j ] T , Mathematical equation: $$ \left\{\begin{array}{ll}{\mathcal{O}}_{+}({z}_n^{\mp })& =\left[\begin{array}{l}{z}_n^{\mp \{<\}}\\ 0\end{array}\right]+{z}_n^{\mp }\\ {\mathcal{O}}_{-}({z}_n^{\mp })& =\left[\begin{array}{l}{z}_n^{\mp \{<\}}\\ 0\end{array}\right]-{z}_n^{\mp }\\ {z}_n^{\mp \{<\}}& ={\left[\begin{array}{lllll}{z}_n^{\mp 0}& {z}_n^{\mp 1}& {z}_n^{\mp 2}& \cdots & {z}_n^{\mp j}\end{array}\right]}^T\\ & ={\left[\begin{array}{llll}{z}_n^{\mp 1}& {z}_n^{\mp 2}& \cdots & {z}_n^{\mp j}\end{array}\right]}^T\\ & \end{array}\right., $$(13)

for performing offset addition and offset subtraction on a given vector.

3 New computation scheme

Zernike calculations in optical applications include, among others, the following topics: basis function calculation, surface (or wavefront) reconstruction, coefficients evaluation/transformation, derivative analysis, etc.

3.1 Zernike basis functions

Equation (10) can be rewritten as a [ z n m ] 1 × ( n + 1 ) ( n + 2 ) 2 = [ X n i ] 1 × ( n + 1 ) ( n + 2 ) 2 T   as   [ z 0 0 z 1 - 1 z 1 1 z 2 - 2 z 2 0 z 2 2 z n - n z n - n + 2 z n n ] T = [ x 0 y 0 x 1 y 0 x 0 y 1 x 2 y 0 x 1 y 1 x 0 y 2 x n y 0 x n - 1 y 1 x 0 y n ] T T , Mathematical equation: $$ {\left[{z}_n^{\mp m}\right]}_{1\times \frac{(n+1)(n+2)}{2}}={\left[{X}_n^i\right]}_{1\times \frac{(n+1)(n+2)}{2}}\mathcal{T}\stackrel{\enspace \mathrm{as}\enspace }{\rightarrow }{\left[\begin{array}{l}{z}_0^0\\ {z}_1^{-1}\\ {z}_1^1\\ {z}_2^{-2}\\ {z}_2^0\\ {z}_2^2\\ \vdots \\ {z}_n^{-n}\\ {z}_n^{-n+2}\\ \vdots \\ {z}_n^n\end{array}\right]}^T={\left[\begin{array}{l}{x}^0{y}^0\\ {x}^1{y}^0\\ {x}^0{y}^1\\ {x}^2{y}^0\\ {x}^1{y}^1\\ {x}^0{y}^2\\ \vdots \\ {x}^n{y}^0\\ {x}^{n-1}{y}^1\\ \vdots \\ {x}^0{y}^n\end{array}\right]}^T\mathcal{T}, $$(14)

where [ X n i = x n - i y i ] Mathematical equation: $ \left[{X}_n^i={x}^{n-i}{y}^i\right]$ denotes the set of basis functions of homogeneous bivariate (x, y) polynomials with orders from 0 to n, [ z n m ] Mathematical equation: $ \left[{z}_n^{\mp m}\right]$ denotes the set of basis functions of Zernike polynomials with the same orders, and T Mathematical equation: $ \mathcal{T}$ denotes the transformation matrix between these two sets of basis function. It is convenient to arrange xy basis functions in a naturally increasing order (Eq. (14)), and the same applies to Zernike basis functions, i.e., with the notation of ∓m3.

There is the inverse transformation matrix T - 1 Mathematical equation: $ {\mathcal{T}}^{-1}$, with which we have [ X n i ] = [ z n m ] T - 1 . Mathematical equation: $$ \left[{X}_n^i\right]=\left[{z}_n^{\mp m}\right]{\mathcal{T}}^{-1}. $$(15)

Although T - 1 Mathematical equation: $ {\mathcal{T}}^{-1}$ can be obtained by matrix inversion of T Mathematical equation: $ \mathcal{T}$, it is recommended to construct it recursively on the basis of the two block-wise recurrences supported by Pascal’s triangle.4

The direct transformation method for calculating Zernike basis functions can be performed by first calculating the basis functions of homogeneous xy polynomials and then transforming them by multiplying the sparse matrix T Mathematical equation: $ \mathcal{T}$. Theoretically, the calculation of the xy-basis functions can be carried out efficiently and accurately according to { [ x n y 0 x n - 1 y 1 x 1 y n - 1 ] = x [ x n - 1 y 0 x n - 2 y 1 x 0 y n - 1 ] [ x n y 0 x n - 1 y 1 x 1 y n - 1 x 0 y n ] = [ [ x n y 0 x n - 1 y 1 x 1 y n - 1 ] y n ] . Mathematical equation: $$ \left\{\begin{array}{ll}& \left[\begin{array}{llll}{x}^n{y}^0& {x}^{n-1}{y}^1& \cdots & {x}^1{y}^{n-1}\end{array}\right]=x\left[\begin{array}{llll}{x}^{n-1}{y}^0& {x}^{n-2}{y}^1& \cdots & {x}^0{y}^{n-1}\end{array}\right]\\ & \left[\begin{array}{lllll}{x}^n{y}^0& {x}^{n-1}{y}^1& \cdots & {x}^1{y}^{n-1}& {x}^0{y}^n\end{array}\right]=\left[\begin{array}{ll}\left[\begin{array}{llll}{x}^n{y}^0& {x}^{n-1}{y}^1& \cdots & {x}^1{y}^{n-1}\end{array}\right]& {y}^n\end{array}\right]\\ & \end{array}\right.. $$(16)

In addition to the direct block-wise transformation method, this work also presents a block-wise recursive method for calculating Zernike basis functions, which is described in equation (12). These two methods are not only mathematically equivalent but also practically interchangeable. The block-wise recursion can start either from any order n once the previous basis functions of order n − 1 and n − 2 are known, or from the 0th order.

3.2 Surface/wavefront reconstruction

Given a set of samples of a surface or wavefront, which can be either a set of 3D coordinate values, {(x i , y i , z i )| i = 0, 1, 2, ⋯} or a set of normal vectors {(x i , y i , (z x  = ∂z/∂x,zy = ∂z/∂y)i )| i = 0, 1, 2, ⋯}, a polynomial description of such a surface or wavefront can be reconstructed using a Least-Squares optimization: C { k } = arg min C { k } k w { i } ( Z { i } - ( X { i } × { k } ) × C { k } ) 2 C { k } = ( X T ( w { i } I ) X ) - 1 ( X T ( w { i } I ) Z { i } ) , Mathematical equation: $$ {C}_{\{k\}}=\mathrm{arg}\underset{{C}_{\{k\}}}{\mathrm{min}}\sum_k {w}_{\{i\}}{\left({Z}_{\{i\}}-\left({X}_{\{i\}\times \{k\}}\right)\times {C}_{\{k\}}\right)}^2\rightarrow {C}_{\{k\}}={\left({X}^T\left({w}_{\{i\}}I\right)X\right)}^{-1}\left({X}^T\left({w}_{\{i\}}I\right){Z}_{\{i\}}\right), $$(17)

where C {k} denotes a set of coefficients, X {i}×{k} basis function values at ( x ,y) with {i} rows for individual samples and {k} columns for individual basis functions, which can be either homogeneous xy basis functions, or Zernike basis functions. Z {i} denotes the set of measurement values of surface height z {i} or of surface normal vectors (z x , z y ){i}, while w {i} assigns weights to the individual samples: if w {i} ≡ 1, all samples are equally important for the reconstruction.

3.3 Polynomial coefficients

A surface/wavefront can be expressed based on Zernike polynomials with basis functions [ z n m ] Mathematical equation: $ [{z}_n^{\mp m}]$ or based on homogenous xy polynomials with basis functions [xni yi ], as z ( x , y / ρ , φ ) = n = 0 N ( m = - n , step 2 + n d n m z n m ( ρ , φ / x , y ) ) n = 0 N ( i = 0 n a ni x n - i y i ) . Mathematical equation: $$ z(x,y/\rho,\phi )=\sum_{n=0}^N \left(\sum_{\mp m=-n,\mathrm{step}2}^{+n} {d}_n^{\mp m}{z}_n^{\mp m}(\rho,\phi /x,y)\right)\equiv \sum_{n=0}^N \left(\sum_{i=0}^n {a}_{{ni}}{x}^{n-i}{y}^i\right). $$(18)

According to equation (17), C { k } = [ d n m ] Mathematical equation: $ {C}_{\{k\}}=[{d}_n^{\mp m}]$ holds for the coefficient vector of Zernike polynomials, and C {k} = [a ni ] the coefficient vector for homogeneous xy polynomials. This leads to another group of transformations [ d n m ] ( n + 1 ) ( n + 2 ) 2 × 1 = T - 1 [ a ni ] ( n + 1 ) ( n + 2 ) 2 × 1 Mathematical equation: $$ {\left[{d}_n^{\mp m}\right]}_{\frac{(n+1)(n+2)}{2}\times 1}={\mathcal{T}}^{-1}{\left[{a}_{{ni}}\right]}_{\frac{(n+1)(n+2)}{2}\times 1} $$(19) [ a ni ] ( n + 1 ) ( n + 2 ) 2 × 1 = T [ d n m ] ( n + 1 ) ( n + 2 ) 2 × 1 Mathematical equation: $$ {\left[{a}_{{ni}}\right]}_{\frac{(n+1)(n+2)}{2}\times 1}=\mathcal{T}{\left[{d}_n^{\mp m}\right]}_{\frac{(n+1)(n+2)}{2}\times 1} $$(20)

which allow us to freely transform not only the basis functions but also the corresponding coefficients between Zernike polynomials and homogeneous xy polynomials describing a surface or a wavefront.

3.4 Derivatives

Derivative analysis plays an important role in optical applications: first-order derivatives for vertex detection and ray tracing, second-order derivatives for surface curvature analysis, third-order derivatives for local apex detection (with local maximum/minimum curvature) and surface tilt evaluation, etc. Using the two sparse transformation matrices mentioned above, derivative calculations, as well as the evaluation of the optical properties of a surface/wavefront, can be flexibly performed based on its polynomial description, either Zernike or homogeneous xy polynomials. In particular, we have the following equation for homogeneous xy polynomials: { z ( x , y / ρ , φ ) x = n = 0 N i = 0 n a ni ( n - i ) x n - i - 1 y i z ( x , y / ρ , φ ) y = n = 0 N i = 0 n a ni i x n - i y i - 1 n i + 1 ; i - 1 0 { z x = n = 0 N - 1 i = 0 n a ( n + 1 ) i ( n - i + 1 ) x n - i y i z y = n = 0 N - 1 i = 0 n a ( n + 1 ) ( i + 1 ) ( i + 1 ) x n - i y i , Mathematical equation: $$ \left\{\begin{array}{ll}\frac{{\partial z}(x,y/\rho,\phi )}{{\partial x}}& =\sum_{n=0}^N \sum_{i=0}^n {a}_{{ni}}(n-i){x}^{n-i-1}{y}^i\\ \frac{{\partial z}(x,y/\rho,\phi )}{{\partial y}}& =\sum_{n=0}^N \sum_{i=0}^n {a}_{{ni}}i{x}^{n-i}{y}^{i-1}\\ & \end{array}\right.\stackrel{n\ge i+1;i-1\ge 0}{\rightarrow }\left\{\begin{array}{ll}\frac{{\partial z}}{{\partial x}}& =\sum_{n=0}^{N-1} \sum_{i=0}^n {a}_{(n+1)i}(n-i+1){x}^{n-i}{y}^i\\ \frac{{\partial z}}{{\partial y}}& =\sum_{n=0}^{N-1} \sum_{i=0}^n {a}_{(n+1)(i+1)}(i+1){x}^{n-i}{y}^i\\ & \end{array}\right., $$(21)

from which two first-order derivatives of a surface/wavefront described by homogeneous xy polynomials with order 0 ≤ n ≤ N correspond to two surfaces described by two homogeneous xy polynomials with order 0 ≤ n ≤ N − 1, according to the following equation { z ( x , y / ρ , φ ) x = n = 0 N - 1 i = 0 n a ni ( x ) x n - i y i z ( x , y / ρ , φ ) y = n = 0 N - 1 i = 0 n a ni ( y ) x n - i y i , Mathematical equation: $$ \left\{\begin{array}{ll}\frac{{\partial z}(x,y/\rho,\phi )}{{\partial x}}& =\sum_{n=0}^{N-1} \sum_{i=0}^n {a}_{{ni}}^{(x)}{x}^{n-i}{y}^i\\ \frac{{\partial z}(x,y/\rho,\phi )}{{\partial y}}& =\sum_{n=0}^{N-1} \sum_{i=0}^n {a}_{{ni}}^{(y)}{x}^{n-i}{y}^i\\ & \end{array}\right., $$(22)

in which we newly introduce two sets of polynomial coefficients have: a ni ( x ) = a ( n + 1 ) i ( n - i + 1 ) Mathematical equation: $ {a}_{{ni}}^{(x)}={a}_{(n+1)i}(n-i+1)$ for z / x Mathematical equation: $ {\partial z}/{\partial x}$ and a ni ( y ) = a ( n + 1 ) ( i + 1 ) ( i + 1 ) Mathematical equation: $ {a}_{{ni}}^{(y)}={a}_{(n+1)(i+1)}(i+1)$ for ∂z/∂y, which can be calculated directly from the coefficients of the original surface. Furthermore, second-order derivatives can be calculated from first-order derivatives, third-order derivatives from second-order derivatives, etc. Using equation (19), these also apply to Zernike polynomials in polar and Cartesian coordinate systems.

4 Discussion

The two block-wise recurrences discovered in Section 2 can be interpreted as a two-dimensional extension of the chronically observed three-term-recurrence-relation (TTRR) in orthogonal polynomials. The Gram–Schmidt orthogonalization process, which naturally introduces the TTRR (i.e., P n ( x ) = ( A n x + B n ) P n - 1 x + C n P n - 2 ( x ) Mathematical equation: $ {P}_n(x)=({A}_nx+{B}_n){P}_{n-1}x+{C}_n{P}_{n-2}(x)$), is widely used to construct orthogonal bases from homogeneous xy Mathematical equation: $ {xy}$-polynomials. In particular, for Zernike polynomials, two coordinate-value-independent processes: the orthogonalization process and the coordinate system transformation, respectively lead to these two cases of block-wise recurrence.

Building upon the block-wise recursions revealed above and the recursive nature of Pascal’s triangle, this work presents both a block-wise direct transformation method (Eq. (10)) and a block-wise recursive computation method (Eq. (12)) for Zernike basis functions. Mathematically, these two methods are equivalent. In contrast to the available Zernike computation techniques: the component-wise computation of Zernike polynomials using a list of functions in the Cartesian coordinate system [8], the brute-force conversion of Zernike polynomials to Cartesian polynomials (homogeneous xy Mathematical equation: $ {xy}$-polynomials) [9], and the component-wise recursive computation method [6, 7], this work contributes to a block-wise understanding of Zernike polynomials.

Our special contributions include: 1. In addition to avoiding cos/sin calculations (as in [8]), we also avoid all calculations of repetitive factorials, divisions of large integers, and matrix inversions; 2. In contrast to the brute-force implementation of bidirectional conversion up to order 5 (with partial extension up to order 8) between Zernike basis functions and homogeneous xy basis functions [9], we separate the calculations irrelevant to the coordinate values from those relevant to the coordinate values, and offer either the recursive computation of the coordinate-irrelevant factors, or the recursive computation of the complete Zernike basis functions. Such recursions are based on block-wise recurrences for coordinate-irrelevant calculations and their close relationship to a Pascal triangle. We exploit these new insights for Zernike-related computations, thereby eliminating the tediousness/complexity of high-order Zernike components and thus achieving greater flexibility for optical applications without restriction of order. Furthermore, this work discovers a direct, but previously unnoticed, block-wise connection between Zernike polynomials in Cartesian form and their recursive computations (Eqs. (10)(12)).

4.1 Computational performance: a preliminary evaluation

The direct block-wise transformation method described in equation (10) and equation (14) for calculating Zernike basis functions can be interpreted as an upgraded version of the xy-form-LUT method mentioned in Section 1. Instead of explicitly defining a LUT of independent functions or equations for individual Zernike components in their xy-polynomial form, one or four recursively extendable transformation matrixes and a recursively extendable list of basis functions of Cartesian xy-polynomials (e.g., based on Eq. (16)) are combined by matrix multiplications, resulting in the required Zernike basis functions. Theoretically, this upgrade does not change the essential computational complexity for a single Zernike component, which can be measured as the number of two arithmetic CPU instructions: multiplication and addition. For a required Zernike component with polynomial order n = 2j or n = 2j + 1 and azimuth order m = ±2l or m = ±(2l + 1), the numbers of essential arithmetic instructions are listed in Table 3, where the construction of T Mathematical equation: $ \mathcal{T}$ is not counted because it is coordinate-independent and can therefore be calculated in advance as a factor LUT for the Zernike calculation. In short, this work improves the traditional Zernike computation scheme based on the xy-polynomial form with two significant advantages: 1) It is no longer necessary to repeatedly calculate the xy-basis functions in each calculation function/equation of individual Zernike components in Cartesian form; 2) There is no longer order restriction caused by the limited list of Zernike components with their Cartesian form given in the literature.

Table 3

Counts of arithmetic instructions for a Zernike component z n ± m Mathematical equation: $ {z}_n^{\pm m}$, where sin and cos components of even and odd orders are considered separately.

It is noticeable that the computational complexity of this direct transformation method is not the same for individual Zernike components with the same polynomial order n, but depends on their azimuth order ±m, where z n - n Mathematical equation: $ {z}_n^{-n}$ requires minimum and z n 0 Mathematical equation: $ {z}_n^0$ (or z n 1 Mathematical equation: $ {z}_n^1$) maximum calculations. In Figure 1a, two solid curves represent the minimum and maximum number of all multiplications, including the computation of the xy Mathematical equation: $ {xy}$ basis functions and the matrix multiplication [ X ] × T Mathematical equation: $ [X]\times \mathcal{T}$ (equation (14))), for polynomial orders from 0 to 99. These two curves are compared with two additional dashed-dotted curves representing the corresponding performance measurements of the Zernike computation method based on component-wise recurrence, where the application scenario is set to compute a single Zernike component with given n and m for a coordinate position (x, y). The computational performance of component-wise recursion is achieved by manually programming the formulas (3)2–38 in [7] (Andersen, 2018), extending the three-term-recurrence to a five-term-recurrence for full Zernike polynomials. Similarly, Figure 1b shows the comparison of computational complexity based on the number of addition operations. These two comparisons demonstrate that the Zernike computation method based on direct block-wise transformation has high computational performance.

Thumbnail: Figure 1 Refer to the following caption and surrounding text. Figure 1

Comparison of computational complexity (I): (a) number of multiplications; (b) number of additions. Four curves in (a) show the maximum and minimum multiplication requirements for the component-wise recursion method and the direct transformation method for a required Zernike component at one (x, y) position; the same applies to four curves in (b) for addition operations.

The above performance evaluation makes sense in theory, but calculating a single component is not so common in practice. In contrast, preparing all components from order 0 to order n is necessary for surface/wavefront reconstruction and analysis. The implementation of the corresponding methods significantly influences the final performance assessment. Two further aspects must be considered: 1) the reuse of lower-order results; 2) the use of modern computer hardware such as SIMD (Single-Instruction-Multiple-Data) technique and Cache-hierarchy. Block-wise recursion offers a direct route to modern, hardware-compatible implementations. Another computational performance comparison was performed between the component-wise recursive calculation method mentioned above and the block-wise recursive calculation method. Figure 2 shows the advantage of the latter method. Both methods were implemented and tested in the same MATLAB environment (DELL laptop, Intel(R) Core(TM) i5-1245U, 16GB RAM, 128MB Intel(R) UHD Graphics, Windows-11 OS, MATLAB-R2020b 64-bit) without any special coding optimization. Although this is only a preliminary assessment, the block-wise recursive method shows better computational performance, scaling linearly with the polynomial order while the component-wise recursive method appears to be exponentially relevant. This advantage stems from the inherent compatibility between the block-wise recursive method and modern hardware technology in civilian commercial computers.

Thumbnail: Figure 2 Refer to the following caption and surrounding text. Figure 2

Comparison of computational complexity (II): Time elapsed for generating all Zernike components up to order 99 using component-wise recursion (red) compared to block-wise recursion (blue): (a) the comparison; (b) further details on the elapsed time of block-wise recursion (with y-axis ≤1.5 ms). The comparison was performed for one (x, y) position, and the elapsed time is measured in millisecond (10−3 s).

4.2 Computational accuracy: a preliminary evaluation

In addition to the computational performance test described above, the computational accuracy was also compared using 120 spatial positions taken from 5 radius positions times 24 azimuth positions (see Fig. 3a). For each spatial position, all Zernike components from order 0 to order 99 were calculated using both the component-wise recursive method mentioned above ([7]) and the block-wise recursive method based on Pascal’s triangle (Eq. (12)). For each order, the maximum absolute difference between the results of both methods was recorded; thus, a difference curve along polynomial orders was created for each position. All 120 curves were recorded during the test. They are shown in Figure 3 in two versions: the raw difference curves (b) and their logarithmic (log10) version (c).

Thumbnail: Figure 3 Refer to the following caption and surrounding text. Figure 3

Accuracy assessment of the block–wise recursion compared to the component-wise recursion (Andersen’s method [7]) for calculating Zernike basis functions: (a) 120 test positions from a circular region with five radii (1.00, 0.96, 0.88, 0.72, 0.40) and 24 uniformly distributed azimuth angles; (b) 120 difference curves (color–coded) with respect to the polynomial orders, each curve representing the maximum absolute differences between two sets of Zernike components along the orders from 0 to 99 for a position in (a); (c) the logarithmic representation (log10) of the corresponding curves in (b), of which 17 curves are distinguished from the others by their difference value of over 3 × 10−15 and whose corresponding positions all lie on the unit circle.

The comparison results show an absolute difference of less than 6 × 10−14, with the maximum absolute difference exceeding 3 × 10−15 at 17 positions on the unit circle from order 50 onwards. This preliminary result confirmed our expectation that the block-wise recursive method can be interpreted as equivalent to the component-wise recursive method, although the former is proposed on the basis of one Pascal triangle and the latter was developed from the TTRR relationship in orthogonal polynomials.

Naturally, the question arises as to the above 17 positions on the unit circle: which method is closer to the truth? Recursive methods (component-wise and block-wise recursion) were further compared with the direct transformation method (Eq. (10)). Unlike that the two recursive methods, which were fully implemented in MATLAB with double precision, the direct transformation method requires additional support from an external library for “arbitrary-precision-arithmetic” due to the rapidly increasing integer values (i.e., binomial factors) for polynomials of order higher than 50. The comparison results for the six positions with the largest deviations, all located on the unit circle, are shown in Figure 4. It is evident that for both recursive methods, all deviations are smaller than approximately 4 × 10−13 compared to the direct transformation method.

Thumbnail: Figure 4 Refer to the following caption and surrounding text. Figure 4

Accuracy comparisons (a)–(f) at six positions on the unit circle: (x, y) ≈ (−0.5000000, −0.8660254), (−0.7071068, −0.7071068), (−0.5000000, 0.8660254), (0.5000000, 0.8660254). (0.5000000, −0.8660254), and (−0.8660254, −0.5000000). Each comparison includes three curves: the one above for 5050 Zernike components of orders 0 to 99, calculated using the direct transformation method, as the comparison reference; the middle one for the absolute difference of the component-wise recursive method to the reference; and the curve below for the block-wise recursive method. All difference curves are shown with the same value scale: ≤4 × 10−13.

It should be noted that this work does not constitute a definitive assessment of the accuracy of one method compared to others, but rather a preliminary evaluation to support the conceptual investigation of the relationship between Zernike polynomials and Pascal’s triangle. Further evaluations with more detailed application scenarios are to be expected, as the difference curves reveal some order-dependent structural information which, although very small, is not random noise.

4.3 Memory requirement

Memory requirements are often a critical factor in development due to detailed application scenarios. This work offers high flexibility for practical system/algorithm development: Block-wise recursive computation for generating basis functions requires no additional memory; similarly, virtually no additional memory is needed for surface/wavefront analysis, which uses transformation matrices for coefficient operations and derivative computations, since all transformation matrices can be rapidly computed by block-wise recursive algorithms, e.g., equation (11) for the forward coordinate system transformation in Zernike computations.

5 Conclusion

In this work, the computation of Zernike basis functions was divided into two parts: the part irrelevant to the coordinate values and the part relevant to the coordinate values. The first part comprises the computation of the coordinate transformation along with an orthogonalization process (based on homogeneous xy polynomials). This leads to two cases of block-wise recurrence in the coordinate-independent Zernike computation. The use of these two block-wise recurrences, supported by Pascal triangle, enables a block-wise direct transformation method and a block-wise recursive computation method for Zernike polynomials. The latter is more suitable for computing basis functions, while the former is better suited for operations and analyses of surfaces using their polynomial coefficients. Theoretically, this significantly improves computational speed, reduces memory requirements, and increases application flexibility without compromising accuracy. Optical applications can benefit from these new insights.

This work provides a solid starting point for further theoretical and application-specific studies, such as a comprehensive evaluation of computational complexity, a dedicated algorithmic accuracy/stability investigation, and application-oriented algorithm design, Zernike analysis with non-circular pupil, fast higher-order derivatives of a surface described by Zernike polynomials, etc. It is also valuable for discovering similar cases of block-wise recurrence in other orthogonal polynomials constructed using the Gram-Schmidt process.

Funding

This research received no external funding.

Conflicts of interest

The authors declare no conflicts of interest in regards to this article.

Data availability statement

The underlying data can be provided by the authors upon reasonable request.

References

  1. Lakshminarayanan V, Fleck A, Zernike polynomials: a guide, J. Modern Opt. 58(7), 545–561 (2011). https://doi.org/10.1080/09500340.2011.633763. [Google Scholar]
  2. Schwiegerling J, Description of Zernike Polynomials, 2016. https://wp.optics.arizona.edu/visualopticslab/wp-content/uploads/sites/52/2016/08/Zernike-Notes-15Jan2016.pdf. [Google Scholar]
  3. Niu K, Tian C, Zernike polynomials and their applications, J. Opt. 24(12), 1–54 (2022). https://doi.org/10.1088/2040-8986/ac9e08. [Google Scholar]
  4. Born M, Wolf E, Bhatia AB, Principles of optics: Electromagnetic theory of propagation, interference and diffraction of light, 7th ed., Vol. 523 (Cambridge University Press, Cambridge, UK, 1999). ISBN 978-0-521-64222-4. https://books.google.de/books?id=nUHGpfNsGyUCq=Zernikeredir_esc=y#v=snippetq=Zernikef=false. [Google Scholar]
  5. Zernike F, Beugungstheorie des schneidenver-fahrens und seiner verbesserten form, der phasenkontrastmethode, Physica 1(7–12), 689–704 (1934), https://doi.org/10.1016/S0031-8914(34)80259-5. [Google Scholar]
  6. Shakibaei BH, Paramesran R, Recursive formula to compute Zernike radial polynomials, Opt. Lett. 38(14), 2487–2489 (2013). https://doi.org/10.1364/OL.38.002487. [Google Scholar]
  7. Andersen TB, Efficient and robust recurrence relations for the Zernike circle polynomials and their derivatives in Cartesian coordinates, Opt. Exp. 26(15), 18878–18896 (2018). https://doi.org/10.1364/OE.26.018878. [Google Scholar]
  8. van Brug H.H. (1997) Efficient Cartesian representation of Zernike polynomials in computer memory, Proc. SPIE: Fifth Int. Topical Meet. Educ. Train. Opt. 382–392, https://doi.org/10.1117/12.294412. [Google Scholar]
  9. Mathar RJ, Zernike basis to Cartesian Transformations, Serbian Astron. J. 179, 107–120 (2009). https://doi.org/10.2298/SAJ0979107M. [Google Scholar]

1

To our knowledge, block-wise recurrence in Zernike calculations has hardly been addressed in the literature, although there is a long history of intensive studies on Zernike polynomials.

2

The mathematical derivation in this section briefly proves the two previously mentioned cases of block–wise recurrence in Zernike computations without order restriction. Further details can be found in Appendix A.

3

This arrangement corresponds to the OSA/ANSI standard indices for Zernike polynomials [3].

4

Table B1 in Appendix B gives 𝓣, Table B2 its inverse 𝓣−1, each up to order 6.

Appendix A: Mathematical proofs

A.1 Pascal triangle supported block-wise recurrence in Zernike polynomials

The Zernike radial polynomial has its binomial form (Eq. (8)). Defining n = 2j, m = 2l for even orders and n = 2j + 1, m = 2l + 1 for odd orders, and defining two intermediate variables J k  = j − k and J 2k  = 2J k , we obtain { R 2 j 2 l = k = 0 j - l ( - 1 ) k ( J 2 k + k J 2 k ) ( J 2 k J k + l ) ( ρ 2 ) J k R 2 j + 1 2 l + 1 = ρ k = 0 j - l ( - 1 ) k ( ( J 2 k + k J 2 k ) + ( J 2 k + k J 2 k + 1 ) ) ( ( J 2 k J k + l ) + ( J 2 k J k + l + 1 ) ) ( ρ 2 ) J k . Mathematical equation: $$ \left\{\begin{array}{ll}{R}_{2j}^{2l}& =\sum_{k=0}^{j-l} (-1{)}^k\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}\end{array}\right)\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l\end{array}\right)({\rho }^2{)}^{{J}_k}\\ {R}_{2j+1}^{2l+1}& =\rho \sum_{k=0}^{j-l} (-1{)}^k\left(\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}\end{array}\right)+\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}+1\end{array}\right)\right)\left(\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l\end{array}\right)+\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l+1\end{array}\right)\right)({\rho }^2{)}^{{J}_k}\end{array}\right.. $$(A.1)

Further defining w k e = ( J 2 k + k J 2 k ) Mathematical equation: $ {w}_k^e=\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}\end{array}\right)$, w k o = w k e + ( J 2 k + k J 2 k + 1 ) Mathematical equation: $ {w}_k^o={w}_k^e+\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}+1\end{array}\right)$, t lk e = ( J 2 k J k + l ) Mathematical equation: $ {t}_{{lk}}^e=\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l\end{array}\right)$, and t lk o = t lk e + ( J 2 k J k + l + 1 ) Mathematical equation: $ {t}_{{lk}}^o={t}_{{lk}}^e+\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l+1\end{array}\right)$, we obtain { R 2 j 2 l = k = 0 j - l ( - 1 ) k w k e t lk e ( ρ 2 ) J k R 2 j + 1 2 l + 1 = ρ k = 0 j - l ( - 1 ) k w k o t lk o ( ρ 2 ) J k . Mathematical equation: $$ \left\{\begin{array}{ll}{R}_{2j}^{2l}=& \sum_{k=0}^{j-l} (-1{)}^k{w}_k^e{t}_{{lk}}^e({\rho }^2{)}^{{J}_k}\\ {R}_{2j+1}^{2l+1}=\rho & \sum_{k=0}^{j-l} (-1{)}^k{w}_k^o{t}_{{lk}}^o({\rho }^2{)}^{{J}_k}\end{array}\right.. $$(A.2)

In particular, we have w k e = ( J 2 k + k J 2 k ) = ( 2 j - k k ) Mathematical equation: $ {w}_k^e=\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}\end{array}\right)=\left(\begin{array}{l}2j-k\\ k\end{array}\right)$, for which we obtain a vector by continuously increasing k by 1 from 0 to k = j − l, provided w { k } e = [ ( 2 j 0 ) ( 2 j - 1 1 ) ( j + l j - l ) ] Mathematical equation: $ {w}_{\{k\}}^e=\left[\begin{array}{llll}\left(\begin{array}{l}2j\\ 0\end{array}\right)& \left(\begin{array}{l}2j-1\\ 1\end{array}\right)& \cdots & \left(\begin{array}{l}j+l\\ j-l\end{array}\right)\end{array}\right]$ as a row vector, where 2j = n for even orders and l ≤ j; we also have w k o = w k e + ( J 2 k + k J 2 k + 1 ) = ( 2 j - k k ) + ( 2 j - k k - 1 ) = ( 2 j + 1 - k k ) Mathematical equation: $ {w}_k^o={w}_k^e+\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}+1\end{array}\right)=\left(\begin{array}{l}2j-k\\ k\end{array}\right)+\left(\begin{array}{l}2j-k\\ k-1\end{array}\right)=\left(\begin{array}{l}2j+1-k\\ k\end{array}\right)$, provided w { k } o = [ ( 2 j + 1 0 ) ( 2 j 1 ) ( j + 1 + l j - l ) ] Mathematical equation: $ {w}_{\{k\}}^o=\left[\begin{array}{llll}\left(\begin{array}{l}2j+1\\ 0\end{array}\right)& \left(\begin{array}{l}2j\\ 1\end{array}\right)& \cdots & \left(\begin{array}{l}j+1+l\\ j-l\end{array}\right)\end{array}\right]$, where 2j + 1 = n for odd orders and l ≤ j. Either w { k } e Mathematical equation: $ {w}_{\{k\}}^e$ or w { k } o Mathematical equation: $ {w}_{\{k\}}^o$ denotes a corresponding anti-diagonal vector in a left-aligned n-row Pascal triangle (e.g., Table 2 for n ≤ 6). For one even (or odd) order, w { k } e Mathematical equation: $ {w}_{\{k\}}^e$ (or w { k } o Mathematical equation: $ {w}_{\{k\}}^o$) depends on a single variable k and is independent of l or m.

Meanwhile, for an even order n = 2j, we have t lk e = ( J 2 k J k + l ) = ( 2 ( j - k ) ( j - k ) + l ) Mathematical equation: $ {t}_{{lk}}^e=\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l\end{array}\right)=\left(\begin{array}{l}2(j-k)\\ (j-k)+l\end{array}\right)$, where t lk e | k = 0 = ( 2 j j + l ) Mathematical equation: $ {t}_{{lk}}^e{|}_{k=0}=\left(\begin{array}{l}2j\\ j+l\end{array}\right)$ subject to k = 0; continuously increasing k by 1 till k = j − l, we obtain a row vector t l { k } e = [ ( 2 j j + l ) ( 2 j - 2 j - 1 + l ) ( 2 j - 4 j - 2 + l ) ( 2 l 2 l ) ] Mathematical equation: $ {t}_{l\{k\}}^e=\left[\begin{array}{lllll}\left(\begin{array}{l}2j\\ j+l\end{array}\right)& \left(\begin{array}{l}2j-2\\ j-1+l\end{array}\right)& \left(\begin{array}{l}2j-4\\ j-2+l\end{array}\right)& \cdots & \left(\begin{array}{l}2l\\ 2l\end{array}\right)\end{array}\right]$ with respect to a particular l, and obtain an anti-upper-triangular matrix for all the 0 ≤ l ≤ j, as T n = 2 j ( t lk e ) = t { l } { k } e = [ ( 2 j j ) ( 2 j - 2 j - 1 ) ( 2 j - 4 j - 2 ) ( 2 1 ) ( 0 0 ) ( 2 j j + 1 ) ( 2 j - 2 j ) ( 2 j - 4 j - 1 ) ( 2 2 ) ( 2 j j + 2 ) ( 2 j - 2 j + 1 ) ( 2 j - 4 j ) ( 2 j 2 j - 2 ) ( 2 j - 2 2 j - 2 ) ( 2 j 2 j ) ] ( j + 1 ) × ( j + 1 ) . Mathematical equation: $$ {T}_{n=2j}\left({t}_{{lk}}^e\right)={t}_{\{l\}\{k\}}^e={\left[\begin{array}{llllll}\left(\begin{array}{l}2j\\ j\end{array}\right)& \left(\begin{array}{l}2j-2\\ j-1\end{array}\right)& \left(\begin{array}{l}2j-4\\ j-2\end{array}\right)& \cdots & \left(\begin{array}{l}2\\ 1\end{array}\right)& \left(\begin{array}{l}0\\ 0\end{array}\right)\\ \left(\begin{array}{l}2j\\ j+1\end{array}\right)& \left(\begin{array}{l}2j-2\\ j\end{array}\right)& \left(\begin{array}{l}2j-4\\ j-1\end{array}\right)& \cdots & \left(\begin{array}{l}2\\ 2\end{array}\right)& \\ \left(\begin{array}{l}2j\\ j+2\end{array}\right)& \left(\begin{array}{l}2j-2\\ j+1\end{array}\right)& \left(\begin{array}{l}2j-4\\ j\end{array}\right)& \cdots & & \\ \cdots & \cdots & \ddots & & & \\ \left(\begin{array}{l}2j\\ 2j-2\end{array}\right)& \left(\begin{array}{l}2j-2\\ 2j-2\end{array}\right)& & & & \\ \left(\begin{array}{l}2j\\ 2j\end{array}\right)& & & & & \end{array}\right]}_{(j+1)\times (j+1)}. $$(A.3)

Also for an odd order n = 2j + 1, we have t lk o = t lk e + ( J 2 k J k + l + 1 ) = ( 2 ( j - k ) ( j - k ) + l ) + ( 2 ( j - k ) ( j - k ) + l + 1 ) = ( 2 ( j - k ) + 1 ( ( j - k ) + 1 ) + l ) Mathematical equation: $ {t}_{{lk}}^o={t}_{{lk}}^e+\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l+1\end{array}\right)=\left(\begin{array}{l}2(j-k)\\ (j-k)+l\end{array}\right)+\left(\begin{array}{l}2(j-k)\\ (j-k)+l+1\end{array}\right)=\left(\begin{array}{l}2(j-k)+1\\ ((j-k)+1)+l\end{array}\right)$, and an anti-upper-triangular matrix as follows: T n = 2 j + 1 ( t lk o ) = t { l } { k } o [ ( 2 j + 1 j + 1 ) ( 2 j - 1 j ) ( 2 j - 3 j - 1 ) ( 3 2 ) ( 1 1 ) ( 2 j + 1 j + 2 ) ( 2 j - 1 j + 1 ) ( 2 j - 3 j ) ( 3 3 ) ( 2 j + 1 j + 3 ) ( 2 j - 1 j + 2 ) ( 2 j - 3 j + 1 ) ( 2 j + 1 2 j ) ( 2 j - 1 2 j - 1 ) ( 2 j + 1 2 j + 1 ) ] ( j + 1 ) × ( j + 1 ) . Mathematical equation: $$ {T}_{n=2j+1}\left({t}_{{lk}}^o\right)={t}_{\{l\}\{k\}}^o{\left[\begin{array}{llllll}\left(\begin{array}{l}2j+1\\ j+1\end{array}\right)& \left(\begin{array}{l}2j-1\\ j\end{array}\right)& \left(\begin{array}{l}2j-3\\ j-1\end{array}\right)& \cdots & \left(\begin{array}{l}3\\ 2\end{array}\right)& \left(\begin{array}{l}1\\ 1\end{array}\right)\\ \left(\begin{array}{l}2j+1\\ j+2\end{array}\right)& \left(\begin{array}{l}2j-1\\ j+1\end{array}\right)& \left(\begin{array}{l}2j-3\\ j\end{array}\right)& \cdots & \left(\begin{array}{l}3\\ 3\end{array}\right)& \\ \left(\begin{array}{l}2j+1\\ j+3\end{array}\right)& \left(\begin{array}{l}2j-1\\ j+2\end{array}\right)& \left(\begin{array}{l}2j-3\\ j+1\end{array}\right)& \cdots & & \\ \cdots & \cdots & \ddots & & & \\ \left(\begin{array}{l}2j+1\\ 2j\end{array}\right)& \left(\begin{array}{l}2j-1\\ 2j-1\end{array}\right)& & & & \\ \left(\begin{array}{l}2j+1\\ 2j+1\end{array}\right)& & & & & \end{array}\right]}_{(j+1)\times (j+1)}. $$(A.4)

The results of mathematical derivation starting from binomial equivalence agree with the intuitive visual observation in the previous Section 2.1: { ( - 1 ) k w k e w n = 2 j k ( - 1 ) k w k o w n = 2 j + 1 k t lk e | k = 0 t n = 2 j m = 2 l t lk o | k = 0 t n = 2 j + 1 m = 2 l + 1 T n ( t lk o / e / 0 ) T n = [ t n { m } [ T n - 2 0 ] ] , Mathematical equation: $$ \left\{\begin{array}{ll}(-1{)}^k{w}_k^e& \equiv {w}_{n=2j}^k\\ (-1{)}^k{w}_k^o& \equiv {w}_{n=2j+1}^k\\ {t}_{{lk}}^e{|}_{k=0}& \equiv {t}_{n=2j}^{m=2l}\\ {t}_{{lk}}^o{|}_{k=0}& \equiv {t}_{n=2j+1}^{m=2l+1}\\ {T}_n\left({t}_{{lk}}^{o/e}/0\right)& \equiv {T}_n=\left[\begin{array}{ll}{t}_n^{\{m\}}& \left[\begin{array}{l}{T}_{n-2}\\ 0\end{array}\right]\end{array}\right]\\ & \end{array}\right., $$(A.5)

where T n ( t lk o / e / 0 ) Mathematical equation: $ {T}_n\left({t}_{{lk}}^{o/e}/0\right)$ denotes a variation of T n ( t lk o / e ) Mathematical equation: $ {T}_n\left({t}_{{lk}}^{o/e}\right)$ by filling the elements below the anti-diagonal elements with zeros. Furthermore, by adopting { diag ( w 2 j { k } ) = [ ( - 1 ) 0 w k = 0 e ( - 1 ) 1 w k = 1 e ( - 1 ) j - l w k = j e ] ( j + 1 ) × ( j + 1 ) diag ( w 2 j + 1 { k } ) = [ ( - 1 ) 0 w k = 0 o ( - 1 ) 1 w k = 1 o ( - 1 ) j - l w k = j o ] ( j + 1 ) × ( j + 1 ) , Mathematical equation: $$ \left\{\begin{array}{ll}\mathrm{diag}\left({w}_{2j}^{\{k\}}\right)=& {\left[\begin{array}{llll}(-1{)}^0{w}_{k=0}^e& & & \\ & (-1{)}^1{w}_{k=1}^e& & \\ & & \ddots & \\ & & & (-1{)}^{j-l}{w}_{k=j}^e\end{array}\right]}_{(j+1)\times (j+1)}\\ \mathrm{diag}\left({w}_{2j+1}^{\{k\}}\right)=& {\left[\begin{array}{llll}(-1{)}^0{w}_{k=0}^o& & & \\ & (-1{)}^1{w}_{k=1}^o& & \\ & & \ddots & \\ & & & (-1{)}^{j-l}{w}_{k=j}^o\end{array}\right]}_{(j+1)\times (j+1)}\\ & \end{array}\right., $$(A.6)

Equation (A.2) can be re-written as { R 2 j { 2 l } = T 2 j × diag ( w 2 j { k } ) ) × ( [ ( ρ 2 ) j ( ρ 2 ) j - 1 ( ρ 2 ) 1 ] T ) ( j + 1 ) × 1 R 2 j + 1 { 2 l + 1 } = T 2 j + 1 × diag ( w 2 j + 1 { k } ) × ( [ ( ρ 2 ) j ( ρ 2 ) j - 1 ( ρ 2 ) 1 ] T ) ( j + 1 ) × 1 × ρ , Mathematical equation: $$ \left\{\begin{array}{ll}{R}_{2j}^{\{2l\}}=& {T}_{2j}\times \mathrm{diag}\left({w}_{2j}^{\{k\}})\right)\times {\left({\left[\begin{array}{lllll}({\rho }^2{)}^j& ({\rho }^2{)}^{j-1}& \cdots & ({\rho }^2)& 1\end{array}\right]}^T\right)}_{(j+1)\times 1}\\ {R}_{2j+1}^{\{2l+1\}}=& {T}_{2j+1}\times \mathrm{diag}\left({w}_{2j+1}^{\{k\}}\right)\times {\left({\left[\begin{array}{llllll}({\rho }^2{)}^j& ({\rho }^2{)}^{j-1}& \cdots & ({\rho }^2)& & 1\end{array}\right]}^T\right)}_{(j+1)\times 1}\times \rho \end{array}\right., $$(A.7)

where the radial coordinate-dependent vector [ ( ρ 2 ) j ( ρ 2 ) j - 1 ( ρ 2 ) 1 ] T Mathematical equation: $ {\left[\begin{array}{lllll}({\rho }^2{)}^j& ({\rho }^2{)}^{j-1}& \cdots & ({\rho }^2)& 1\end{array}\right]}^T$ contains all possible ( ρ 2 ) J k Mathematical equation: $ {\left({\rho }^2\right)}^{{J}_k}$ in equation (A.7), ∀k ∈ [0, j − l], ∀l ∈ [0, j]. Essentially equation (A.7) is equivalent to equation (5), and equations ((A.3)) and ((A.4)) are equivalent to equation (7), without an order limit (∀n ≥ 0).

It is noticed that the close relationship between the radial polynomials and Pascal triangle can be straightforwardly obtained even without the intermediate variables J k and J 2k : The ordered set of binomial factors { ( n - k k ) | k = 0,1 , . . . ( n - m ) / 2 } Mathematical equation: $ \left\{\left(\begin{array}{l}n-k\\ k\end{array}\right)|k=\mathrm{0,1},...(n-m)/2\right\}$ corresponds to an anti-diagonal vector of a left-aligned Pascal triangle, where k Mathematical equation: $ k$ increases while n − k decreases, each in steps of 1, as shown in Table 2 for n ≤ 6; the binomial factor ( n - 2 k ( n - m ) / 2 - k ) Mathematical equation: $ \left(\begin{array}{l}{n}-\mathbf{2}{k}\\ ({n}-{m})/\mathbf{2}-{k}\end{array}\right)$ can be rewritten as ( n - 2 k ( n - 2 k ) / 2 - m / 2 ) Mathematical equation: $ \left(\begin{array}{l}{n}-\mathbf{2}{k}\\ ({n}-\mathbf{2}{k})/\mathbf{2}-{m}/\mathbf{2}\end{array}\right)$ , which is equivalent to ( n - 2 k ( n - 2 k ) / 2 + m / 2 ) Mathematical equation: $ \left(\begin{array}{l}{n}-\mathbf{2}{k}\\ ({n}-\mathbf{2}{k})/\mathbf{2}+{m}/\mathbf{2}\end{array}\right)$ . If k varies as the column index and l = m/2 for even orders or l = (m − 1)/2 for odd orders varies as the row index, the ordered factor set { ( n - 2 k ( n - 2 k ) / 2 + l ) | l = 0,1 , j ; k = 0,1 , . . . j - l } Mathematical equation: $ \left\{\left(\begin{array}{l}n-2k\\ (n-2k)/2+l\end{array}\right)|l=\mathrm{0,1},j;k=\mathrm{0,1},...j-l\right\}$ forms a 2D matrix. For a certain k, the column vector ( n - 2 k ( n - 2 k ) / 2 + { l } ) Mathematical equation: $ \left(\begin{array}{l}n-2k\\ (n-2k)/2+\{l\}\end{array}\right)$ corresponds to the right half of the (n − 2k)th row in Pascal triangle (Table 1 for n ≤ 6). Nevertheless, using the intermediate variables J k and J 2k , additional block-wise relationships such as w k o = w k e + ( J 2 k + k J 2 k + 1 ) Mathematical equation: $ {w}_k^o={w}_k^e+\left(\begin{array}{l}{J}_{2k}+k\\ {J}_{2k}+1\end{array}\right)$ and t lk o = t lk e + ( J 2 k J k + l + 1 ) Mathematical equation: $ {t}_{{lk}}^o={t}_{{lk}}^e+\left(\begin{array}{l}{J}_{2k}\\ {J}_k+l+1\end{array}\right)$ can be obtained, which, although not as intuitive, are useful for further algorithm development.

A.2 Zernike radial polynomials in Cartesian: the second block-wise recurrence

Considering that ρ2 = x2 + y2, its power value (ρ2)j can be expressed as the multiplication of two vectors: ( ρ 2 ) j = q = 0 j b j q x 2 ( j - q ) y 2 q = b j { q } × X j { q } Mathematical equation: $$ {\left({\rho }^2\right)}^j=\sum_{q=0}^j {b}_j^q{x}^{2(j-q)}{y}^{2q}={b}_j^{\{q\}}\times {X}_j^{\{q\}} $$(A.8)

where b j { q } Mathematical equation: $ {b}_j^{\{q\}}$ denotes a row vector containing all binomial factors of { b j q = ( j q ) | q = 0,1 , 2 , . . . j } Mathematical equation: $ \{{b}_j^q=\left(\begin{array}{l}j\\ q\end{array}\right)|q=\mathrm{0,1},2,...j\}$, corresponding to the jth row in an n-row Pascal triangle, and X j { q } Mathematical equation: $ {X}_j^{\{q\}}$ denotes a column vector of the sequentially listed jth basis functions of homogeneous bivariate polynomials for (x2, y2), as [ x 2 j y 0 x 2 ( j - 1 ) y 2 x 0 y 2 j ] T Mathematical equation: $ {\left[\begin{array}{lll}{x}^{2j}{y}^0& {x}^{2(j-1)}{y}^2& \cdots {x}^0{y}^{2j}\end{array}\right]}^T$. Further, the radial coordinate-dependent vector in equation (A.7) can be represented in matrix form as follows: [ ( ρ 2 ) j ( ρ 2 ) j - 1 ( ρ 2 ) 1 ] ( j + 1 ) × 1 = [ b j { q } 0 0 0 0 b j - 1 { q } 0 0 0 0 b 1 { q } 0 0 0 0 b 0 { q } ] ( j + 1 ) × ( j + 1 ) ( j + 2 ) 2 × [ X j { q } X j - 1 { q } X 1 { q } X 0 { q } ] ( j + 1 ) ( j + 2 ) 2 × 1 , Mathematical equation: $$ {\left[\begin{array}{l}({\rho }^2{)}^j\\ ({\rho }^2{)}^{j-1}\\ \vdots \\ \left({\rho }^2\right)\\ 1\end{array}\right]}_{\left(j+1\right)\times 1}={\left[\begin{array}{lllll}{b}_j^{\left\{q\right\}}& 0& \cdots & 0& 0\\ 0& {b}_{j-1}^{\left\{q\right\}}& \cdots & 0& 0\\ \vdots & \vdots & \ddots & \vdots & \vdots \\ 0& 0& \cdots & {b}_1^{\left\{q\right\}}& 0\\ 0& 0& \cdots & 0& {b}_0^{\left\{q\right\}}\end{array}\right]}_{\left(j+1\right)\times \frac{\left(j+1\right)\left(j+2\right)}{2}}\times {\left[\begin{array}{l}{X}_j^{\left\{q\right\}}\\ {X}_{j-1}^{\left\{q\right\}}\\ \vdots \\ {X}_1^{\left\{q\right\}}\\ {X}_0^{\left\{q\right\}}\end{array}\right]}_{\frac{\left(j+1\right)\left(j+2\right)}{2}\times 1}, $$(A.9)

which can be iteratively represented in submatrix form as follows: [ ( ρ 2 ) j ( ρ 2 ) j - 1 ( ρ 2 ) 1 ] ( j + 1 ) × 1 = B j × X j = [ b j { q } 0 0 B j - 1 ] ( j + 1 ) × ( j + 1 ) ( j + 2 ) 2 × [ X j { q } X j - 1 ] ( j + 1 ) ( j + 2 ) 2 × 1   Mathematical equation: $$ {\left[\begin{array}{l}({\rho }^2{)}^j\\ ({\rho }^2{)}^{j-1}\\ \vdots \\ \left({\rho }^2\right)\\ 1\end{array}\right]}_{\left(j+1\right)\times 1}={\mathcal{B}}_j\times {\mathcal{X}}_j={\left[\begin{array}{ll}{b}_j^{\left\{q\right\}}& 0\\ 0& {\mathcal{B}}_{j-1}\end{array}\right]}_{\left(j+1\right)\times \frac{\left(j+1\right)\left(j+2\right)}{2}}\times {\left[\begin{array}{l}{X}_j^{\left\{q\right\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]}_{\frac{\left(j+1\right)\left(j+2\right)}{2}\times 1}\enspace $$(A.10)

where B j Mathematical equation: $ {\mathcal{B}}_j$ denotes the complete matrix with (j + 1) rows and ( j + 1 ) ( j + 2 ) 2 Mathematical equation: $ \frac{(j+1)(j+2)}{2}$ columns in equation (A.9), B j - 1 Mathematical equation: $ {\mathcal{B}}_{j-1}$ is its right/below submatrix with j rows and ( j ) ( j + 1 ) 2 Mathematical equation: $ \frac{(j)(j+1)}{2}$ columns, and the same applies to X j Mathematical equation: $ {\mathcal{X}}_j$ and its sub–vector X j - 1 Mathematical equation: $ {\mathcal{X}}_{j-1}$ for the right column vector containing all X j { q } Mathematical equation: $ {X}_j^{\{q\}}$s. Subsequentially equation (A.7) can be written as { R 2 j { 2 l } = T 2 j × diag ( w 2 j { k } ) × B j × X j R 2 j + 1 { 2 l + 1 } = T 2 j + 1 × diag ( w 2 j + 1 { k } ) × B j × X j × ρ Mathematical equation: $$ \left\{\begin{array}{ll}{R}_{2j}^{\{2l\}}=& {T}_{2j}\times \mathrm{diag}\left({w}_{2j}^{\{k\}}\right)\times {\mathcal{B}}_j\times {\mathcal{X}}_j\\ {R}_{2j+1}^{\{2l+1\}}=& {T}_{2j+1}\times \mathrm{diag}\left({w}_{2j+1}^{\{k\}}\right)\times {\mathcal{B}}_j\times {\mathcal{X}}_j\times \rho \end{array}\right. $$(A.11)

inside which we have two cases of coordinate-irrelevant block-wise recurrence, as follows: { R 2 j { 2 l } = [ t 2 j { 2 l } [ T 2 j - 2 0 ] ] × diag ( w 2 j { k } ) × [ b j { q } 0 0 B j - 1 ] × [ X j { q } X j - 1 ] R 2 j + 1 { 2 l + 1 } = [ t 2 j + 1 { 2 l + 1 } [ T 2 j - 1 0 ] ] × diag ( w 2 j + 1 { k } ) × [ b j { q } 0 0 B j - 1 ] × [ X j { q } X j - 1 ] × ρ . Mathematical equation: $$ \left\{\begin{array}{ll}{R}_{2j}^{\{2l\}}=& \left[\begin{array}{ll}{t}_{2j}^{\{2l\}}& \left[\begin{array}{l}{T}_{2j-2}\\ 0\end{array}\right]\end{array}\right]\times \mathrm{diag}\left({w}_{2j}^{\{k\}}\right)\times \left[\begin{array}{ll}{b}_j^{\{q\}}& 0\\ 0& {\mathcal{B}}_{j-1}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]\\ {R}_{2j+1}^{\{2l+1\}}=& \left[\begin{array}{ll}{t}_{2j+1}^{\{2l+1\}}& \left[\begin{array}{l}{T}_{2j-1}\\ 0\end{array}\right]\end{array}\right]\times \mathrm{diag}\left({w}_{2j+1}^{\{k\}}\right)\times \left[\begin{array}{ll}{b}_j^{\{q\}}& 0\\ 0& {\mathcal{B}}_{j-1}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]\times \rho \end{array}\right.. $$(A.12)

For weight factors, w n 0 = 1 Mathematical equation: $ {w}_n^0=1$ always applies, and subsequentially w n { k } = [ 1 w n { k > 0 } ] Mathematical equation: $ {w}_n^{\{k\}}=\left[\begin{array}{ll}1& {w}_n^{\{k>0\}}\end{array}\right]$, where w n { k > 0 } Mathematical equation: $ {w}_n^{\{k>0\}}$ denotes the sub-vector of w n { k } Mathematical equation: $ {w}_n^{\{k\}}$ without its first element. Equation (A.12) can be written as follows: { R 2 j { 2 l } = [ t 2 j { 2 l } [ T 2 j - 2 0 ] ] × [ 1 0 0 diag ( w 2 j { k > 0 } ) ] × [ b j { q } 0 0 B j - 1 ] × [ X j { q } X j - 1 ] R 2 j + 1 { 2 l + 1 } = [ t 2 j + 1 { 2 l + 1 } [ T 2 j - 1 0 ] ] × [ 1 0 0 diag ( w 2 j + 1 { k > 0 } ) ] × [ b j { q } 0 0 B j - 1 ] × [ X j { q } X j - 1 ] × ρ Mathematical equation: $$ \left\{\begin{array}{ll}{R}_{2j}^{\{2l\}}=& \left[\begin{array}{ll}{t}_{2j}^{\{2l\}}& \left[\begin{array}{l}{T}_{2j-2}\\ 0\end{array}\right]\end{array}\right]\times \left[\begin{array}{ll}1& 0\\ 0& \mathrm{diag}\left({w}_{2j}^{\{k>0\}}\right)\end{array}\right]\times \left[\begin{array}{ll}{b}_j^{\{q\}}& 0\\ 0& {\mathcal{B}}_{j-1}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]\\ {R}_{2j+1}^{\{2l+1\}}=& \left[\begin{array}{ll}{t}_{2j+1}^{\{2l+1\}}& \left[\begin{array}{l}{T}_{2j-1}\\ 0\end{array}\right]\end{array}\right]\times \left[\begin{array}{ll}1& 0\\ 0& \mathrm{diag}\left({w}_{2j+1}^{\{k>0\}}\right)\end{array}\right]\times \left[\begin{array}{ll}{b}_j^{\{q\}}& 0\\ 0& {\mathcal{B}}_{j-1}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]\times \rho \end{array}\right. $$(A.13)

where all coordinate-irrelevant calculations, i.e., calculations of and between t, T, w, b and B Mathematical equation: $ \mathcal{B}$, are fully supported by one n-row Pascal triangle.

A.3 Complete Zernike by one Pascal triangle

If we further define J kl = j - k - l Mathematical equation: $ {J}_{{kl}}=j-k-l$ and combine de Moivre’s formula with equation (A.2), we obtain { z 2 j + 2 l = k = 0 j - l ( - 1 ) k w k e t lk e ( ( q = 0 J kl b J kl q ( x 2 ) q ( y 2 ) J kl - q ) × ( p = 0 l ( - 1 ) p b 2 l 2 p ( x 2 ) l - p ( y 2 ) p ) ) z 2 j - 2 l = x - 1 y k = 0 j - l ( - 1 ) k w k e t lk e ( ( q = 0 J kl b J kl q ( x 2 ) q ( y 2 ) J kl - q ) × ( p = 0 l - 1 ( - 1 ) p b 2 l 2 p + 1 ( x 2 ) l - p ( y 2 ) p ) ) z 2 j + 1 + ( 2 l + 1 ) = x k = 0 j - l ( - 1 ) k w k o t lk o ( ( q = 0 J kl b J kl q ( x 2 ) q ( y 2 ) J kl - q ) × ( p = 0 l ( - 1 ) p b 2 l + 1 2 p ( x 2 ) l - p ( y 2 ) p ) ) z 2 j + 1 - ( 2 l + 1 ) = y k = 0 j - l ( - 1 ) k w k o t lk o ( ( q = 0 J kl b J kl q ( x 2 ) q ( y 2 ) J kl - q ) × ( p = 0 l ( - 1 ) p b 2 l + 1 2 p + 1 ( x 2 ) l - p ( y 2 ) p ) ) , Mathematical equation: $$ \left\{\begin{array}{lll}{z}_{2j}^{+2l}=\sum_{k=0}^{j-l} (-1{)}^k{w}_k^e{t}_{{lk}}^e& \left(\left(\sum_{q=0}^{{J}_{{kl}}} {b}_{{J}_{{kl}}}^q({x}^2{)}^q({y}^2{)}^{{J}_{{kl}}-q}\right)\times \left(\sum_{p=0}^l (-1{)}^p{b}_{2l}^{2p}({x}^2{)}^{l-p}({y}^2{)}^p\right)\right)& \\ {z}_{2j}^{-2l}={x}^{-1}y\sum_{k=0}^{j-l} (-1{)}^k{w}_k^e{t}_{{lk}}^e& \left(\left(\sum_{q=0}^{{J}_{{kl}}} {b}_{{J}_{{kl}}}^q({x}^2{)}^q({y}^2{)}^{{J}_{{kl}}-q}\right)\times \left(\sum_{p=0}^{l-1} (-1{)}^p{b}_{2l}^{2p+1}({x}^2{)}^{l-p}({y}^2{)}^p\right)\right)& \\ {z}_{2j+1}^{+(2l+1)}=x\sum_{k=0}^{j-l} (-1{)}^k{w}_k^o{t}_{{lk}}^o& \left(\left(\sum_{q=0}^{{J}_{{kl}}} {b}_{{J}_{{kl}}}^q({x}^2{)}^q({y}^2{)}^{{J}_{{kl}}-q}\right)\times \left(\sum_{p=0}^l (-1{)}^p{b}_{2l+1}^{2p}({x}^2{)}^{l-p}({y}^2{)}^p\right)\right)& \\ {z}_{2j+1}^{-(2l+1)}=y\sum_{k=0}^{j-l} (-1{)}^k{w}_k^o{t}_{{lk}}^o& \left(\left(\sum_{q=0}^{{J}_{{kl}}} {b}_{{J}_{{kl}}}^q({x}^2{)}^q({y}^2{)}^{{J}_{{kl}}-q}\right)\times \left(\sum_{p=0}^l (-1{)}^p{b}_{2l+1}^{2p+1}({x}^2{)}^{l-p}({y}^2{)}^p\right)\right)& \end{array}\right., $$(A.14)

which is equivalent to the following equation in matrix form: { z 2 j - { 2 l } = [ t 2 j { 2 l } [ T 2 j - 2 0 ] ] × [ 1 0 0 diag ( w 2 j { k > 0 } ) ] × [ [ b 2 l { 2 p + 1 } b j - l { q } ] { l } { k } 0 0 B j - 1 e - ] × [ X j { q } X j - 1 ] x - 1 y z 2 j + { 2 l } = [ t 2 j { 2 l } [ T 2 j - 2 0 ] ] × [ 1 0 0 diag ( w 2 j { k > 0 } ) ] × [ [ b 2 l { 2 p } b j - l { q } ] { l } { k } 0 0 B j - 1 e + ] × [ X j { q } X j - 1 ] z 2 j + 1 - { 2 l + 1 } = [ t 2 j + 1 { 2 l + 1 } [ T 2 j - 1 0 ] ] × [ 1 0 0 diag ( w 2 j + 1 { k > 0 } ) ] × [ [ b 2 l + 1 { 2 p + 1 } b j - l { q } ] { l } { k } 0 0 B j - 1 o - ] × [ X j { q } X j - 1 ] y z 2 j + 1 + { 2 l + 1 } = [ t 2 j + 1 { 2 l + 1 } [ T 2 j - 1 0 ] ] × [ 1 0 0 diag ( w 2 j + 1 { k > 0 } ) ] × [ [ b 2 l + 1 { 2 p } b j - l { q } ] { l } { k } 0 0 B j - 1 o + ] × [ X j { q } X j - 1 ] x . Mathematical equation: $$ \left\{\begin{array}{ll}{z}_{2j}^{-\{2l\}}=& \left[\begin{array}{ll}{t}_{2j}^{\{2l\}}& \left[\begin{array}{l}{T}_{2j-2}\\ 0\end{array}\right]\end{array}\right]\times \left[\begin{array}{ll}1& 0\\ 0& \mathrm{diag}({w}_{2j}^{\{k>0\}})\end{array}\right]\times \left[\begin{array}{ll}[{b}_{2l}^{\{2p+1\}}\otimes {b}_{j-l}^{\{q\}}{]}^{\{l\}\{k\}}& 0\\ 0& {\mathcal{B}}_{j-1}^{e-}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]{x}^{-1}y\\ {z}_{2j}^{+\{2l\}}=& \left[\begin{array}{ll}{t}_{2j}^{\{2l\}}& \left[\begin{array}{l}{T}_{2j-2}\\ 0\end{array}\right]\end{array}\right]\times \left[\begin{array}{ll}1& 0\\ 0& \mathrm{diag}({w}_{2j}^{\{k>0\}})\end{array}\right]\times \left[\begin{array}{ll}[{b}_{2l}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}{]}^{\{l\}\{k\}}& 0\\ 0& {\mathcal{B}}_{j-1}^{e+}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]\\ {z}_{2j+1}^{-\{2l+1\}}=& \left[\begin{array}{ll}{t}_{2j+1}^{\{2l+1\}}& \left[\begin{array}{l}{T}_{2j-1}\\ 0\end{array}\right]\end{array}\right]\times \left[\begin{array}{ll}1& 0\\ 0& \mathrm{diag}({w}_{2j+1}^{\{k>0\}})\end{array}\right]\times \left[\begin{array}{ll}[{b}_{2l+1}^{\{2p+1\}}\otimes {b}_{j-l}^{\{q\}}{]}^{\{l\}\{k\}}& 0\\ 0& {\mathcal{B}}_{j-1}^{o-}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]y\\ {z}_{2j+1}^{+\{2l+1\}}=& \left[\begin{array}{ll}{t}_{2j+1}^{\{2l+1\}}& \left[\begin{array}{l}{T}_{2j-1}\\ 0\end{array}\right]\end{array}\right]\times \left[\begin{array}{ll}1& 0\\ 0& \mathrm{diag}({w}_{2j+1}^{\{k>0\}})\end{array}\right]\times \left[\begin{array}{ll}[{b}_{2l+1}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}{]}^{\{l\}\{k\}}& 0\\ 0& {\mathcal{B}}_{j-1}^{o+}\end{array}\right]\times \left[\begin{array}{l}{X}_j^{\{q\}}\\ {\mathcal{X}}_{j-1}\end{array}\right]x\end{array}\right.. $$(A.15)

This is an extension of equation (A.13), where we have distinguished four submatrices B j - 1 e - , B j - 1 e + , B j - 1 o - Mathematical equation: $ {\mathcal{B}}_{j-1}^{e-},{\mathcal{B}}_{j-1}^{e+},{\mathcal{B}}_{j-1}^{o-}$ and B j - 1 o + Mathematical equation: $ {\mathcal{B}}_{j-1}^{o+}$ for the sin and cos components of even and odd orders, respectively, as well as the submatrix with index ( l , k ) Mathematical equation: $ (l,k)$ introduced by the intermediate variable J kl = j - k - l Mathematical equation: $ {J}_{{kl}}=j-k-l$, as follows: B 2 j + = [ b 2 l { 2 p } b j - l { q } ] { l } { k } = [ b 0 { 2 p } b j { q } b 2 { 2 p } b j - 1 { q } b 2 j { 2 p } b 0 { q } ] ( j + 1 ) × ( j + 1 ) . Mathematical equation: $$ {B}_{2j}^{+}={\left[{b}_{2l}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}\right]}^{\{l\}\{k\}}={\left[\begin{array}{l}{b}_0^{\{2p\}}\otimes {b}_j^{\{q\}}\\ {b}_2^{\{2p\}}\otimes {b}_{j-1}^{\{q\}}\\ \vdots \\ {b}_{2j}^{\{2p\}}\otimes {b}_0^{\{q\}}\end{array}\right]}_{(j+1)\times (j+1)}. $$(A.16)

Each submatrix in the matrix above corresponds to a convolution of two vectors as follows: b 2 l { 2 p } b j - l { q } = ( [ ( - 1 ) 0 b 2 l 0 ( - 1 ) 1 b 2 l 2 ( - 1 ) l b 2 l 2 l ] T ) 1 × ( l + 1 ) × [ b j - l 0 b j - l 1 b j - l j - l 0 0 0 b j - l 0 b j - l j - l - 1 b j - l j - l 0 0 0 b j - l 0 b j - l 1 b j - l j - l ] ( l + 1 ) × ( j + 1 ) , Mathematical equation: $$ {b}_{2l}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}={\left({\left[\begin{array}{l}(-1{)}^0{b}_{2l}^0\\ (-1{)}^1{b}_{2l}^2\\ \vdots \\ (-1{)}^l{b}_{2l}^{2l}\end{array}\right]}^T\right)}_{1\times (l+1)}\times {\left[\begin{array}{lllllll}{b}_{j-l}^0& {b}_{j-l}^1& \cdots & {b}_{j-l}^{j-l}& 0& \cdots & 0\\ 0& {b}_{j-l}^0& \cdots & {b}_{j-l}^{j-l-1}& {b}_{j-l}^{j-l}& \cdots & 0\\ \vdots & \vdots & \ddots & \vdots & \vdots & \vdots & \vdots \\ 0& \cdots & 0& {b}_{j-l}^0& {b}_{j-l}^1& \cdots & {b}_{j-l}^{j-l}\end{array}\right]}_{(l+1)\times (j+1)}, $$(A.17)

which performs the multiplication between the azimuth polynomials and the radial polynomials for n = 2j of even order, + m = + ( 2 l ) Mathematical equation: $ +m=+(2l)$ part, just as b 2 l { 2 p + 1 } b j - l { q } Mathematical equation: $ {b}_{2l}^{\{2p+1\}}\otimes {b}_{j-l}^{\{q\}}$ for - m = - ( 2 l ) Mathematical equation: $ -m=-(2l)$ part, while b 2 l + 1 { 2 p } b j - l { q } Mathematical equation: $ {b}_{2l+1}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}$ and b 2 l + 1 { 2 p + 1 } b j - l { q } Mathematical equation: $ {b}_{2l+1}^{\{2p+1\}}\otimes {b}_{j-l}^{\{q\}}$ stand for n = 2 j + 1 Mathematical equation: $ n=2j+1$ of odd order, + m = ( 2 l + 1 ) Mathematical equation: $ +m=(2l+1)$ and - m = - ( 2 l + 1 ) Mathematical equation: $ -m=-(2l+1)$ parts, respectively.

Overall, equation (A.14) and its matrix form (Eq.(A.15)) show two cases of block-wise recurrence in complete Zernike calculations, which are irrelevant to the coordinates, since equation (A.15) can be represented as follows: { z 2 j - { 2 l } = T 2 j × diag ( w 2 j { k } ) × B j e - × X j x - 1 y z 2 j + { 2 l } = T 2 j × diag ( w 2 j { k } ) × B j e + × X j z 2 j + 1 - { 2 l + 1 } = T 2 j + 1 × diag ( w 2 j + 1 { k } ) × B j o - × X j y z 2 j + 1 + { 2 l + 1 } = T 2 j + 1 × diag ( w 2 j + 1 { k } ) × B j o + × X j x Mathematical equation: $$ \left\{\begin{array}{ll}{z}_{2j}^{-\{2l\}}=& {T}_{2j}\times \mathrm{diag}({w}_{2j}^{\{k\}})\times {\mathcal{B}}_j^{e-}\times {\mathcal{X}}_j{x}^{-1}y\\ {z}_{2j}^{+\{2l\}}=& {T}_{2j}\times \mathrm{diag}({w}_{2j}^{\{k\}})\times {\mathcal{B}}_j^{e+}\times {\mathcal{X}}_j\\ {z}_{2j+1}^{-\{2l+1\}}=& {T}_{2j+1}\times \mathrm{diag}({w}_{2j+1}^{\{k\}})\times {\mathcal{B}}_j^{o-}\times {\mathcal{X}}_jy\\ {z}_{2j+1}^{+\{2l+1\}}=& {T}_{2j+1}\times \mathrm{diag}({w}_{2j+1}^{\{k\}})\times {\mathcal{B}}_j^{o+}\times {\mathcal{X}}_jx\end{array}\right. $$(A.18)

where we have { B 0 e - = 0 , B 0 e + = 1 B 0 o - = 1 , B 0 o + = 1 B j e - = [ B 2 j - 0 0 B j - 1 e - ] , B 2 j - = [ b 2 l { 2 p + 1 } b j - l { q } ] { l } { k } B j e + = [ B 2 j + 0 0 B j - 1 e + ] , B 2 j + = [ b 2 l { 2 p } b j - l { q } ] { l } { k } B j o - = [ B 2 j + 1 - 0 0 B j - 1 o - ] , B 2 j + 1 - = [ b 2 l + 1 { 2 p + 1 } b j - l { q } ] { l } { k } B j o + = [ B 2 j + 1 + 0 0 B j - 1 o + ] , B 2 j + 1 + = [ b 2 l + 1 { 2 p } b j - l { q } ] { l } { k } , Mathematical equation: $$ \left\{\begin{array}{ll}{\mathcal{B}}_0^{e-}& =0,{\mathcal{B}}_0^{e+}=1\\ {\mathcal{B}}_0^{o-}& =1,{\mathcal{B}}_0^{o+}=1\\ {\mathcal{B}}_j^{e-}=& \left[\begin{array}{ll}{B}_{2j}^{-}& 0\\ 0& {\mathcal{B}}_{j-1}^{e-}\end{array}\right],{B}_{2j}^{-}={\left[{b}_{2l}^{\{2p+1\}}\otimes {b}_{j-l}^{\{q\}}\right]}^{\{l\}\{k\}}\\ {\mathcal{B}}_j^{e+}=& \left[\begin{array}{ll}{B}_{2j}^{+}& 0\\ 0& {\mathcal{B}}_{j-1}^{e+}\end{array}\right],{B}_{2j}^{+}={\left[{b}_{2l}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}\right]}^{\{l\}\{k\}}\\ {\mathcal{B}}_j^{o-}=& \left[\begin{array}{ll}{B}_{2j+1}^{-}& 0\\ 0& {\mathcal{B}}_{j-1}^{o-}\end{array}\right],{B}_{2j+1}^{-}={\left[{b}_{2l+1}^{\{2p+1\}}\otimes {b}_{j-l}^{\{q\}}\right]}^{\{l\}\{k\}}\\ {\mathcal{B}}_j^{o+}=& \left[\begin{array}{ll}{B}_{2j+1}^{+}& 0\\ 0& {\mathcal{B}}_{j-1}^{o+}\end{array}\right],{B}_{2j+1}^{+}={\left[{b}_{2l+1}^{\{2p\}}\otimes {b}_{j-l}^{\{q\}}\right]}^{\{l\}\{k\}}\\ & \end{array}\right., $$(A.19)

such that both T n = 2 j Mathematical equation: $ {T}_{n=2j}$, T n = 2 j + 1 Mathematical equation: $ {T}_{n=2j+1}$, B j = n / 2 e ± Mathematical equation: $ {\mathcal{B}}_{j=n/2}^{e\pm }$, and B j = ( n - 1 ) / 2 o ± Mathematical equation: $ {\mathcal{B}}_{j=(n-1)/2}^{o\pm }$ have their recursive submatrix decomposition and are fully supported by an n Mathematical equation: $ n$-row Pascal triangle.

A.4 Block-wise Zernike calculation

Since w n 0 1 Mathematical equation: $ {w}_n^0\equiv 1$ always holds, all formulas in equation (A.18) have an alternative pseudo-iterative form. For example, we have z 2 j + { 2 l } = ( t 2 j { l } B 2 j + ) × X j { q } + T 2 ( j - 1 ) × diag ( w 2 j { k > 0 } ) × B j - 1 e + × X j - 1 Mathematical equation: $$ {z}_{2j}^{+\{2l\}}=\left({t}_{2j}^{\{l\}}\odot {B}_{2j}^{+}\right)\times {X}_j^{\{q\}}+{T}_{2(j-1)}\times \mathrm{diag}\left({w}_{2j}^{\{k>0\}}\right)\times {\mathcal{B}}_{j-1}^{e+}\times {\mathcal{X}}_{j-1} $$(A.20)

where Mathematical equation: $ \odot $ denotes the Hadamard product as element-wise multiplication between a vector and a matrix, e.g., we have t { l } B { l } { k } = [ t 0 t 1 t j ] ( j + 1 ) × 1 [ B 0,0 B 0,1 B 0 , j B 1,0 B 1,1 B 1 , j B j , 0 B j , 1 B j , j ] ( j + 1 ) × ( j + 1 ) = [ t 0 B 0,0 t 0 B 0,1 t 0 B 0 , j t 1 B 1,0 t 1 B 1,1 t 1 B 1 , j t j B j , 0 t j B j , 1 t j B j , j ] ( j + 1 ) × ( j + 1 ) . Mathematical equation: $$ {t}^{\{l\}}\odot {B}^{\{l\}\{k\}}={\left[\begin{array}{l}{t}^0\\ {t}^1\\ \vdots \\ {t}^j\end{array}\right]}_{(j+1)\times 1}\odot {\left[\begin{array}{llll}{B}^{\mathrm{0,0}}& {B}^{\mathrm{0,1}}& \cdots & {B}^{0,j}\\ {B}^{\mathrm{1,0}}& {B}^{\mathrm{1,1}}& \cdots & {B}^{1,j}\\ \vdots & \vdots & \ddots & \vdots \\ {B}^{j,0}& {B}^{j,1}& \cdots & {B}^{j,j}\end{array}\right]}_{(j+1)\times (j+1)}={\left[\begin{array}{llll}{t}^0{B}^{\mathrm{0,0}}& {t}^0{B}^{\mathrm{0,1}}& \cdots & {t}^0{B}^{0,j}\\ {t}^1{B}^{\mathrm{1,0}}& {t}^1{B}^{\mathrm{1,1}}& \cdots & {t}^1{B}^{1,j}\\ \vdots & \vdots & \ddots & \vdots \\ {t}^j{B}^{j,0}& {t}^j{B}^{j,1}& \cdots & {t}^j{B}^{j,j}\end{array}\right]}_{(j+1)\times (j+1)}. $$(A.21)

Equation (A.2) is equivalent to z 2 j + { 2 l } = k = 0 j w 2 j k ( t 2 ( j - k ) { l } B 2 ( j - k ) + ) × X ( j - k ) { q } , Mathematical equation: $$ {z}_{2j}^{+\{2l\}}=\sum_{k=0}^j {w}_{2j}^k\left({t}_{2(j-k)}^{\{l\}}\odot {B}_{2(j-k)}^{+}\right)\times {X}_{(j-k)}^{\{q\}}, $$(A.22)

which offers us a direct block-wise transformation method for calculating the cos-relevant components of even-order ( n = 2 j Mathematical equation: $ n=2j$) Zernike basis functions in the Cartesian coordinate system. Such a transformation applies to all Zernike basis functions, as shown in equation (10).

Appendix B: Forward and inverse transformation matrices, up to order 6

Table B1

The forward transformation matrix T Mathematical equation: $ \mathcal{T}$, up to order 6.

Table B2

The inverse transformation matrix T - 1 Mathematical equation: $ {\mathcal{T}}^{-1}$, up to order 6, with 2 decimal digits for visualization.

All Tables

Table 1

A standard 6-row Pascal triangle and its right half vectors.

Table 2

A left-aligned 6-row Pascal triangle and its anti-diagonal vectors.

Table 3

Counts of arithmetic instructions for a Zernike component z n ± m Mathematical equation: $ {z}_n^{\pm m}$, where sin and cos components of even and odd orders are considered separately.

Table B1

The forward transformation matrix T Mathematical equation: $ \mathcal{T}$, up to order 6.

Table B2

The inverse transformation matrix T - 1 Mathematical equation: $ {\mathcal{T}}^{-1}$, up to order 6, with 2 decimal digits for visualization.

All Figures

Thumbnail: Figure 1 Refer to the following caption and surrounding text. Figure 1

Comparison of computational complexity (I): (a) number of multiplications; (b) number of additions. Four curves in (a) show the maximum and minimum multiplication requirements for the component-wise recursion method and the direct transformation method for a required Zernike component at one (x, y) position; the same applies to four curves in (b) for addition operations.

In the text
Thumbnail: Figure 2 Refer to the following caption and surrounding text. Figure 2

Comparison of computational complexity (II): Time elapsed for generating all Zernike components up to order 99 using component-wise recursion (red) compared to block-wise recursion (blue): (a) the comparison; (b) further details on the elapsed time of block-wise recursion (with y-axis ≤1.5 ms). The comparison was performed for one (x, y) position, and the elapsed time is measured in millisecond (10−3 s).

In the text
Thumbnail: Figure 3 Refer to the following caption and surrounding text. Figure 3

Accuracy assessment of the block–wise recursion compared to the component-wise recursion (Andersen’s method [7]) for calculating Zernike basis functions: (a) 120 test positions from a circular region with five radii (1.00, 0.96, 0.88, 0.72, 0.40) and 24 uniformly distributed azimuth angles; (b) 120 difference curves (color–coded) with respect to the polynomial orders, each curve representing the maximum absolute differences between two sets of Zernike components along the orders from 0 to 99 for a position in (a); (c) the logarithmic representation (log10) of the corresponding curves in (b), of which 17 curves are distinguished from the others by their difference value of over 3 × 10−15 and whose corresponding positions all lie on the unit circle.

In the text
Thumbnail: Figure 4 Refer to the following caption and surrounding text. Figure 4

Accuracy comparisons (a)–(f) at six positions on the unit circle: (x, y) ≈ (−0.5000000, −0.8660254), (−0.7071068, −0.7071068), (−0.5000000, 0.8660254), (0.5000000, 0.8660254). (0.5000000, −0.8660254), and (−0.8660254, −0.5000000). Each comparison includes three curves: the one above for 5050 Zernike components of orders 0 to 99, calculated using the direct transformation method, as the comparison reference; the middle one for the absolute difference of the component-wise recursive method to the reference; and the curve below for the block-wise recursive method. All difference curves are shown with the same value scale: ≤4 × 10−13.

In the text

Current usage metrics show cumulative count of Article Views (full-text article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.

Data correspond to usage on the plateform after 2015. The current usage metrics is available 48-96 hours after online publication and is updated daily on week days.

Initial download of the metrics may take a while.