# 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.

120 questions
Filter by
Sorted by
Tagged with
558 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 ...
337 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 ...
9k 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 ...
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?
76 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 ...
885 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 ...
104 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 ...
178 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

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

My fortran code contains lines like the following ...
301 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 ...
3k 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 ...
632 views

### Matrix Balancing Algorithm

I have been writing a control system toolbox from scratch and purely in Python3 (shameless plug : harold ). From my past research, I have always complaints about ...
68 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 ...
252 views

### Appropriate Lapack/MKL routines to efficiently compute C = A* inv(B)

I know that, from numerical point of view, computing Ax = b B=inv(A), x= B*b are completely different things, and we should factor the matrix using TRF routine ...
894 views

### Compute all eigenvectors and eigenvalues of small symmetric matrices

My problem is to compute eigenvectors and eigenvalues of a lot of small (n < 30) symetric, positive definite matrices. So far I am using LAPACK's DSYEV. The priority is speed more than accuracy. ...
115 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 ...
7k views

### solve $xA=b$ for $x$ using LAPACK and BLAS

I am porting an existing code from MATLAB to C++ and have a linear system to solve $xA=b$ (rather than the more typical form $Ax=b$) The matrix $A$ is dense, and of general form, but is no larger ...
517 views

### Code to update dense QR and Cholesky factorizations

I am looking for some production-ready code to update dense QR and/or Cholesky factorizations (by adding / removing rows and columns or making small-rank updates -- yes, I need all these cases). I ...
220 views

### Total Flop count for LAPACK DPOSV

I am looking at the LAPACK DPOSV routine that computes the solution to the real system of linear equations A * X = B. The routine description can be found here: http://www.math.utah.edu/software/...
206 views

### Lapack routines for solving A x = 0 [duplicate]

I am looking for a LAPACK routine that allows to find a non-trivial solution to the following equation: A x = 0 provided that A is a n×n square singular non-symmetric band matrix. In reality A ...
305 views

### Optimized parallel routine for $X' W X$ with $W$ diagonal

$X$ is a dense matrix of real doubles, typically of size 20 million rows and 500 columns, and $W$ is a diagonal matrix of real, non-negative doubles stored as a vector. I'm working in C and have ...
4k 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. ...
348 views

### Kronecker products and basis contractions (ie. B.A.Transpose[B]) in C?

I have implemented a basis transformation in C of the following form kron[A,A]*B*Transpose[kron[A,A]] where A and ...
325 views

### Finite Difference Beam Propagation Method problem

I am trying to implement the finite difference beam propagation method to study the propagation of a TE light signal through a waveguide. However, my solutions are exponentially growing, and display ...
2k 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 <...
209 views

### Azimuthal average in Fortran? Find indexes in Fortran?

I am working on an eigenvalue problem in fortran. I have used Lapack to solve the problem and get the eigenvalues and eigenvectors. This is done for $201\times101$ wavenumbers, only half the wavespace ...
196 views

### Level 3 BLAS accelerated solver for banded linear systems.

At the moment I consider the following problem. I have a huge dense banded matrix $A$ which I want to factorize and use to solve linear systems $Ax=b$. $b$ has around more than 100 columns. At the ...
2k views

### Matrix exponential of a skew-Hermitian matrix with fortran 95 and LAPACK

I'm just getting tucked into fortran 95 for some quantum mechanics simulations. Honestly, I've been spoiled by Octave so I've taken matrix exponentiation for granted. Given a (small, $n\leq 36$) skew-...
163 views

### Computing eigenpairs of singular matrix with ZGEEV?

I've never run into a singular matrix before, so bear with me. I have a complex non-symmetric matrix (about 1000 x 1000) that I know has a couple zero eigenvalues. It isn't guaranteed to be ...
72 views

### LAPACK DGGEVX: BALANC option

I'm using DGGEVX routine from LAPACKE with BALANC option as shown below, but to my surprise changing BALANC option from 'N' to ...
3k views

### Eigenvectors: MATLAB vs LAPACK DGGEV or DGGEVX

If we call LAPACK DGGEV or DGGEVX routines for two badly-conditioned matrices in a C++ code, will we get the same eigen-values &...
8k views

### Understanding how Numpy does SVD

I have been using different methods to calculate both the rank of a matrix and the solution of a matrix system of equations. I came across the function linalg.svd. Comparing this to my own effort of ...
155 views

### Matrix size LAPACK can support with level-3 BLAS

I am a newbie in using LAPACK library. I know that LAPACK's internal rountines break the large problem into smaller problems recursively (I am considering level-3 BLAS). If we consider matrix ...
1k views

### Schur(QZ) Decomposition Differences

I am having issues understanding why different languages are producing different answers for the Schur(QZ) decomposition. I am working on writing some old stuff from Matlab into Julia and Python and ...
1k views

### BLAS/LAPACK Non absolute sum

I need to know if there is some function in BLAS/LAPACK or some other Scientific Library that returns a non absolute sum of a vector/matrix. I've found the 'asum', but it returns only the absolute ...
5k views

### BLAS/LAPACK subroutine to add two matrices with different offsets and leading dimensions

I currently searching for a subroutine from BLAS or LAPACK which realizes the following operation A = alpha*A + beta * B where A and B have different leading ...
2k views

### Impact of frequent row major / column major conversions using LAPACK/BLAS?

If you call a library like LAPACK or BLAS (which are written in FORTRAN and use column major order) from a C-like language that uses row major order, won't you lose performance and use a lot of memory ...
92 views

### Threaded QR with column pivoting

My program needs to perform pivoted QR decomposition on tall (e.g. 1e9 by 100) matrices. I run into the bottleneck that the major computational time of my program is spent on doing serial pivoted-QR ...
1k views

### How can QR iteration with complex matrices produce complex diagonal entries?

In Lapack (zhseqr) and matlab, the eigenvalues of a complex matrix are computed successfully. I notice that QR iteration or algorithm is involved with that process. QR iteration repeats to call QR ...
1k views

### Flop counts for LAPACK symmetric eigenvalue routines DSYEV, DSYEVD, DSYEVX and DSYEVR

LAPACK has following 4 routines for calculating eigenvalues of a real symmetric matrix; namely DSYEV, DSYEVD, DSYEVX and DSYEVR (DSYEVR being the recommended one). If I were to calculate both ...
123 views

### Why would this a pair of E5-2670 cpus be faster than 4 E5-2640 cpus for large matrix diagonalisation problems?

Not really much more to say; Of several computers available for use, these are two of the larger ones; one has 2x E5-2670, and the other has 4x E5-4640. The problems we're looking at essentially boil ...
3k views

### Fast vector - “diagonal” matrix multiplication

Let $\mathbf{1}\in\mathbb{R}^d$ be a vector with all elements equal to $1$. Define: \mathbf{D} = \mathrm{diag}(\mathbf{1}^\top,\mathbf{1}^\top,\ldots,\mathbf{1}^\top) = \begin{bmatrix} 1 \cdots 1 &...
577 views

### how to use lanczos code from netlib for large sparse symmetric matrix?

I want to use lanczos method to calculate the few lowest eigenvalue and eigen-vector of a large sparse symmetric matrix(~50k x ~50k). In http://www.netlib.org/lanczos/index.html I found the codes ...
164 views

### Do vendors release their own LAPACK library?

Every CPU vendor seems to make BLAS libraries that are specialized to run on their hardware. Do they do the same for LAPACK? Or is that a non-issue because LAPACK is written entirely in terms of BLAS ...
408 views

### LAPACK - singular matrices - what does the positive integer info mean?

please can you help me with my code - I use Lapack to solve complex matrix (quite biq) and do it in two steps: I call zgetrf (LU factorization) and then ...
890 views

### lapack singular matrix

I'd like to find a condition that allows me to determine if a matrix is invertible or not. naively, I computed the determinant to see if it was zero. but then I realized that even for very small ...
172 views

### cgees subroutine

I'm tryng to learn to use a lapack subroutine but I got stuck. I hope this is the right forum... In this fortran program I'd like as a test to find the Shur form of the matrix ((0,1)(1,0)) using cgees,...
2k views

### Solving for null space of a matrix with mkl LAPACK

I want to find a solution for $xA=0$, where $A$ is a square matrix. I know that most of the LAPACK routines solve for $Ax=b$. So I take $A^T$ as a, and set $b=0$. I have an additional restriction of \$\...