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

learn more… | top users | synonyms

0
votes
1answer
81 views

Open Source Linear Algebra Library

I am making a code in C that requires the equivalent of Matlab's '\' command for a linear system of the form AX=B where A is an NxN matrix and X, B are Nx1 vectors- i.e a code that performs X=A\B that ...
4
votes
1answer
48 views

Vectorize a part of a huge matrix in C++

I have a large matrix, side-length is about $n\geq 1000$. I need to do element-wise multiplication of this matrix with another matrix many, many times. I make this process by: Vectorizing (through ...
3
votes
1answer
37 views

Lanczos algorithms for Hermitian system with toeplitz kernel

Basically I am trying to compute the SVD of a large hermian matrix H using Lanczos iteration, while H consists if a toeplitz kernel K, which should be able to help speed up the matrix-vector ...
2
votes
1answer
91 views

Why do libraries need hand-vectorized code instead of compiler auto vectorization

C++ eigen library does vectorization for different architecture, like SSE, NEON etc. In their documentation they mentioned that, Eigen vectorization is not compiler dependent. But most modern ...
0
votes
1answer
43 views

Mapping from n x n complex symmetric tridiagonal to 2n x 2n real symmetric tridiagonal

In my program I have a complex symmetric tridiagonal matrix. In order to perform some algorithmic optimizations I am searching for a (ideally linear) mapping from $n\times n$ complex symmetric ...
5
votes
0answers
100 views

Effects of Lumping Mass Matrix

I've recently finished an introductory course on the finite element method from a more mathematical perspective (following Brenner and Scott) and we were introduced to the finite element mass matrix ...
3
votes
0answers
33 views

Sparse matrix format and sparse-matrix sparse-matrix multiplication

Good morning, I'm having some performance problems with my code dealing with the multiplication of big sparse matrices (stiffness and aerodynamic influence coefficient matrices). Mainly I have to ...
1
vote
0answers
24 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
98 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
53 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
46 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
83 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
116 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
76 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
104 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
29 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 ...
2
votes
0answers
68 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
195 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
199 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 ...
6
votes
1answer
255 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
27 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
723 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
107 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
80 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
41 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
131 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
119 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
88 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
246 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
40 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
120 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
123 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
151 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
102 views

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

I want to invert large matrices ($10^4 \times 10^4$ to $10^6 \times 10^6$) but sparse (less than $100$ non-zero entries per line) on clusters with $16$ to $48$ processors per node. I'm looking for an ...
1
vote
1answer
166 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
141 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
65 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
413 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
103 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
121 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
85 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
81 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
204 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
287 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 ...
1
vote
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
201 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 ...