Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [matrix]

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

2
votes
1answer
54 views

How to find the nearest/a near positive definite from a given matrix?

I'm given a matrix. How do I find the nearest (or a near) positive definite from it? The matrix can have complex eigenvalues, not be symmetric, etc. However, all its entries are real valued. The ...
2
votes
0answers
77 views

A Bound for the inverse of the sum of identity and triangular matrix

I wonder if there are any theorems which can help me to calculate an upper bound for the spectral norm of: $$\left\| \left[ I + \sum_{i=1}^{\overline{n}\in\mathbb{N}} \big( C_i - I\big)\right]^{-1}\...
1
vote
0answers
56 views

Fast calculation of $A^T B$

I need to compute a matrix-matrix product, $A^T B$, where $A$ is $n \times r$ sparse, and $B$ is $n \times q$ dense. The number of rows $n$ is far larger than both $r$ and $q$. In fact $n$ is so large ...
0
votes
0answers
48 views

Open source distributed sparse-matrix vector multiplication library

What is the current state-of-the-art open source library that has an efficient implementation distributed memory sparse matrix-vector multiplication? I need to perform repeated SpMVs and I am looking ...
-4
votes
1answer
81 views

what is Sherman-Morrison formula

Can someone please explain what is the Sherman-Morrison formula and it's specialities when it comes to matrix calculations? I'm a little bit confused on understanding how the preconditioning works ...
2
votes
0answers
22 views

Randomized Submatrix of a Sparse Matrix

I have a sparse square matrix $A$ with size $n \times n$ and number of nonzero entries $nnz$. The goal is making a sub-matrix $B$ with $s$ nonzeros which are randomly chosen from $A$. Duplicates are ...
1
vote
2answers
48 views

Access optimized data structure for representing integer lattice

Consider the integer lattice in $2d$, namely the set $\mathbb{Z}^2 = \{(x,y): x,y\in \mathbb{Z}\}$, and let $u:\mathbb{Z}^2 \to \mathbb{R} $ be a function defined on some bounded subset of $\mathbb{Z}^...
1
vote
1answer
131 views

Solving linear system with matrix multiplication

When solving a linear system $Ax=b$ where $A=B^TCB$ do I need to form $A$ explicitly by two matrix-matrix multiplications or is there another more simple way? $C$ is a NxN matrix and not always ...
4
votes
1answer
145 views

Do I really need to invert this matrix

I need to calculate a matrix $A$ (at least some elements of it, see below) as defined by the following equation $$ A=B(\mathbb{1}-B)^{-1} $$ where B is a square matrix of dimension $N$ and $\mathbb{...
1
vote
0answers
59 views

finding null space to a complex matrix

I need to solve the following equation: $$ \begin{pmatrix} \frac{\omega^2}{c^2}\varepsilon_x-\mu_z^{-1}k_y^2-\mu_y^{-1}k_z^2 & \mu_z^{-1}k_xk_y & \mu_y^{-1}k_xk_z\\ \mu_z^{-1}k_xk_y &\...
8
votes
3answers
183 views

Rule of thumb for sparse vs dense matrix storage

Suppose I know the expected sparsity of a matrix (i.e. the number of non-zeros / total possible number of non-zeros). Is there a rule of thumb (perhaps approximate) for deciding whether to use sparse ...
3
votes
0answers
103 views

Computing Small Eigenvalues with Sparse Symmetric Indefinite Mass Matrix

I want the eigenvalues of the following generalized eigenvalue problem: $$ Av = \lambda M v $$ where $A\in\mathbb{R}^{n\times n}$ is sparse, symmetric, and positive semi-definite $M\in\mathbb{R}^{n\...
1
vote
1answer
48 views

Thomas Algorithm Kernel OpenCL

I am trying to implement the Thomas algorithm using OpenCL. ...
2
votes
2answers
159 views

Lost on Matrix Inversion

I try to implement some big matrix inversion. My system configuration is Hardware:- Memory: 62.8GiB, Processor: Intel Xeon(R)CPU E5-2670 v3 @2.30GHZ*48 To implement matrix inversion I am using ...
3
votes
0answers
32 views

Reweighted least squares factorization

This is a continuation of the question asked here. I want to solve numerous least squares systems of the form $$ D_i A x \approx D_i b $$ where $D_i$ are $m \times m$ diagonal matrices with positive ...
6
votes
0answers
109 views

An invertible matrix that minimizes the norm of the product with a given matrix

Given a fat matrix $B \in \mathbb{C}^{n \times m}$ (where $m > n$) with full row rank, I would like to find (numerically) a full-rank matrix $A$ that minimizes the Frobenius norm of the product $A ...
2
votes
1answer
101 views

Finding probability vectors from an implicit equation

I have $q$ $n$-dimensional vectors $\vec y_i$ and a matrix $\hat B$ of shape $n\times m$. I'm looking for $q$ $m$-dimensional vectors $\vec x_i$ such that: $\vec y_i=\hat B \vec x_i$ each vector $\...
4
votes
2answers
125 views

How “sparse” should a sparse matrix be to see benefits?

I have a matrix, whose size scales as $2^N$ (assume even $N$). In each row of the matrix, only about $2^{N/2}$ of the entries are filled ($N$ can be somewhere between 10 and 40, depending on what's ...
3
votes
1answer
71 views

Compute nearly degenerated eigen values and vectors

In a quantum physics calculation, I have to deal with a matrix that has a lot of eigenvalues really close to each other ($10^{-6}$ relative difference for example) and I can't manage to obtain ...
0
votes
0answers
28 views

Converting logit coefficients into probabilities through the inverse multinomial logit

I am trying to come up with the transition intensities of a parameterized Markov model, i.e, the elements of the transition matrix weighted by the covariates through the inverse Logit relation: $$\...
5
votes
1answer
119 views

Generate approximately semi-orthogonal tall matrix approximately satisfying constraints

I have a set of matrices $\{(A_i,D_i)\}$ for $i\in\{1,\ldots,n\}$, where: Each $D_j\in\mathbb{R}^{S\times S}$ is diagonal, and every entry on the main diagonal is non-negative. Each $A_j\in\mathbb{R}^...
5
votes
1answer
45 views

Transform from linear index of a packed triangular matrix to dense indices

Given indices $i,j$ s.t. $0\leq i \leq j <n$, the function $f(i,j)=i+j(j+1)/2$ maps 2d indices to linear indices in column major order. What is the fastest way to invert this function? My first ...
7
votes
2answers
205 views

Is large condition number good measure of nearness to singularity for a matrix?

I am new to numerical linear algebra, so i came to know that condition number in 2-norm case will be ratio of largest to smallest singular value. Another concept "Nearness To Singularity" is measured ...
4
votes
1answer
117 views

How can I apply Euler's Method to predict a point in time rotating around multiple axis'

I am xposting this from my original stackoverflow question where I was presented with a coding challenge that I have been able to narrow down extensively and I think it lies with Euler's Method. Here'...
6
votes
2answers
297 views

Matrix multiplication accuracy Matlab vs Python

I am translating some Matlab code into Python and I having some problems regarding matrix multiplication accuracy. Assuming we have following data: ...
2
votes
2answers
55 views

Discrete-time input matrix when one of the eigenvalues of the system matrix is zero

If we have a continuous time state-equation, $$ \dot{x}(t) = A x(t) + B u(t)$$ where $A \in \mathbb{R}^{n \times n}, x \in \mathbb{R}^{n\times1}, B \in \mathbb{R}^{n \times m}, u \in \mathbb{R}^{m \...
-1
votes
2answers
229 views

Does armadillo library slow down the execution of matrix operations?

I've converted a MATLAB code to C++ to speed it up, using the Armadillo library to handle matrix operations in C++, but surprisingly it is 10 times slower than the MATLAB code! So I test the ...
3
votes
2answers
91 views

Image hash similarity matching possible?

I have the following question: We have two face image files (JPEG), a Matrix of $128\times 128$ with values between 0-255. We would like to hash both image files using a function $f(x, key)$. Where I ...
1
vote
0answers
52 views

Dense decomposition of very non-square matrices

I have inherited code that solves Eigen::Matrix problems using the code shown on this page: ...
0
votes
0answers
42 views

Minimum Residual Richardson Iteration for non positive definite matrix

I am trying to solve a matrix equation using a simple Minimum Residual Richardson method (http://depts.washington.edu/ph506/Boyd.pdf : page 304-306). I am using a finite difference matrix as ...
9
votes
2answers
276 views

Matrix exponential of a Hamiltonian matrix

Let $A, G, Q$ be real, square, dense matrices. $G$ and $Q$ are symmetric. Let $$H = \begin{bmatrix} A & -G \\ -Q &-A^T \end{bmatrix}$$ be a Hamiltonian matrix. I want to compute the matrix ...
3
votes
1answer
99 views

Solve $A^{-1} b$ when one column is replaced

Given square matrix $A_0$, vector $b$, vector $A_0^{-1}b$ and matrices $A_1, A_2, \dots, A_k$, in which each $A_i$ is generated from $A_{i-1}$ by replacing one single column, I would like to find an ...
2
votes
0answers
63 views

Acceleration of matrix geometric series

Suppose we want to find $x$ such that: $$x=b+Ax$$ where $A$ is a large sparse square matrix with eigenvalues in the unit circle. There are two representations of the solution: 1) $$x=(I-A)^{-1}b,$$...
0
votes
0answers
44 views

How to reduce dimension using CUR Decomposition?

I am trying to understand this paper called High Dimensionality Reduction Using CUR Matrix Decomposition and Auto-encoder for Web Image Classification. I have understood the method proposed for ...
8
votes
2answers
84 views

Exploiting patterns in matrix for efficient matrix-vector multiplication

I have the following situation: I have a sequence of vectors $x_1, x_2,.. $ and for each I want to compute the product $Ax_i$ where $A$ is fixed at the outset. Although there is no information about ...
3
votes
1answer
183 views

What is the fastest method to invert millions of matrices?

My project involves large simulation and estimation. For each simulation I need to solve 600,000 systems of nonlinear equations. Currently I am using Newton's method to find the solutions. That ...
3
votes
1answer
94 views

Normalizing a density matrix at each iteration

I need to numerically evolve a density matrix using this formula(Actually I have more terms but right nows I am starting with this and facing problems): $$\dot\rho(t) = -i[H(t), \rho(t)]$$ $H(t)$ is ...
0
votes
1answer
60 views

Matrix factorization empty rows and columns

I would like to do non negative mf and I wanna ask a question about my main matrix. The question is should I include rows and columns that have no non-zero entry in them. I think if there is not a ...
6
votes
0answers
178 views

Speed and accuracy of Strassen vs Winograd matrix multiplication algorithms

I am doing work which requires as fast matrix multiplication as possible and just want to double-check with this community that the Winograd variant of Strassen's MM algorithm is the fastest practical ...
4
votes
2answers
138 views

MATLAB Matrix Multiply Efficiency

I am using MATLAB to prototype a few matrix multiply techniques and compare efficiency. Eventually, I will move the prototype codes to C. It is for a homework assignment where we need to write an ...
3
votes
0answers
66 views

Backward stable algorithm to get orthogonal projection onto the column space of a matrix

I have to find the orthogonal projection of a vector $b$ onto the matrix $A$ of size $m \times n$. In my application, I don't have the luxury of calculating the QR factorization. All I have are ...
2
votes
3answers
211 views

Matrix vector multiplication performance

I have been learning about the impact of cache size on code performance. I wrote a small code to see how using a column major loop in MATLAB would be better than using a row major loop, since MATLAB ...
1
vote
1answer
50 views

Optimal algorithm choice for mixed diagonal/dense problem

$$ \text{Let}\\ A, B \in \mathbb{C}^{n \times n} \text{ and } \hat{\alpha}, \hat{\beta} \in \mathbb{C}^{n}, \hat{f} \in \mathbb{C}^{2n} \\ \text{Find }\\ \underline{\mathbf{x}} \in \mathbb{C}^{2n} \...
1
vote
0answers
157 views

Multithreading determinant computation of a Big Matrix

I've been trying to design an algorithm for computing determinant of Big square Matrices (N <= 1000). I am allowed to use multithreading, but still, I can't design the algorithm. The assignment ...
6
votes
1answer
156 views

Fast multiplication of highly structured matrix

I want to compute a fast matrix-vector product using a matrix $T$ which has a peculiar quasi-Hankel structure. For example, \begin{equation} T_2= \left( \begin{array}{c|ccc|cccccc} a & b & c &...
0
votes
1answer
65 views

Which are some good algorithms and heuristics to calculate the similarity between two matrices?

Say I have a matrix like this: \begin{bmatrix} 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 1 & 1 & 1 \\ \end{bmatrix} And this one: \begin{bmatrix} ...
1
vote
0answers
83 views

Low memory algorithm for matrix diagonalisation

I'm trying to find the largest eigenvalues of very large $N \times N$ matrices ($N = 10^{10}$ and larger). The matrices are not sparse but the multiplication operation is fast. For now, I'm using ...
2
votes
2answers
165 views

Inverting big symmetric and singular matrices

In this post I found a very similar probem to the one I have, but not a satisfactory answer for my purposes. I have a set of matrices $C_\ell$. They are exactly symmetric by construction. ...
7
votes
0answers
178 views

Eigenvalue with largest imaginary part

Iterative eigensolvers such as ARPACK, give the option to find a subset of the eigenvalues which have the largest imaginary part. My question is how do these algorithms work. As I understand it, ...
5
votes
1answer
122 views

Eigenvector with maximum overlap

Given a matrix $M$ and a vector $v$, is there an efficient method to find the normalized eigenvector of $M$ that is closest to $v$, in that it has maximal overlap. More explicitly, a vector $v$ can be ...