1

Do you know whether boost has functions that can calculate the determinant and the inversion of a complex matrix? The matrix dimension isn't large (less than 50).

Inversion: Input: matrix M = A +i*B with A,B two real matrices of dimension (n x n) with n <50.

Output:

  • Inversion: matrix N = C + iD with C,D two real matrices of dimension (n x n) such that: (A +iB)^T (C+ i*D) = I (I: the identity matrix)
  • Determinant: det(A+iB)

I googled but didn't succeed.

Thank you in advance.

NN2
  • 111
  • 1
  • 5
  • 1
    Boost has [uBLAS](https://www.boost.org/doc/libs/1_65_1/libs/numeric/ublas/doc/index.html). However, as mentionned there, *the last major improvement of uBLAS was in 2008 and no significant change was committed since 2009* – Damien Jan 29 '21 at 15:44
  • Thank you for your answer. I had tested ublas and hadn't succeed to inverse a complex matrix, but I wasn't sure so I asked this question. By chance, do you know where I can get a (free) C++ code to inverse a complex matrix? – NN2 Jan 29 '21 at 15:50
  • 1
    I use sometimes the *eigen* library. In the past, in C, I have used the *Recipies in C* library. And I have also used some code I wrote myself ... – Damien Jan 29 '21 at 15:58
  • 1
    Is not clear what you want to achieve, I suggest you do add the expected Output – Federico Baù Jan 29 '21 at 15:58
  • Yes, I just added the Input and the expected Output. – NN2 Jan 29 '21 at 16:03

1 Answers1

0

Finally I know why these operators on inversion and determinant of matrices aren't implemented. It's because we have closed-form solution of these 2 operators from classical operators on real matrices.

For matrix inversion: we have this closed-form solution https://fr.mathworks.com/matlabcentral/fileexchange/49373-complex-matrix-inversion-by-real-matrix-inversion

For matrix determinant, we have:

det((A+iB))= det (A * (I + i A1.B)) (with A1 is the inversed matrix of A)
= det(A) * det (I + i A1.B))

= det(A) * det (U1 (I + iD) U2) (with U1 = A1.B, U2 is the invered matrix of U1, D is the diagonal matrix of U1) = det(A) *det(I +iD). It's easy to calculated the determinant of I +iD which is a diagonal matrix.

So, det(A+iB) = det(A) * det(I +iD) with D: the matrix of eigenvalues of (A^(-1) * B)

NN2
  • 111
  • 1
  • 5