ReadonlyformatChooses how the one-dimensional arrays encode the two-dimensional matrix.
"csc" (compressed sparse column): coefficients are grouped by column.
starts[j]..starts[j + 1] locates column j, and each corresponding
indices[k] is a row index."csr" (compressed sparse row): coefficients are grouped by row.
starts[i]..starts[i + 1] locates row i, and each corresponding
indices[k] is a column index.This changes the meanings and required length of both starts and
indices; it does not transpose the mathematical matrix. Use "csc" when
constructing columns naturally and "csr" when constructing rows
naturally.
ReadonlyindicesMinor-axis coordinate for every packed coefficient in values.
indices[k] and values[k] always describe the same matrix entry.
In CSC, packed position k belongs to the column determined by starts,
and indices[k] is its zero-based row. In CSR, position k belongs to the
row determined by starts, and indices[k] is its zero-based column.
Consequently CSC indices must be below numRows, while CSR indices must be
below numCols.
indices.length must equal values.length and the final starts entry.
A single packed row/column must not repeat a minor index, because that would
specify the same matrix coordinate twice. Indices in different packed
rows/columns may naturally repeat.
For CSC starts: [0, 2, 3], indices: [0, 1, 1] means column 0 has entries
in rows 0 and 1, while column 1 has one entry in row 1.
ReadonlynumNumber of columns in the mathematical matrix. It must be a non-negative signed 32-bit integer.
In CSR format, every entry of indices is a column index and must satisfy
0 <= indices[k] < numCols. In CSC format, this is the number of packed
column segments, so starts.length must equal numCols + 1.
ReadonlynumNumber of rows in the mathematical matrix. It must be a non-negative signed 32-bit integer.
In CSC format, every entry of indices is a row index and must satisfy
0 <= indices[k] < numRows. In CSR format, this is the number of packed
row segments, so starts.length must equal numRows + 1.
ReadonlystartsBoundaries of the packed rows or columns inside indices and values.
These are offsets, not model row/column indices.
In CSC, column j occupies positions k from starts[j] inclusive to
starts[j + 1] exclusive. In CSR, the same formula describes row j.
Therefore an empty row/column has equal adjacent offsets.
The array must have numCols + 1 entries for CSC or numRows + 1 entries
for CSR. It must start with 0, be nondecreasing, and end with the exact
number of stored entries:
starts[starts.length - 1] === indices.length === values.length.
Example: starts: [0, 2, 2, 3] describes three major-axis items. The first
has two entries at packed positions 0 and 1, the second is empty, and the
third has one entry at position 2.
ReadonlyvaluesNumerical matrix coefficient at every packed position. values[k] is at
the minor coordinate indices[k] within the row/column selected by
starts; all three arrays must therefore be interpreted together.
values.length must equal indices.length and the final starts entry.
Values must be numbers other than NaN; matrix coefficients should be
finite rather than using infinity to represent a bound. Explicit zero and
coefficients whose magnitude is at or below small_matrix_value may be
removed by HiGHS, so the later extracted matrix can contain fewer entries.
For the CSC encoding starts: [0, 2, 3], indices: [0, 1, 1], and
values: [1, 2, 3], the stored coordinates are (row 0, col 0) = 1,
(row 1, col 0) = 2, and (row 1, col 1) = 3.
Constraint matrix in compressed sparse column (CSC) or compressed sparse row (CSR) form.
formatchooses the major axis. With"csc", each packed segment is one column andindicescontains row indices. With"csr", each segment is one row andindicescontains column indices. DefinemajorDimension = format === "csc" ? numCols : numRows. The arrays must obey:starts.length === majorDimension + 1starts[0] === 0startsis nondecreasingstarts[majorDimension] === indices.length === values.lengthFor example, the matrix
[[1, 0], [2, 3]]is CSC-encoded asstarts: [0, 2, 3],indices: [0, 1, 1],values: [1, 2, 3]. Explicit zeros and coefficients at or below HiGHS' small-matrix threshold may be removed. All arrays are copied before the call returns.