LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Complex Array to LAPACK Complex Array

Hello,

 

I'm trying to use the LAPACK complex linear equation solver instead of the built in solver since it is significantly faster (in our use case close to 4x faster). I've got liblapack.dll that I'm calling from LabVIEW and this works fine for normal linear equations as you just pass a pointer to the 2D input arrays of doubles. However, LabVIEW uses structs for complex numbers so an array of complex numbers is an array of structs. Meanwhile, LAPACK expects an input that is an array of two doubles (Re & Im) per cell in the array. Ie:

 

Normal array:

[ {double Val}, {double Val}, ... ]

 

LabVIEW's complex array:

[ {struct cmplx64}, {cmplx64}, ... ]

 

Wanted Complex array:

[ {double Re double Im}, {double Re double Im}, ... ]

 

What is the best way to convert a complex array in LabVIEW to this format?

 

(Details on the LAPACK function I'm using can be found here: http://www.netlib.org/lapack/explore-html/d6/d10/group__complex16_g_esolve.html#ga531713dfc62bc5df38...)

 

Any help would be great!

0 Kudos
Message 1 of 2
(2,533 Views)

Not sure about the exact binary layout of a Lapack array data structure, but in terms of logical memory location of elements in the array the values in a LabVIEW complex array seem to match exactly the ones in the Lapack array.

 

Basically a struct cmplx64 in LabVIEW is simple a {double re, double im} too, so you can see that it ends up with the same layout in memory as what Lapack supposedly is using according to your claim.

 

So if a Lapack complex array is indeed just a pointer to an array of doubles with the real and imaginary values interleaved, this is the same memory layout as LabVIEW is using. You should then be able to declare  the CLN parameter to Adapt to Type, Pass as Array Data Pointer and simply connect your complex array to this parameter. How the dimensionality parameter in the Fortran documentation would have to be handled I'm not sure, however.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,504 Views)