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

mkl_?imatcopy

soliton
Beginner
1,675 Views
Hi All,

Has anyone had any experience on using the in place traspose/scale routines mkl_?imatcopy?

I have been trying to make it work in my code but it always returns the matrix untouched.
I am using mkl 10.1 from a fortran program.

my simple test code is:

----------------------
a1(1,1) = 1.0_8
a1(1,2) = 3.0_8
a1(2,2) = 5.0_8
a1(2,1) = 7.0_8
call dimatcopy(C,T,2,2,5.0_8,a1,2,2)
write(*,*)a1(1,1)
write(*,*)a1(1,2)
write(*,*)a1(2,2)
write(*,*)a1(2,1)
----------------------

which writes back the values without change.

Cheers,

Cristian
0 Kudos
6 Replies
Vladimir_Petrov__Int
New Contributor III
1,675 Views
Quoting - soliton
Hi All,

Has anyone had any experience on using the in place traspose/scale routines mkl_?imatcopy?

I have been trying to make it work in my code but it always returns the matrix untouched.
I am using mkl 10.1 from a fortran program.

my simple test code is:

----------------------
a1(1,1) = 1.0_8
a1(1,2) = 3.0_8
a1(2,2) = 5.0_8
a1(2,1) = 7.0_8
call dimatcopy(C,T,2,2,5.0_8,a1,2,2)
write(*,*)a1(1,1)
write(*,*)a1(1,2)
write(*,*)a1(2,2)
write(*,*)a1(2,1)
----------------------

which writes back the values without change.

Cheers,

Cristian
Cristian,

This is a problem in the FORTRAN interface of the matrix movement routines which will be fixed in our future releases. In case you urgently need the fix I would recomend submitting this to the premier.intel.com site.

Best regards,
Vladimir
0 Kudos
soliton
Beginner
1,675 Views
Quoting - soliton
Hi All,

Has anyone had any experience on using the in place traspose/scale routines mkl_?imatcopy?

I have been trying to make it work in my code but it always returns the matrix untouched.
I am using mkl 10.1 from a fortran program.

my simple test code is:

----------------------
a1(1,1) = 1.0_8
a1(1,2) = 3.0_8
a1(2,2) = 5.0_8
a1(2,1) = 7.0_8
call dimatcopy(C,T,2,2,5.0_8,a1,2,2)
write(*,*)a1(1,1)
write(*,*)a1(1,2)
write(*,*)a1(2,2)
write(*,*)a1(2,1)
----------------------

which writes back the values without change.

Cheers,

Cristian
Cristian,

This is a problem in the FORTRAN interface of the matrix movement routines which will be fixed in our future releases. In case you urgently need the fix I would recomend submitting this to the premier.intel.com site.

Best regards,
Vladimir

Thanx Vladimir,

The problem seems to be there for all of the "blas like extensions" routines Ive tried. Do you know wether the C ones work fine? If thats the case I might write a small C wrapper to get the job done.

Cheers,
Cristian
0 Kudos
Vladimir_Petrov__Int
New Contributor III
1,675 Views
Cristian,

Yes, the C interface works correctly.

Best regards,
Vladimir
0 Kudos
Gennady_F_Intel
Moderator
1,675 Views
FYI: Below - the output of your code:

a[0] == 1.000000
a[1] == 3.000000
a[2] == 5.000000
a[3] == 7.000000

C interface of mkl_dimatcopy

OUTPUT DATA
a[0] == 5.000000
a[1] == 25.000000
a[2] == 15.000000
a[3] == 35.000000
Press any key to continue .
--Gennady

0 Kudos
soliton
Beginner
1,675 Views
FYI: Below - the output of your code:

a[0] == 1.000000
a[1] == 3.000000
a[2] == 5.000000
a[3] == 7.000000

C interface of mkl_dimatcopy

OUTPUT DATA
a[0] == 5.000000
a[1] == 25.000000
a[2] == 15.000000
a[3] == 35.000000
Press any key to continue .
--Gennady

Many thanx Guys,

Ive managed to make a tiny C wrapper for the routines I needed and it works fine. Code for a rudimentary working interface to zomatadd is attached. Its probably not "correct" since my C is extremely rudimentary.

All the best,

Cristian

-----------------------------------------
#include
#include "mkl_trans.h"

void matadd_(int *d, MKL_Complex16 *a, MKL_Complex16 *alpha, MKL_Complex16 *b, MKL_Complex16 *beta, MKL_Complex16 *c)

{
unsigned long dim;

dim = *d;
mkl_zomatadd('C','N','N',dim,dim,*alpha,a,dim,*beta,b,dim,c,dim);
}
-----------------------------------------

0 Kudos
Gennady_F_Intel
Moderator
1,675 Views
Quoting - soliton

Thanx Vladimir,

The problem seems to be there for all of the "blas like extensions" routines Ive tried. Do you know wether the C ones work fine? If thats the case I might write a small C wrapper to get the job done.

Cheers,
Cristian
Cristian,
the problem with this routine ( Fortran interfaces ) was fixed in MKL version 10.2. released yesterday.
This version available for download from intel registration center: https://registrationcenter.intel.com/

one comment:
use parameter fomat 5.0d1 instead of 5.0

mkl_dimatcopy( 'C','T', 2, 2, 5.0d1, a, 2, 2)

see below the output i received with your test:
THE In-place transposition/copying of matrices
500.000000000000
3500.00000000000
2500.00000000000
1500.00000000000
THE Out-place transposition/copying of matrices
25000.0000000000
75000.0000000000
125000.000000000
175000.000000000
THE END
Press any key to continue . . .

Regards, Gennady



0 Kudos
Reply