Questions tagged [matrix]

For questions about using and representing matrices on a computer in order to solve computational problems. Should generally also include a tag about the specific property/problem you are solving (e.g. [tag:linear-algebra], [tag:eigenvalues], [tag:inverse].

Filter by
Sorted by
Tagged with
1 vote
0 answers
47 views

Overlap matrix and its inverse matrix

Now, we consider a non-orthonormal basis: $$\mathcal{S}_N=\{|\alpha\rangle,a^\dagger|\alpha\rangle,a^{\dagger 2}|\alpha\rangle,\ldots,a^{\dagger N}|\alpha\rangle\},$$ where $|\alpha\rangle$ is the ...
Young Q's user avatar
  • 11
1 vote
1 answer
45 views

Finding the Vector $v$ for a Given Householder Matrix Transformation of Non-Collinear Vectors $a$ and $b$

Consider a vector $v$ in $\mathbb{R}^{n\times1}$. The Householder matrix is defined as follows: $$H(v)=I-\dfrac{2vv^T}{v^Tv}.$$ It can be demonstrated that $H(v)$ is symmetric and orthonormal. The ...
Ilkay Burak's user avatar
3 votes
0 answers
64 views

Efficient Algorithm for LU-Factorization of Modified Matrix with Last Column Alteration If We Have Its Not-Modified LU-Factorization

Suppose that we have a $n\times n$ matrix $A$. We have its LU-factorization as $A=LU$ (or $PA=LU$ that $P$ is a permutation matrix). Now assume we change the last column of matrix $A$ and denote the ...
Ilkay Burak's user avatar
9 votes
1 answer
1k views

Why is it that SVD routines on nearly square matrices run significantly faster than if the matrix was highly non square?

In Python / Matlab, if you run a routine for SVD on a significantly non-square matrix, X, such as X.shape = (2,15000) you will ...
tisPrimeTime's user avatar
3 votes
1 answer
150 views

How can we calculate mixed derivatives numerically using the Chebyshev derivative matrix?

Using the Chebyshev derivative matrix $D$, we can numerically approximate the first and second derivative of a function by doing matrix multiplication: $${df(x) \over dx} = Df(x) \tag 1$$ $${d^2f(x) \...
Nikola Ristic's user avatar
2 votes
0 answers
67 views

Complex matrix logarithm discontinuity by solving inverse Fourier integral by alternative method to FFT

NOTE: This code is a piece of code I am using for a master's thesis, so I do not expect someone to do the work for me, but I gladly accept suggestions of any kind. However, I am trying to get the ...
SimoPape's user avatar
1 vote
0 answers
30 views

numerical calculation of haldane model arm chair edge states

hello I am trying to numerical simulate the band structure of the one-dimensional periodic arm chair edge states, I use the pybinding model to construct and ...
yangxing844's user avatar
1 vote
0 answers
33 views

Sums of sparse matrices modulo 2

I have a set of sparse matrices modulo 2 (i.e systems of equations in the format "a XOR b XOR ... XOR c = 0 or 1" compressed by me into reduced row echelon form). This is a rather large set (...
unknown's user avatar
  • 111
2 votes
2 answers
187 views

Reordering eigenvalues in Schur factorization - MATLAB orschur and LAPACK dtrsen not producing the same results

Disclaimer: I previously posted this on SO, but though it would be more relevant for scicomp. The original post has been deleted. I have been trying to recreate the functionality provided by MATLABs <...
two_Thomas's user avatar
2 votes
1 answer
84 views

Tools to compare two matrices with same dimensions

Context: I have two 3D non-random matrices that have the same dimensions. These matrices represent satellite images with 1 band, so their values are strictly positive. They both present areas that ...
Nihilum's user avatar
  • 121
2 votes
1 answer
149 views

Measuring the extent to which two sets of vectors span the same space

I have a set of measurements $y_i$, $1 \leq i \leq N$, and I want to model these measurements with a linear model. I have two possible models I can use, $$ y \approx A c $$ and $$ y \approx B d $$ ...
vibe's user avatar
  • 1,048
1 vote
1 answer
80 views

Calculating camera calibration matrix with Scilab

I'm not entirely sure whether this question belongs here or in DSP but I think this is the proper site. I'm following these videos (first video, second video) to calibrate a camera for photogrammetry ...
Vaahterasiirappi's user avatar
1 vote
1 answer
89 views

Automatic differentiation (AD) of a loss function which maps unitary matrix onto number

Is it possible to estimate whether automatic differentiation (AD) techniques could enable a more efficient way to repeatedly compute the derivative $\delta L / \delta u^*_{ij}$ of a specific loss ...
thyme's user avatar
  • 111
1 vote
1 answer
84 views

Reshaping a matrix and rearranging the elements lexicographically into a vector

Let us say that I have a $3 \times 3$ matrix $\bf X$, that has to be reshaped into a vector and rearranged as follows: $$ {\bf v} ({\bf X}) = \begin{bmatrix} x_{22} & (x_{23}+x_{32}) & (x_{21}+...
Neuling's user avatar
  • 23
2 votes
0 answers
68 views

When is Lanczos tridiagonalization accurate?

Suppose that we are given a random, symmetric matrix $A$, and a random vector $q$. For concreteness, assume the dimensions of $q$ and $A$ are both $1,000$. I would like to use the Lanczos algorithm to ...
miggle's user avatar
  • 41
1 vote
1 answer
144 views

QR algorithm for eigenvalues and eigenvectors of large symmetric matrices

I am trying to write a QR algorithm in Python for eigenvectors and eigenvalues finding for large symmetric matrices, My initial thought was to use Householder transformation with a Wilkinson shift on ...
Daniel's user avatar
  • 11
2 votes
1 answer
198 views

Parallelize pseudo inverse of a matrix using Lapacke

I am currently using the protocol described in https://stackoverflow.com/questions/55599950/computation-of-pseidoinverse-with-svd-in-c-using-blas-and-lapacke to compute the pseudo inverse of a matrix. ...
Filippo Caleca's user avatar
4 votes
5 answers
632 views

Matrix derivative

I am looking to compute the derivative of the following expression: $$\frac{\partial}{\partial X}\mathrm{tr}\left[A\exp(X)\right]$$ where $A$ is both a symmetrical and positive-definite matrix and $X$ ...
PC1's user avatar
  • 436
3 votes
1 answer
106 views

Scipy solve_ivp sensitivity to random phase shifts

I am trying to solve a coupled system of ODE's using the solve_ivp function from scipy. The general form of the equation is given via $$\dot{y}(t) = M(t)y(t).$$ The time dependence of matrix is ...
raeel's user avatar
  • 31
0 votes
1 answer
153 views

How to efficiently transpose distributed matrix in Scalapack?

I have a distributed matrix in block cyclic layout. Is there an efficient way to out/in place transpose a distributed matrix with scalapack? Context: I am trying to diagonalize the transpose of a ...
Aditya Kurrodu's user avatar
3 votes
1 answer
131 views

Rewriting quadratically-constrained optimization problem as a semidefinite program

Suppose $A,H$ are positive definite matrices and $\alpha,t$ are scalars. Is there a way to massage the following problem into a form suitable for a specialized solver? $$\begin{array}{ll} \underset{\...
Yaroslav Bulatov's user avatar
1 vote
0 answers
112 views

Does cblas_dgemm mutate my input matrices?

I have written a matrix class Matrix<T> for which I have implemented a wrapper function for cblas_dgemm. ...
Urwald's user avatar
  • 111
0 votes
3 answers
211 views

How do we compute a matrix-vector product without using the standard matrix multiplication?

I am a bit confused right now. I am taking a class on numerical linear algebra and as I have understood sometimes one doesn't compute the Matrix-Vector product $Av$ normally but uses other techniques ...
Josh.K's user avatar
  • 11
1 vote
1 answer
111 views

QR decomposition with only diagonal elements changing

I have to compute the QR decomposition of a matrix A repeatedly, each time with ONLY diagonal elements changing. Is there an efficient way to accomplish this ...
Madhurjya's user avatar
  • 111
3 votes
1 answer
227 views

BiCGSTAB convergence

So I need a fast converging solver for SysLinEq as a subroutine in fortran, decided to test BiCGStab in Matlab. Thank God I decided to test it out on first before implementing in Fortran as a ...
2Napasa's user avatar
  • 384
2 votes
1 answer
373 views

Matrix regularisation for ill-conditioned problems

I have read that matrix regularisation can improve the stability of LU or Cholesky decomposition of ill conditioned problems. The idea is to add a value to the diagonals of a matrix: $B=A+cI$ In the ...
vydesaster's user avatar
2 votes
0 answers
52 views

Is there a permutation used in sparse QR factorizations that better locates small elements on the diagonal of R?

Is there a permutation used in sparse QR factorizations that better locates small elements on the diagonal of R to the end of the diagonal? As an example, consider the following snippet of MATLAB ...
wyer33's user avatar
  • 757
5 votes
2 answers
359 views

Recurrence relation for matrices

I have matrices ($S_0$ thought $S_N$) and I have a recurrence relation that link successive matrices together. $$S_i + S_i(aS_{i-1}^{-1})S_i=C_i+aS_{i+1}$$ We can assume for this problem that $S_0=S_N=...
PC1's user avatar
  • 436
5 votes
0 answers
45 views

Lowest eigenvalues of a matrix with divergent entries

In high energy physics we oftentimes encounter the following problem. For a given parametrized matrix $\{H_{ij}(\Lambda)\}$, we know that in the limit $\Lambda\to\infty$ some of its entries become ...
mavzolej's user avatar
  • 151
3 votes
1 answer
164 views

Using submatrices of matrix decomposition for solving a large number least-squares problems

I want to decrease the computational time for solving a large number (>1000) of least-squares problems. Given a matrix, the system matrix for each least-squares problem is a submatrix of the given ...
Raibyo's user avatar
  • 219
1 vote
1 answer
165 views

constructing a symmetric matrix for finite difference

I come across the following operator in a paper $\mathcal{I}\psi = \psi_{xxxx} + (r~\psi_x)_x$, where $\psi=\psi(x)$ and $r=r(x)$. Periodic boundary condition is employed. It claims that the operator $...
Physicist's user avatar
  • 227
0 votes
1 answer
3k views

Dynamic Sized Identity Matrix in Eigen

I am aware of creating an identity matrix in Eigen if the number of rows and columns are known. How do we create them dynamically when the size is not known? An example would be useful. Thanks.
user1408865's user avatar
1 vote
2 answers
299 views

Calculate average distance between pairs of points without computing full distance matrix

Suppose I have a set of $N$ points of shape $N \times D$, where $D$ is the dimensionality. I want to compute the average Euclidean distance between all points, as well as additional moments such as ...
wil3's user avatar
  • 165
1 vote
1 answer
100 views

Fast algorithm to compute chi-square

I would like to evaluate the chi-square of the form $\chi^2=v^{T}C^{-1}v$ where $v$ is a column vector and $C$ is a covariance matrix. Both $v$ and $C$ are known and $C$ is a $740\times740$ matrix. ...
user7896's user avatar
  • 123
1 vote
1 answer
86 views

Converting a 4 rank matrix to 2 rank matrix after using tensorproduct

Let's say I have a 2x2 matrix (with symbols) called 'A'. Now, if do B = sympy.tensorproduct(A,A) print(sympy.shape(B)) I get, ...
Shashank Saumya's user avatar
5 votes
1 answer
461 views

Converting distance matrix back into original data

Suppose that we have $N$ points, and a distance matrix $D \in \mathbb{R}^{N \times N}$ describing the Euclidean distance among those points. For now, assume that we do not necessarily know how many ...
wil3's user avatar
  • 165
4 votes
2 answers
220 views

nnz-preserving sparse matrix multiplication

Let A and B be sparse matrices in $ \mathbb{R}^{m\times m}$ with (roughly) the same density $p$. I want to efficiently compute a matrix $C$ that in some sense is "closest" to $AB$ while ...
nonagon's user avatar
  • 41
1 vote
0 answers
851 views

Symmetric Matrix in Eigen C++

I am aware of a symmetric matrix type in uBLAS as ublas::symmetric_matrix matrix. Is there an equivalent for this in Eigen library that can be used to construct one or do we need to explicitly check ...
user1408865's user avatar
1 vote
0 answers
293 views

Trouble inverting complex matrix with numpy and scipy

I have some matrix-valued, complex data $Z(f)$ with $f\in\{f_0,f_1,\dots\}$ and $Z(f_i)$ being a 3x3 matrix. I require the inverse $Z^{-1}(f)$ in my workflow. After encountering some problems with my ...
totally_lost's user avatar
5 votes
0 answers
90 views

Is this a legit way to sample a random matrix spectrum?

In order to undergird a theoretical model concerning many body physics, I want to have exponentially large eigenvalue spectra from the random matrix GOE ensemble. its properties are mainly (i) a ...
Peter Sanctus's user avatar
0 votes
2 answers
133 views

Implementation of $[X, \cdot]$ as an $n^2 \times n^2$ matrix, where $X$ is an $n \times n$ matrix

Let $M_n(\mathbb{R})$ denote the set of $n\times n$ matrices with real entries. I have an $n\times n$ matrix $X\in M_n(\mathbb{R})$, and I would like to implement the linear operator $[X, \cdot] : M_n(...
Solarflare0's user avatar
6 votes
1 answer
249 views

Algorithm for solving systems which are nearly symmetric/adjoint?

I am familiar with Cholesky decomposition and LU factorization for solving systems of linear equations. I have a problem where I have large sparse matrices (say, 1000x1000 or larger) where only one or ...
user3814483's user avatar
19 votes
3 answers
3k views

Why do we usually not want the eigenvalues of non-symmetric matrices?

I came across this line in a class note I am reading where it discusses finding eigenvalues of matrices. In reality we don't go all the way with Arnoldi. We stop at a decent value of 𝑘. Then the 𝑘 ...
CuriousMind's user avatar
1 vote
1 answer
690 views

Efficiency of scipy.sparse.linalg.expm_multiply with sparse vs unsparse vectors

From the package scipy.sparse.linalg in Python, calling expm_multiply(X, v) allows you to compute the vector ...
Solarflare0's user avatar
1 vote
1 answer
372 views

2-norm and infinty norm of a system in controls

How to compute 2-norm or infinity norm of following system? i am confused whether to calculate using simple matrix theory "where it don't regard for s domain" or H2 and H-infinty norm. ...
Syed Tirmizi's user avatar
1 vote
1 answer
3k views

What is difference between L2 norm and H2 Norm?

When someone refers 2-norm of system,L2 and H2 are used interchangeably by author and is rather confusing. Even the matlab has different functions for H-infinity norm and L-infinity norm. as shown in ...
Syed Tirmizi's user avatar
0 votes
0 answers
83 views

Can a symmetric matrix be found using matrix-vector operation while maintaining matrix-vector operatin?

Consider $A\in\mathbb{R}^{n\times n}$ its not a special matrix and in the worst case all of its entries are non-zero. I am looking for a way to compute $AA^{T}$ using matrix-vector operation. The ...
TYWQ's user avatar
  • 101
0 votes
0 answers
163 views

Do the projection (with Jacobian) and marginalisation (inversion of matrix and remove a row/column and reinversion) commute?

I try to check the equality or the inequality between 2 Fisher matrices. The goal is too see if the projection (with Jacobian) and marginalisation (inversion of matrix and remove a row/column and ...
user avatar
1 vote
2 answers
689 views

Dyadic operations, fourth order tensors and Tensor algebra

I am trying to understand the dyadic operation for a while since I am interested in Elasticity problems. I believe an intuitive understanding (rather than assuming) will give me good problem solving ...
Bruce Lee Jun Fan's user avatar
2 votes
1 answer
137 views

Vectorization Matlab/Octave of Markov Matrix Powers

I have just created a code snippet in Octave/Matlab that aims to create a plot which shows the accuracy of an initial probability vector $\vec{\pi}$ derived from the transition probability matrix $\...
david david's user avatar

1
2 3 4 5
12