32
votes
Accepted
How to start using LAPACK in c++?
I'm going to disagree with some of the other answers and say that I believe that figuring out how to use LAPACK is important in the field of scientific computing.
However, there is a large learning ...
16
votes
Accepted
Why is it that SVD routines on nearly square matrices run significantly faster than if the matrix was highly non square?
You are asking for a full (dense) SVD, which also needs to generate the unitary components of $U$ and $V$ which correspond with the null space of your input.
for the $1000 \times 800$ case, your input ...
10
votes
How to start using LAPACK in c++?
I usually resist telling people what I think they should do rather
than answering their question but in this case I'm going to make an
exception.
Lapack is written in FORTRAN and the API is very ...
9
votes
How to start using LAPACK in c++?
Here's another answer in the same vein as the above.
You should look into the Armadillo C++ linear algebra library.
Pros:
The function syntax is high-level (similar to that of MATLAB). So no <...
9
votes
Is LAPACK behind the cutting edge of dense linear algebra?
When one says an algorithm is of order $O(n)$, that may mean that the complexity is given by: $c + b*n$. With every new element you add you increase in runtime (effectively). What mathematically ...
8
votes
Rapidly determining whether or not a dense matrix is of low rank
The problem, of course, is that computing the true rank (e.g., via a QR decomposition) is not really any cheaper than computing a low-rank representation of the matrix.
The best you can probably do ...
8
votes
Is LAPACK behind the cutting edge of dense linear algebra?
LAPACK has been on the cutting edge for just about three decades, and probably still is for its niche. However, given given recent developments in libraries for the simpler BLAS-type matrix operations ...
8
votes
Accepted
Python scipy eigh(Arpack) giving wrong eigenvalues for generalized eigenvalue problem
The matrix B (M in the documentation) needs to positive definite according to the documentation: "If sigma is None, M is positive definite", this is in addition to the first requirement &...
7
votes
Accepted
Matrix Balancing Algorithm
Took me quite a while to figure this out and as usual it becomes obvious after you find the culprit.
After checking the problematic cases reported in David S. Watkins. A case where balancing is ...
7
votes
What's the fastest implementation of elementwise vector multiplication in Fortran?
The cost of the multiplication is almost insignificant compared to the cost of loading the data from memory (and writing it back). If you're worried about performance, you should be thinking about ...
7
votes
Rapidly determining whether or not a dense matrix is of low rank
There is a neat trick I have recently learned from this paper. You start doing rank-revealing QR, and stop after the first $k$ Householder reflections, when you have a matrix of the form
$$
\begin{...
7
votes
Matlab, Mathematica & LAPACK returning 3 different eigenvectors
Seems that you have a duplicate eigenvalue. Thus, you have two eigenpairs $(\lambda_1, x_1)$ and $(\lambda_2, x_2)$ where $\lambda_1 = \lambda_2$. Denote $\lambda = \lambda_1 = \lambda_2$. Let $\alpha$...
7
votes
What is the reason that LAPACK uses $\tau$ in QR decomposition (instead of normalizing the reflection vector)?
It's the blocked variant of Householder-QR that is driving this design. If you look in Golub and Van Loan's book (Ch 5.2 or so) they talk about how k-iterations of the algorithm can be blocked ...
7
votes
Accepted
Do most statistical packages and libraries in high-level programming languages rely on LAPACK for their matrix inversion operations?
tl;dr Yes.
But your question doesn't make it clear that you understand what LAPACK is about. LAPACK is both a software as well as an interface. That is, the operations that LAPACK defines are standard ...
7
votes
Accepted
Functions from Scipy, Blas, or Lapack that compute only upper triangular matrix
I think you are overestimating the overhead of computing L. There are zero extra operations needed; the only additional cost is writing to RAM some numbers that you ...
6
votes
Accepted
Fast c++ library to solve very big sparse systems
I second the idea of using Eigen, which is pretty efficient, but also very simple to include.
If you need a lot more performance, you could try to use PETSc or Trilinos. They are very powerful ...
6
votes
Accepted
Faster eigenvector routine for non-symmetric matrices with real eigensystem?
The trick is trying to find out why that matrix has real eigenvalues in the first place. Usually it is because a suitable set of conjugations turns it into a symmetric matrix, and then you can reduce ...
6
votes
Accepted
Eigenvalues of diagonal plus rank-one
Thanks to Brian Borchers for suggesting dlaed9; this mostly solves my problem.
Unfortunately, dlaed9 does not include deflation ...
5
votes
Rapidly determining whether or not a dense matrix is of low rank
Another approach, which might be of interest to you is randomized sampling. This is of particular interest if you can quickly compute matrix-vector products $x\rightarrow Ax$ and $x\rightarrow A^* x$. ...
5
votes
Accepted
How many operations are needed for LAPACK's zgesv to solve a linear system?
The LAPACK routine zgesv first computes the LU factorization, and then solves the system making use of the factorization. It is a simple driver for calling the two ...
5
votes
A misunderstanding or a bug in LAPACK's solver for generalized eigenvalue problems?
The other answers already tell you what went wrong, but I will add a terminology note: the term for what is happening is that the pencil $A - \lambda B$ is a singular matrix pencil, i.e., $\det (A - \...
5
votes
Accepted
Does LAPACK offer routines for Krylov sub-space based solvers and nonlinear solvers?
As far as I know, there are no such methods in LAPACK. Since LAPACK is the linear algebra package, no nonlinear solvers are included.
However, you can use the underlying BLAS for implementing ...
4
votes
Accepted
Efficient computation of AX=B where B has special structure (block-diagonal)
Supposing you already have an LU factorization, you can save a half of a forward substitution step. In the system $Lx=b$, you would have
$$ \begin{pmatrix}
l_{11}&0&&&&\cdots&0\...
4
votes
Rapidly determining whether or not a dense matrix is of low rank
Another approach worth trying is to use Adaptive Cross Approximation (ACA). It is a pretty popular algorithm that has many implementations available online. For the reference, you can see the original ...
4
votes
Accepted
LAPACK sorting eigenvalues differently each time
You write, that you are computing the eigenvalues of a symmetric matrix. Does the matrix have real entries? In this case all eigenvalues are real, and you can use a symmetric eigenvalue solver, which ...
4
votes
Are there any packaged routines (in lapack or elsewhere) for inverting a banded matrix?
Well, other than the usual "don't invert your matrices unless you need the inverse itself" you can still use the banded routines ?gbtrf and then use ...
4
votes
LAPACK non-convergent eigenvalue algorithm for complex but not double matrix
Your matrix is not diagonalizable, in the Jordan decomposition of it there is a block for the eigenvalue $0$ of the form
$$\begin{pmatrix}0&0&0\\0&0&1\\0&0&0\end{pmatrix},$$
...
4
votes
Accepted
Does armadillo library slow down the execution of matrix operations?
You're comparing statically-defined arrays which live on the stack:
double a[100][100];
double b[100][100];
double c[100][100];
to heap allocated ...
4
votes
Accepted
How to know which LAPACK's function is used by Scipy's eig function?
I don't think there is a way to display the used LAPACK function names natively during runtime using the interfaces provided by scipy.linalg.
Depending on your ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
lapack × 131linear-algebra × 58
blas × 31
eigenvalues × 26
matrix × 24
fortran × 12
c++ × 11
linear-solver × 10
eigensystem × 10
matrix-factorization × 10
matlab × 8
scipy × 6
numerics × 5
parallel-computing × 5
c × 5
eigen × 5
dense-matrix × 4
banded-matrix × 4
optimization × 3
python × 3
sparse-matrix × 3
performance × 3
svd × 3
intel-mkl × 3
scalapack × 3