Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
148 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
1 answer
4k 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
0 answers
1k 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
0 votes
0 answers
184 views

Calculating the exponential of a complex matrix

I am trying to calculate the exponent of a 3 x 3 matrix using the formula $\sum_{i=0}^\infty\frac {A^n}{n!}$ I believe that my error may lay in the scalar division with a factorial or the member ...
Kishan Bhatt's user avatar
0 votes
1 answer
432 views

Computing excited states using itensor (with DMRG)

I am trying to compute first few excited states of some Hamiltonian (I am using itensor and its DMRG algorithm). To do so, I am ...
brzepkowski's user avatar
0 votes
2 answers
2k 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 ...
MAh2014's user avatar
  • 131
2 votes
1 answer
94 views

Dense decomposition of very non-square matrices

I have inherited code that solves Eigen::Matrix problems using the code shown on this page: ...
Ken Y-N's user avatar
  • 121
1 vote
2 answers
308 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. ...
johnhenry's user avatar
  • 129
4 votes
1 answer
186 views

Using GSL for basic operations

I am learning C/C++ for Scientific Computing and I have a question regarding the usage of scientific libraries for basic operations. Suppose I have to write a small program in C for a bioinformatics ...
wrong_path's user avatar
1 vote
1 answer
990 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 ...
Alireza's user avatar
  • 313
1 vote
0 answers
134 views

Problem in analyzing the program of Gauss Jordan Inverse problem

I had to code a program which calculates Inverse of a matrix by Gauss-Jordan Inverse method , I was trying to analyse the program and then code it myself. the link http://hullooo.blogspot.in/2011/...
BAYMAX's user avatar
  • 229
6 votes
3 answers
5k views

Method to check for positive definite matrices

I think it's already been asked, but I still can't figure out a way to do it computationally. I had to check for positive definiteness of an $n \times n$ matrix $A$. I know that for any nonzero ...
BAYMAX's user avatar
  • 229
1 vote
2 answers
1k views

LU decomposition of large dense matrices

I wanted to generate LU decomposition of large size dense matrices ($N>10^7$), the LU decomposition I'm currently using is based on Adaptive Cross Approximation and is taking very long time to ...
user7440094's user avatar
5 votes
3 answers
3k views

Efficiently computing the product of a multi-dimensional matrix (or tensor) and vectors

Update: Thank you very much for all of you who answered below. I'm studying each answer now. In the long term, I'm more interested in solutions that work for sparse tensors (sorry I should have ...
f10w's user avatar
  • 515
6 votes
4 answers
8k views

Beating typical BLAS libraries matrix multiplication performance

A dull matrix multiplication algorithm where we use the formula $$C_{ij}=\sum_{k}A_{ik}B_{kj}$$ By literally following this in 3 loops we'll get a very slow program, because we don't utilize ...
The Quantum Physicist's user avatar
2 votes
1 answer
696 views

Fast C++ implementation of sparse binary matrices

I am looking for the subject. The size of matrices will be around 1000x2000 elements with linear amount of ones (say, 6000 ones in the whole matrix). The operations I will use the most: iterating ...
Yauhen Yakimenka's user avatar
3 votes
1 answer
2k views

Vectorize a part of a huge matrix in C++

I have a large matrix, side-length is about $n\geq 1000$. I need to do element-wise multiplication of this matrix with another matrix many, many times. I make this process by: Vectorizing (through ...
The Quantum Physicist's user avatar
5 votes
1 answer
1k views

Why do libraries need hand-vectorized code instead of compiler auto vectorization

C++ eigen library does vectorization for different architecture, like SSE, NEON etc. In their documentation they mentioned that, Eigen vectorization is not compiler dependent. But most modern ...
user1670773's user avatar
3 votes
2 answers
2k views

Stabilizing a 3x3 real symmetric matrix eigenvalue calculation

I have many 3x3 real symmetric matrices for which I need to determine the eigenvalues. Wikipedia gives a nice non-iterative algorithm for this case, which I have translated into C++: ...
user14717's user avatar
  • 2,165
2 votes
1 answer
2k views

Armadillo library appears slow

I have been experimenting in building a C++ project for a FDTDS system for Electro-Magnetics. I have implemented a class [see below] which I called mesh using the Armadillo library. The 3D matrices {...
Paul Mackenzie's user avatar
3 votes
1 answer
774 views

Kernel of a Sparse Matrix

Given a sparse rectangular matrix $A$ (let's say, with dimension $n,m$ and number of non-zero elements $O(n)\sim O(m)$) with entries in $\mathbb Z/2\mathbb Z$ I'm looking for a basis of the kernel as ...
Exodd's user avatar
  • 131
2 votes
1 answer
639 views

Recommendation for C/C++ library which offers Schur complement functions?

I need to find C/C++ libraries which offer function for computing Schur complement. I know about MUMPS and Pastix, but I need more of them to compare them in my research. Do you have any experience ...
Eenoku's user avatar
  • 141
1 vote
2 answers
1k views

Parallelization of element-wise matrix multiplication

I use Armadillo as an interface to OpenBLAS. In my current program, I have a loop, in which I do multiplications of the form ...
The Quantum Physicist's user avatar
9 votes
6 answers
14k views

Super C++ optimization of matrix multiplication with Armadillo

I'm using Armadillo to do very intensive matrix multiplications with side lengths $2^n$, where $n$ can be up to 20 or even more. I'm using Armadillo with OpenBLAS for matrix multiplication, which ...
The Quantum Physicist's user avatar
0 votes
1 answer
317 views

GMRES: Making the matrix square without solving for boundaries

How do we define the matrix for GMRES, if we do not want to solve the boundary elements but only the interior ones. I am using pentagonal elements so in a row there are 6 elements (cell itself + 5 ...
Shibli's user avatar
  • 293
5 votes
1 answer
567 views

What is the most efficient way to obtain the max eigenvalue of a specific symmetric matrix via Eigen C++

Suppose I have a symmetric matrix $A_{1000\times 1000}$, which can be represented by: $A = J G J^T$ where $J$ in 1000x3 is full column rank dense matrix; $G$ in 3x3 is a nonsingular dense matrix. ...
LCFactorization's user avatar
3 votes
1 answer
6k views

How to change the dimensions of an Eigen Matrix in a loop?

I have a while loop, in which I use a Matrix A, vectors B and x with varying dimensions: <...
LCFactorization's user avatar
2 votes
1 answer
391 views

A programming model for Quantum Mechanics angular momenta in Mathematica

I'm writing prototypes for solving the Liouville Equations with Mathematica and C++. Perhaps the question about this may not be suited for this forum in a strict way, but it suits the people here ...
The Quantum Physicist's user avatar
1 vote
1 answer
2k views

C+C++ library for inversion of a large scale matrix over cluster

I need to implement a matrix inversion of a very big matrix that currently is exceeding the memory limits of my machine (unfortunately I have little memory running on 32-bit machines). I would like to ...
Abruzzo Forte e Gentile's user avatar
11 votes
3 answers
1k views

Testing if two 12x12 matrices have the same determinant

I am given a $12 \times 12$ matrix $Q$ that is symmetric, invertible, positive definite and dense. I need to test if $$\det(Q) = \det(12I-Q-J) \; \; (1)$$ where $J$ is the all ones matrix. I am ...
Jernej's user avatar
  • 468