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
as.double(<AnvlArray>) as.integer(<AnvlArray>) as.logical(<AnvlArray>) as.vector(<AnvlArray>)
Coerce AnvlArray to an R Vector
await()
Block until an async operation completes

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
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

nv_reshape()
Reshape
nv_flatten()
Flatte
nv_transpose() t(<AnvlArray>)
Transpose
nv_concatenate()
Concatenate
nv_rbind() nv_cbind() rbind(<AnvlArray>) cbind(<AnvlArray>)
Combine arrays by rows or columns
nv_static_slice()
Static Slice
nv_select()
Select Elements Along a Dimension
nv_pad()
Pad
nv_reverse()
Reverse
nv_squeeze()
Squeeze
nv_unsqueeze()
Unsqueeze
`[`(<AnvlArray>) nv_subset()
Subset an Array
`[<-`(<AnvlArray>) nv_subset_assign()
Update Subset

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 (Truncating)
nv_mod()
Modulo (Flooring 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_sin()
Sine
nv_cos()
Cosine
nv_tan()
Tangent
nv_asin()
Arc Sine
nv_acos()
Arc Cosine
nv_atan()
Arc Tangent
nv_atan2()
Arctangent 2
nv_sinh()
Hyperbolic Sine
nv_cosh()
Hyperbolic Cosine
nv_tanh()
Hyperbolic Tangent
nv_asinh()
Inverse Hyperbolic Sine
nv_acosh()
Inverse Hyperbolic Cosine
nv_atanh()
Inverse Hyperbolic Tangent
nv_sign()
Sign
nv_floor()
Floor
nv_ceiling()
Ceiling
nv_trunc()
Truncate
nv_round()
Round
nv_logistic()
Logistic (Sigmoid)
nv_erf()
Error Function
nv_erfc()
Complementary Error Function
nv_erf_inv()
Inverse Error Function
nv_digamma()
Digamma
nv_lgamma()
Log-Gamma
nv_polygamma()
Polygamma
nv_is_finite() is.finite(<AnvlArray>)
Is Finite
nv_is_nan() is.nan(<AnvlArray>)
Is NaN
nv_is_infinite() is.infinite(<AnvlArray>)
Is Infinite

Reduction Operations

Operations that reduce array dimensions

nv_reduce_sum()
Sum 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

Statistical Summaries

Summary statistics over array dimensions

nv_mean() mean(<AnvlArray>)
Mean
nv_median() median(<AnvlArray>)
Median
nv_quantile()
Quantile
nv_var()
Variance Reduction
nv_sd()
Standard Deviation Reduction

Cumulative Operations

Cumulative (scan) operations along a single dimension

nv_cumsum()
Cumulative Sum
nv_cumprod()
Cumulative Product
nv_cummax()
Cumulative Maximum
nv_cummin()
Cumulative Minimum

Linear Algebra

Linear algebra operations

nv_matmul()
Matrix Multiplication
nv_chol() chol(<AnvlArray>)
Cholesky Decomposition
nv_qr() qr(<AnvlArray>)
QR Decomposition
nv_lu()
LU Decomposition
nv_svd()
Singular Value Decomposition
nv_eigh()
Symmetric Eigendecomposition
nv_solve() solve(<AnvlArray>)
Solve Linear System
nv_triangular_solve()
Triangular Solve
nv_inv()
Matrix Inverse
nv_det()
Determinant
nv_determinant() determinant(<AnvlArray>)
Determinant in modulus/sign form
nv_crossprod() crossprod(<AnvlArray>)
Cross Product (Matrix)
nv_tcrossprod() tcrossprod(<AnvlArray>)
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

Sorting and Searching

Sorting arrays and finding extrema

nv_sort() sort(<AnvlArray>)
Sort
nv_argsort()
Argsort
nv_top_k()
Top-K Elements
nv_argmax()
Index of the Maximum
nv_argmin()
Index of the Minimum

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

Miscellaneous

General-purpose helpers

arr()
Create an R array
eq_type() neq_type()
Compare AbstractArray Types

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
rule_reverse()
Reverse Rule
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
current_platform() local_platform()
Current Lowering Target Platform

Tree

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
map_tree()
Map Over a Tree
pmap_tree()
Map Over Multiple Trees
filter_list_node()
Filter List Node

Miscellaneous

at2vt()
Convert AbstractArray to ValueType
vt2at()
Convert ValueType to AbstractArray
vt()
Construct a stablehlo ValueType
is_arrayish()
Array-like Objects
Shape()
Create a Shape object

Primitives

Low-level primitive operations (prim_* functions)

prim_abs()
Primitive Absolute Value
prim_acos()
Primitive Arc Cosine
prim_acosh()
Primitive Inverse Hyperbolic Cosine
prim_add()
Primitive Addition
prim_and()
Primitive And
prim_argmax()
Primitive Argmax
prim_argmin()
Primitive Argmin
prim_asin()
Primitive Arc Sine
prim_asinh()
Primitive Inverse Hyperbolic Sine
prim_atan()
Primitive Arc Tangent
prim_atan2()
Primitive Atan2
prim_atanh()
Primitive Inverse Hyperbolic Tangent
prim_bitcast_convert()
Primitive Bitcast Convert
prim_broadcast_in_dim()
Primitive Broadcast
prim_cbrt()
Primitive Cube Root
prim_ceil()
Primitive Ceiling
prim_chol()
Primitive Cholesky Decomposition
prim_clamp()
Primitive Clamp
prim_concatenate()
Primitive Concatenate
prim_convert()
Primitive Convert
prim_cos()
Primitive Cosine
prim_cosh()
Primitive Hyperbolic Cosine
prim_cummax()
Primitive Cumulative Maximum
prim_cummin()
Primitive Cumulative Minimum
prim_cumprod()
Primitive Cumulative Product
prim_cumsum()
Primitive Cumulative Sum
prim_digamma()
Primitive Digamma
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_eigh()
Primitive Symmetric Eigendecomposition
prim_eq()
Primitive Equal
prim_erf()
Primitive Error Function
prim_erf_inv()
Primitive Inverse Error Function
prim_erfc()
Primitive Complementary Error Function
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_lgamma()
Primitive Log-Gamma
prim_log()
Primitive Logarithm
prim_log1p()
Primitive Log Plus One
prim_logistic()
Primitive Logistic (Sigmoid)
prim_lt()
Primitive Less Than
prim_lu()
Primitive LU Decomposition
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_polygamma()
Primitive Polygamma
prim_popcnt()
Primitive Population Count
prim_pow()
Primitive Power
prim_print()
Primitive Print
prim_qr()
Primitive QR Decomposition
prim_reduce()
Primitive Generic Reduce
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_sin()
Primitive Sine
prim_sinh()
Primitive Hyperbolic Sine
prim_sort()
Primitive Sort
prim_sqrt()
Primitive Square Root
prim_static_slice()
Primitive Static Slice
prim_sub()
Primitive Subtraction
prim_svd()
Primitive Singular Value Decomposition
prim_tan()
Primitive Tangent
prim_tanh()
Primitive Hyperbolic Tangent
prim_top_k()
Primitive Top-K
prim_transpose()
Primitive Transpose
prim_triangular_solve()
Primitive Triangular Solve
prim_while()
Primitive While Loop
prim_xor()
Primitive Xor

Package

anvl anvl-package
anvl: Accelerated Array Computing and Automatic Differentiation