DSPRelated.com
Forums

complex matrix inversion

Started by asimmasud November 21, 2008
Hello 

      I need to invert  square complex matrixes of sizes 52x52,64x64 and
128x128 in MS VC++6.I need to implement it as fast as possible. I have
written a code for complex matrix inversion but it takes lot of time. (e.g.
a complex matrix inversion of 52x52 matrix takes more than 2ms) Can any one
tell me free intel library or any other related library to do my task more
fastly?

                                            THANKS IN ADVANCE




On Nov 21, 11:43&#4294967295;am, "asimmasud" <asimbhatti...@hotmail.com> wrote:
> Hello > > &#4294967295; &#4294967295; &#4294967295; I need to invert &#4294967295;square complex matrixes of sizes 52x52,64x64 and > 128x128 in MS VC++6.I need to implement it as fast as possible. I have > written a code for complex matrix inversion but it takes lot of time. (e.g. > a complex matrix inversion of 52x52 matrix takes more than 2ms)
does that mean less than 3 ms? shit, that doesn't sound so bad to me. this is essentially solving 52 sets of equations where each set has 52 equations and 52 unknowns. i would think that you would need to do this in double precision (would 64 or 80 bits be enough?) to keep nasty numerical errors at bay. i s'pose there are optimization tricks, particularly if there is some kind of symmetry in the matrix, but if there is no symmetry, i dunno how inverting an NxN matrix can be made conceptually simpler than simultaneously solving N sets of N equations, each with N unknowns. right off the bat, i s'pose that diagonallizing or triangularizing the "A" matrix for one set is about the same as diagonallizing or triangularizing the same "A" matrix for the other sets, and in that manner, some computation can be saved. other than that, i can't think of any other tricks for the general "A". r b-j
"asimmasud" <asimbhatti267@hotmail.com> writes:

> Hello > > I need to invert square complex matrixes of sizes 52x52,64x64 and > 128x128 in MS VC++6.I need to implement it as fast as possible. I have > written a code for complex matrix inversion but it takes lot of time. (e.g. > a complex matrix inversion of 52x52 matrix takes more than 2ms) Can any one > tell me free intel library or any other related library to do my task more > fastly? > > THANKS IN ADVANCE
There is an Intel library - it's called the Intel Integrated Performance Primitives (IPP). But it's not free. However, I don't think it's too bad either (~$100?). Alternately, have you tried math packages like LAPACK? -- % Randy Yates % "So now it's getting late, %% Fuquay-Varina, NC % and those who hesitate %%% 919-577-9882 % got no one..." %%%% <yates@ieee.org> % 'Waterfall', *Face The Music*, ELO http://www.digitalsignallabs.com
On Fri, 21 Nov 2008 12:11:30 -0500, Randy Yates <yates@ieee.org>
wrote:

>There is an Intel library - it's called the Intel Integrated Performance >Primitives (IPP).
...
>>Alternately, have you tried math packages like LAPACK?
I use an old version of Intel MKL (v6.1), which has now been absorbed into the IPP. The MKL has matrix inversion routines under LAPACK, but only in Fortran. I don't know if the IPP NOW has equivalent routines in C.
Greg Berchin <gberchin@comicast.net.invalid> writes:

> On Fri, 21 Nov 2008 12:11:30 -0500, Randy Yates <yates@ieee.org> > wrote: > >>There is an Intel library - it's called the Intel Integrated Performance >>Primitives (IPP). > ... >>>Alternately, have you tried math packages like LAPACK? > > I use an old version of Intel MKL (v6.1), which has now been absorbed > into the IPP. The MKL has matrix inversion routines under LAPACK, but > only in Fortran. I don't know if the IPP NOW has equivalent routines > in C.
As long as the libraries have a standard ABI, their language of implementation doesn't matter. -- % Randy Yates % "The dreamer, the unwoken fool - %% Fuquay-Varina, NC % in dreams, no pain will kiss the brow..." %%% 919-577-9882 % %%%% <yates@ieee.org> % 'Eldorado Overture', *Eldorado*, ELO http://www.digitalsignallabs.com
On 21 Nov, 17:43, "asimmasud" <asimbhatti...@hotmail.com> wrote:
> Hello > > &#4294967295; &#4294967295; &#4294967295; I need to invert &#4294967295;square complex matrixes of sizes 52x52,64x64 and > 128x128 in MS VC++6.I need to implement it as fast as possible. I have > written a code for complex matrix inversion but it takes lot of time. (e.g. > a complex matrix inversion of 52x52 matrix takes more than 2ms) Can any one > tell me free intel library or any other related library to do my task more > fastly?
You are in the right neighbourhood. My matlab inverts one complex-valued 52x52 matrix (looking at the other numbers, do you mean 32x32?) in 0.5 ms on the 2.6 GHz PC. It *might* be that this is a parallel inversion routine which takes advantage of the fact that my PC has two cores (I haven't explicitly configured matlab to do that, though), but it seems you are within a factor 5-10 of the libraries matlab uses for these things, depending on the system parameters. Which isn't too bad. As far as I know, matlab uses the Intel libraries already mentioned by others. If you need something significantly faster than that, you need to take advantage of either some structure in the matrix (symmetry) or of the problem. If you for instance invert 'almost the same' matrix over and over, you might want to have a look at what is usually called 'the Matrix Inversion Lemma' in texts on the Kalman filter. The idea is that if you already know a matrix A and its inverse, you can use this knowledge to find the inverse of a perturbed matrix (A+d), which - depending on the nature of the perturbation - might be significantly faster than by inverting the whole thing from scratch. Rune
On Fri, 21 Nov 2008 22:41:29 -0500, Randy Yates <yates@ieee.org>
wrote:

>As long as the libraries have a standard ABI, their language of >implementation doesn't matter.
I assumed that they were implemented in assembly, or in compiled high-level code, but that's not the problem. The problem is the interface. Some of the Intel MKL functions, such as the DFT, have subroutines that can be called from Fortran and equivalent functions that can be called from C. Others, such as the LAPACK matrix routines, only have Fortran subroutines -- no C equivalents. If there is a way to call those Fortran subroutines from C, I would DEFINITELY be interested in learning about it. Greg
Greg Berchin <gberchin@comicast.net.invalid> writes:

> On Fri, 21 Nov 2008 22:41:29 -0500, Randy Yates <yates@ieee.org> > wrote: > >>As long as the libraries have a standard ABI, their language of >>implementation doesn't matter. > > I assumed that they were implemented in assembly, or in compiled > high-level code, but that's not the problem. The problem is the > interface. Some of the Intel MKL functions, such as the DFT, have > subroutines that can be called from Fortran and equivalent functions > that can be called from C. Others, such as the LAPACK matrix > routines, only have Fortran subroutines -- no C equivalents. > > If there is a way to call those Fortran subroutines from C, I would > DEFINITELY be interested in learning about it.
Hmm. Well, here is someone who it seems has solved your problem: http://icl.cs.utk.edu/~delmas/lapwrapc.html -- % Randy Yates % "Maybe one day I'll feel her cold embrace, %% Fuquay-Varina, NC % and kiss her interface, %%% 919-577-9882 % til then, I'll leave her alone." %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://www.digitalsignallabs.com
On 22 Nov, 14:36, Greg Berchin <gberc...@comicast.net.invalid> wrote:
> On Fri, 21 Nov 2008 22:41:29 -0500, Randy Yates <ya...@ieee.org> > wrote: > > >As long as the libraries have a standard ABI, their language of > >implementation doesn't matter. > > I assumed that they were implemented in assembly, or in compiled > high-level code, but that's not the problem. &#4294967295;The problem is the > interface. &#4294967295;Some of the Intel MKL functions, such as the DFT, have > subroutines that can be called from Fortran and equivalent functions > that can be called from C. &#4294967295;Others, such as the LAPACK matrix > routines, only have Fortran subroutines -- no C equivalents. > > If there is a way to call those Fortran subroutines from C, I would > DEFINITELY be interested in learning about it.
There is. The problem is that the FORTRAN <-> C(++) interface is not standardized, it changes between platforms and even between compilers. It's a nightmare, but it can be done. Rune
On Sat, 22 Nov 2008 09:03:32 -0500, Randy Yates <yates@ieee.org>
wrote:

>Hmm. Well, here is someone who it seems has solved your problem: > > http://icl.cs.utk.edu/~delmas/lapwrapc.html
Thank you! Lots to digest there, but it looks very promising. Greg