Quantcast
Channel: Intel® Software - Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 3005

[help]Data type in zheev.c example.

$
0
0

Hi,

In the example of

https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11...

The to-be-diagonalized matrix is declared to be a dcomplex type

(struct _dcomplex { double re, im; };
typedef struct _dcomplex dcomplex;)

and initialized using:

dcomplex a[LDA*N] = {
           { 9.14,  0.00}, {-4.37,  9.22}, {-1.98,  1.72}, {-8.96,  9.50},
           { 0.00,  0.00}, {-3.35,  0.00}, { 2.25,  9.51}, { 2.57, -2.40},
           { 0.00,  0.00}, { 0.00,  0.00}, {-4.82,  0.00}, {-3.24, -2.04},
           { 0.00,  0.00}, { 0.00,  0.00}, { 0.00,  0.00}, { 8.44,  0.00}
        };

When I try to supply my own matrix elements to a[LDA*N] using

dcomplex a[LDA*N];
        for (int i=0;i<N;i++) {
        for (int j=0;j<LDA;j++) {
        int k=j+i*4*N;
        a[k] = {std::real(hamiltonian[i][j]),std::imag(hamiltonian[i][j])};
        }//j
        }//i

It complains:

error: expected an expression
          a[k] = {std::real(hamiltonian[i][j]),std::imag(hamiltonian[i][j])};
                 ^

when I tried to icc the code using mkl link.

I guess the question is: how to initialize/access members in a[LDA*N] in a more free way.

As you see I mostly use vectors to store my data. So I am not familiar with other data types.

 

Thanks a lot,

Yue


Viewing all articles
Browse latest Browse all 3005

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>