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
1 answer

Cholesky decomposition failure for my correlation matrix

I am trying to use chol() to find the Cholesky decomposition of the correlation matrix below. Is there a maximum size I can use that function on? I am asking because I get the following: d <-chol(corrMat) Error in chol.default(corrMat) : the…
user3390169
  • 1,015
  • 1
  • 11
  • 34
1
vote
2 answers

Turning matrix diagonals to columns

I am looking for a matrix operation of the form: B = M*A*N where A is some general square matrix and M and N are the matrices I want to find. Such that the columns of B are the diagonals of A. The first column the main diagonal, the second the…
AsaridBeck91
  • 1,276
  • 9
  • 12
1
vote
0 answers

Suitesparse equivalent for MATLAB A/b of complex semi-symmetric matrix

I am currently using MATLAB to do matrix division of very large, very sparse, complex matrices that are symmetric in structure, but asymmetric in value (i.e. A(1,2)=3+4i and A(2,1)=3-4i). I am now converting my code to Java. What is the proper…
FlyingTurbine
  • 323
  • 2
  • 9
1
vote
0 answers

How to impose sparseness constraints in Sklearn NMF library's cd solver?

Recently, I found out that the Sklearn NMF library deprecated its pg solver and now uses its cd solver. With the cd solver, I don't think I can apply sparseness constraints. Or maybe the L1 rate implicitly represents sparseness? Is there a way to…
Jisun Kang
  • 21
  • 3
1
vote
1 answer

MvNormal Error with Symmetric & Positive Semi-Definite Matrix

The summary of my problem is that I am trying to replicate the Matlab function: mvnrnd(mu', sigma, 200) into Julia using: rand( MvNormal(mu, sigma), 200)' and the result is a 200 x 7 matrix, essentially generating 200 random return time series…
kulsuri
  • 143
  • 8
1
vote
0 answers

cholesky decomposition in python

I'm trying to use cholesky decomposition in python, with numpy (np) and scikits (sci) libraries. Assume that D is sparse (using csc_matrix). The results of the following two lines are different L1 = csc_matrix(np.linalg.cholesky(D.todense())); L2 =…
Mehdi
  • 19
  • 3
1
vote
1 answer

one of Eigenvalues of covariance matrix is negative in R

I have a data set x. And I use cov(x) to calculate the covariance of x. I want to calculate the inverse square root of cov(x). But I get negative eigenvalue of cov(x). Here is my code S11=cov(x) S=eigen(S11,symmetric=TRUE) R=solve(S$vectors %*%…
81235
  • 179
  • 2
  • 11
1
vote
2 answers

the use of combining max, xrange and lambda function in python

I have found a code that pivotize a square matrix for LU decomposition, but I can't understand some of them. def pivotize(m): """Creates the pivoting matrix for m.""" n = len(m) ID = [[float(i == j) for i in xrange(n)] for j in…
Physicist
  • 2,848
  • 8
  • 33
  • 62
1
vote
0 answers

LU Decomposition

i did an exercise with LU decomposition in Matlab, my professor highlighted some problems, but i don't understand what i should correct. This is for the lower triangular matrix: function b = triI(A,b) n = length(A); for i=1:n for j=1:i-1 …
Pring
  • 31
  • 6
1
vote
6 answers

Can I return two array types at the same time in a single method (LDL^T Factroization) in Java

I wrote this method for LDL^T decomposition in java (It factorizes a square symmetric matrix "A" into 3 matrices where "L" is a lower triangular matrix with 1s in the diagonal and "D" is a diagonal matrix with positive entries and "L^T" is the…
Shagohod
  • 13
  • 4
1
vote
1 answer

Cholesky Decomposition of matrix in OpenCV

is there any function in OpenCV that I can use to apply Cholesky Decomposition on a matrix?
farahm
  • 1,326
  • 6
  • 32
  • 70
1
vote
3 answers

LU decomposing a square matrix matlab gauss elimination

I'm trying to create a program that takes a square (n-by-n) matrix as input, and if it is invertible, will LU decompose the matrix using Gaussian Elimination. Here is my problem: in class we learned that it is better to change rows so that your…
Oria Gruber
  • 1,513
  • 2
  • 22
  • 44
0
votes
1 answer

QR decomposition

Is there a way to implement a QR decomposition like in Matlab? In particular, I am interested in the following command: [C,R,P] = qr(S,B) According to the description it "returns a permutation matrix P that is chosen to reduce fill-in in R. You can…
NC520
  • 346
  • 3
  • 13
0
votes
1 answer

Inverting a triangular matrix in python/numpy/scipy

I am looking to invert a (lower) triangular matrix that comes from the Cholesky decomposition of A, as A = L @ L.T. There are a few potential solutions, including numpy: inverting an upper triangular matrix. Unfortunately, this question is now more…
user16715836
0
votes
0 answers

Incomplete LU factorization in SymPy

I'm trying to to find a way to perform an incomplete LU factorization of a symbolic matrix in SymPy and cannot find anything helpful on my own. It's an option for solvers to use ilu as a preconditioner, but it seems there's no way to have it on its…