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

How to convert real matrix to complex matrix

HUANGK
Novice
524 Views

Hi,

I'm trying to solve a kinetic problem where the linear system is (K+i*omega*C-omega*omega*M)X=F, where K C M are all real matrices, i is a complex index, omega is a parameter, i Want to assemble the left end item. K+i*omega*C-omega*omega*M want to assemble, K C M was stored in sparse_matrix_t format and internally stored as double-precision real matrix, I tried to use mkl_sparse_z_add, but the final result is very strange, I suspect it is due to When K C M is performing the operation, I directly substitute K C M without initializing the complex part. But if I want to initialize it, I have to export the real matrix and re-import it after processing the value, which will cause a huge waste of memory and operations. Excuse me, is there a better way to deal with it?

Thanks for helping me

0 Kudos
3 Replies
VidyalathaB_Intel
Moderator
480 Views

Hi Huang,


Thanks for reaching out to us.


>> I suspect it is due to When K C M is performing the operation, I directly substitute K C M without initializing the complex part


Yes, it might be the possible reason for the strange results that you are observing. We need to initialize the imaginary parts as well while dealing with operations of complex matrices and even the scalars should also be represented in complex data type format.


I suspect you are using this mkl_sparse_z_add routine twice as this is used for computing the sum of two matrices and in your case there are 3, K C M.

Maybe you could try rearranging this expression K+i*omega*C-omega*omega*M.(maybe something like K-omega*omega*M+i*omega*C, finish the operation between only real matrices, and then initialize the imaginary part for the resultant and then continue with the part performing computation between the complex data type).


If you still observe the strange results with this function mkl_sparse_z_add even after initializing the imaginary parts, kindly get back to us with a sample reproducer code along with your OS details so that we can check it from our end.


Regards,

Vidya.


0 Kudos
VidyalathaB_Intel
Moderator
438 Views

Hi Huang,


A gentle reminder:


As we haven't heard back from you, could you please provide us with an update regarding your issue? Please get back to us with the above-mentioned details if your issue still persists.


Regards,

Vidya.


0 Kudos
ShanmukhS_Intel
Moderator
410 Views

Hi,


We assume that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Best Regards,

Shanmukh.SS


0 Kudos
Reply