I am currently working on a two-dimensional ADI Crank-Nicolson algorithm using the pardiso and cspblas packages. In order to use the Alternating-Direction-Implicit (ADI) method, I need to solve a linear system of equations Ax = By, where x and y are single columns and single rows from a 2D matrix. However I am having difficulty thinking of a way to extract singular rows and columns from a matrix.
Is there a fast way I can slice an array using the MKL package such that I do not have to iterate over my array every step?
In other languages this can be done by indexing in such a way Ax[1,:] = By[1,:] for example.
You mentioned using the pardiso and cspblas packages. So can I suppose the loop and extract singular rows and columns from a matrix are needed only in phase 3 steps. right?
and X and Y single columns and single rows from a 2D matrix. can you name row or column?
I guess, it may be column. then it should be ok for call pardiso and cspblas without exacting.
As Pardiso support multiply right hand. So you can call one blas function to compute B*Y=> Z as multiply right hand (each column is a zi ) . then you can get all of xi at pardiso phase 3 once. Thus no iteration are needed.
phase – integer, execution control. There are three major phases in the solving
process and one service phase
• Phase 1: Fill-in reduction analysis and symbolic factorization
• Phase 2: Numerical factorization
• Phase 3: Forward and Backward solve including iterative refinements
• Release Memory (phase ≤ 0).
If either xi and yi are row, you may reorig the AX=YB etc and using multiply right -hand support to get what you wanted.
Thanks for the response.
Can I use cblas to perform matrix-vector multiplication with multiple vectors at once?
For example A*Xi = Bi, where A,X and B are NxN matrices, and Bi is the ith column of B.
If i understand correctly, yes, cblas_dgemm perform matrix -matrix multiplication, that equal matrix-vector multiplication with multiply vectors at once.
for example, for (i loop) Ci = A*Bi
. cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, A, k, B, n, beta, C, n);