/*! \file algebraic.h
 *
 * \brief Declaration of algebraic functions with different call-backs.
 *
 * In principle, the system that runs NP_TMcode may offer various types of
 * optimized features, such as multi-core or multi-node scaling, GPU offload,
 * or external libraries. This header collects a set of functions that can
 * perform standard algebraic operations choosing the most optimized available
 * system as a call-back. If no optimization is detected, eventually the 
 * legacy serial function implementation is used as a fall-back.
 */

#ifndef INCLUDE_ALGEBRAIC_H_
#define INCLUDE_ALGEBRAIC_H_

#ifndef np_int
#ifndef lapack_int
#define np_int int64_t
#else
#define np_int lapack_int
#endif
#endif

/*! \brief Perform in-place matrix inversion.
 *
 * \param mat: Matrix of complex. The matrix to be inverted (must be a square matrix).
 * \param size: `lapack_int` The size of the matrix (i.e. the number of its rows or columns).
 * \param ier: `int &` Reference to an integer variable for returning a result flag.
 * \param max_size: `lapack_int` The maximum expected size (required by some call-backs,
 * optional, defaults to 0).
 */
void invert_matrix(std::complex<double> **mat, np_int size, int &ier, np_int max_size=0);

#endif