Optimizing (Reducing run time) of a sparse matrix division
이전 댓글 표시
Hi, so I have a sparse matrix as shown below:
[ap ae 0 an 0 0 0 0 0 ...
[aw ap ae 0 an 0 0 0 0 ...
[0 aw ap 0 0 an 0 0 0 ...
[as 0 0 ap ae 0 an 0 0 0 ....
[0 as 0 aw ap ae 0 an 0 0 0 0 ...
and this matrix is multiplied by
[T1,1]
[T1,2]
[T1,3]
[T2,1]
T[2,2]
.
.
.
This is used to solve Ax=T
To find x, I use A\T,
but when the A matrix is really large (1000 x 1000 or even more), the matrix division starts taking up a lot of time, but most of the entries are 0.
I was wondering if there is any way to optimize this to reduce run time, or since it doesnt follow a particular pattern it can't be done?
댓글 수: 6
Torsten
2022년 3월 31일
And you already work with A, T in sparse format ?
Steven Lord
2022년 3월 31일
What is "a lot of time" in this context?
Are aw, ap, ae, and/or T variables containing numbers or are they symbolic variables? If the latter, try substituting values for those variables before solving the system.
Walter Roberson
2022년 3월 31일
If MATLAB is not able to detect one of the special sparse forms such as a bandwidth-limited matrix, then it uses solvers that typically end up needing dense matrices.
Bjorn Gustavsson
2022년 4월 1일
If the standard methods doesn't "perform", then you can try the different iterative solvers available. You can check the documentation for Systems of Linear Equations for a list of those, or the help and documentation for pcg, bicg, bicgstab, bicgstabl, cgs, gmres, lsqr, minres, qmr, symmlq, or tfqmr.
Santosh Fatale
2022년 4월 6일
What is the sparsity of the first matrix (Matrix A) in your case?
What are the dimesion for matrix A and matrix T?
As pointed out Steven, are the variables in matrix A are of type syms?
If possible could you provide the data for matrix A and matrix T?
Walter Roberson
2022년 4월 6일
sparse() matrices cannot hold symbolic variables.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!