Package de.labathome.trustconstr.sparse
Class SparseAssembly
java.lang.Object
de.labathome.trustconstr.sparse.SparseAssembly
Sparse-aware structured assembly: vstack, hstack, blockArray, and the
specialised KKT/Jacobian builders that
trust-constr relies on.
These mirror the slice of scipy.sparse that the trust-region
constrained optimiser actually uses. The block constructors in scipy live in
scipy.sparse._construct and are reached via sps.vstack,
sps.hstack, sps.block_array.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CSRMatrixassembleJacobianWithSlacks(CSRMatrix jEq, CSRMatrix jIneq, double[] s) Build the augmented Jacobian used inside the interior-point method:static CSRMatrixblockArray(CSRMatrix[][] blocks) 2D block assembly.static CSRMatrixHorizontal stack of CSR matrices: columns are concatenated, rows must agree.static CSRMatrixVertical stack of CSR matrices: rows are concatenated, columns must agree.static CSRMatrixzeros(int rows, int cols)
-
Method Details
-
vstack
Vertical stack of CSR matrices: rows are concatenated, columns must agree. Empty input yields an empty0 x 0matrix; if all blocks have a common positive column count, the result has that column count.- Parameters:
blocks- CSR blocks to stack (in row order)- Returns:
- concatenated CSR matrix
- See Also:
-
hstack
Horizontal stack of CSR matrices: columns are concatenated, rows must agree.- Parameters:
blocks- CSR blocks to stack (in column order)- Returns:
- concatenated CSR matrix
- See Also:
-
blockArray
2D block assembly.blocks[i][j]is the block at row-band i, column-band j;nullrepresents a zero block. Within a row band all non-null blocks must share row count; within a column band all non-null blocks must share column count. At least one block per row band and per column band must be non-null so the band size can be inferred.- Parameters:
blocks- 2-D grid ofCSRMatrixblocks (rows by columns);null= zero block- Returns:
- assembled CSR matrix
- See Also:
-
zeros
- Parameters:
rows- number of rowscols- number of columns- Returns:
- a
rows x colsCSR matrix with no stored entries
-
assembleJacobianWithSlacks
Build the augmented Jacobian used inside the interior-point method:[ J_eq 0 ] [ J_ineq diag(s) ]Equivalent toblockArray([[J_eq, null], [J_ineq, diag(s)]])but inlined for the specific structure -- this is the optimised path_assemble_sparse_jacobianfromtr_interior_point.py:187.- Parameters:
jEq-n_eq x n_varsCSR equality JacobianjIneq-n_ineq x n_varsCSR inequality Jacobians-n_ineqslack-variable values- Returns:
(n_eq + n_ineq) x (n_vars + n_ineq)CSR
-