Indigo implements a collection of routines for constructing and evaluating high-performance linear operators on multicore and accelerator platforms.
Installation
From Python Package Index
pip install indigo
From source
- Install Anaconda or Miniconda.
- Download
indigo
.git clone git@github.com:mbdriscoll/indigo.git cd indigo
- Create a
conda
environment and installindigo
’s dependences.conda env create --file requirements.txt
With gcc
conda develop -b .
With icc
LDSHARED='icc -shared' CC=icc conda develop -b .
For the optional customgpu backend (requires nvcc)
make -C indigo/backends
- (Optional) Run the test suite.
pytest
Examples
See spmm.py in the examples
directory.
Available Backends
Indigo provides three backends. Users need not change any application code to move between them.
- Numpy: reference backend. Slow, but widely available and provides informative error messages.
- MKL: multicore CPU backend utilizing Intel’s FFT and Sparse Blas libraries.
- CUDA: GPU backend utilizing nVidia’s CUFFT and CUSPARSE libraries.
To select a backend, import and instantiate it:
from indigo.backends import get_backend
b = get_backend('cuda', device_id=1)
Available Operators
Indigo provides a number of classes for constructing structured linear operators.
Simple Operators
Simple operators implement linear transformations directly via high-performance libraries.
Diagonal Matrix (indigo.operators.Diag
)
Sparse Matrix (indigo.operators.SpMatrix
)
Dense Matrix (indigo.operators.DenseMatrix
)
DFT Matrix (indigo.operators.UnscaledFFT
)
Supports 3D FFTs. 1D and 2D TBD.
Composite Operators
Composite operators represent a collection of operators arranged in some structured way.
BlockDiag Matrix (indigo.operators.BlockDiag
)
Represents different submatrices arranged along a diagonal.
KronI Matrix (indigo.operators.KronI
)
The KronI
operator represents repetition of the same submatrix along a diagonal.
VStack Matrix (indigo.operators.VStack
)
Represents different submatrices stacked vertically. Akin to scipy.sparse.vstack
.
HStack Matrix (indigo.operators.HStack
)
Currently unimplemented. Consider using VStack
and Adjoint
:
HStack(A,B) = Adjoint( VStack( Adjoint(A), Adjoint(B) ) )
Product Matrix (indigo.operators.Product
)
Adjoint Matrix (indigo.operators.Adjoint
)
Derived Operators
We can combine the aforementioned operators to implement higher-level functionality.
Unitary DFT matrix (indigo.operators.UnitaryFFT
)
The scaling effect of the DFT can be undone by an elementwise multiplication, represented in Indigo as a diagonal matrix.
Centered DFT matrix (indigo.operators.CenteredFFT
)
A centered DFT consists of an FFT Shift, followed by a standard FFT, followed by another FFT Shift.
Non-uniform Fourier Transform (indigo.operators.NUFFT
)
Indigo implements an NUFFT as a product of diagonal, FFT, and general sparse matrices (for apodization, FFT, and interpolation, respectively).
FAQ
- What datatypes are supported?
indigo
only support single-precision complex floating point numbers at the moment, but it’s not a fundamental limitation.