Skip to content
Thin wrapper of ARPACK for real symmetrix eigenproblem in C++ with Eigen
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Arpaca - ARPACk Adaptor for real symmetric eigenproblem in C++ with Eigen

Arpaca is a thin wrapper of ARnoldi PACKage (ARPACK) in C++ using Eigen.


Arpaca uses ARPACK, which you can install by many package managers. If you want to install it from source code, gfortran, BLAS (ATLAS is better as its implementation) and LAPACK are required.

arpaca_performance_test also depends on pficommon.


Just copy arpaca.hpp where you like. Since the interface may be changed in the future, it is recommended to copy it to the local directory of your own project.

Typical Usage

You can use arpaca by including arpaca.hpp and linking to the dependent libraries listed above.

In order to compute the top ten eigenvalues and corresponding eigenvectors of large sparse symmetric matrix A, write as follows:

Eigen::SparseMatrix<double, Eigen::RowMajor> A;

const int num_eigenvalues = 10;
const arpaca::EigenvalueType type = arpaca::ALGEBRAIC_LARGEST;

arpaca::SymmetricEigenSolver<double> solver =
    arpaca::Solve(A, num_eigenvalues, type);

const Eigen::MatrixXd& eigenvectors = solver.eigenvectors();
const Eigen::VectorXd& eigenvalues = solver.eigenvalues();

EigenvalueType indicates which side of eigenvalues to compute. You can compute large or small side of eigenvalues in the sense of signed or absolute value.

Thanks to the flexibility of ARPACK, you can use arbitrary formulation of operator A * x, where x is a real vector.

template<typename MatrixA, typename MatrixB>
class TimesAB {
  explicit TimesAB(MatrixA& A, typename MatrixB)
      : A_(A),

  template<typename X, typename Y>
  void operator(X x, Y y) const
    y = A_ * (B_ * x);

  MatrixA& A_;
  MatrixB& B_;

template<typename MatrixA, typename MatrixB>
TimesAB<MatrixA, MatrixB> MakeTimesAB(MatrixA& A, MatrixB& B) {
  return TimesAB<MatrixA, MatrixB>(A, B);

Eigen::SparseMatrix<double, Eigen::RowMajor> A;
Eigen::SparseMatrix<double, Eigen::ColMajor> B;

// Solve eigenproblem of AB'
arpaca::SymmetricEigenSolver<double> solver;
solver.Solve(A.rows(), 10, MakeTimesAB(A, B.transpose()));


Arpaca is distributed under MIT License, which is available in LICENSE file.


Copyright (c) 2011 Seiya Tokui All Rights Reserved.

You can’t perform that action at this time.