# Questions tagged [lapack]

LAPACK (Linear Algebra PACKage) is a commonly used library of subroutines for numerical linear algebra tasks, including solutions of linear sets of equations, linear least squares, eigenvalue problems, and singular value decomposition. LAPACK routines may be used with fortran, C and relatives and a variety of other languages.

109 questions
Filter by
Sorted by
Tagged with
33 views

### Numerical calculation of the Berry connection

I'm doing some numerical calculations involving Hermitian matrices, and derivatives of the eigenvectors. Essentially, I have an n x n, Hermitian matrix H(x), which is dependent on some continuous ...
63 views

### Why is LAPACK (seemingly) suboptimal for packed and banded eigenvalue problems?

Based on this LAPACK routines list, it looks like there is no relatively robust representation (RRR) driver routine for either packed or banded symmetric eigenvalue problems. According to the relevant ...
138 views

### Is LAPACK behind the cutting edge of dense linear algebra?

I have been digging into some numerical linear algebra lately, and reading in particular about how LAPACK solves symmetric eigenvalue problems. I noticed that the ...
59 views

### Functions from Scipy, Blas, or Lapack that compute only upper triangular matrix

My goal is to transform a matrix into upper triangular form in Python. I know the function scipy.linalg.lu will do LU decomposition and get both upper and lower ...
51 views

### Library to solve dense linear system with GMRES

I have a fortran 90 code and I want to solve a dense linear system with GMRES. I would prefer the restarted GMRES with preconditioning. Is there some library that you know of that I could use? Now I ...
169 views

### How to know which LAPACK's function is used by Scipy's eig function?

As far as I understood, scipy.linalg.eig use wrappers from scipy.lapack to compute the eigenvalues and eigenvectors of a matrix. ...
116 views

### Do most statistical packages and libraries in high-level programming languages rely on LAPACK for their matrix inversion operations?

Possible an open-ended question, but I am wondering if most statistical packages and libraries, for instance, Stata, R, Python's NumPy and MATLAB rely on LAPACK algorithms to perform matrix operations,...
100 views

### Lapack symmetric update $B^{-1}AB^{-T}$

Does Lapack have a routine that, given symmetric $A=A^T$ and $B$, computes the symmetric matrix $B^{-1}AB^{-T}$ (while preserving symmetry exactly)? It would be enough to have this routine for ...
85 views

### Using LAPACK to compute $B^{-1}AB^{-T}$ for thin $B$

How can I use BLAS/LAPACK to compute $$B^{-1}AB^{-T}$$ where $A\in\mathbb{R}^{n,n}$, $B\in\mathbb{R}^{m,n}$ is full rank matrix with $m>n$, and $B^{-1}y:=\arg \min_{x} \|Bx-y\|_{2}$. In theory, ...
164 views

### Inverting a matrix from LU decomposition

The LAPACK routines xGETRI compute the inverse of a matrix $A = PLU$ in its LU decomposed form by first computing $U^{-1}$, and then solving the system: $$(A^{-1} P) L = U^{-1}$$ My question is: ...
167 views

### How to use LAPACK function (DGELSY) in Fortran

I am trying to use Least Squares Minimization to solve a the matrix problem: b = A*x for x. The system is overdetermined, and A is a dense matrix. In the LAPACK library, I believe the routine DGELSY ...
45 views

### Stability of SVD, Eigendecompositions, and pseudoinverse procedures in modern LAPACK routines

I have proposed an optimisation algorithm which I claim has improved upon the previous algorithm in a number of ways. One of these claims is that my proposed solution requires no explicit SVD and ...
343 views

### LAPACK equivalent on c++ , which is the best one? [duplicate]

I am following a course of computational material physics. The professor uses fortran to code and uses lapack to solve eigenvalue problems. So far I just know c++. There is an equivalent library that ...
356 views

### What is the reason that LAPACK uses $\tau$ in QR decomposition (instead of normalizing the reflection vector)?

LAPACK's QR routine stores Q as Householder reflectors. It scales the reflection vector $v$ with $1/v_1$, so the first element of the result becomes $1$, so it doesn't have to be stored. And it stores ...
168 views

### Fast matrix multiplication with matrix elements computed on-the-fly (without forming the matrix)

Is there any library or routine for high-performance matrix-matrix product, where the matrix elements are computed on-the-fly using a given function of $i$ and $j$? More specifically, in the problem ...
135 views

### Wrong result of 'ddot' from BLAS

I am having trouble with a C/C++ program that uses the BLAS routine ddot. I am running Linux and so far LAPACK routines worked without any problems. I get a wrong ...
89 views

### Inverting small matrices: canned factorization versus explicit formula

I am interested in solving a large number of small linear systems of equations, $Ax=b$, with $A$ either $2\times2$ or $3\times3$. Assuming none of these systems are actually singular, is there ...
172 views

### How many operations are needed for LAPACK's zgesv to solve a linear system?

I have a linear system of complex numbers. I am using LAPACK' zgesv (actually I am using intel MKL LAPACKE, but I am assuming the algorithm is the same). No assumption can be made about the system. I ...
148 views

### Benchmark problems for eigenvalue reordering algorithms sought

Every real matrix $A$ can be reduce to real Schur form $T = U^T A U$ using an orthogonal similiary transform $U$. Here the matrix $T$ is quasi-triangular form with 1 by 1 or 2 by 2 blocks on the main ...
159 views

### Compute bilinear form with LAPACK

I need to compute a bilinear form for a set of left and right vectors $$w_k = \sum_{i,j} V_{ik}^*A_{ij}U_{jk},$$ where $A_{ij}\in\mathbb{R}$ and $U_{jk}, V_{ik} \in \mathbb{C}$ (Assume that all the ...
157 views

446 views

### LAPACK sorting eigenvalues differently each time

I'm using LAPACK zgeev routine to get eigenvalues and eigenvectors of a symmetric matrix in C++. Problem is zgeev is being called in a loop but it sorts eigenvalues (and eigenvectors) differently ...
294 views

### Matlab, Mathematica & LAPACK returning 3 different eigenvectors

(I'm not sure which of math.se / stackoverflow / scicomp.se is the right place to ask this question) I have a C++ code which generates a complex matrix and then calculates its eigenvalues and ...
336 views

### Rapidly determining whether or not a dense matrix is of low rank

In a software project that I'm working on, certain computations are vastly easier for dense low-rank matrices. Some problem instances involve dense low-rank matrices, but they're given to me in full, ...
85 views

### What is the difference in the pivoting strategies between LAPACK's dpstrf and dpst2 and why?

dpstf and dpstrf sometimes give different pivot results. Of course I can read the source code, but I don't get the idea from it. Since pivoting is for stability of the Cholesky decomposition, one of ...
7k views

### Fast c++ library to solve very big sparse systems

I am working on a project with electrical circuits, where I am trying to compute the voltages at all the nodes of an electrical circuit. I know that the electrical circuit is a perfect grid, so each ...
75 views

### Efficient computation of $BX=A$ when LU factorization of $A$ is given

First, $AX=B$ is solved, so I have the LU factorization of $A$ computed already. Now I need to solve $BX=A$. Is there any way to reuse this information (LAPACK ...
124 views

### Efficient computation of AX=B where B has special structure (block-diagonal)

In case B(size ~ 2k, complex double) is block-diagonal, where block size is small(e.g. 2), is there any more efficient way to compute this other than Lapack gesv?
713 views

### LAPACK: ZHEEV and DSYEV give different eigenvalues for real symmetric matrix

exchangers, I have run into a bit of a puzzling problem. To solve an complex eigenvalue-problem, I make use of the LAPACK library function ZHEEV. To test the implementation I used a real symmetric ...
15k views

### How to start using LAPACK in c++?

I'm new to computational science and I already have learned basic methods for integration, interpolation, methods like RK4, Numerov etc on c++ but recently my professor asked me to learn how to use ...
99 views

### Set strictly upper triangular part of a matrix to alpha using BLAS or LAPACK

Is there routine in standard BLAS or LAPACK to set strictly-upper triangular part (the part above the diagonal) of a matrix to alpha? I do not want to change diagonal elements so ...
2k views

### What's the fastest implementation of elementwise vector multiplication in Fortran?

My fortran code contains lines like the following ...
236 views

### Is lapack getri numerically the same as getrs with identity matrix as RHS?

I was just wondering, in case of computing B=inv(A), suppose I is the identity matrix (diagonal), After obtaining the ...
176 views

### numerically stable routines to compute $M = B A^{-1} B$

Rather than gesv -> solve $AX = B$ gemm -> compute $M = BX$, somehow I feel there are better ways to compute $M$ with lapack/mkl?
2k views

### Fastest way to perform element-wise multiplication on a sparse matrix

I have two large-ish matrices (~100K cols x ~100K rows). They are sparse and symmetrical (about 0.1% of them values are non-zero). I want to do element-wise multiplication between them. Also, I ...
98 views

### Compute specific eigenvalues in the complex plane with Feast?

In physical problems, it's quite common that we need to solve for specific eigenvalues in the complex plane, e.g. with a positive real part and negative imaginary part. In this case, we are looking ...
64 views

### Under what circumstances does Elemental's distributed SVD not work? [closed]

I am playing around with Elemental's distributed singular value decomposition and am running into two particular issues. Building the test at tests/lapack_like/SVD.cpp, and running with ...