Skip to contents

Array

Constructing and working with AnvlArrays

Construction

Functions for creating and initializing arrays

Attributes

Functions for querying array properties

backend()
Get Backend of an Array
ambiguous()
Get Ambiguity of an Array
dtype()
Get the data type of an array
shape()
Get the shape of an array
ndims()
Get the number of dimensions of an array
device()
Get the device of an array
platform()
Get the platform of an array or buffer

Converters

Functions for converting arrays

as_array()
Convert to an R array
as_raw()
Convert an array to a raw vector
as_dtype()
Convert to a DataType
is_dtype()
Check if an object is a DataType

Serialization

Functions for serializing and deserializing arrays

nv_save()
Save arrays to a file
nv_read()
Read arrays from a file
nv_serialize()
Serialize arrays to raw bytes
nv_unserialize()
Deserialize arrays from raw bytes

API Functions

User-facing nv_* functions for array operations

Type Conversion and Broadcasting

Functions for type conversion, promotion, and broadcasting

nv_convert()
Convert Data Type
nv_bitcast_convert()
Bitcast Conversion
as_anvl_array() as_anvl_arrays()
Convert to AnvlArray
nv_promote_to_common()
Promote Arrays to a Common Dtype
nv_broadcast_scalars()
Broadcast Scalars to Common Shape
nv_broadcast_arrays()
Broadcast Arrays to a Common Shape
nv_broadcast_to()
Broadcast to Shape
common_dtype()
Type Promotion Rules

Array Manipulation

Functions for reshaping and rearranging arrays

Arithmetic Operations

Basic arithmetic operations on arrays

nv_add()
Addition
nv_sub()
Subtraction
nv_mul()
Multiplication
nv_div()
Division
nv_pow()
Power
nv_negate()
Negation
nv_remainder()
Remainder

Comparison Operations

Element-wise comparison operations

nv_eq()
Equal
nv_ne()
Not Equal
nv_gt()
Greater Than
nv_ge()
Greater Than or Equal
nv_lt()
Less Than
nv_le()
Less Than or Equal

Mathematical Functions

Mathematical and trigonometric functions

nv_abs()
Absolute Value
nv_sqrt()
Square Root
nv_rsqrt()
Reciprocal Square Root
nv_cbrt()
Cube Root
nv_exp()
Exponential
nv_expm1()
Exponential Minus One
nv_log()
Natural Logarithm
nv_log1p()
Log Plus One
nv_log2()
Base-2 Logarithm
nv_log10()
Base-10 Logarithm
nv_sine()
Sine
nv_cosine()
Cosine
nv_tan()
Tangent
nv_tanh()
Hyperbolic Tangent
nv_atan2()
Arctangent 2
nv_sign()
Sign
nv_floor()
Floor
nv_ceil()
Ceiling
nv_round()
Round
nv_logistic()
Logistic (Sigmoid)
nv_is_finite() is.finite(<AnvlBox>)
Is Finite
nv_is_nan() is.nan(<AnvlBox>)
Is NaN
nv_is_infinite() is.infinite(<AnvlBox>)
Is Infinite

Reduction Operations

Operations that reduce array dimensions

nv_reduce_sum()
Sum Reduction
nv_reduce_mean()
Mean Reduction
nv_reduce_prod()
Product Reduction
nv_reduce_max()
Max Reduction
nv_reduce_min()
Min Reduction
nv_reduce_any()
Any Reduction
nv_reduce_all()
All Reduction
nv_var()
Variance Reduction
nv_sd()
Standard Deviation Reduction

Linear Algebra

Linear algebra operations

nv_matmul()
Matrix Multiplication
nv_cholesky()
Cholesky Decomposition
nv_solve()
Solve Linear System
nv_crossprod() crossprod(<AnvlBox>)
Cross Product (Matrix)
nv_tcrossprod() tcrossprod(<AnvlBox>)
Transpose Cross Product (Matrix)
nv_outer()
Outer Product
nv_trace()
Matrix Trace
nv_extract_diag()
Extract Diagonal
nv_tril()
Lower Triangular Matrix
nv_triu()
Upper Triangular Matrix

Logical and Bitwise Operations

Logical and bitwise operations on arrays

nv_and()
Logical And
nv_or()
Logical Or
nv_xor()
Logical Xor
nv_not()
Logical Not
nv_shift_left()
Shift Left
nv_shift_right_logical()
Logical Shift Right
nv_shift_right_arithmetic()
Arithmetic Shift Right
nv_popcnt()
Population Count

Element-wise Operations

Other element-wise array operations

nv_min()
Minimum
nv_max()
Maximum
nv_clamp()
Clamp

Control Flow

Control flow operations

nv_if()
Conditional Branching
nv_while()
While Loop
nv_ifelse()
Conditional Element Selection

Random Number Generation

Functions for generating random numbers

nv_runif()
Sample from a Uniform Distribution
nv_rnorm()
Sample from a Normal Distribution
nv_rbinom()
Sample from a Binomial Distribution
nv_rdunif()
Sample from a Discrete Uniform Distribution
nv_rng_state()
Generate RNG State

Transformations

Code transformations

jit()
JIT compile a function
gradient()
Gradient
value_and_gradient()
Value and Gradient

Debugging

Debugging utilities and tools

nv_print()
Print Array

Backend

Backend-related functionality and implementations

backend()
Get Backend of an Array
default_backend()
Get the default backend
local_backend()
Temporarily set the default backend
with_backend()
Run code with a specific backend
device_arg()
Select JIT device from a function argument
nv_device()
Create a Device
default_device()
Get the default device
is_device()
Test whether an object is a device
quickr_device()
Quickr device
AnvlBackend()
Create a backend
AnvlBackendXla()
XLA backend
AnvlBackendQuickr()
Quickr backend

Internals

Internal data structures and functions

Graph

AnvlGraph()
Graph of Primitive Calls
GraphDescriptor()
Graph Descriptor
GraphNode
Graph Node
GraphValue()
Graph Value
GraphBox()
Graph Box
GraphLiteral()
Graph Literal
AnvlBox
AnvlBox
graph_desc_add()
Add a Primitive Call to a Graph Descriptor
local_descriptor()
Create a graph
.current_descriptor()
Get the current graph
subgraphs()
Get Subgraphs from Higher-Order Primitive

Primitives

new_primitive()
Create a Primitive
AnvlPrimitive()
AnvlPrimitive
PrimitiveCall()
Primitive Call

Abstract Types

nv_aval() AbstractArray()
Abstract Array Class
ConcreteArray()
Concrete Array Class
LiteralArray()
Literal Array Class
IotaArray()
Iota Array Class
shape_abstract() ndims_abstract() dtype_abstract() ambiguous_abstract()
Abstract Properties
to_abstract()
Convert to Abstract Array
is_arrayish()
Array-like Objects

Transformations

xla()
Ahead-of-time compile a function to XLA
trace_fn()
Trace an R function into a Graph
transform_gradient()
Transform a graph to its gradient
graph_to_quickr_r_function()
Convert an AnvlGraph to a plain R function
jit_eval()
JIT-compile and evaluate an expression
compile_xla()
Trace, lower, and compile a function to an XLA executable
stablehlo()
Lower a graph to StableHLO

Miscellaneous

eq_type() neq_type()
Compare AbstractArray Types
at2vt()
Convert AbstractArray to ValueType
vt2at()
Convert ValueType to AbstractArray
is_arrayish()
Array-like Objects
Shape()
Create a Shape object

Tree utilities

Utilities for working with nested structures

flatten()
Flatten
unflatten()
Unflatten
build_tree()
Build Tree
reindex_tree()
Reindex Tree
tree_size()
Tree Size
tree_path()
Tree Path
filter_list_node()
Filter List Node

Primitives

Low-level primitive operations (prim_* functions)

prim_abs()
Primitive Absolute Value
prim_add()
Primitive Addition
prim_and()
Primitive And
prim_atan2()
Primitive Atan2
prim_bitcast_convert()
Primitive Bitcast Convert
prim_broadcast_in_dim()
Primitive Broadcast
prim_cbrt()
Primitive Cube Root
prim_ceil()
Primitive Ceiling
prim_cholesky()
Primitive Cholesky Decomposition
prim_clamp()
Primitive Clamp
prim_concatenate()
Primitive Concatenate
prim_convert()
Primitive Convert
prim_cosine()
Primitive Cosine
prim_div()
Primitive Division
prim_dot_general()
Primitive Dot General
prim_dynamic_slice()
Primitive Dynamic Slice
prim_dynamic_update_slice()
Primitive Dynamic Update Slice
prim_eq()
Primitive Equal
prim_exp()
Primitive Exponential
prim_expm1()
Primitive Exponential Minus One
prim_fill()
Primitive Fill
prim_floor()
Primitive Floor
prim_gather()
Primitive Gather
prim_ge()
Primitive Greater Equal
prim_gt()
Primitive Greater Than
prim_if()
Primitive If
prim_ifelse()
Primitive Ifelse
prim_iota()
Primitive Iota
prim_is_finite()
Primitive Is Finite
prim_le()
Primitive Less Equal
prim_log()
Primitive Logarithm
prim_log1p()
Primitive Log Plus One
prim_logistic()
Primitive Logistic (Sigmoid)
prim_lt()
Primitive Less Than
prim_max()
Primitive Maximum
prim_min()
Primitive Minimum
prim_mul()
Primitive Multiplication
prim_ne()
Primitive Not Equal
prim_negate()
Primitive Negation
prim_not()
Primitive Not
prim_or()
Primitive Or
prim_pad()
Primitive Pad
prim_popcnt()
Primitive Population Count
prim_pow()
Primitive Power
prim_print()
Primitive Print
prim_reduce_all()
Primitive All Reduction
prim_reduce_any()
Primitive Any Reduction
prim_reduce_max()
Primitive Max Reduction
prim_reduce_min()
Primitive Min Reduction
prim_reduce_prod()
Primitive Product Reduction
prim_reduce_sum()
Primitive Sum Reduction
prim_remainder()
Primitive Remainder
prim_reshape()
Primitive Reshape
prim_reverse()
Primitive Reverse
prim_rng_bit_generator()
Primitive RNG Bit Generator
prim_round()
Primitive Round
prim_rsqrt()
Primitive Reciprocal Square Root
prim_scatter()
Primitive Scatter
prim_shift_left()
Primitive Shift Left
prim_shift_right_arithmetic()
Primitive Arithmetic Shift Right
prim_shift_right_logical()
Primitive Logical Shift Right
prim_sign()
Primitive Sign
prim_sine()
Primitive Sine
prim_sqrt()
Primitive Square Root
prim_static_slice()
Primitive Static Slice
prim_sub()
Primitive Subtraction
prim_tan()
Primitive Tangent
prim_tanh()
Primitive Hyperbolic Tangent
prim_transpose()
Primitive Transpose
prim_triangular_solve()
Primitive Triangular Solve
prim_while()
Primitive While Loop
prim_xor()
Primitive Xor