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

C++ ?imatcopy

Andrew_Drach
Beginner
658 Views
Hi everyone,
Does anybody know how to use mkl_?imatcopy? I cannot get it working on my system. I use a lot of other MKL routines without a glitch but this one does not do anything :(
I work in MSVC 2008 with MKL 10.2
0 Kudos
1 Solution
Vladimir_Petrov__Int
New Contributor III
658 Views
Andrew,

The root cause of the problem is using Cblas constants instead of the chars ('R' for row-major, and 'N' for no action) as documented in the MKL manual.

Please use
mkl_dimatcopy('R','N',3,3,K,&(D1(0,0)),3,3);
instead of
mkl_dimatcopy(CblasRowMajor,CblasNoTrans,3,3,K,&D1(0,0),3,3);

Best regards,
Vladimir

View solution in original post

0 Kudos
7 Replies
Gennady_F_Intel
Moderator
658 Views
Hi krfighter,
in's not clear what do you mean by "but this one does not do anything"?
is that mean the input array == the output one?
--Gennady
0 Kudos
Vladimir_Koldakov__I
New Contributor III
658 Views
Hello,
Could you please provide a testcase?
It's not cleare what are you trying to do.
Thanks,
Vladimir
0 Kudos
Andrew_Drach
Beginner
658 Views
I am terribly sorry that first post was not clear enough.

Yes, input equals to output for some reason.
Here is an example code:
using namespace boost::numeric::ublas;
double K(3.0);
matrix D1;
D1.resize(3,3);
for (int i=0;i<3;++i) for (int j=0;j<3;++j) D1(i,j)=1.0;
mkl_dimatcopy(CblasRowMajor,CblasNoTrans,3,3,K,&D1(0,0),3,3);

P.S. Is it just me or all MKL developers are Russian? :) !
0 Kudos
Vladimir_Petrov__Int
New Contributor III
658 Views
Hello,

My first guess is that you are passing CblasNoTrans to mkl_dimatcopy.

My second thought is that you may be simply scaling...
In this case I wonder what D1 and D2 are in your example?

Best regards,
Vladimir (yet another one)
0 Kudos
Andrew_Drach
Beginner
658 Views
Yes, I do not need transposition.
Yes, I thought I could use this procedure for simple scaling (scalar multiplication)

Sorry, it should be D1 in both cases. Already corrected
0 Kudos
Vladimir_Petrov__Int
New Contributor III
659 Views
Andrew,

The root cause of the problem is using Cblas constants instead of the chars ('R' for row-major, and 'N' for no action) as documented in the MKL manual.

Please use
mkl_dimatcopy('R','N',3,3,K,&(D1(0,0)),3,3);
instead of
mkl_dimatcopy(CblasRowMajor,CblasNoTrans,3,3,K,&D1(0,0),3,3);

Best regards,
Vladimir
0 Kudos
Andrew_Drach
Beginner
658 Views
Vladimir,

Thanks a lot!
Such a silly mistake to mess it up with CBLAS interface constants...
0 Kudos
Reply