Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7222 토론

Selective row/column to use for mat-mat and mat-vec multiplication

ssylee
초급자
1,470 조회수
Sorry to double-post in advance. I initially posted at http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=892 to ask about my question in the link. However, as I'm aware that there are probably more people using Intel or AMD math calculation tools when working with matrices, which includes Lapack, BLAS, and Sparse BLAS, I think I would have much better luck on asking for opinions here. It would be great if you have any tips on if there's a library function available for performing mat-mat, row-col, and mat-vec calculations while being able to select which rows/columns to multiply. The matrix is not densely sparse. It's more so randomly sparse along the matrix diagonal.
0 포인트
4 응답
Victor_Gladkikh
새로운 기여자 I
1,470 조회수
Quoting - ssylee
Sorry to double-post in advance. I initially posted at http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=2&t=892 to ask about my question in the link. However, as I'm aware that there are probably more people using Intel or AMD math calculation tools when working with matrices, which includes Lapack, BLAS, and Sparse BLAS, I think I would have much better luck on asking for opinions here. It would be great if you have any tips on if there's a library function available for performing mat-mat, row-col, and mat-vec calculations while being able to select which rows/columns to multiply. The matrix is not densely sparse. It's more so randomly sparse along the matrix diagonal.


MKL BLAS level1 and MKL Sparse BLAS level 1 contain functions for vector-vector operations.

These routines can be used for performing multiplication of selected row of one matrix and a column of other matrix.

1.Dot product the i-th row of dense matrix A (m by n matrix stored in 2 dimensional FORTRAN array) and the j-th column of dense matrix B (n by n) can be computed with the help of "?dot" routine from BLAS level 1.

res = ddot(n, a(i, 1), m, b(1,j), 1)

2.Dot product the i-th row of sparse matrix A (m by n matrix stored in the CSR matrix format) and the j-th column of dense matrix B (n by n) can be computed with the help of "?doti" routine from Sparse BLAS level 1.

res = ddoti( pointere(i)-pointerb(i), values(pointerb(i)), columns(pointerb(i)), b(1,j))

See MKL Reference Manual for more details.

0 포인트
ssylee
초급자
1,470 조회수


MKL BLAS level1 and MKL Sparse BLAS level 1 contain functions for vector-vector operations.

These routines can be used for performing multiplication of selected row of one matrix and a column of other matrix.

1.Dot product the i-th row of dense matrix A (m by n matrix stored in 2 dimensional FORTRAN array) and the j-th column of dense matrix B (n by n) can be computed with the help of "?dot" routine from BLAS level 1.

res = ddot(n, a(i, 1), m, b(1,j), 1)

2.Dot product the i-th row of sparse matrix A (m by n matrix stored in the CSR matrix format) and the j-th column of dense matrix B (n by n) can be computed with the help of "?doti" routine from Sparse BLAS level 1.

res = ddoti( pointere(i)-pointerb(i), values(pointerb(i)), columns(pointerb(i)), b(1,j))

See MKL Reference Manual for more details.


Would I need to extract a(i, 1) or b(1, j) in a vector manually first before calling the dot product function?
0 포인트
Victor_Gladkikh
새로운 기여자 I
1,470 조회수

This is not actually needed.

0 포인트
TimP
명예로운 기여자 III
1,470 조회수
Quoting - ssylee

Would I need to extract a(i, 1) or b(1, j) in a vector manually first before calling the dot product function?
It seems that a Fortran dot_product would be appropriate.
0 포인트
응답