Reference
Built-in functions
Search and filter the built-in functions documented for the Sun interpreter.
01
Function catalog
This inventory follows the runtime dispatch and parallel purity lists. Signatures distinguish interpreter support, native LLVM lowering, and effects that require a capable runtime host.
54 functions
| Name | Signature | Description | Availability |
|---|---|---|---|
sqrt | sqrt(x) | Element-wise square root of a scalar, boolean, or matrix. | InterpreterLLVM |
sin | sin(x) | Element-wise sine using real f64 semantics. | InterpreterLLVM |
cos | cos(x) | Element-wise cosine using real f64 semantics. | InterpreterLLVM |
tan | tan(x) | Element-wise tangent of a scalar, boolean, or matrix. | Interpreter |
abs | abs(x) | Element-wise absolute value. | Interpreter |
accumarray | accumarray(subs, values) | Sums scalar or vector values into a dense 1D or 2D matrix using positive 1-based subscripts. | Interpreter |
acos | acos(x) | Element-wise inverse cosine in radians for real or complex scalars and real matrices. | Interpreter |
acosd | acosd(x) | Element-wise inverse cosine in degrees for real or complex scalars and real matrices. | Interpreter |
acosh | acosh(x) | Element-wise inverse hyperbolic cosine for real or complex scalars and real matrices. | Interpreter |
acot | acot(x) | Element-wise inverse cotangent in radians for real or complex scalars and real matrices. | Interpreter |
acotd | acotd(x) | Element-wise inverse cotangent in degrees for real or complex scalars and real matrices. | Interpreter |
acoth | acoth(x) | Element-wise inverse hyperbolic cotangent for real or complex scalars and real matrices. | Interpreter |
acsc | acsc(x) | Element-wise inverse cosecant in radians for real or complex scalars and real matrices. | Interpreter |
acscd | acscd(x) | Element-wise inverse cosecant in degrees for real or complex scalars and real matrices. | Interpreter |
acsch | acsch(x) | Element-wise inverse hyperbolic cosecant for real or complex scalars and real matrices. | Interpreter |
all | all(x) | Returns one boolean indicating whether every scalar or matrix element is nonzero. | Interpreter |
allbetween | allbetween(x, lower, upper) | Returns whether every real element lies in a closed interval with scalar bounds. | Interpreter |
allfinite | allfinite(x) | Returns whether every real or complex component is finite. | Interpreter |
class | class(value) | Returns the runtime class name of a value. | Interpreter |
isa | isa(value, className) | Tests an exact class name or the numeric, float, and integer categories. | Interpreter |
double | double(value) | Preserves double values and converts logical scalars to 0 or 1. | Interpreter |
exp | exp(x) | Element-wise exponential. | InterpreterLLVM |
log | log(x) | Element-wise natural logarithm. | InterpreterLLVM |
sum | sum(x) | Reduces all matrix elements to one scalar; sum([]) is 0. | Interpreter |
mean | mean(x) | Arithmetic mean of all elements; mean([]) is NaN. | Interpreter |
min | min(x) | min(a, b) | Reduces one value or compares two values element by element. | Interpreter |
max | max(x) | max(a, b) | Reduces one value or compares two values element by element. | Interpreter |
zeros | zeros() | zeros(n) | zeros(r, c) | zeros([r, c]) | Creates a zero-filled matrix with checked dimensions. | Interpreter |
ones | ones() | ones(n) | ones(r, c) | ones([r, c]) | Creates a one-filled matrix with checked dimensions. | Interpreter |
eye | eye() | eye(n) | eye(r, c) | eye([r, c]) | Creates a rectangular identity matrix. | Interpreter |
transpose | transpose(A) | Returns the transpose of a numeric matrix. | Interpreter |
det | det(A) | Computes the determinant of a square matrix. | Interpreter |
inv | inv(A) | Inverts a nonsingular square matrix. | Interpreter |
solve | solve(A, B) | Solves the dense linear system A * X = B. | Interpreter |
size | size(x) | Returns [rows, columns] for a scalar, boolean, or matrix. | Interpreter |
numel | numel(x) | Returns the total number of elements. | Interpreter |
isempty | isempty(x) | Returns true when a value has no matrix elements. | Interpreter |
disp | disp(value) | Writes one value to the active runtime host. | InterpreterLLVM |
pause | pause() | pause(seconds) | pause(state) | Waits interactively, sleeps, or changes the session pause state. | InterpreterHost |
error | error(message) | error(identifier, message) | Raises a catchable Sun runtime exception. | Interpreter |
rethrow | rethrow(exception) | Raises an existing exception without changing its identity. | Interpreter |
readmatrix | readmatrix(filename) | Reads a headerless UTF-8 numeric CSV file into a matrix. | InterpreterHost |
writematrix | writematrix(value, filename) | Atomically writes a numeric scalar or matrix as CSV. | InterpreterHost |
plot | plot(x, y) | Creates a 2D curve figure in a graphical host. | InterpreterHost |
plot3 | plot3(x, y, z) | Creates one or more 3D curves. | InterpreterHost |
surf | surf(Z) | surf(x, y, Z) | surf(X, Y, Z) | Creates a triangulated 3D surface. | InterpreterHost |
title | title(text) | Sets the active figure title. | InterpreterHost |
xlabel | xlabel(text) | Sets the active figure x-axis label. | InterpreterHost |
ylabel | ylabel(text) | Sets the active figure y-axis label. | InterpreterHost |
zlabel | zlabel(text) | Sets the z-axis label on a 3D figure. | InterpreterHost |
legend | legend(labels...) | legend("on" | "off") | Labels curves or changes legend visibility. | InterpreterHost |
grid | grid() | grid(flag) | Toggles or explicitly configures the figure grid. | InterpreterHost |
axis | axis("auto") | axis(limits) | Sets 2D four-value or 3D six-value finite bounds. | InterpreterHost |
clf | clf() | Clears the active figure. | InterpreterHost |
02
Reading availability
- Interpreter means the built-in is dispatched by sun run.
- LLVM means the audited native backend lowers the documented form.
- Host means the operation requires host I/O, timing, filesystem, or figure support.
03
Numeric compatibility boundaries
- accumarray currently performs dense sum aggregation for one- or two-column subscript matrices; function handles, explicit sizes, fill values, sparse output, and higher dimensions are not implemented.
- acos, acosd, acosh, acoth, acsc, and acscd return complex values for scalar inputs outside their real domains.
- acsch is real for nonzero real inputs, reaches signed infinity at zero, and accepts complex scalars.
- all reduces all elements to one boolean because Sun does not yet have logical matrices or dimension-based logical reductions.
- allbetween currently supports the closed three-argument form with real scalar bounds; interval-type and table options are not implemented.
- Matrices currently store real f64 elements, so an element whose result would be complex is represented as NaN instead.
Source note
The function count is derived from the catalog. New runtime dispatch entries must be reflected here.