MARIA: MAtrix and tensoR Interpolation and Approximation

March 5, 2024 ยท View on GitHub

Purpose

MARIA is an open-source Fortran library for working with low-rank matrices and tensors:

  • truncated SVD
  • truncated SVD with sketching
  • adaptive cross approximation with rook pivoting
  • cross approximation based on the maximum-volume principle
  • cross approximation based on the maximum-projective-volume principle
  • elements of Riemannian geometry of fixed-rank matrices
  • tensor-train SVD

Note: MARIA will not be developed further as a Fortran library, it will be ported to Julia

Style

MARIA is inspired by LAPACK and provides

  • single- and double-precision versions of every subroutine
  • maximum control over memory allocation

Technical features

  • written in modern Fortran 2008
  • source code structured with modules and submodules
  • automated build with CMake and 6 configuration presets
  • automated testing with CTest
  • source code documentation with FORD

How to build and test

The build and testing processes for MARIA are automated with CMake and CTest, respectively.

  1. Navigate to the root folder of MARIA (maria, by default)

    foo@bar:~$ cd <path_to_maria>/maria/
    
  2. Choose one of the 6 available configuration presets

    PresetCompilerModeLAPACK
    gnu-debug-lapackgfortranDebugObenBLAS
    intel-debug-mklifortDebugIntel MKL (parallel)
    intel-debug-mklseqifortDebugIntel MKL (sequential)
    gnu-release-lapackgfortranReleaseObenBLAS
    intel-release-mklifortReleaseIntel MKL (parallel)
    intel-release-mklseqifortReleaseIntel MKL (sequential)

    Note: when using one of the Intel presets, make sure that ifort and Intel MKL are available by running

    foo@bar:~$ source /opt/intel/oneapi/setvars.sh intel64
    

    or

    foo@bar:~$ source /opt/intel/mkl/mklvars.sh intel64
    

    In addition, it may be required to change the -mkl compiler flag in CMakePresetes.json to -qmkl.

  3. Build the code by typing

    foo@bar:~<path_to_maria>/maria$ cmake -S . --preset <preset_name>
    foo@bar:~<path_to_maria>/maria$ cmake --build --preset <preset_name>
    

    This will create a folder <path_to_maria>/maria/build/<preset_name> and put the corresponding binaries there.

  4. You can check that the code is built correctly by running the unit tests:

    foo@bar:~<path_to_maria>/maria$ ctest --preset <preset_name>
    

Documentation

You can generate the source code documentation with FORD and view it as an HTML page. FORD can be installed with

pip install ford

Then, go to the documentation folder and run FORD:

foo@bar:~<path_to_maria>/maria$ cd ./doc 
foo@bar:~<path_to_maria>/maria/doc$ ford ./ford.md

This will create a ford_html folder with index.html inside.