This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Linear algebra

The matrix product, transpose, and the symmetric eigensolver. Run a cell to see its output beside the expected one.

The matrix product

@ always means matmul, never elementwise.

Viv [1]

transpose

Viv [2]

The symmetric eigensolver

eig_sym fills its arguments: values ascending, eigenvectors in columns. Trace = sum of eigenvalues.

Viv [3]

Matrix-vector products via matmul

A 2×2 times a length-2 vector.

Viv [4]

Chained products

Viv [5]

A 3x3 eigenproblem

The eigenvalues come out in ascending order and sum to the trace, 9.

Viv [6]

Solvers that return their results

The same solvers as the forms that fill arrays you pass, which still work: the values ascend, and lin_solve's answer gives back b.

Viv [7]

transpose reverses the axes

Of a matrix, the rows become columns; of a rank-3 array, all three axes turn around; a vector comes back as it was, as in NumPy. transpose(A, axes) puts them in any order.

Viv [8]

The dot product is dot, not @

@ is the matrix product and refuses two vectors; dot(u, v) sums u[i] * v[i] left to right, and outer(u, v) is the other product of two vectors. The cell prints 11 from dot, then stops at the @ line.

Viv [9]

expected error: `@` of two vectors is refused…