Questions tagged [matrix-decomposition]

In the mathematical discipline of linear algebra, a matrix decomposition or matrix factorization is a factorization of a matrix into a product of matrices.

In the mathematical discipline of linear algebra, a matrix decomposition or matrix factorization is a factorization of a matrix into a product of matrices.

In numerical analysis, different decompositions are used to implement efficient matrix algorithms.

94 questions
1
vote
0 answers

Matrix whose columns are the first $p$ left singular vectors

Let's say I have a $m \times n$ matrix $A$. When I find its SVD, I get $p$ dominant singular values. How do I get the $m \times p$ matrix whose columns are the first $p$ left singular vectors of $A$?
user15394281
1
vote
1 answer

Calculating determinants via Cholesky decomposition in PyTorch

I've been trying to calculate the determinant of a 2x2 matrix via Cholesky decomposition in PyTorch and it won't give the same number as Numpy and I'm not sure why. From my understanding, you can calculate the determinant of a square…
1
vote
0 answers

Choleky decomposition using cholmod package

I am trying to use the cholesky decomposition to invert a sparse matrix and I found this great package to help me on my problem. My issue is that I keep getting CholmodNotPositiveDefiniteError although I verified with the eigenvalues that my matrix…
mirimo
  • 144
  • 4
1
vote
0 answers

How to compute variance decomposition proportions of correlation matrix in python?

I'm looking to identify collinear variables in my input matrix X. I'm able to get some metrics like VIF scores, condition number, condition indices, but unable to get variance decomposition proportions. Can someone please help me on how to compute…
Venkatesh Gandi
  • 441
  • 1
  • 9
  • 24
1
vote
0 answers

Scikit-learn NMF return NAN values

I am working with a 6650254x5650 sparse matrix which values are in numpy.float64 format. I am using the NMF implemetnation from scikit-learn as following from sklearn.decomposition import NMF model = NMF(n_components=12, init='random',…
Areza
  • 5,623
  • 7
  • 48
  • 79
1
vote
0 answers

Eigen LLT (Cholesky) fails, while SVD works

I'm trying to reproduce some numpy code on Gaussian Processes (from here) using Eigen. Basically, I need to sample from a multivariate normal distribution: samples = np.random.multivariate_normal(mu.ravel(), cov, 1) The mean vector is currently…
Svalorzen
  • 5,353
  • 3
  • 30
  • 54
1
vote
1 answer

Cholesky optimization for Pentadiagonial matrix in python

So I'm working at this pentadiagonial matrix A, size n : (Also here general information for pentadiagonial matrices : https://en.wikipedia.org/wiki/Pentadiagonal_matrix ) I'm using Cholesky Decomposition in order to get the matrix L of matrix A ,…
1
vote
1 answer

Rfast hd.eigen() returns NAs but base eigen() does not

I am having problems with hd.eigen in Rfast. It gives extremely close results to eigen with most data, but sometimes hd.eign returns an empty $vector, NAs, or other undesirable results. For example: > set.seed(123) > bigm <-…
Stonecraft
  • 860
  • 1
  • 12
  • 30
1
vote
1 answer

python Implementation of Proximal alternating linearized minimization algorithm

The updates of the gradients are somehow wrong. I have implemented the below given algorithm. I have done something wrong ''' Implementation of PALM- proximal alternating linearisation method ''' def palm(X,m,niter,lamda): X = X.T l =…
sveer
  • 427
  • 3
  • 16
1
vote
0 answers

How to obtain correct L and U matrices from LU decomposition of a sparse matrix A, without using scipy.sparse.linalg.splu()?

I have noticed that scipy.sparse.linalg.splu() does not allow me to decompose a sparse matrix A into the correct L and U matrix that I can call separately. The command ''merely'' allows me to decompose the matrix and reconstruct it later on using…
1
vote
1 answer

How come that scipy.linalg.lu() does not return the same L matrix as scipy.sparse.linalg.splu()?

I have the following piece of code where I compute the L matrix of a given square matrix using the command scipy.linalg.lu() and then I do the same thing again except then applied to the sparse form of the given matrix using…
1
vote
1 answer

How to decompose affine matrix?

I have a series of points in two 3D systems. With them, I use np.linalg.lstsq to calculate the affine transformation matrix (4x4) between both. However, due to my project, I have to "disable" the shear in the transform. Is there a way to decompose…
1
vote
1 answer

NURBS: Where can I find these two Linear Algebra utility functions?

I am working through The NURBS Book by Piegl and Tiller. For the global interpolation algorithm, they require you to provide two utility routines for solving a system of linear equations: LUDecomposition(A, q, sbw) to decompose the q x q…
nonremovable
  • 798
  • 1
  • 6
  • 19
1
vote
1 answer

Solving for Lx=b and Px=b when A=LLt

I am decomposing a sparse SPD matrix A using Eigen. It will either be a LLt or a LDLt deomposition (Cholesky), so we can assume the matrix will be decomposed as A = P-1 LDLt P where P is a permutation matrix, L is triangular lower and D diagonal…
1
vote
1 answer

EigenvalueDecomposition returns wrong eigenvectors

I'm using the apache.commons.math3 library to calculate eigenvectors of a 3x3 matrix, but the EigenDecomposition methods for calculating eigenvectors return wrong results: here's my code: double[][] matrix = { {1 ,3 ,2}, {1 …
Federico Taschin
  • 2,027
  • 3
  • 15
  • 28