Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Array slicing with MKL

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Dylan_B_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-28-2015
10:26 PM

124 Views

Array slicing with MKL

Hi there,

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.

Thanks,

Dylan

Link Copied

3 Replies

Ying_H_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-29-2015
06:19 PM

124 Views

Hi Dylan,

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

pardiso()

• Phase 2: Numerical factorization

pardiso()

• 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.

Best Regards,

Ying

Dylan_B_

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-29-2015
07:04 PM

124 Views

Hi Ying,

Thanks for the response.

Can I use cblas to perform matrix-vector multiplication with multiple vectors at once?

For example A*X_{i} = B_{i}, where A,X and B are NxN matrices, and B_{i} is the i^{th} column of B.

Thanks,

Dylan

Ying_H_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-01-2015
05:21 PM

124 Views

Hi Dylan,

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

for (i = 0; i < N; i++) {

cblas_dgemv(CblasRowMajor,CblasNoTrans,N,N,alpha,a,N,&b*,N,beta,&c**,N);*

cblas_dgemv(CblasRowMajor,CblasNoTrans,N,N,alpha,a,N,&b

=

C=A*B

. cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, A, k, B, n, beta, C, n);

Best Regards,

Ying

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.