qndiag | Quasi-Newton algorithm for joint-diagonalization | Math library
kandi X-RAY | qndiag Summary
kandi X-RAY | qndiag Summary
This Python package contains code for fast joint-diagonalization of a set of positive definite symmetric matrices. The main function is qndiag, which takes as input a set of matrices of size (p, p), stored as a (n, p, p) array, C. It outputs a (p, p) array, B, such that the matrices B @ C[i] @ B.T (python), i.e. B * C(i,:,:) * B' (matlab/octave) are as diagonal as possible.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- R Solve quadrature decomposition
- Transform a set of matrices into a matrix
- Performs line search
- Computes the loss of a diagonal matrix
- Transform a matrix into a matrix
- Calculates the loss function of a diagonal matrix
- Compute the gradient of a matrix
qndiag Key Features
qndiag Examples and Code Snippets
Community Discussions
Trending Discussions on qndiag
QUESTION
I am looking for a way to find same eigenvectors for 2 given matrices, this way I would make a joint diagonalisation. For this, I found out and tried to use qndiag (from https://github.com/pierreablin/qndiag.git ) from the following function :
...ANSWER
Answered 2021-Jan-27 at 21:18From the documentation for eigs
:
d = eigs(A)
returns a vector of the six largest magnitude eigenvalues of matrix A.
If you want all seven, you need to call d = eigs(A,7)
or d = eig(A)
. For a small matrix (e.g. < 1000 x 1000) it's usually easier to just get all the eigenvalues with eig
, rather than get a subset with eigs
.
Edit: Responding to your "Update 3"
for k=1:length(D)
should be replaced by for k=1:n
. This needs to be changed on two lines. Judging from your error message they are lines 231 and 236.
L = length(X)
returns the length of the largest array dimension in X
, which in your case is 7, i.e. too high for the first dimension.
QUESTION
I am using the qndiag library to try to find a diagonalisation for 2 given matrices.
The github is here : qndiag libray
I am using this Python script to compute these 2 diagonalisation as closed as possible :
...ANSWER
Answered 2021-Jan-26 at 01:54The issue lies in [D, B] = qndiag(C, 'max_iter', 1000, 'tol', 1e-3)
, B0
(which is the second param) gets assigned as a string not as an array! Then eventually B
would be a string and hence the error message str object has no attribute 'dot' !, if you are only passing C
matrix as parameter, just do [D, B] = qndiag(C)
.
QUESTION
I am using the qndiag library to try to find a diagonalisation for 2 given matrices.
The github is here : qndiag libray
The function qndiag is defined like this (not entirely source) :
...ANSWER
Answered 2021-Jan-25 at 00:11As stated in the toy example you should be able to run your code if you would change this line
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install qndiag
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page