ValueMat

class dsviper.ValueMat

Bases: Value

A value of type mat<numeric_type, columns, rows>, stored column-major. Seamless with a Python seq[seq[int|float]] whose outer sequence lists the columns: m[column] is a column, m[column, row] an element, and iterating gives the columns. len(m) counts them, so it answers what m[i] accepts; size() counts the elements.

Or use Value.create(type_mat [, initial_value]).

This constructor builds a new container over the same elements, so only a mutation inside an element shows through.

at(column: int, row: int, *, encoded: Literal[True] = True) → _NumericOutputValues

Return the value at column and row.

encoded=False returns a Value rather than a native object.

column runs from 0 to columns() - 1 and row from 0 to rows() - 1; anything else is out of range, a negative one included.

static cast(value: Value | _OutputValues) → ValueMat

Return value as a mat, or raise if it is not one.

columns() → int

Return the number of columns.

copy() → ValueMat

Return a deep copy.

description(*, namespace: NameSpace | None = None) → str

Return the value written out, then its type, as <value>:<type>.

namespace qualifies the type name; representation() gives the value alone.

hash() → int

Return the hash value.

representation() → str

Return the value written out: the components between square brackets, comma separated.

rows() → int

Return the number of rows.

set(column: int, row: int, value: _InputValues) → None

Set the value at column, row.

size() → int

Return the number of elements.

to_tuple() → tuple[tuple[_NumericOutputValues, ...], ...]

Return the elements column-major, as a tuple of columns.

type() → Type

Return the Type this value is an instance of.

type_code() → str

Return the code naming this kind of value, such as “int32”, “struct” or “vector”.

type_mat() → TypeMat

Return the type mat<element_type, columns, rows>.