Stdlib module math/matrix.vitl

This page is a wiki-style reference for one concrete stdlib file. It explains what the file owns, where it fits in the family, and how to decide whether this is the right surface to depend on.

Visual portrait of math/matrix.vitl
Wiki-style portrait for math/matrix.vitl.

Family: math

Kind: public stdlib surface

Page style: this reference follows the same “encyclopedic card + portrait + usage contract” logic as the keyword pages, but for stdlib modules.

Summary

Overview

FieldValue
Pathmath/matrix.vitl
Familymath
Kindpublic stdlib surface
Line count57
Declared procedures53
Declared forms/picks0

`math/matrix.vitl` is a public stdlib surface inside the `math` family. It should be read as one focused slice of the broader family responsibility: Arithmetic, algebra, comparison, calculus, geometry, modular arithmetic, number theory, probability, statistics, matrix, and vector helpers.

Purpose

This file should be chosen because of responsibility, not because its name “sounds close enough”. Inside the math family, it carries one focused part of the contract and keeps that responsibility separate from neighboring concerns.

  • A scoring engine can compute aggregates in `math` while keeping I/O and transport elsewhere.
  • A statistics or matrix chapter should explain the workflow around the computation, not just a single formula.

Taxonomy

Think of this page as a generated encyclopedia entry rather than a hand-written tutorial. The goal is to show what kind of module this is, how dense it is, and what reading strategy makes sense before depending on it.

  • Large algorithm surface: this file exposes many procedures and likely acts as a domain toolkit rather than a single thin wrapper.
  • Minimal top-level dependencies: the module reads as mostly self-contained from its opening declarations.
  • Explicit export surface: the file ends with visible export declarations instead of relying only on implicit namespace discovery.

Implementation profile

This profile is inferred directly from the source text. It does not replace reading the file, but it tells you quickly whether the module is mostly declarative, loop-heavy, branch-heavy, or organized around many small exits.

SignalCountWhat it suggests
if28Branching density and local decision-making.
while1Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let9Local state and intermediate value density.
give80Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Proceduresmat2, mat2_zero, mat2_identity, mat2_diag, mat2_is_valid, mat2_clone, mat2_m11, mat2_m12, mat2_m21, mat2_m22, mat2_row0, mat2_row1
Formsnone declared at top level
Picksnone declared at top level
Constantsnone declared at top level
Exports*

Imported surfaces

This file does not advertise a top-level `use` surface in its opening declarations. That often means it is either self-contained or an aggregation layer.

Position in family

This file is module 10 of 21 in the math family when ordered by path. By procedure count it ranks 10, and by line count it ranks 20. Those ranks are useful as rough signals of breadth, not as quality judgments.

Declaration map

The declaration map turns raw source into a scan-friendly catalog. It is useful when the file is large enough that a reader wants to orient by kinds of surfaces first.

LineNameKindRole
1vitte/stdlib/math/matrixspaceDeclares the namespace that anchors this file in the stdlib tree.
3mat2procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
4mat2_zeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
5mat2_identityprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
6mat2_diagprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
7mat2_is_validprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
8mat2_cloneprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
9mat2_m11procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
10mat2_m12procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
11mat2_m21procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
12mat2_m22procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
13mat2_row0procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
14mat2_row1procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
15mat2_col0procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
16mat2_col1procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
17mat2_equalprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
18mat2_is_zeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
19mat2_is_identityprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
20mat2_is_diagonalprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
21mat2_is_symmetricprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
22mat2_is_upper_triangularprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
23mat2_is_lower_triangularprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
24mat2_addprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
25mat2_subprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
26mat2_negprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
27mat2_scaleprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
28mat2_hadamardprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
29mat2_mulprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
30mat2_mul_vec2procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
31vec2_mul_mat2procRepresents one top-level surface in the file contract and should be read as part of the module boundary.
32mat2_traceprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
33mat2_detprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
34mat2_transposeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
35mat2_adjugateprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
36mat2_cofactorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
37mat2_invprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
38mat2_has_inverseprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
39mat2_powprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
40mod_normprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
41mat2_mod_normprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
42mat2_add_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
43mat2_sub_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
44mat2_scale_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
45mat2_mul_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
46mat2_det_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
47mat2_inv_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
48mat2_pow_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
49mat2_fibonacci_matrixprocOwns a concrete data shape or the operations that maintain it.
50mat2_fibprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
51mat2_fib_modprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
52mat2_idprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
53matrix_versionprocOwns a concrete data shape or the operations that maintain it.
54matrix_readyprocOwns a concrete data shape or the operations that maintain it.
55matrix_selftestprocOwns a concrete data shape or the operations that maintain it.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 54 matching surfaces.

Representative signatures

These signatures are shown in source order so the page keeps the feel of a reference manual, not just a keyword cloud.

  • proc mat2(a: int, b: int, c: int, d: int) -> [int] { give [a, b, c, d] } (line 3)
  • proc mat2_zero() -> [int] { give [0, 0, 0, 0] } (line 4)
  • proc mat2_identity() -> [int] { give [1, 0, 0, 1] } (line 5)
  • proc mat2_diag(a: int, d: int) -> [int] { give [a, 0, 0, d] } (line 6)
  • proc mat2_is_valid(m: [int]) -> bool { give m.len == 4 } (line 7)
  • proc mat2_clone(m: [int]) -> [int] { give m } (line 8)
  • proc mat2_m11(m: [int]) -> int { if m.len != 4 { give 0 } give m[0] } (line 9)
  • proc mat2_m12(m: [int]) -> int { if m.len != 4 { give 0 } give m[1] } (line 10)
  • proc mat2_m21(m: [int]) -> int { if m.len != 4 { give 0 } give m[2] } (line 11)
  • proc mat2_m22(m: [int]) -> int { if m.len != 4 { give 0 } give m[3] } (line 12)
  • proc mat2_row0(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[0], m[1]] } (line 13)
  • proc mat2_row1(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[2], m[3]] } (line 14)
  • proc mat2_col0(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[0], m[2]] } (line 15)
  • proc mat2_col1(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[1], m[3]] } (line 16)
  • proc mat2_equal(a: [int], b: [int]) -> bool { give a.len == 4 and b.len == 4 and a[0] == b[0] and a[1] == b[1] and a[2] == b[2] and a[3] == b[3] } (line 17)
  • proc mat2_is_zero(m: [int]) -> bool { give mat2_equal(m, mat2_zero()) } (line 18)
  • proc mat2_is_identity(m: [int]) -> bool { give mat2_equal(m, mat2_identity()) } (line 19)
  • proc mat2_is_diagonal(m: [int]) -> bool { give m.len == 4 and m[1] == 0 and m[2] == 0 } (line 20)

The list is intentionally capped here; the source file declares 53 matching signatures in total.

How to use this module

Start by reading the file as an ownership boundary. Ask three questions: what enters this module, what stable types or procedures it exports, and what adjacent module should stay outside of it.

  1. Read space and top-level imports first so the ownership boundary of math/matrix.vitl is explicit.
  2. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  3. Only after that compare neighbor modules, because the right boundary choice matters more than memorizing one helper name.

User example

This example is generated from the actual stdlib module surface. Its job is not to be the smallest snippet possible; its job is to show a realistic consumer-shaped file that exercises the module and mirrors the language keywords the module itself relies on.

space demo/math_matrix
proc run_example() -> string {
  let entries = mat2(1, 1, 1, 1)
  let ready: bool = mat2_is_valid([1, 2, 3])
  let stable: bool = ready and true
  let fallback: bool = ready or false
  let idx: int = 0
  let count: int = 0
  while idx < entries.len {
    set count = count + 1
    set idx = idx + 1
  }
  if not ready {
    give "not-ready"
  }
    give "ok"
}
export run_example

Keyword coverage

This table makes the “all keywords of the module” requirement auditable. It compares the detected Vitte keywords in the source file with the generated consumer example above.

KeywordPresent in module sourceUsed in generated user example
spaceyesyes
procyesyes
letyesyes
setyesyes
ifyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
andyesyes
oryesyes
notyesyes

The generated snippet exercises every detected Vitte keyword used by this module.

Source shape

space vitte/stdlib/math/matrix
proc mat2(a: int, b: int, c: int, d: int) -> [int] { give [a, b, c, d] }
proc mat2_zero() -> [int] { give [0, 0, 0, 0] }
proc mat2_identity() -> [int] { give [1, 0, 0, 1] }
proc mat2_diag(a: int, d: int) -> [int] { give [a, 0, 0, d] }
proc mat2_is_valid(m: [int]) -> bool { give m.len == 4 }
proc mat2_clone(m: [int]) -> [int] { give m }
proc mat2_m11(m: [int]) -> int { if m.len != 4 { give 0 } give m[0] }
proc mat2_m12(m: [int]) -> int { if m.len != 4 { give 0 } give m[1] }
proc mat2_m21(m: [int]) -> int { if m.len != 4 { give 0 } give m[2] }

The excerpt is not meant to replace the file. It exists to make the module recognizable at first glance, the same way a Wikipedia infobox helps the reader orient before reading the whole article.

Source landmarks

Large files are easier to retain when they have visible landmarks. When the source contains explicit section banners, they are surfaced here; otherwise the first major declarations are used as anchors.

  • Line 1: space vitte/stdlib/math/matrix
  • Line 3: proc mat2(a: int, b: int, c: int, d: int) -> [int] { give [a, b, c, d] }
  • Line 4: proc mat2_zero() -> [int] { give [0, 0, 0, 0] }
  • Line 5: proc mat2_identity() -> [int] { give [1, 0, 0, 1] }
  • Line 6: proc mat2_diag(a: int, d: int) -> [int] { give [a, 0, 0, d] }
  • Line 7: proc mat2_is_valid(m: [int]) -> bool { give m.len == 4 }
  • Line 8: proc mat2_clone(m: [int]) -> [int] { give m }
  • Line 9: proc mat2_m11(m: [int]) -> int { if m.len != 4 { give 0 } give m[0] }

Source organization

When a file carries its own internal chaptering, those chapters usually reveal the intended reading order better than a flat symbol list. This section reconstructs that organization from the source itself.

File surfaces

Top-level items: 55. Procedures: 53. Data surfaces: 0. Constants: 0.

First visible names: vitte/stdlib/math/matrix, mat2, mat2_zero, mat2_identity, mat2_diag, mat2_is_valid, mat2_clone, mat2_m11, mat2_m12, mat2_m21

Complete API catalog

This catalog is the exhaustive file-level index for the module. It is intentionally closer to a generated encyclopedia appendix than to a tutorial summary.

Procedures

LineNameSignatureRole
3mat2proc mat2(a: int, b: int, c: int, d: int) -> [int] { give [a, b, c, d] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
4mat2_zeroproc mat2_zero() -> [int] { give [0, 0, 0, 0] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
5mat2_identityproc mat2_identity() -> [int] { give [1, 0, 0, 1] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
6mat2_diagproc mat2_diag(a: int, d: int) -> [int] { give [a, 0, 0, d] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
7mat2_is_validproc mat2_is_valid(m: [int]) -> bool { give m.len == 4 }Represents one top-level surface in the file contract and should be read as part of the module boundary.
8mat2_cloneproc mat2_clone(m: [int]) -> [int] { give m }Represents one top-level surface in the file contract and should be read as part of the module boundary.
9mat2_m11proc mat2_m11(m: [int]) -> int { if m.len != 4 { give 0 } give m[0] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
10mat2_m12proc mat2_m12(m: [int]) -> int { if m.len != 4 { give 0 } give m[1] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
11mat2_m21proc mat2_m21(m: [int]) -> int { if m.len != 4 { give 0 } give m[2] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
12mat2_m22proc mat2_m22(m: [int]) -> int { if m.len != 4 { give 0 } give m[3] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
13mat2_row0proc mat2_row0(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[0], m[1]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
14mat2_row1proc mat2_row1(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[2], m[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
15mat2_col0proc mat2_col0(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[0], m[2]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
16mat2_col1proc mat2_col1(m: [int]) -> [int] { if m.len != 4 { give [] } give [m[1], m[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
17mat2_equalproc mat2_equal(a: [int], b: [int]) -> bool { give a.len == 4 and b.len == 4 and a[0] == b[0] and a[1] == b[1] and a[2] == b[2] and a[3] == b[3] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
18mat2_is_zeroproc mat2_is_zero(m: [int]) -> bool { give mat2_equal(m, mat2_zero()) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
19mat2_is_identityproc mat2_is_identity(m: [int]) -> bool { give mat2_equal(m, mat2_identity()) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
20mat2_is_diagonalproc mat2_is_diagonal(m: [int]) -> bool { give m.len == 4 and m[1] == 0 and m[2] == 0 }Represents one top-level surface in the file contract and should be read as part of the module boundary.
21mat2_is_symmetricproc mat2_is_symmetric(m: [int]) -> bool { give m.len == 4 and m[1] == m[2] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
22mat2_is_upper_triangularproc mat2_is_upper_triangular(m: [int]) -> bool { give m.len == 4 and m[2] == 0 }Represents one top-level surface in the file contract and should be read as part of the module boundary.
23mat2_is_lower_triangularproc mat2_is_lower_triangular(m: [int]) -> bool { give m.len == 4 and m[1] == 0 }Represents one top-level surface in the file contract and should be read as part of the module boundary.
24mat2_addproc mat2_add(a: [int], b: [int]) -> [int] { if not mat2_is_valid(a) or not mat2_is_valid(b) { give [] } give [a[0] + b[0], a[1] + b[1], a[2] + b[2], a[3] + b[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
25mat2_subproc mat2_sub(a: [int], b: [int]) -> [int] { if not mat2_is_valid(a) or not mat2_is_valid(b) { give [] } give [a[0] - b[0], a[1] - b[1], a[2] - b[2], a[3] - b[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
26mat2_negproc mat2_neg(m: [int]) -> [int] { if not mat2_is_valid(m) { give [] } give [0 - m[0], 0 - m[1], 0 - m[2], 0 - m[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
27mat2_scaleproc mat2_scale(m: [int], k: int) -> [int] { if not mat2_is_valid(m) { give [] } give [m[0] * k, m[1] * k, m[2] * k, m[3] * k] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
28mat2_hadamardproc mat2_hadamard(a: [int], b: [int]) -> [int] { if not mat2_is_valid(a) or not mat2_is_valid(b) { give [] } give [a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
29mat2_mulproc mat2_mul(a: [int], b: [int]) -> [int] { if not mat2_is_valid(a) or not mat2_is_valid(b) { give [] } give [a[0] * b[0] + a[1] * b[2], a[0] * b[1] + a[1] * b[3], a[2] * b[0] + a[3] * b[2], a[2] * b[1] + a[3] * b[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
30mat2_mul_vec2proc mat2_mul_vec2(m: [int], v: [int]) -> [int] { if not mat2_is_valid(m) or v.len != 2 { give [] } give [m[0] * v[0] + m[1] * v[1], m[2] * v[0] + m[3] * v[1]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
31vec2_mul_mat2proc vec2_mul_mat2(v: [int], m: [int]) -> [int] { if not mat2_is_valid(m) or v.len != 2 { give [] } give [v[0] * m[0] + v[1] * m[2], v[0] * m[1] + v[1] * m[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
32mat2_traceproc mat2_trace(m: [int]) -> int { if not mat2_is_valid(m) { give 0 } give m[0] + m[3] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
33mat2_detproc mat2_det(m: [int]) -> int { if not mat2_is_valid(m) { give 0 } give m[0] * m[3] - m[1] * m[2] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
34mat2_transposeproc mat2_transpose(m: [int]) -> [int] { if not mat2_is_valid(m) { give [] } give [m[0], m[2], m[1], m[3]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
35mat2_adjugateproc mat2_adjugate(m: [int]) -> [int] { if not mat2_is_valid(m) { give [] } give [m[3], 0 - m[1], 0 - m[2], m[0]] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
36mat2_cofactorproc mat2_cofactor(m: [int]) -> [int] { give mat2_adjugate(m) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
37mat2_invproc mat2_inv(m: [int]) -> [int] { let det: int = mat2_det(m) if det == 0 { give [] } let adj: [int] = mat2_adjugate(m) give [adj[0] / det, adj[1] / det, adj[2] / det, adj[3] / det] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
38mat2_has_inverseproc mat2_has_inverse(m: [int]) -> bool { give mat2_det(m) != 0 }Represents one top-level surface in the file contract and should be read as part of the module boundary.
39mat2_powproc mat2_pow(m: [int], exp: int) -> [int] { if exp < 0 { give [] } let out: [int] = mat2_identity() let base: [int] = m let e: int = exp while e > 0 { if e % 2 == 1 { set out = mat2_mul(out, base) } set base = mat2_mul(base, base); set e = e / 2 } give out }Represents one top-level surface in the file contract and should be read as part of the module boundary.
40mod_normproc mod_norm(value: int, modulus: int) -> int { if modulus <= 0 { give 0 } let out: int = value % modulus if out < 0 { give out + modulus } give out }Represents one top-level surface in the file contract and should be read as part of the module boundary.
41mat2_mod_normproc mat2_mod_norm(m: [int], modulus: int) -> [int] { if not mat2_is_valid(m) { give [] } give [mod_norm(m[0], modulus), mod_norm(m[1], modulus), mod_norm(m[2], modulus), mod_norm(m[3], modulus)] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
42mat2_add_modproc mat2_add_mod(a: [int], b: [int], modulus: int) -> [int] { give mat2_mod_norm(mat2_add(a, b), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
43mat2_sub_modproc mat2_sub_mod(a: [int], b: [int], modulus: int) -> [int] { give mat2_mod_norm(mat2_sub(a, b), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
44mat2_scale_modproc mat2_scale_mod(m: [int], k: int, modulus: int) -> [int] { give mat2_mod_norm(mat2_scale(m, k), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
45mat2_mul_modproc mat2_mul_mod(a: [int], b: [int], modulus: int) -> [int] { give mat2_mod_norm(mat2_mul(a, b), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
46mat2_det_modproc mat2_det_mod(m: [int], modulus: int) -> int { give mod_norm(mat2_det(m), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
47mat2_inv_modproc mat2_inv_mod(m: [int], modulus: int) -> [int] { give mat2_mod_norm(mat2_inv(m), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
48mat2_pow_modproc mat2_pow_mod(m: [int], exp: int, modulus: int) -> [int] { give mat2_mod_norm(mat2_pow(m, exp), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
49mat2_fibonacci_matrixproc mat2_fibonacci_matrix() -> [int] { give [1, 1, 1, 0] }Owns a concrete data shape or the operations that maintain it.
50mat2_fibproc mat2_fib(n: int) -> int { if n <= 0 { give 0 } if n == 1 { give 1 } let p: [int] = mat2_pow(mat2_fibonacci_matrix(), n - 1) give p[0] }Represents one top-level surface in the file contract and should be read as part of the module boundary.
51mat2_fib_modproc mat2_fib_mod(n: int, modulus: int) -> int { give mod_norm(mat2_fib(n), modulus) }Represents one top-level surface in the file contract and should be read as part of the module boundary.
52mat2_idproc mat2_id() -> [int] { give mat2_identity() }Represents one top-level surface in the file contract and should be read as part of the module boundary.
53matrix_versionproc matrix_version() -> string { give "max-1" }Owns a concrete data shape or the operations that maintain it.
54matrix_readyproc matrix_ready() -> bool { give true }Owns a concrete data shape or the operations that maintain it.
55matrix_selftestproc matrix_selftest() -> bool { let m: [int] = mat2(1, 2, 3, 4) let inv: [int] = mat2_inv(mat2(2, 0, 0, 2)) give matrix_ready() and matrix_version() == "max-1" and mat2_det(m) == -2 and mat2_trace(m) == 5 and mat2_mul_vec2(m, [1, 1])[0] == 3 and mat2_has_inverse(mat2(2, 0, 0, 2)) and inv.len == 4 and mat2_fib(8) == 21 }Owns a concrete data shape or the operations that maintain it.

Exports

LineNameSignatureRole
57*export *Re-exports surfaces that the module wants to expose as part of its public boundary.

Integration boundaries

Within math, this file should remain focused. If a future helper changes the host boundary, scheduling boundary, or data-shape boundary, it probably belongs in a neighbor module instead of being added here by convenience.

  • Family responsibility: Arithmetic, algebra, comparison, calculus, geometry, modular arithmetic, number theory, probability, statistics, matrix, and vector helpers.
  • Family architecture role: Use `math` when the transformation itself is the feature. This family exists so algorithmic intent stays visible and testable.

Composition guidance

Choose this module when

  • Choose math/matrix.vitl when the main question is owned by this module rather than by transport, storage, orchestration, or user-interface code.
  • A scoring engine can compute aggregates in `math` while keeping I/O and transport elsewhere.
  • A statistics or matrix chapter should explain the workflow around the computation, not just a single formula.

Pause before extending it when

  • Avoid extending this file when the new helper mostly changes the boundary to host I/O, runtime coordination, or foreign integration instead of staying inside math.
  • Check nearby modules such as math/algebra.vitl, math/arithmetic.vitl, math/arrays.vitl before adding convenience wrappers here.

Relationship table

This table keeps the page closer to a real encyclopedia entry: a module is easier to understand when compared with its nearest alternatives in the same family.

NeighborProceduresData surfacesWhy compare it
math/algebra.vitl140Shares the same family boundary but carries a distinct slice of responsibility.
math/arithmetic.vitl722Shares the same family boundary but carries a distinct slice of responsibility.
math/arrays.vitl832Shares the same family boundary but carries a distinct slice of responsibility.
math/calculus.vitl563Shares the same family boundary but carries a distinct slice of responsibility.
math/comparison.vitl470Shares the same family boundary but carries a distinct slice of responsibility.
math/complex.vitl490Shares the same family boundary but carries a distinct slice of responsibility.
math/geometry.vitl720Shares the same family boundary but carries a distinct slice of responsibility.
math/logic.vitl200Shares the same family boundary but carries a distinct slice of responsibility.

Neighbor modules