solve_circulant(c, b, singular='raise', tol=None, caxis=-1, baxis=0, outaxis=0)
C is the circulant matrix associated with the vector c.
The system is solved by doing division in Fourier space. The calculation is
x = ifft(fft(b) / fft(c))
where fft and ifft are the fast Fourier transform and its inverse, respectively. For a large vector c, this is much faster than solving the system with the full circulant matrix.
solve_circulant(c, b)
returns the same result as
solve(circulant(c), b)
where solve and circulant are from scipy.linalg.
The coefficients of the circulant matrix.
Right-hand side matrix in a x = b
.
If any eigenvalue of the circulant matrix has an absolute value that is less than or equal to tol, the matrix is considered to be near singular. If not given, tol is set to
tol = abs_eigs.max() * abs_eigs.size * np.finfo(np.float64).eps
where abs_eigs is the array of absolute values of the eigenvalues of the circulant matrix.
When c or b are multidimensional, the value returned by solve_circulant is multidimensional. In this case, outaxis is the axis of the result that holds the solution vectors.
If the circulant matrix associated with c is near singular.
Solution to the system C x = b
.
Solve C x = b for x, where C is a circulant matrix.
circulant
import numpy as np
from scipy.linalg import solve_circulant, solve, circulant, lstsq
c = np.array([2, 2, 4])
b = np.array([1, 2, 3])
solve_circulant(c, b)
solve(circulant(c), b)
c = np.array([1, 1, 0, 0])
b = np.array([1, 2, 3, 4])
solve_circulant(c, b, singular='lstsq')
x, resid, rnk, s = lstsq(circulant(c), b)
x
c = np.array([[1.5, 2, 3, 0, 0], [1, 1, 4, 3, 2]])
b = np.arange(15).reshape(-1, 5)
x = solve_circulant(c[:, np.newaxis, :], b, baxis=-1, outaxis=-1)
x.shape
np.set_printoptions(precision=3) # For compact output of numbers.
x
solve_circulant(c[1], b[1, :])
The following pages refer to to this document either explicitly or contain code examples using this.
scipy.linalg._basic:solve_circulant
scipy.linalg._special_matrices:circulant
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them