einsums::linear_algebra::getrs#

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

Defined in header Einsums/LinearAlgebra.hpp.

template<CoreBasicTensorConcept AType, CoreBasicTensorConcept BType, typename Pivots>
int getrs(const AType &A, const Pivots &pivot, BType *B)#

Solves a system of linear equations against a factorization ::getrf already computed.

The routine solves \(AX = B\) where \(A\) has already been replaced by its LU factorization. The factorization is READ, so one ::getrf serves any number of right-hand sides; this is what distinguishes the pair from ::gesv, which destroys its coefficient matrix on every solve.

Added in version 2.0.0.

Template Parameters:
  • AType – The type of the factored matrix.

  • BType – The type of the right-hand side. Can be a matrix or a vector.

  • Pivots – The pivot container type.

Parameters:
  • A – The LU factorization of the coefficient matrix, as ::getrf left it.

  • pivot – The pivot array ::getrf filled. It must hold at least as many entries as the order of A.

  • B – The right-hand sides. On exit it holds the solutions.

Throws:
  • RankError – If the factored matrix is not rank-2 or the right-hand side is neither rank-1 nor rank-2.

  • TensorCompatError – If the factored matrix is not square, or its order differs from the number of rows of the right-hand side.

  • std::length_error – If the pivot array is shorter than the order of A.

Returns:

0 on success. If negative, one of the parameters in the underlying LAPACK call was invalid, and the absolute value gives which one.

Requires requires (Pivots a, size_t ind) { requires SameUnderlying<AType, BType>; { a.size() } -> std::same_as<typename Pivots::size_type>; { a.data() } -> std::same_as<typename Pivots::value_type *>; a[ind]; requires std::same_as<blas::int_t, typename Pivots::value_type>; }.