Numerical arrays with native storage
Run checked vector arithmetic, dot products, cumulative sums, and population statistics, then copy Float64 values into a Tensor.
// Native typed loops; every input and result keeps an explicit dtype.
let x = Array<Float64>(size: 3, fill: 0.0)
x.set(0, 1.0)
x.set(1, 2.0)
x.set(2, 3.0)
let y = x.scale(factor: 2.0)
print(y.to_list())
print(x.sum())
print(x.mean())
print(x.dot(y))
print(x.cumsum().to_list())
print(x.variance())
print(x.std())
print(x.add(y).to_list())
let matrix = x.to_tensor(rows: 1, cols: 3)
print(type_of(matrix))
let integers = DynamicArray<Int64>(capacity: 3)
integers.append(1)
integers.append(2)
integers.append(3)
print(integers.to_float().scale(0.5).to_list())
Make it your experiment.
Use Aner 0.0.3 or newer. Save this program as examples/arrays_numeric.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.
aner check examples/arrays_numeric.aner
aner run examples/arrays_numeric.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use Aner 0.0.3 or newer and matching VS Code integration. Arrays are built in and require no import. Every array requires an explicit fixed width integer, Float32, Float64, Decimal, Bool, or String element type. Decimal uses its own exact arithmetic contract. See the typed array guide for method contracts and complexity.
Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.
Dataset sources & attribution