- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which linear function of SciPy is used to solve the circulant matrix equation?
The linear function named scipy.linalg.solve_circulant is used to solve the circulant matrix equation. The form of this function is as follows −
scipy.linalg.solve_circulant(c, b, singular=’raise’, tol=None, caxis=-1, baxis=0, outaxis=0)
This linear function will solve the equation Cx = b for x where C is a Circulant matrix associated with the vector c.
The circulant matrix equation is solved by doing division in Fourier space as follows −
x = ifft(fft(b) / fft(c))
Here fft is the fast Fourier transform and ifft is the inverse fast Fourier transform.
Parameters
Below are given the parameters of the function scipy.linalg.solve_circulant() −
c− array_like
This parameter represents the coefficient of the circulant matrix.
b− array_like
This parameter represents the right-hand side matrix in the equation ax =b.
singular− str, optional
This parameter is used to control how a near singular circulant matrix is handled. Below are given the options of this parameter −
v raise− If the circulant matrix is near singular and you choose the value of this parameter ‘raise’, a LinAlgError would be raised. It is the default value for singular parameters as well.
v lstsq− If the circulant matrix is near singular and you choose the value of this parameter ‘lstsq’, the least squares solution would be returned.
tol− float, optional
This parameter is used to tell whether the matrix is near singular or not. The value of tol is compared with the eigenvalue of the circulant matrix and if it is less than or equal to tol, the matrix is near singular. If the value of tol is not given, you can set it with the help of following equation −
tol = abs_eigs.max() * abs_eigs.size * np.finfo(np.float64).eps
Here abs_eigs is the array of absolute values of the eigenvalues of the circulant matrix.
caxis− int
When the circulant matrix c has dimension greater than 1, caxis is the axis of c holding the vectors of circulant coefficients.
baxis− int
When the circulant matrix c has dimension greater than 1, baxis is the axis of b holding the right-hand side vectors.
outaxis− int
outaxis is the axis of the result holding solution vectors.
Returns
x− ndarray
It returns the solution of the circulant matrix equation Cx = b.
Raises
LinAlgError
It raises LinAlgError if the circulant matrix associated with c is near singular.