Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

matrix-vector multiplication stored in skyline format

mariospapa
Beginner
484 Views
Is there any subroutine in fortran90 which multiply a matrix A by a vector x where Matrix A is stored in symmetric skyline format?

0 Kudos
5 Replies
Gennady_F_Intel
Moderator
484 Views
look atmkl_sskymv(....) -- which computes matrix - vector product for a sparse matrix in the skyline storage format.
--Gennady
0 Kudos
mariospapa
Beginner
484 Views
This is what I was looking for! But with one problem, in the documentation of MKL for the matrix C (see the link) the storage scheme for the upper triangle of matrix C is:

values
= ( 1 -1 5 -3 0 4 6 7 4 0 -5 )

pointers = ( 1 2 4 7 9 12 )

But I store the matrix C in skyline format (upper triangle) like this:
values
= ( 1 5 -1 4 0 -3 7 6 -5 0 4 )
pointers = ( 1 2 4 7 9 12 )

I beggin always from the diagonal and store all the elements below the skyline. Can I change this in order to be compatible with mkl_sskymv assignments?

And one more question, how I can link MKL libraries in my solution? I use VS2008 with IVF Compiler 11.0. Which are the modifications that i should make to includes and lib paths?

Thank you for helping me Gennady!
0 Kudos
Gennady_F_Intel
Moderator
484 Views
Quoting mariospapa
This is what I was looking for! But with one problem, in the documentation of MKL for the matrix C (see the link) the storage scheme for the upper triangle of matrix C is:

values
= ( 1 -1 5 -3 0 4 6 7 4 0 -5 )

pointers = ( 1 2 4 7 9 12 )

But I store the matrix C in skyline format (upper triangle) like this:
values
= ( 1 5 -1 4 0 -3 7 6 -5 0 4 )
pointers = ( 1 2 4 7 9 12 )

I beggin always from the diagonal and store all the elements below the skyline. Can I change this in order to be compatible with mkl_sskymv assignments?

And one more question, how I can link MKL libraries in my solution? I use VS2008 with IVF Compiler 11.0. Which are the modifications that i should make to includes and lib paths?

Thank you for helping me Gennady!

No, I don't think that you can change the order of non-zero elements like you did - it will not compatible with skyline's format.

for linking with IVF under VS2008 - please look at th "Configuring Intel Fortran in MVSC to build Intel MKL Applications" article.

--Gennady

0 Kudos
mariospapa
Beginner
484 Views
I managed to link mkl libraries into an intel visual fortran project and use mkl_dskymv in the following code.

----------------------------------------------------------------------
Real(8) :: A(3), b(2), X(2), y(2)
Integer :: IA(3)

Data A / 4.d0, 1.d0, 3.d0 /
Data IA / 1, 2, 3 /
Data b / 1.d0, 2.d0 /
Data M / 0.250d0, 0.333d0 /

Call mkl_dskymv('N', 2 ,2 ,1.0d0, 'SUN', A, IA, b, 0.d0, y)
Print *, y
----------------------------------------------------------------------

for symmetric matrix stored in skyline format (upper triangle):

Multiplication
*{b} = {y} must give {y} = [ 6.00 ] where
[ 7.00 ]

= [ 4 1] and {b} =[ 1 ]
[ 1 3] [ 2 ]

But the above subroutine gives: {y} = [ 4.00 ]
[ 2.00 ]


Is there any mistake in the arguments?
0 Kudos
mariospapa
Beginner
484 Views
I found my mistake: IA must be
IA = [ 1 2 4]

now works fine!
0 Kudos
Reply