[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Library for matrix operations? (eigenvalues, pseudoinverse)
From: |
CEL |
Subject: |
Re: Library for matrix operations? (eigenvalues, pseudoinverse) |
Date: |
Thu, 16 Jan 2020 21:46:20 +0000 |
Oh not to forget: if you really just want to use LAPACK in isolation
and not require other dependencies at runtime... there's of course also
the option of writing Fortran [1] and then just directly using it from
C++... but beware, FORTRAN matrices are column-major, whereas C/C++
tends to be row-major.
Best regards,
Marcus
[1]
https://github.com/kit-cel/gr-specest/search?q=filename%3A.f90&unscoped_q=filename%3A.f90
On Thu, 2020-01-16 at 21:31 +0000, Müller, Marcus (CEL) wrote:
> So, that depends a bit on what you want to do:
>
> These operations are classically implemented in a library called
> LAPACK, which is really mature (and, it's written in Fortran90). You
> use it through C++ wrappers like "IT++" or "Armadillo".
>
> Be a bit careful though. The usual way of defining the pseudoinverse of
> a martrix with lin. indep. columns is
>
> A⁺ = (A* A)⁻¹ A*
>
> (with * being hermitian transposition).
>
> One of the relatively eternal laws of numerical math seems to be
>
> "you DON'T want to calculate that matrix inverse; it's way more work
> than finding the solution to a system of linear equations directly (and
> potentially much worse in terms of accuracy[2, (1.2) on p.2])"
>
> even for relatively small (A'A). Therefore, other methods exist, which
> tend to be faster, and can, under some assumptions, be more stable[1];
> one is based on the singular value decomposition
>
> A = U𝛴V*
>
> TL;DR: LAPACK wrapped for your language of choice, e.g. IT++ has
> eigenvalue, and singular value decompositions. You should find the
> Pseudoinverse through the singular value decomposition.
>
> Best regards,
> Marcus
>
> [1]https://www.johndcook.com/blog/2018/05/05/svd/
> [2] S. Rump: "Inversion of Extremely Ill-Conditioned Matrices
> in Floating-Point" http://www.ti3.tuhh.de/paper/rump/Ru08a.pdf
>
> On Thu, 2020-01-16 at 20:57 -0800, Laura Arjona wrote:
> > Hi all,
> >
> > Is there any library to use in gnuradio for algebra operations, such as
> > matrix eigenvalues, and pseudoinverse? Or I'd need to code them myself in
> > C++?
> >
> > I need to integrate those operations into my OOT C++ blocks.
> >
> > Thanks for your time
> >
> > Best
> >
smime.p7s
Description: S/MIME cryptographic signature