Supercirculant and Circulant Matrices
In questa pagina 3
Two families handled with algorithms sublinear in the number of entries: supercirculant (SC), built recursively from quadrants, and circulant (CR), obtained by rotating the first row. Cost model: scalar operations cost , assignments and copies (Matrix Multiplication - Iterative and Recursive Block ProductCost model on n x n matrices (scalar operations, size n or N = n^2); sum in n^2 operations (optimal); iterative row-by-column product with exact cost 2n^3 - n^2; the fractal property of the block product proved on indices; recursive algorithm RMUL with T(n) = 8T(n/2) + n^2, Theta(n^3) and exact solution 2n^3 - n^2: it performs the same operations as the iterative one.Matrix Multiplication - Iterative and Recursive Block Product →). Entries are real or complex; for SC.
Supercirculant matrices
Definition. of order is supercirculant if (any scalar), or and with SC of order (alternating quadrants).
Example: from , one gets .
Properties
- Symmetric; every row is a permutation of the first (induction on the two halves; since are symmetric). So at most distinct values: an SC is determined by its first row .
- Entry : with indices from , ( = bitwise XOR).
- Closure: sum, difference, scalar multiple and product of SC are SC.
- Commutativity: for SC.
Proof of 3 and 4 (induction on ). Base: scalars. Step, with , : has alternating SC quadrants. For the product, the fractal property gives sums of products of SC of order , hence SC. gives , , equal to by commutativity at order . SC form a commutative subring of the symmetric matrices.
Sum, difference, scalar product
S_SUM(A, B) { A, B SC of order n = 2^k }
n <- rows(A)
if n = 1 then return [a11 + b11]
* A = [A1 A2; A2 A1], B = [B1 B2; B2 B1] *
C1 <- S_SUM(A1, B1)
C2 <- S_SUM(A2, B2)
return [C1 C2; C2 C1], : , , only leaves, (the length of a row). S_SUB and S_SCALPROD cost as well. The output matrix is built by copying ; copies are quadratic but free in the model. If assignments cost , (Case 3 of the Master TheoremThe Master Theorem for T(n) = aT(n/b) + w(n) compares w(n) with the threshold n^(log_b a). Case 1 (w polynomially smaller): Theta(n^(log_b a)); case 2 (same order): Theta(n^(log_b a) log n); case 3 (polynomially larger and regular): Theta(w(n)). Full proof from the levels of the tree, extended version with floors and ceilings, a table of applications, and the misuse when no case applies (w = n log n).Master Theorem →) would give : no gain.
Product: from 4 calls to 2
Computing the distinct quadrants directly needs 4 recursive calls and sums of SC of order : , threshold , Case 1, (exact ). As with Strassen, fewer calls and more Divide/Conquer work: so , . The factors , are SC (closure).
S_MUL(A, B)
n <- rows(A)
if n = 1 then return [a11 * b11]
* A = [A1 A2; A2 A1], B = [B1 B2; B2 B1] *
Ap <- S_SUM(A1, A2); Bp <- S_SUM(B1, B2) { DIVIDE: 4 operations on SC of order n/2 }
Am <- S_SUB(A1, A2); Bm <- S_SUB(B1, B2)
U <- S_MUL(Ap, Bp) { RECURSE: 2 calls }
V <- S_MUL(Am, Bm)
C1 <- S_SCALPROD(1/2, S_SUM(U, V)) { CONQUER: 4 operations }
C2 <- S_SCALPROD(1/2, S_SUB(U, V))
return [C1 C2; C2 C1]Internal work: operations on SC of order , each costing , i.e. : Threshold : Case 2, . Exact: each level costs , with levels and leaves: .
Example (). , : , , , . Divide: , , , . : sums and , differences and , products and , so . . Conquer: , . First row of the product: (check by definition: , ).
Diagonalization and the Hadamard transform
SC commute, and commuting diagonalizable matrices share a basis of eigenvectors ( and give ). The common basis is explicit.
The basis
and, for , The vectors have entries and first entry , and are pairwise orthogonal (three cases for distinct vectors: : ; : ; : ), hence a basis of . The matrices with these columns are the Hadamard (Sylvester) matrices: , They are symmetric with (induction), so .
Theorem. For every SC of order and : with .
Proof (induction on ). is trivial. For , , : is SC of order , so by hypothesis with . Hence .
Since the first component of each is , only the first row is needed: . The eigenvalues of an SC are the Hadamard transform of its first row. Eigenvectors with are those of , with those of : is invertible iff are, and . The values at the leaves of S_MUL's recursion are exactly the eigenvalues.
Fast Hadamard Transform (FHT)
With , : an instance of size becomes two of size , with sums and differences.
FHT(x) { x of length n = 2^k }
n <- length(x)
if n = 1 then return x
for i <- 1 to n/2 do
s[i] <- x[i] + x[i + n/2]
d[i] <- x[i] - x[i + n/2]
return concatenate(FHT(s), FHT(d)), : . The inverse (FHT plus products by ) costs .
Example (). : , ; , . Eigenvalues (the first two for , the others for ). One is : is singular, .
Product through the diagonalizing basis
Theorem. For SC with etc.: , with the componentwise product.
Eigenvalues of are the products (same basis). Cost: two FHT (), products, one inverse (): , cheaper than S_MUL () for . The eigenvalue route also solves inversion (invertible iff no eigenvalue is ; take reciprocals and return to the first row) and the determinant with operations, which the block substructure alone cannot do.
Circulant matrices
Definition. (, any ) is circulant if each row is the previous one rotated one place to the right: .
With indices from : ; e.g. gives rows . CR model time-invariant linear systems with -periodic inputs.
The rotation matrix
is the CR with first row : , .
- is CR iff : and (indices mod ); equality for all is the definition.
- Every CR is a polynomial in : (above: ).
So CR are closed under sum and product and commute (a commutative subring).
Product cyclic convolution
A product of polynomials in is computed modulo (since ). The cyclic convolution has , . With , : , i.e. : multiplying circulants is cyclically convolving their first rows (see Polynomials - Representations and ConvolutionA polynomial with degree bound n is represented by n coefficients or by n values at n distinct points (interpolation theorem, Vandermonde matrix). By coefficients the sum costs n and the product, the linear convolution, n^2 products and (n-1)^2 sums; by values the product costs only componentwise multiplication but needs at least 2n-1 points. General conversions cost too much: evaluation n times with Horner 2n(n-1), interpolation with Gauss-Jordan n^3 or Lagrange n^2. A special base is needed: the DFT.Polynomials - Representations and Convolution →).
Diagonalization: the DFT appears
For a diagonalizable , for every polynomial . Let and : component of is (for use ), so : the eigenvalues of are the distinct -th roots of unity, and is the Fourier matrix (DFT and Roots of UnityThe DFT of order n evaluates a polynomial with degree bound n at the n n-th roots of unity, y_i = p(w^i) with w = e^{2 pi i/n}; it is the product by the Fourier matrix F_n, an invertible Vandermonde matrix. The roots form a multiplicative group and satisfy three lemmas: cancellation (w_{dn}^{dk} = w_n^k, w_n^{n/2} = -1), halving (the squares of the n roots are the n/2 roots of order n/2, each twice) and summation (the sum of the powers of w^k is n if k is a multiple of n, 0 otherwise). Linear convolution theorem: (c|0) = DFT^{-1}{2n}(DFT{2n}(a|0) times DFT_{2n}(b|0)).DFT and Roots of Unity →). It diagonalizes all CR, with eigenvalues : The eigenvalues of a CR are the DFT of its first row.
Theorem (cyclic convolution, matrix form). .
With the FFT (Fast Fourier TransformThe FFT computes the DFT_n (n a power of two) by divide and conquer: split the coefficients by index parity, p(x) = p0(x^2) + x p1(x^2), and by the halving lemma two DFTs of order n/2 suffice; y_i = y0_i + w^i y1_i and y_{i+n/2} = y0_i - w^i y1_i. The recurrence T(n) = 2T(n/2) + 2n with T(1) = 0 has exact solution 2 n log2 n. The inverse has matrix F^{-1}_{ij} = w^{-ij}/n and is obtained with the FFT on negative powers (then dividing by n outside the recursion) or with a reversed DFT_n(y). LIN_CONV multiplies two polynomials with n coefficients in 12 n log2(2n) + 4n operations.Fast Fourier Transform →) two transforms and one inverse cost , plus products: two circulants multiply in (the FHT only diagonalizes SC; for CR the Fourier transform is needed).
Example (). , , . For , : DFT, DFT, componentwise product , inverse transform .
Versione ripasso
Supercirculant (SC): ; scalar, else with SC of order . , first row : rows .
- Properties: symmetric; every row a permutation of the first; only distinct values, determined by the first row ; (XOR, indices from ).
- Closure and commutativity (induction on ): has quadrants , ; has , alternating, sums of products of SC; gives the same by commutativity at order . SC = commutative subring of symmetric matrices.
- Sum/difference/scalar:
S_SUMrecurses on , and copies: , , so (leaves only). Copies free; if they cost , , Case 3, . - Product, 4 calls: , threshold , Case 1: (exact ).
- Product with the trick: , ; , , so , . Internal work operations on size , i.e. : Threshold , Case 2 (Master TheoremThe Master Theorem for T(n) = aT(n/b) + w(n) compares w(n) with the threshold n^(log_b a). Case 1 (w polynomially smaller): Theta(n^(log_b a)); case 2 (same order): Theta(n^(log_b a) log n); case 3 (polynomially larger and regular): Theta(w(n)). Full proof from the levels of the tree, extended version with floors and ceilings, a table of applications, and the misuse when no case applies (w = n log n).Master Theorem →): . Example: , , , , .
- Diagonalizing basis : ; , . Entries , first entry , pairwise orthogonal (three cases).
- Theorem: for every SC and , . Induction: , and is SC. Eigenvalues ; invertible iff are; .
- Hadamard and FHT: , , . , ; inverse . Example : ; a zero eigenvalue, so singular.
- Via eigenvalues: , cost (cheaper than
S_MULfor ); in ; inverse by reciprocals of eigenvalues (the block substructure alone cannot give invertibility).
Circulant (CR): , each row is the right rotation of the previous one, any .
- Matrix (first row ): , . is CR iff (, ). (e.g. : ): closed, commutative.
- Product cyclic convolution: , , polynomial product modulo (Polynomials - Representations and ConvolutionA polynomial with degree bound n is represented by n coefficients or by n values at n distinct points (interpolation theorem, Vandermonde matrix). By coefficients the sum costs n and the product, the linear convolution, n^2 products and (n-1)^2 sums; by values the product costs only componentwise multiplication but needs at least 2n-1 points. General conversions cost too much: evaluation n times with Horner 2n(n-1), interpolation with Gauss-Jordan n^3 or Lagrange n^2. A special base is needed: the DFT.Polynomials - Representations and Convolution →).
- Diagonalization: , , : diagonalizes all CR, eigenvalues DFT of the first row (DFT and Roots of UnityThe DFT of order n evaluates a polynomial with degree bound n at the n n-th roots of unity, y_i = p(w^i) with w = e^{2 pi i/n}; it is the product by the Fourier matrix F_n, an invertible Vandermonde matrix. The roots form a multiplicative group and satisfy three lemmas: cancellation (w_{dn}^{dk} = w_n^k, w_n^{n/2} = -1), halving (the squares of the n roots are the n/2 roots of order n/2, each twice) and summation (the sum of the powers of w^k is n if k is a multiple of n, 0 otherwise). Linear convolution theorem: (c|0) = DFT^{-1}{2n}(DFT{2n}(a|0) times DFT_{2n}(b|0)).DFT and Roots of Unity →).
- Theorem: : with the FFT (Fast Fourier TransformThe FFT computes the DFT_n (n a power of two) by divide and conquer: split the coefficients by index parity, p(x) = p0(x^2) + x p1(x^2), and by the halving lemma two DFTs of order n/2 suffice; y_i = y0_i + w^i y1_i and y_{i+n/2} = y0_i - w^i y1_i. The recurrence T(n) = 2T(n/2) + 2n with T(1) = 0 has exact solution 2 n log2 n. The inverse has matrix F^{-1}_{ij} = w^{-ij}/n and is obtained with the FFT on negative powers (then dividing by n outside the recursion) or with a reversed DFT_n(y). LIN_CONV multiplies two polynomials with n coefficients in 12 n log2(2n) + 4n operations.Fast Fourier Transform →) the product costs .
- Numeric example: gives rows . , , . , : DFT and , product , inverse .
- Common mistakes: using the FHT for CR (it diagonalizes only SC; CR need the FFT); forgetting that the factor costs operations in the exact count; swapping row and column in entry ( for CR, for SC); counting quadrant copies.