Matrix is a rectangular array of elements (e.q. numbers, symbols, or expressions), arranged in columns and rows.

learn more… | top users | synonyms

1
vote
0answers
20 views

Can I exploit symmetry in a two-sided matrix product A*S*transp(A) to gain execution speed?

Let $A$ and $S$ be $n \times n$ matrices. Only $S$ is symmetric. What is the fastest algorithm to compute $S := A S A^T$?
3
votes
1answer
86 views

Stabilizing a 3x3 real symmetric matrix eigenvalue calculation

I have many 3x3 real symmetric matrices for which I need to determine the eigenvalues. Wikipedia gives a nice non-iterative algorithm for this case, which I have translated into C++: ...
0
votes
1answer
38 views

Armadillo Multi-threaded Linear Solve Yielding Different Answers

I'm working on some problems that ultimately boil down into a simple assembly of an overdetermined system of equations, $Ax=b$, where $A$ is $m \times n$ for $m \gg n$. I'm leveraging Armadillo's C++ ...
0
votes
1answer
45 views

Construct tridiagonal matrix from eigenvalues

I have a sort of reverse problem, and I'm not sure if there is a simple solution. I have a tridiagonal Hermitian matrix: $$ A = \begin{bmatrix} 0 & a_1 & 0 & 0 & 0 \\ a_1 & 0 ...
1
vote
1answer
71 views

Matrix transpose multiplication

In CVX, I encounter a problem. I want to multiply a Matrix of 2x4 with its transpose. I know the result must be positive definite. However, it couldn't let me do the multiplication directly. Says: ...
0
votes
0answers
108 views

Preconditioned Conjugate Gradient linear system solver in MATLAB

I have been trying to use the MATLAB's pcg() function to minimize an energy functional. Converting minimization problems to the solution of a linear system is ...
7
votes
0answers
71 views

The fast, and The Backward-Stable (left) $3\times 3$ matrix inverse

I need to compute a lot of $3\times3$ matrix inverses (for Newton iteration polar decomposition), with very small number of degenerate cases ($<0.1\%$). Explicit inverse (via matrix minors divided ...
0
votes
1answer
103 views

Fast computation of square root inverse of matrix, matrix being determined from Ax=b form

I have an equation of the form $J^Te=f$, where $e$ and $f$ are known vectors and $J$ is an unknown matrix. How can I efficiently compute $J^T(JJ^T)^{-1/2}e$ ? My motivation to address this problem ...
0
votes
1answer
74 views

Is there any rapid way to calculate the determinant of NXN covariance matrix?

I searched the web and found some C code for calculating the determinant of a $n\times n$ matrix. This code however seems timing complexity, and run pretty slow especially when handling a larger ...
1
vote
0answers
28 views

Optimal distribution of zeros and ones over matrix

I have the following problem: Given a matrix with n rows and m columns. Some elements of the matrix are unavailable. For each column, you have a set containing a number of zeros and ones which must ...
1
vote
0answers
60 views

Solve for $D$ in $R^{T}DSDR = Id$

Given that $R$ is a rectangular matrix, $D$ is a diagonal, square matrix and $S$ being a square matrix along with the fact that both $D$ and $S$ are invertible. $S$ in this specific case can be ...
0
votes
1answer
144 views

Solve AX=B where A is skyline matrix

This is in continuation to a question previous asked; My goal is to solve an equation linear equation of the type $AX=B$, where $A$ is an $n\times n$ symmetric matrix stored in the form of symmetric ...
7
votes
3answers
182 views

How to compute the rank of a large sparse matrix in MATLAB

I am interested in computing the ranks of fairly large, the largest being of magnitude $10^6$ x $10^6$, sparse matrices whose entires are all 0, 1, or -1. I have been trying to use Matlab to ...
0
votes
0answers
39 views

Simple fortran 90 code for skyline matrix solution [duplicate]

I am looking for a simple subroutine in Fortran 90 (GNU Compiler) to solve linear equation of the type AX=B, where A is an n*n symmetric matrix stored in the form of symmetric skyline matrix. I want a ...
5
votes
1answer
229 views

What category is this problem?

My first question, please excuse me if its too basic. I have a matrix of evenly spaced geographical points; say 10 x 10, which I will call seed points. Each seed ...
0
votes
1answer
25 views

Calculating adjacency matrix of platonic solids

I need to devise a algorithm (in Python) that calculates adjacency matrices for the platonic solids. Inputted into the algorythm needs to be the number of polygons meeting at each vertex and the ...
6
votes
1answer
44 views

Finding all binary vectors with given A-length

I am given a $n \times n$ matrix $A$ with real entries and define the inner product $$\langle x,y\rangle = x^T A y.$$ I am also given an integer $k$ and need to find all binary vectors $x$ such that ...
1
vote
1answer
35 views

How to use compiled python packages for matrix initialization

Assume I have an expression for an matrix initialization, for example the following: A[i,i-2*j+k] = B[i-k] * C[i] * D[i+j+k] In order to execute such a process, I could loop over all i, j and k. ...
6
votes
2answers
587 views

In FEM, why is the stiffness matrix positive definite?

In FEM classes, it's usually taken for granted that the stiffness matrix is positive definite, but I just can't understand why. Could anyone give some explanation? For instance, we can consider the ...
2
votes
1answer
106 views

MATLAB : Does the qr algorithm and the DGEMM used in MATLAB take into account if the input matrix is tridigonal and optimize accordingly?

Let's say we want to solve for the eigen-values of a symmetric matrix of size $n$ x $n$. In the Phase 1 of the computation, the matrix is reduced to a tridigonal form using Householder/Arnoldi's ...
0
votes
2answers
75 views

Matlab Vectorization of columns in a 2D matrix and single element multiplication

MATLAB. I am trying to vectorize a loop in which each column vector of a 2D matrix (n-by-n) is found by multiplying each single element in a diagonal matrix with a column vector in another n-by-n 2D ...
2
votes
0answers
37 views

Get a matrix with absolute values in PETSc

Is there any function to create or change a matrix, to have $A_{ij} = \text{abs}(A_{ij})$ in PETSc? If possible it should work with MPIAIJ matrices, not only local.
0
votes
3answers
129 views

How to find closed form $C$ such that $CC^T = AA^T + BB^T$

How to find $C$ such that $CC^T = AA^T + BB^T$, $A$ and $B$ are known. $A = \left(\begin{matrix}X\\Y\end{matrix}\right)$, $B = \left(\begin{matrix}0\\cY\end{matrix}\right)$, $c$ is a constant. To ...
2
votes
2answers
118 views

Generation of random Matrix with Real eigen values

does anyone know any matlab algorithm that can help me generate a random matrix with REAL EIGEN values? Thanks.
1
vote
1answer
86 views

Max size of set linear equations to solve? (X=AX+B)

This question has also been asked at Stack Overflow. This is a very general question regarding the maximum size of a set of linear equations to be solved by today's fastest hardware, in the form: ...
2
votes
2answers
221 views

Efficently invert tiny matrix in Fortran

I have a piece of code in Fortran90 in which I have to solve both a non-linear (with the Newton-Raphson method, for which I have to invert the Jacobian matrix) and a linear system of equations. When I ...
1
vote
1answer
39 views

Compare reconstruction of matrices using SVD

I'm interested in how much 'signal' is retained from including k singular values in a Singular Value Decomposition, but I'm having trouble conceptualizing (or ...
1
vote
0answers
100 views

How to convert MPIAIJ to SEQAIJ matrix in petsc/petsc4py?

I am curious, if there is a function to convert MPIAIJ (distributed matrices in AIJ format) to a SEQAIJ matrix that lie on a single processor. It is possible to do such an operation for PETSc vectors ...
0
votes
1answer
113 views

Efficient method to multiply floating point matrix with binary matrix and get double precision results

I have a matrix A which is of size (n2, n1) and I am multiplying it by a matrix, B, of size ...
2
votes
1answer
150 views

How to calculate $det(X^TX)$ efficiently, update one column of X each time

$X_{1} = (A, b)$, where $X_{1}$ is a $n\times p$ matrix, $A$ is a $n\times (p-1)$ and $b$ is $n\times1$. update $b$ with $c$,Is there any update method to compute more efficiently?
1
vote
1answer
90 views

solve linear system of equation of a large sparse symetric positive definite matrix

I want to invert large matrices ($10^4x10^4$ to $10^6x10^6$) but sparce (less than 100 non-zero entries per line) on clusters with 16 to 48 processors per node. I'm looking for an efficient method to ...
1
vote
1answer
162 views

ADR equation implicit solution: Penta-diagonal matrix for a 2D $N\times N$ system

Objective: I am trying to simulate the following advection-diffusion-reaction equation in 2D space (x,y) and time. $$\begin{align} \text{ADR Equation: }\frac{\partial C}{\partial t} + \nabla\left(v.C ...
4
votes
1answer
135 views

What is wrong with this matrix multiplication?

I am attempting to write a matrix multiplication routine because I need to do some analysis in CUDA and I want to validate it with CPU code. I am trying to use ...
0
votes
1answer
64 views

Is this the correct procedure for calculating matrix spectrum?

I am not sure if my question is on topic but I have a piece of Fortran code that is used to perform successive over relaxation. Prior to performing successive over relaxation the author is calculating ...
3
votes
2answers
353 views

BLAS, LAPACK or ATLAS for Matrix Multiplication in C

I am trying to find the most optimized way to perform Matrix Multiplication of very large sizes in C language and under Windows 7 or Ubuntu 14.04. And searching led me to BLAS, LAPACK and ATLAS. ...
2
votes
1answer
88 views

Sparse matrix vector product using PETSC

I am trying to do a simple parallel sparse matrix vector multiplications using PETSC. My sparse matrix is a simple tridiagonal laplacian matrix, which is distributed over multiple processors using ...
0
votes
0answers
110 views

How can I efficiently solve $Ax$=$b$ given $A$ is symmetric and contains very small (even negative) eigenvalues using EIGEN

Currently I am using the EIGEN C++ library to try to solve $x$ from the equation $Ax$ = $b$. One problem I encountered is that the matrix $A$ is a correlation matrix with size > 5000 and can ...
2
votes
1answer
84 views

How do I make sparse solvers to accept custom matvec function insted of matrix?

I have tried it with Lis, Intel mkl and PETSc. Everywhere you need to pass an actual matrix ...
3
votes
0answers
77 views

What is the computational cost of using complex numbers in contrast to real numbers in matrix operations, e.g. $LU$ or $LDL^T$ factorizations?

I am curious about how much one loses in terms of computational cost, when complex numbers are used instead of real numbers? I guess the number of floating point operations and memory doubles, but I ...
1
vote
2answers
195 views

How can I prove that two eigenvectors are orthogonal?

I obtained 6 eigenpairs of a matrix using eigs of Matlab. How can I demonstrate that these eigenvectors are orthogonal to each other? I am almost sure that I ...
4
votes
2answers
247 views

Optimization with matrix determinant as constraint

I'm solving a constrained optimization for matrix $\mathbf{A}$ with dimension 6x6, where one of the constraints is $\mathrm{det}(\mathbf{A})>0$. I use the NLopt package to solve my problem and ...
0
votes
1answer
3k views

What is the fastest algorithm for computing the inverse matrix and its determinant for positive definite symmetric matrices?

Given a positive definite symmetric matrix, what is the fastest algorithm for computing the inverse matrix and its determinant? For problems I am interested in, the matrix dimension is 30 or less. ...
1
vote
2answers
173 views

Parallelization of element-wise matrix multiplication

I use Armadillo as an interface to OpenBLAS. In my current program, I have a loop, in which I do multiplications of the form ...
7
votes
6answers
3k views

Super C++ optimization of matrix multiplication with Armadillo

I'm using Armadillo to do very intensive matrix multiplications with side lengths $2^n$, where $n$ can be up to 20 or even more. I'm using Armadillo with OpenBLAS for matrix multiplication, which ...
2
votes
1answer
240 views

Solve Ax=B where B is a matrix in parallell

I try to solve the problem $Ax=B$ where $A$ is a large sparse $n\times n$ matrix, and $B$ is a dense $n\times m$ matrix (here $n=754850$ and $m=182$). The backslash operator yields correct solution ...
7
votes
1answer
128 views

Compute eigenvectors of a matrix with known eigenvalue spectrum

If I have already accurately known the eigenvalue spectrum (i.e. all eigenvalues) of a matrix, is there any efficient numerical algorithm to compute all the eigenvectors corresponding to these ...
6
votes
1answer
217 views

Is there a faster method to compute the geometric series of a matrix?

I want to calculate the geometric series of a matrix $A$: $$S=I+A+A^2+\dots+A^n$$ and then apply to a vector $v$, $Sv$. I've done it in Matlab with a loop and I think it's quite efficient applying ...
1
vote
0answers
51 views

Library for calculating determinants with Kronecker products

I need to calculate a determinant consisting of vectors, using the Kronecker product as product. As an example I would need to be able to calculate: $\left| \begin{array}{cc} ...
5
votes
1answer
221 views

What is a good way to take fractional powers of a matrix in MATLAB?

I am working on a problem that involves taking fractional powers of particular matrices. For the matrix A with 2 on the main diagonal and -1 on the sub and super diagonal (the finite difference ...
1
vote
0answers
135 views

Optimizing rank computation for very large sparse matrices

I have a sparse matrix such as ...