51    bool r = (a.shape()[0] == a.shape()[1]);
 
   52    if (not r and print_error)
 
   53      std::cerr << 
"Error in nda::detail::is_matrix_square: Dimensions are: (" << a.shape()[0] << 
"," << a.shape()[1] << 
")\n" << std::endl;
 
 
   71    if (not r and print_error) std::cerr << 
"Error in nda::detail::is_matrix_diagonal: Non-diagonal matrix: " << a << std::endl;
 
 
   93    static_assert(std::is_convertible_v<value_t, double> or std::is_convertible_v<value_t, std::complex<double>>,
 
   94                  "Error in nda::determinant_in_place: Value type needs to be convertible to double or std::complex<double>");
 
   95    static_assert(not std::is_const_v<M>, 
"Error in nda::determinant_in_place: Value type cannot be const");
 
   98    if (m.empty()) 
return value_t{1};
 
  101    if (m.extent(0) != m.extent(1)) NDA_RUNTIME_ERROR << 
"Error in nda::determinant_in_place: Matrix is not square: " << m.shape();
 
  104    const int dim = m.extent(0);
 
  107    if (info < 0) NDA_RUNTIME_ERROR << 
"Error in nda::determinant_in_place: info = " << info;
 
  110    auto det    = value_t{1};
 
  112    for (
int i = 0; i < dim; i++) {
 
  115      if (ipiv(i) != i + 1) ++n_flips;
 
  118    return ((n_flips % 2 == 1) ? -det : det);
 
 
  131  template <
typename M>
 
  156  template <MemoryMatrix M>
 
  159    if (m(0, 0) == 0.0) NDA_RUNTIME_ERROR << 
"Error in nda::inverse1_in_place: Matrix is not invertible";
 
  160    m(0, 0) = 1.0 / m(0, 0);
 
 
  171  template <MemoryMatrix M>
 
  178    auto det = (m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0));
 
  179    if (det == 0.0) NDA_RUNTIME_ERROR << 
"Error in nda::inverse2_in_place: Matrix is not invertible";
 
  180    auto detinv = 1.0 / det;
 
 
  197  template <MemoryMatrix M>
 
  201    auto b00 = +m(1, 1) * m(2, 2) - m(1, 2) * m(2, 1);
 
  202    auto b10 = -m(1, 0) * m(2, 2) + m(1, 2) * m(2, 0);
 
  203    auto b20 = +m(1, 0) * m(2, 1) - m(1, 1) * m(2, 0);
 
  204    auto b01 = -m(0, 1) * m(2, 2) + m(0, 2) * m(2, 1);
 
  205    auto b11 = +m(0, 0) * m(2, 2) - m(0, 2) * m(2, 0);
 
  206    auto b21 = -m(0, 0) * m(2, 1) + m(0, 1) * m(2, 0);
 
  207    auto b02 = +m(0, 1) * m(1, 2) - m(0, 2) * m(1, 1);
 
  208    auto b12 = -m(0, 0) * m(1, 2) + m(0, 2) * m(1, 0);
 
  209    auto b22 = +m(0, 0) * m(1, 1) - m(0, 1) * m(1, 0);
 
  212    auto det = m(0, 0) * b00 + m(0, 1) * b10 + m(0, 2) * b20;
 
  213    if (det == 0.0) NDA_RUNTIME_ERROR << 
"Error in nda::inverse3_in_place: Matrix is not invertible";
 
  214    auto detinv = 1.0 / det;
 
  217    m(0, 0) = detinv * b00;
 
  218    m(0, 1) = detinv * b01;
 
  219    m(0, 2) = detinv * b02;
 
  220    m(1, 0) = detinv * b10;
 
  221    m(1, 1) = detinv * b11;
 
  222    m(1, 2) = detinv * b12;
 
  223    m(2, 0) = detinv * b20;
 
  224    m(2, 1) = detinv * b21;
 
  225    m(2, 2) = detinv * b22;
 
 
  241  template <MemoryMatrix M>
 
  247    if (m.empty()) 
return;
 
  251      if (m.shape()[0] == 1) {
 
  256      if (m.shape()[0] == 2) {
 
  261      if (m.shape()[0] == 3) {
 
  270    if (info != 0) NDA_RUNTIME_ERROR << 
"Error in nda::inverse_in_place: Matrix is not invertible: info = " << info;
 
  272    if (info != 0) NDA_RUNTIME_ERROR << 
"Error in nda::inverse_in_place: Matrix is not invertible: info = " << info;
 
 
Provides definitions and type traits involving the different memory address spaces supported by nda.
 
Provides the generic class for arrays.
 
void swap(nda::basic_array_view< V1, R1, LP1, A1, AP1, OP1 > &a, nda::basic_array_view< V2, R2, LP2, A2, AP2, OP2 > &b)=delete
std::swap is deleted for nda::basic_array_view.
 
Provides basic functions to create and manipulate arrays and views.
 
A generic multi-dimensional array.
 
Provides concepts for the nda library.
 
Provides a custom runtime error class and macros to assert conditions and throw exceptions.
 
Provides a generic interface to the LAPACK getrf routine.
 
Provides a generic interface to the LAPACK getri routine.
 
decltype(auto) make_regular(A &&a)
Make a given object regular.
 
ArrayOfRank< 2 > auto diag(V const &v)
Get a new nda::matrix with the given values on the diagonal.
 
ArrayOfRank< 1 > auto diagonal(M &&m)
Get a view of the diagonal of a 2-dimensional array/view.
 
basic_array< ValueType, Rank, Layout, 'A', ContainerPolicy > array
Alias template of an nda::basic_array with an 'A' algebra.
 
constexpr char get_algebra
Constexpr variable that specifies the algebra of a type.
 
constexpr bool is_matrix_or_view_v
Constexpr variable that is true if type A is a regular matrix or a view of a matrix.
 
std::decay_t< decltype(get_first_element(std::declval< A const  >()))> get_value_t
Get the value type of an array/view or a scalar type.
 
#define CLEF_MAKE_FNT_LAZY(name)
Macro to make any function lazy, i.e. accept lazy arguments and return a function call expression nod...
 
int getri(A &&a, IPIV const &ipiv)
Interface to the LAPACK getri routine.
 
int getrf(A &&a, IPIV &&ipiv)
Interface to the LAPACK getrf routine.
 
static constexpr bool on_host
Constexpr variable that is true if all given types have a Host address space.
 
Provides definitions of various layout policies.
 
Provides functionality to make objects, functions and methods lazy.
 
Provides functions to create and manipulate matrices, i.e. arrays/view with 'M' algebra.
 
Defines various memory handling policies.
 
Provides various overloads of the operator<< for nda related objects.
 
Contiguous layout policy with C-order (row-major order).
 
Memory policy using an nda::mem::handle_sso.
 
Provides type traits for the nda library.