This method assembles the constraint matrix A from user-supplied or internally generated components — C, S, M, and Q — and assigns the corresponding right-hand side vector b. It is a required pre-step before solving a Convex Least Squares Programming (CLSP) problem.
canonize(
object,
problem = "",
C = NULL,
S = NULL,
M = NULL,
Q = NULL,
b = NULL,
m = NULL,
p = NULL,
i = 1L,
j = 1L,
zero_diagonal = FALSE
)An updated object of class "clsp".
An object of class "clsp".
Character, optional. Structural template for matrix construction. One of:
'ap' or 'tm': allocation or tabular matrix problem.
'cmls' or 'rp': constrained modular least squares or RP-type.
'' or other: General CLSP problems (user-defined C and/or M).
Numeric matrix or NULL. Blocks of the constraint
matrix \(A = [C | S; M | Q]\). If C and/or M are
provided, the matrix A is constructed accordingly. If both are
NULL and A is not yet defined, an error is raised.
Numeric matrix or NULL. Externally supplied residual slack
matrix used to adjust inequality constraints in M. Required only when
\(r > 1\). Encodes the sign pattern of residuals from the previous
iteration and is used to construct the \([C | S; M | Q]\) canonical
form. Defaults to a conformable zero matrix on the first iteration.
Numeric vector or NULL. Right-hand side vector. Must have
as many rows as \(A\). Required.
Integer or NULL. Dimensions of
\(X \in \mathbb{R}^{m \times p}\), relevant for allocation problems
('ap').
Integer, default = 1. Grouping sizes for row and column
sum constraints in AP problems.
Logical, default = FALSE. If TRUE,
enforces structural zero diagonals via identity truncation.
ANumeric matrix. Canonical design matrix constructed from (C, S, M, Q).
C_idxInteger vector of length 2 indicating the size of the C block.
bNumeric vector. Conformable right-hand side vector.
Depending on the specified problem type, it can generate allocation, tabular matrix, or modular constraints and enforce optional diagonal exclusions. All missing blocks are padded to ensure conformability.