TDLS 0.4.0
Tiny Device-callable Linear Solvers
Loading...
Searching...
No Matches
tdls::ArrowheadLUppSolverDynamic< T, Config > Struct Template Reference

Arrowhead solver with a runtime shape. More...

#include <solver_dynamic.hpp>

Classes

struct  RecomputedBlock
 Block k of a recomputed solve (solve_inplace_recomputed, solve_inplace_recomputed_or_tangent): a StreamedBlock, the same view and accessors, and whether the solver asks for the block again, in its recovery. A provider taking a StreamedBlock& serves too; one taking a RecomputedBlock&, or auto&, reads the flag. The streamed entry points keep the StreamedBlock alone, so that their code is that of a solver without the recomputed ones. More...
 
struct  StreamedBlock
 Block k of a streamed solve: a view of the areas of the workspace where the solver factors and solves the block, which the caller fills through the accessors when the solver asks for it; the factorization and the solve then run in place; only a save, after the areas of the stored path, is copied to store a refused block as given. The accessors are those of ArrowheadLUppSolverStatic::StreamedBlock, so that one provider serves both solvers. Entries in logical order whatever the layout and the storage. The areas hold the previous block: the caller writes every entry, zeros included, by assignment. More...
 

Public Types

enum class  StreamedOutcome { solved , tangent , singular }
 Outcome of solve_inplace_streamed_or_tangent. More...
 
enum class  RecomputedOutcome { solved , tangent , singular , deferred }
 Outcome of solve_inplace_recomputed and solve_inplace_recomputed_or_tangent. More...
 
using storage_map = ArrowheadStorageMap<Config.storage, Config.coupling, Config.layout>
 Index of every entry of the matrix in its storage.
 

Static Public Member Functions

static TDLS_HOST_DEVICE constexpr bool valid (const ArrowheadShape &shape, const int nrhs=1) noexcept
 Whether the solver accepts a shape, with nrhs right-hand sides (unit columns, tangent columns): storage_map::valid(shape), nrhs in [1, 2^30], and the workspaces of the entry points below 2^31 entries, their offsets being ints. The entry points return false on a shape they reject, before any access, and the sizes are 0 for it. The checks cannot overflow, whatever the shape.
 
static TDLS_HOST_DEVICE constexpr int workspace_size (const ArrowheadShape &shape) noexcept
 Entries of the workspace of solve_inplace and solve.
 
static TDLS_HOST_DEVICE constexpr int workspace_size (const ArrowheadShape &shape, const int nrhs) noexcept
 Entries of the workspace of the entry points with nrhs right-hand sides: the temporaries of the right-hand sides and one column of the front per right-hand side.
 
static TDLS_HOST_DEVICE constexpr int streamed_workspace_size (const ArrowheadShape &shape) noexcept
 Entries of the workspace of solve_inplace_streamed: those of solve_inplace, then A_bk of a block under the dense coupling and the copies that restore a refused block.
 
static TDLS_HOST_DEVICE constexpr int streamed_workspace_size (const ArrowheadShape &shape, const int nrhs) noexcept
 Entries of the workspace of solve_border_canonical_multirhs_streamed with nrhs unit columns, and of solve_inplace_streamed_or_tangent with nrhs tangent columns.
 
static TDLS_HOST_DEVICE constexpr int pivot_size (const ArrowheadShape &shape) noexcept
 Entries of the pivot array: the pivots of a block, then of the border system, reuse it.
 
static TDLS_HOST_DEVICE constexpr bool solve_inplace (const ArrowheadShape &shape, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, int &refused_count) noexcept
 Solves A x = y in place, counting the refused blocks.
 
static TDLS_HOST_DEVICE constexpr bool solve_inplace (const ArrowheadShape &shape, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride) noexcept
 Solves A x = y in place.
 
static TDLS_HOST_DEVICE constexpr bool solve (const ArrowheadShape &shape, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const T *TDLS_RESTRICT b, T *TDLS_RESTRICT x, const int rhs_stride, int &refused_count) noexcept
 Solves A x = b, b left untouched, counting the refused blocks: b is copied into x, then solved in place.
 
static TDLS_HOST_DEVICE constexpr bool solve (const ArrowheadShape &shape, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const T *TDLS_RESTRICT b, T *TDLS_RESTRICT x, const int rhs_stride) noexcept
 Solves A x = b, b left untouched.
 
static TDLS_HOST_DEVICE constexpr bool solve_inplace_multirhs (const ArrowheadShape &shape, const int nrhs, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, const std::size_t xcol_stride, int &refused_count) noexcept
 Solves A X = Y in place for nrhs right-hand sides, counting the refused blocks. The right-hand sides ride along the condensation, which runs once. Column m comes out bitwise identical to solve_inplace on it alone under the default rhs_pass_width, within rounding errors under another (see ArrowheadLUppConfig::rhs_pass_width), and bitwise identical to the compile-time solver (the same contraction of multiply-adds assumed, see the file documentation).
 
static TDLS_HOST_DEVICE constexpr bool solve_inplace_multirhs (const ArrowheadShape &shape, const int nrhs, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, const std::size_t xcol_stride) noexcept
 Solves A X = Y in place for nrhs right-hand sides.
 
static TDLS_HOST_DEVICE constexpr bool solve_multirhs (const ArrowheadShape &shape, const int nrhs, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const T *TDLS_RESTRICT b, T *TDLS_RESTRICT x, const int rhs_stride, const std::size_t xcol_stride, int &refused_count) noexcept
 Solves A X = B for nrhs right-hand sides, B left untouched, counting the refused blocks: B is copied into X, then solved in place.
 
static TDLS_HOST_DEVICE constexpr bool solve_multirhs (const ArrowheadShape &shape, const int nrhs, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const T *TDLS_RESTRICT b, T *TDLS_RESTRICT x, const int rhs_stride, const std::size_t xcol_stride) noexcept
 Solves A X = B for nrhs right-hand sides, B left untouched.
 
static TDLS_HOST_DEVICE constexpr bool solve_border_canonical_multirhs (const ArrowheadShape &shape, const int nrhs, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const int col0, T *TDLS_RESTRICT x, const int rhs_stride, const std::size_t xcol_stride, int &refused_count) noexcept
 Columns col0 .. col0 + nrhs - 1 of the border block of A^-1 (col0 + nrhs <= border), counting the refused blocks; see ArrowheadLUppSolverStatic::solve_border_canonical_multirhs.
 
static TDLS_HOST_DEVICE constexpr bool solve_border_canonical_multirhs (const ArrowheadShape &shape, const int nrhs, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const int col0, T *TDLS_RESTRICT x, const int rhs_stride, const std::size_t xcol_stride) noexcept
 Columns col0 .. col0 + nrhs - 1 of the border block of A^-1 (col0 + nrhs <= border).
 
template<typename Provider >
static TDLS_HOST_DEVICE constexpr bool solve_inplace_streamed (const ArrowheadShape &shape, Provider &&provider, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, int &refused_count) noexcept
 Solves A x = y in place, the blocks streamed: provider(k, blk) fills block k (StreamedBlock) when the solver needs it, k = 0, 1, ... in order, exactly once, and the solver condenses it at once. The caller writes beforehand only the border: A_bb in A and the border rows of y. An accepted block leaves its recovery data in its storage; a refused one is stored as given for the second pass. Bit for bit the results of solve_inplace, and of ArrowheadLUppSolverStatic::solve_inplace_streamed (the same contraction of multiply-adds assumed, see the file documentation).
 
template<typename Provider >
static TDLS_HOST_DEVICE constexpr bool solve_border_canonical_multirhs_streamed (const ArrowheadShape &shape, const int nrhs, Provider &&provider, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, const int col0, T *TDLS_RESTRICT x, const int rhs_stride, const std::size_t xcol_stride, int &refused_count) noexcept
 solve_border_canonical_multirhs with the blocks streamed (see solve_inplace_streamed; blk.y is not read).
 
template<typename Provider , typename Converged >
static TDLS_HOST_DEVICE constexpr StreamedOutcome solve_inplace_streamed_or_tangent (const ArrowheadShape &shape, const int ntan, Provider &&provider, Converged &&converged, T *TDLS_RESTRICT A, const int A_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, const int col0, T *TDLS_RESTRICT x, const int x_stride, const std::size_t xcol_stride, int &refused_count) noexcept
 One streamed pass of a Newton iteration: the blocks condensed as solve_inplace_streamed does, then converged() is called (the provider may compute the residual meanwhile). When it returns false, the pass ends as solve_inplace_streamed (y holds the correction). When it returns true, the correction is not computed: the border system condensed by the pass gives instead columns col0 .. col0 + ntan - 1 of the border block of A^-1 in x (the consistent tangent of a behaviour loaded through the border), refused blocks included. The provider is called exactly once per block, in order, and converged() once, after the last block. Bit for bit the results of solve_inplace_streamed and of ArrowheadLUppSolverStatic::solve_inplace_streamed_or_tangent, and those of solve_border_canonical_multirhs_streamed under the default rhs_pass_width (within rounding errors under another, see ArrowheadLUppConfig::rhs_pass_width), the same contraction of multiply-adds assumed (see the file documentation).
 
static TDLS_HOST_DEVICE constexpr bool valid_recomputed (const ArrowheadShape &shape, const int capacity, const int nrhs=1) noexcept
 Whether the recomputed entry points accept a shape, a capacity and nrhs tangent columns: valid(shape, nrhs), capacity in [0, blocks], their workspace below 2^31 entries, and every block index exact in T (2^24 blocks at most in float), the store keeping the index of the block of each of its places in the workspace.
 
static TDLS_HOST_DEVICE constexpr int recomputed_workspace_size (const ArrowheadShape &shape, const int capacity, const int nrhs=1) noexcept
 Entries of the workspace of solve_inplace_recomputed with a store of capacity refused blocks, and of solve_inplace_recomputed_or_tangent with nrhs tangent columns: the areas of a streamed block and of its condensation, the front of the second pass, and the refused blocks in the storage of a matrix of capacity blocks with their right-hand sides. It does not grow with the number of blocks of the matrix.
 
template<typename Provider >
static TDLS_HOST_DEVICE constexpr RecomputedOutcome solve_inplace_recomputed (const ArrowheadShape &shape, const int capacity, Provider &&provider, const T *TDLS_RESTRICT Abb, const int Abb_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, int &refused_count) noexcept
 Solves A x = y in place, the blocks recomputed: the runtime counterpart of ArrowheadLUppSolverStatic::solve_inplace_recomputed, bit for bit (the same contraction of multiply-adds assumed). provider(k, blk) fills block k once while the solver condenses it, k = 0, 1, ... in order, and once more, blk.recovery set, while it recovers the unknowns of the block, in decreasing k. Nothing of an accepted block is stored, and the matrix is never stored: the caller gives the border block A_bb, entry (r, c) at (r * border + c) * Abb_stride, or (c * border + r) * Abb_stride under the column-major layout, and the border rows of y. The workspace holds the refused blocks, at most capacity of them; beyond, the solve stops, deferred. Nothing is written to y until the solution: y is untouched when the solve is deferred or the matrix singular.
 
template<typename Provider , typename Converged >
static TDLS_HOST_DEVICE constexpr RecomputedOutcome solve_inplace_recomputed_or_tangent (const ArrowheadShape &shape, const int ntan, const int capacity, Provider &&provider, Converged &&converged, const T *TDLS_RESTRICT Abb, const int Abb_stride, int *TDLS_RESTRICT piv, const int piv_stride, T *TDLS_RESTRICT work, const int work_stride, T *TDLS_RESTRICT y, const int rhs_stride, const int col0, T *TDLS_RESTRICT x, const int x_stride, const std::size_t xcol_stride, int &refused_count) noexcept
 One recomputed pass of a Newton iteration: the runtime counterpart of ArrowheadLUppSolverStatic::solve_inplace_recomputed_or_tangent, bit for bit (the same contraction of multiply-adds assumed). The blocks are condensed as solve_inplace_recomputed condenses them, then converged() is called: false, the pass ends as solve_inplace_recomputed; true, x receives columns col0 .. col0 + ntan - 1 of the border block of A^-1, refused blocks included, y is untouched, and the provider is called once per block. When more than capacity blocks are refused, the pass stops there, deferred, before converged() is called.
 

Detailed Description

template<typename T, ArrowheadLUppConfig< T > Config>
struct tdls::ArrowheadLUppSolverDynamic< T, Config >

Arrowhead solver with a runtime shape.

Template Parameters
Tscalar type (float, double or long double)
Configconfiguration (see ArrowheadLUppConfig)

Member Enumeration Documentation

◆ RecomputedOutcome

template<typename T , ArrowheadLUppConfig< T > Config>
enum class tdls::ArrowheadLUppSolverDynamic::RecomputedOutcome
strong

Outcome of solve_inplace_recomputed and solve_inplace_recomputed_or_tangent.

Enumerator
solved 

y holds the solution

tangent 

converged (solve_inplace_recomputed_or_tangent): x holds the tangent columns, y is untouched

singular 

the matrix is singular, or the shape or the capacity rejected; y is untouched

deferred 

more blocks refused than the capacity of the store; y is untouched, for a solve that stores them (solve_inplace_streamed)

◆ StreamedOutcome

template<typename T , ArrowheadLUppConfig< T > Config>
enum class tdls::ArrowheadLUppSolverDynamic::StreamedOutcome
strong

Outcome of solve_inplace_streamed_or_tangent.

Enumerator
solved 

y holds the solution (converged() returned false)

tangent 

converged: x holds the canonical border columns, y intermediate values

singular 

the matrix is singular, or the shape rejected

Member Function Documentation

◆ pivot_size()

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr int tdls::ArrowheadLUppSolverDynamic< T, Config >::pivot_size ( const ArrowheadShape & shape)
inlinestaticnodiscardconstexprnoexcept

Entries of the pivot array: the pivots of a block, then of the border system, reuse it.

Parameters
[in]shapeshape of the matrix
Returns
max(block, border), 0 for a shape the solver rejects

◆ recomputed_workspace_size()

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr int tdls::ArrowheadLUppSolverDynamic< T, Config >::recomputed_workspace_size ( const ArrowheadShape & shape,
const int capacity,
const int nrhs = 1 )
inlinestaticnodiscardconstexprnoexcept

Entries of the workspace of solve_inplace_recomputed with a store of capacity refused blocks, and of solve_inplace_recomputed_or_tangent with nrhs tangent columns: the areas of a streamed block and of its condensation, the front of the second pass, and the refused blocks in the storage of a matrix of capacity blocks with their right-hand sides. It does not grow with the number of blocks of the matrix.

Parameters
[in]shapeshape of the matrix
[in]capacitynumber of refused blocks the workspace holds
[in]nrhsnumber of tangent columns, 1 without tangent
Returns
the number of workspace entries a call needs, 0 for a shape or a capacity the solver rejects

◆ solve() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve ( const ArrowheadShape & shape,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const T *TDLS_RESTRICT b,
T *TDLS_RESTRICT x,
const int rhs_stride )
inlinestaticnodiscardconstexprnoexcept

Solves A x = b, b left untouched.

Parameters
[in]shapeshape of the matrix (valid)
[in,out]Amatrix in its storage; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape) entries
[in]work_strideelement stride of work
[in]bright-hand side
[out]xsolution
[in]rhs_strideelement stride of b and x
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve ( const ArrowheadShape & shape,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const T *TDLS_RESTRICT b,
T *TDLS_RESTRICT x,
const int rhs_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Solves A x = b, b left untouched, counting the refused blocks: b is copied into x, then solved in place.

Parameters
[in]shapeshape of the matrix (valid)
[in,out]Amatrix in its storage; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape) entries
[in]work_strideelement stride of work
[in]bright-hand side
[out]xsolution
[in]rhs_strideelement stride of b and x
[out]refused_countnumber of blocks refused by the pivot check
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_border_canonical_multirhs() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_border_canonical_multirhs ( const ArrowheadShape & shape,
const int nrhs,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const int col0,
T *TDLS_RESTRICT x,
const int rhs_stride,
const std::size_t xcol_stride )
inlinestaticnodiscardconstexprnoexcept

Columns col0 .. col0 + nrhs - 1 of the border block of A^-1 (col0 + nrhs <= border).

Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of unit columns, in [1, border]
[in,out]Amatrix in its storage; unchanged on exit, but under schur_in_place
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in]col0first unit column, col0 + nrhs <= border
[out]xthe border rows, border entries per column
[in]rhs_strideelement stride of x
[in]xcol_strideelement stride between columns of x
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_border_canonical_multirhs() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_border_canonical_multirhs ( const ArrowheadShape & shape,
const int nrhs,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const int col0,
T *TDLS_RESTRICT x,
const int rhs_stride,
const std::size_t xcol_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Columns col0 .. col0 + nrhs - 1 of the border block of A^-1 (col0 + nrhs <= border), counting the refused blocks; see ArrowheadLUppSolverStatic::solve_border_canonical_multirhs.

Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of unit columns, in [1, border]
[in,out]Amatrix in its storage; unchanged on exit, but under schur_in_place
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in]col0first unit column, col0 + nrhs <= border
[out]xthe border rows, border entries per column
[in]rhs_strideelement stride of x
[in]xcol_strideelement stride between columns of x
[out]refused_countnumber of blocks refused by the pivot check
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_border_canonical_multirhs_streamed()

template<typename T , ArrowheadLUppConfig< T > Config>
template<typename Provider >
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_border_canonical_multirhs_streamed ( const ArrowheadShape & shape,
const int nrhs,
Provider && provider,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const int col0,
T *TDLS_RESTRICT x,
const int rhs_stride,
const std::size_t xcol_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

solve_border_canonical_multirhs with the blocks streamed (see solve_inplace_streamed; blk.y is not read).

Template Parameters
Providercallable (int k, StreamedBlock& blk)
Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of unit columns, in [1, border]
[in]providerthe source of the blocks
[in,out]Astorage: A_bb on entry; on exit the refused blocks as given, the accepted ones not written
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of streamed_workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in]col0first unit column, col0 + nrhs <= border
[out]xthe border rows, border entries per column
[in]rhs_strideelement stride of x
[in]xcol_strideelement stride between columns of x
[out]refused_countnumber of refused blocks
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_inplace() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace ( const ArrowheadShape & shape,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride )
inlinestaticnodiscardconstexprnoexcept

Solves A x = y in place.

Parameters
[in]shapeshape of the matrix (valid)
[in,out]Amatrix in its storage; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape) entries
[in]work_strideelement stride of work
[in,out]yright-hand side on entry, solution on exit
[in]rhs_strideelement stride of y
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_inplace() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace ( const ArrowheadShape & shape,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Solves A x = y in place, counting the refused blocks.

Parameters
[in]shapeshape of the matrix (valid)
[in,out]Amatrix in its storage (pattern entries only); recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape) entries
[in]work_strideelement stride of work
[in,out]yright-hand side on entry, solution on exit
[in]rhs_strideelement stride of y
[out]refused_countnumber of blocks refused by the pivot check, eliminated by the second pass
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_inplace_multirhs() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace_multirhs ( const ArrowheadShape & shape,
const int nrhs,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
const std::size_t xcol_stride )
inlinestaticnodiscardconstexprnoexcept

Solves A X = Y in place for nrhs right-hand sides.

Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of right-hand sides, >= 1
[in,out]Amatrix in its storage; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in,out]ynrhs right-hand-side columns on entry, the solutions on exit
[in]rhs_strideelement stride of y
[in]xcol_strideelement stride between columns of y
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_inplace_multirhs() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace_multirhs ( const ArrowheadShape & shape,
const int nrhs,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
const std::size_t xcol_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Solves A X = Y in place for nrhs right-hand sides, counting the refused blocks. The right-hand sides ride along the condensation, which runs once. Column m comes out bitwise identical to solve_inplace on it alone under the default rhs_pass_width, within rounding errors under another (see ArrowheadLUppConfig::rhs_pass_width), and bitwise identical to the compile-time solver (the same contraction of multiply-adds assumed, see the file documentation).

Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of right-hand sides, >= 1
[in,out]Amatrix in its storage (pattern entries only); recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in,out]ynrhs right-hand-side columns on entry, the solutions on exit
[in]rhs_strideelement stride of y
[in]xcol_strideelement stride between columns of y
[out]refused_countnumber of blocks refused by the pivot check, eliminated by the second pass
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_inplace_recomputed()

template<typename T , ArrowheadLUppConfig< T > Config>
template<typename Provider >
static TDLS_HOST_DEVICE constexpr RecomputedOutcome tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace_recomputed ( const ArrowheadShape & shape,
const int capacity,
Provider && provider,
const T *TDLS_RESTRICT Abb,
const int Abb_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Solves A x = y in place, the blocks recomputed: the runtime counterpart of ArrowheadLUppSolverStatic::solve_inplace_recomputed, bit for bit (the same contraction of multiply-adds assumed). provider(k, blk) fills block k once while the solver condenses it, k = 0, 1, ... in order, and once more, blk.recovery set, while it recovers the unknowns of the block, in decreasing k. Nothing of an accepted block is stored, and the matrix is never stored: the caller gives the border block A_bb, entry (r, c) at (r * border + c) * Abb_stride, or (c * border + r) * Abb_stride under the column-major layout, and the border rows of y. The workspace holds the refused blocks, at most capacity of them; beyond, the solve stops, deferred. Nothing is written to y until the solution: y is untouched when the solve is deferred or the matrix singular.

Template Parameters
Providercallable (int k, StreamedBlock& blk)
Parameters
[in]shapeshape of the matrix
[in]capacitynumber of refused blocks the workspace holds, in [0, blocks]
[in]providerthe source of the blocks
[in]Abbthe border block A_bb, B x B in the layout of the configuration
[in]Abb_strideelement stride of Abb
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of recomputed_workspace_size(shape, capacity) entries
[in]work_strideelement stride of work
[in,out]yborder rows of the right-hand side on entry, the solution on exit when solved
[in]rhs_strideelement stride of y
[out]refused_countnumber of refused blocks
Returns
solved, singular (or a shape or a capacity rejected, see valid_recomputed), or deferred when more than capacity blocks are refused

◆ solve_inplace_recomputed_or_tangent()

template<typename T , ArrowheadLUppConfig< T > Config>
template<typename Provider , typename Converged >
static TDLS_HOST_DEVICE constexpr RecomputedOutcome tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace_recomputed_or_tangent ( const ArrowheadShape & shape,
const int ntan,
const int capacity,
Provider && provider,
Converged && converged,
const T *TDLS_RESTRICT Abb,
const int Abb_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
const int col0,
T *TDLS_RESTRICT x,
const int x_stride,
const std::size_t xcol_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

One recomputed pass of a Newton iteration: the runtime counterpart of ArrowheadLUppSolverStatic::solve_inplace_recomputed_or_tangent, bit for bit (the same contraction of multiply-adds assumed). The blocks are condensed as solve_inplace_recomputed condenses them, then converged() is called: false, the pass ends as solve_inplace_recomputed; true, x receives columns col0 .. col0 + ntan - 1 of the border block of A^-1, refused blocks included, y is untouched, and the provider is called once per block. When more than capacity blocks are refused, the pass stops there, deferred, before converged() is called.

Template Parameters
Providercallable (int k, StreamedBlock& blk)
Convergedcallable () returning bool
Parameters
[in]shapeshape of the matrix
[in]ntannumber of tangent columns, in [1, border]
[in]capacitynumber of refused blocks the workspace holds, in [0, blocks]
[in]providerthe source of the blocks
[in]convergedcalled after the last block: whether the tangent replaces the correction
[in]Abbthe border block A_bb, B x B in the layout of the configuration
[in]Abb_strideelement stride of Abb
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of recomputed_workspace_size(shape, capacity, ntan) entries
[in]work_strideelement stride of work
[in,out]yborder rows of the right-hand side on entry, the correction on exit when solved
[in]rhs_strideelement stride of y
[in]col0first tangent column, col0 + ntan <= border
[out]xthe tangent columns (tangent), border entries per column
[in]x_strideelement stride of x
[in]xcol_strideelement stride between columns of x
[out]refused_countnumber of refused blocks
Returns
solved, tangent, singular (or a shape or a capacity rejected), or deferred when more than capacity blocks are refused

◆ solve_inplace_streamed()

template<typename T , ArrowheadLUppConfig< T > Config>
template<typename Provider >
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace_streamed ( const ArrowheadShape & shape,
Provider && provider,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Solves A x = y in place, the blocks streamed: provider(k, blk) fills block k (StreamedBlock) when the solver needs it, k = 0, 1, ... in order, exactly once, and the solver condenses it at once. The caller writes beforehand only the border: A_bb in A and the border rows of y. An accepted block leaves its recovery data in its storage; a refused one is stored as given for the second pass. Bit for bit the results of solve_inplace, and of ArrowheadLUppSolverStatic::solve_inplace_streamed (the same contraction of multiply-adds assumed, see the file documentation).

Template Parameters
Providercallable (int k, StreamedBlock& blk)
Parameters
[in]shapeshape of the matrix (valid)
[in]providerthe source of the blocks
[in,out]Astorage: A_bb on entry; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of streamed_workspace_size(shape) entries
[in]work_strideelement stride of work
[in,out]yborder rows of the right-hand side on entry, the solution on exit
[in]rhs_strideelement stride of y
[out]refused_countnumber of refused blocks
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_inplace_streamed_or_tangent()

template<typename T , ArrowheadLUppConfig< T > Config>
template<typename Provider , typename Converged >
static TDLS_HOST_DEVICE constexpr StreamedOutcome tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_inplace_streamed_or_tangent ( const ArrowheadShape & shape,
const int ntan,
Provider && provider,
Converged && converged,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
T *TDLS_RESTRICT y,
const int rhs_stride,
const int col0,
T *TDLS_RESTRICT x,
const int x_stride,
const std::size_t xcol_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

One streamed pass of a Newton iteration: the blocks condensed as solve_inplace_streamed does, then converged() is called (the provider may compute the residual meanwhile). When it returns false, the pass ends as solve_inplace_streamed (y holds the correction). When it returns true, the correction is not computed: the border system condensed by the pass gives instead columns col0 .. col0 + ntan - 1 of the border block of A^-1 in x (the consistent tangent of a behaviour loaded through the border), refused blocks included. The provider is called exactly once per block, in order, and converged() once, after the last block. Bit for bit the results of solve_inplace_streamed and of ArrowheadLUppSolverStatic::solve_inplace_streamed_or_tangent, and those of solve_border_canonical_multirhs_streamed under the default rhs_pass_width (within rounding errors under another, see ArrowheadLUppConfig::rhs_pass_width), the same contraction of multiply-adds assumed (see the file documentation).

Template Parameters
Providercallable (int k, StreamedBlock& blk)
Convergedcallable () returning bool
Parameters
[in]shapeshape of the matrix (valid)
[in]ntannumber of tangent columns, in [1, border]
[in]providerthe source of the blocks
[in]convergedcalled after the last block: whether the tangent replaces the correction
[in,out]Astorage: A_bb on entry; overwritten
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of streamed_workspace_size(shape, ntan) entries
[in]work_strideelement stride of work
[in,out]yborder rows of the right-hand side on entry, the correction on exit (solved), intermediate values otherwise
[in]rhs_strideelement stride of y
[in]col0first tangent column, col0 + ntan <= border
[out]xthe tangent columns (tangent), border entries per column
[in]x_strideelement stride of x
[in]xcol_strideelement stride between columns of x
[out]refused_countnumber of refused blocks
Returns
solved, tangent, or singular when the matrix is singular or the shape rejected (see valid)

◆ solve_multirhs() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_multirhs ( const ArrowheadShape & shape,
const int nrhs,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const T *TDLS_RESTRICT b,
T *TDLS_RESTRICT x,
const int rhs_stride,
const std::size_t xcol_stride )
inlinestaticnodiscardconstexprnoexcept

Solves A X = B for nrhs right-hand sides, B left untouched.

Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of right-hand sides, >= 1
[in,out]Amatrix in its storage; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in]bnrhs right-hand-side columns
[out]xthe nrhs solutions
[in]rhs_strideelement stride of b and x
[in]xcol_strideelement stride between columns of b and x
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ solve_multirhs() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::solve_multirhs ( const ArrowheadShape & shape,
const int nrhs,
T *TDLS_RESTRICT A,
const int A_stride,
int *TDLS_RESTRICT piv,
const int piv_stride,
T *TDLS_RESTRICT work,
const int work_stride,
const T *TDLS_RESTRICT b,
T *TDLS_RESTRICT x,
const int rhs_stride,
const std::size_t xcol_stride,
int & refused_count )
inlinestaticnodiscardconstexprnoexcept

Solves A X = B for nrhs right-hand sides, B left untouched, counting the refused blocks: B is copied into X, then solved in place.

Parameters
[in]shapeshape of the matrix (valid)
[in]nrhsnumber of right-hand sides, >= 1
[in,out]Amatrix in its storage; recovery data on exit
[in]A_strideelement stride of A
[out]pivpivot array of pivot_size(shape) ints
[in]piv_strideelement stride of piv
[out]workworkspace of workspace_size(shape, nrhs) entries
[in]work_strideelement stride of work
[in]bnrhs right-hand-side columns
[out]xthe nrhs solutions
[in]rhs_strideelement stride of b and x
[in]xcol_strideelement stride between columns of b and x
[out]refused_countnumber of blocks refused by the pivot check
Returns
false when the matrix is singular, or the shape rejected (see valid)

◆ streamed_workspace_size() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr int tdls::ArrowheadLUppSolverDynamic< T, Config >::streamed_workspace_size ( const ArrowheadShape & shape)
inlinestaticnodiscardconstexprnoexcept

Entries of the workspace of solve_inplace_streamed: those of solve_inplace, then A_bk of a block under the dense coupling and the copies that restore a refused block.

Parameters
[in]shapeshape of the matrix
Returns
the number of workspace entries a call needs, 0 for a shape the solver rejects

◆ streamed_workspace_size() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr int tdls::ArrowheadLUppSolverDynamic< T, Config >::streamed_workspace_size ( const ArrowheadShape & shape,
const int nrhs )
inlinestaticnodiscardconstexprnoexcept

Entries of the workspace of solve_border_canonical_multirhs_streamed with nrhs unit columns, and of solve_inplace_streamed_or_tangent with nrhs tangent columns.

Parameters
[in]shapeshape of the matrix
[in]nrhsnumber of columns
Returns
the number of workspace entries a call needs, 0 for a shape the solver rejects

◆ valid()

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::valid ( const ArrowheadShape & shape,
const int nrhs = 1 )
inlinestaticnodiscardconstexprnoexcept

Whether the solver accepts a shape, with nrhs right-hand sides (unit columns, tangent columns): storage_map::valid(shape), nrhs in [1, 2^30], and the workspaces of the entry points below 2^31 entries, their offsets being ints. The entry points return false on a shape they reject, before any access, and the sizes are 0 for it. The checks cannot overflow, whatever the shape.

Parameters
[in]shapeshape of the matrix
[in]nrhsnumber of right-hand sides
Returns
true when the solver accepts the shape

◆ valid_recomputed()

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr bool tdls::ArrowheadLUppSolverDynamic< T, Config >::valid_recomputed ( const ArrowheadShape & shape,
const int capacity,
const int nrhs = 1 )
inlinestaticnodiscardconstexprnoexcept

Whether the recomputed entry points accept a shape, a capacity and nrhs tangent columns: valid(shape, nrhs), capacity in [0, blocks], their workspace below 2^31 entries, and every block index exact in T (2^24 blocks at most in float), the store keeping the index of the block of each of its places in the workspace.

Parameters
[in]shapeshape of the matrix
[in]capacitynumber of refused blocks the workspace holds
[in]nrhsnumber of tangent columns, 1 without tangent
Returns
true when the recomputed entry points accept them

◆ workspace_size() [1/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr int tdls::ArrowheadLUppSolverDynamic< T, Config >::workspace_size ( const ArrowheadShape & shape)
inlinestaticnodiscardconstexprnoexcept

Entries of the workspace of solve_inplace and solve.

Parameters
[in]shapeshape of the matrix
Returns
the number of workspace entries a call needs, 0 for a shape the solver rejects

◆ workspace_size() [2/2]

template<typename T , ArrowheadLUppConfig< T > Config>
static TDLS_HOST_DEVICE constexpr int tdls::ArrowheadLUppSolverDynamic< T, Config >::workspace_size ( const ArrowheadShape & shape,
const int nrhs )
inlinestaticnodiscardconstexprnoexcept

Entries of the workspace of the entry points with nrhs right-hand sides: the temporaries of the right-hand sides and one column of the front per right-hand side.

Parameters
[in]shapeshape of the matrix
[in]nrhsnumber of right-hand sides
Returns
the number of workspace entries a call needs, 0 for a shape the solver rejects

The documentation for this struct was generated from the following file: