Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1035324 // eigenvaluesOfSymmetricMatrix

JavaX fragment (include) [tags: use-pretranspiled]

Uses 652K of libraries. Click here for Pure Java version (7928L/44K).

!include once #1035331 // EJML Include (Matrix library)

static Complex[] eigenvaluesOfSymmetricMatrix(double[][] matrixData) {
  var matrix = new DMatrixRMaj(matrixData);

  var evd = new SymmetricQRAlgorithmDecomposition_DDRM(false); // false = don't need vectors
  if (!evd.decompose(matrix))
    null;
  
  int n = evd.getNumberOfEigenvalues();
  Complex[] eigenvalues = new[n];
  for i to n: {
    var v = evd.getEigenvalue(i);
    eigenvalues[i] = Complex(v.real, v.imaginary);
  }
  ret eigenvalues;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035324
Snippet name: eigenvaluesOfSymmetricMatrix
Eternal ID of this version: #1035324/5
Text MD5: 5f4192414454229b65db8dcabb6501bb
Transpilation MD5: 61f9b373d684184ed2692600153b1fa1
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 16:36:24
Source code size: 524 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 125 / 200
Version history: 4 change(s)
Referenced in: [show references]