Stdlib module math/complex.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/complex.vitl
Wiki-style portrait for math/complex.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/complex.vitl
Familymath
Kindpublic stdlib surface
Line count492
Declared procedures49
Declared forms/picks0

`math/complex.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
if47Branching density and local decision-making.
while3Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let25Local state and intermediate value density.
give94Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Proceduresabs_int, sqrt_floor, complex_pair, complex_zero, complex_one, complex_i, complex_is_valid, complex_real, complex_imag, complex_clone, complex_equal, complex_is_zero
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 7 of 21 in the math family when ordered by path. By procedure count it ranks 12, and by line count it ranks 11. 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/complexspaceDeclares the namespace that anchors this file in the stdlib tree.
13abs_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
21sqrt_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
49complex_pairprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
53complex_zeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
57complex_oneprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
61complex_iprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
65complex_is_validprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
69complex_realprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
77complex_imagprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
85complex_cloneprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
97complex_equalprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
105complex_is_zeroprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
113complex_is_realprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
121complex_is_imaginaryprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
129complex_is_unitprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
141complex_addprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
149complex_subprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
157complex_negprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
165complex_scaleprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
173complex_mulprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
184complex_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
192complex_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
204complex_conjprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
212complex_abs_sqprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
220complex_normprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
224complex_absprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
232complex_manhattanprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
240complex_chebyshevprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
256complex_dotprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
264complex_crossprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
272complex_distance_sqprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
283complex_distanceprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
287complex_arg_quadrantprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
315complex_invprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
334complex_divprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
353complex_has_inverseprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
371complex_powprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
399complex_from_realprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
403complex_swapprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
411complex_perp_leftprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
419complex_perp_rightprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
427complex_mul_iprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
431complex_mul_neg_iprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
439complex_powersprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
461complex_reprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
465complex_improcRepresents one top-level surface in the file contract and should be read as part of the module boundary.
469complex_versionprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
473complex_readyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
477complex_selftestprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 50 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 abs_int(value: int) -> int { (line 13)
  • proc sqrt_floor(value: int) -> int { (line 21)
  • proc complex_pair(real: int, imag: int) -> [int] { (line 49)
  • proc complex_zero() -> [int] { (line 53)
  • proc complex_one() -> [int] { (line 57)
  • proc complex_i() -> [int] { (line 61)
  • proc complex_is_valid(value: [int]) -> bool { (line 65)
  • proc complex_real(value: [int]) -> int { (line 69)
  • proc complex_imag(value: [int]) -> int { (line 77)
  • proc complex_clone(value: [int]) -> [int] { (line 85)
  • proc complex_equal(a: [int], b: [int]) -> bool { (line 97)
  • proc complex_is_zero(value: [int]) -> bool { (line 105)
  • proc complex_is_real(value: [int]) -> bool { (line 113)
  • proc complex_is_imaginary(value: [int]) -> bool { (line 121)
  • proc complex_is_unit(value: [int]) -> bool { (line 129)
  • proc complex_add(a: [int], b: [int]) -> [int] { (line 141)
  • proc complex_sub(a: [int], b: [int]) -> [int] { (line 149)
  • proc complex_neg(value: [int]) -> [int] { (line 157)

The list is intentionally capped here; the source file declares 49 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/complex.vitl is explicit.
  2. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  3. Use the source landmarks section below as a table of contents when the file is large.
  4. 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_complex
proc run_example() -> string {
  let entries = complex_pair(1, 1)
  let ready: bool = complex_is_valid([1, 2, 3])
  let failed: bool = false
  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"
  } else {
    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
elseyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes
oryesyes
notyesyes

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

Source shape

space vitte/stdlib/math/complex
proc abs_int(value: int) -> int {
  if value < 0 {
    give 0 - value
  } else {
    give value
  }
}
proc sqrt_floor(value: int) -> int {
  if value <= 0 {

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.

  • Complex — integer complex arithmetic / representation / [ real, imag ]
  • Internal helpers
  • Construction / validation
  • Predicates
  • Basic arithmetic
  • Conjugation / norms
  • Derived operations
  • Division / inverse
  • Powers
  • Special constructors / helpers

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.

Opening declarations

Top-level items: 1. Procedures: 0. Data surfaces: 0. Constants: 0.

First visible names: vitte/stdlib/math/complex

Internal helpers

Top-level items: 2. Procedures: 2. Data surfaces: 0. Constants: 0.

First visible names: abs_int, sqrt_floor

Construction / validation

Top-level items: 8. Procedures: 8. Data surfaces: 0. Constants: 0.

First visible names: complex_pair, complex_zero, complex_one, complex_i, complex_is_valid, complex_real, complex_imag, complex_clone

Predicates

Top-level items: 5. Procedures: 5. Data surfaces: 0. Constants: 0.

First visible names: complex_equal, complex_is_zero, complex_is_real, complex_is_imaginary, complex_is_unit

Basic arithmetic

Top-level items: 7. Procedures: 7. Data surfaces: 0. Constants: 0.

First visible names: complex_add, complex_sub, complex_neg, complex_scale, complex_mul, complex_square, complex_cube

Conjugation / norms

Top-level items: 6. Procedures: 6. Data surfaces: 0. Constants: 0.

First visible names: complex_conj, complex_abs_sq, complex_norm, complex_abs, complex_manhattan, complex_chebyshev

Derived operations

Top-level items: 5. Procedures: 5. Data surfaces: 0. Constants: 0.

First visible names: complex_dot, complex_cross, complex_distance_sq, complex_distance, complex_arg_quadrant

Division / inverse

Top-level items: 3. Procedures: 3. Data surfaces: 0. Constants: 0.

First visible names: complex_inv, complex_div, complex_has_inverse

Powers

Top-level items: 1. Procedures: 1. Data surfaces: 0. Constants: 0.

First visible names: complex_pow

Special constructors / helpers

Top-level items: 6. Procedures: 6. Data surfaces: 0. Constants: 0.

First visible names: complex_from_real, complex_swap, complex_perp_left, complex_perp_right, complex_mul_i, complex_mul_neg_i

Sequence helpers

Top-level items: 1. Procedures: 1. Data surfaces: 0. Constants: 0.

First visible names: complex_powers

Aliases

Top-level items: 6. Procedures: 5. Data surfaces: 0. Constants: 0.

First visible names: complex_re, complex_im, complex_version, complex_ready, complex_selftest, *

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
13abs_intproc abs_int(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
21sqrt_floorproc sqrt_floor(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
49complex_pairproc complex_pair(real: int, imag: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
53complex_zeroproc complex_zero() -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
57complex_oneproc complex_one() -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
61complex_iproc complex_i() -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
65complex_is_validproc complex_is_valid(value: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
69complex_realproc complex_real(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
77complex_imagproc complex_imag(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
85complex_cloneproc complex_clone(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
97complex_equalproc complex_equal(a: [int], b: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
105complex_is_zeroproc complex_is_zero(value: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
113complex_is_realproc complex_is_real(value: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
121complex_is_imaginaryproc complex_is_imaginary(value: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
129complex_is_unitproc complex_is_unit(value: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
141complex_addproc complex_add(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
149complex_subproc complex_sub(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
157complex_negproc complex_neg(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
165complex_scaleproc complex_scale(value: [int], scalar: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
173complex_mulproc complex_mul(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
184complex_squareproc complex_square(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
192complex_cubeproc complex_cube(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
204complex_conjproc complex_conj(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
212complex_abs_sqproc complex_abs_sq(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
220complex_normproc complex_norm(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
224complex_absproc complex_abs(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
232complex_manhattanproc complex_manhattan(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
240complex_chebyshevproc complex_chebyshev(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
256complex_dotproc complex_dot(a: [int], b: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
264complex_crossproc complex_cross(a: [int], b: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
272complex_distance_sqproc complex_distance_sq(a: [int], b: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
283complex_distanceproc complex_distance(a: [int], b: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
287complex_arg_quadrantproc complex_arg_quadrant(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
315complex_invproc complex_inv(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
334complex_divproc complex_div(a: [int], b: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
353complex_has_inverseproc complex_has_inverse(value: [int]) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
371complex_powproc complex_pow(value: [int], exponent: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
399complex_from_realproc complex_from_real(real: int) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
403complex_swapproc complex_swap(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
411complex_perp_leftproc complex_perp_left(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
419complex_perp_rightproc complex_perp_right(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
427complex_mul_iproc complex_mul_i(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
431complex_mul_neg_iproc complex_mul_neg_i(value: [int]) -> [int] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
439complex_powersproc complex_powers(value: [int], count: int) -> [[int]] {Represents one top-level surface in the file contract and should be read as part of the module boundary.
461complex_reproc complex_re(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
465complex_improc complex_im(value: [int]) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
469complex_versionproc complex_version() -> string {Represents one top-level surface in the file contract and should be read as part of the module boundary.
473complex_readyproc complex_ready() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
477complex_selftestproc complex_selftest() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.

Exports

LineNameSignatureRole
492*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/complex.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/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.
math/matrix.vitl530Shares the same family boundary but carries a distinct slice of responsibility.

Neighbor modules