Intrepydd v0.2 supports the following classes of built-in functions and library
wrappers for
the convenience of the programmer. When an entry below corresponds to
a
standard Python function or library, we include a link to the Python
documentation and also summarize limitations in the Intrepydd version
relative to the Python version. We also use Intrepydd-style type
declarations for function prototypes to summarize the acceptable
parameters and types. For convenience, we use T
, T1
, T2
, etc. as
type parameters below to represent any Intrepydd numeric type: int32
, int64
, float32
, or float64
, and use BT
, BT1
, BT2
etc. as
type parameters to represent any numeric type or bool
.
Finally, note that all standard Python functions and libraries can be used without limitations in the Python main program that invokes Intrepydd functions.
Functions Reference. For a Jupyter-based summary and demo of many of the Intrepydd-supported functions, refer to the functions reference or its preview. The complete list of functions and libraries available in Intrepydd is included below. Many of the entries also include a link to a standard library API that is equivalent, or closely related, to the Intrepydd API.
Intrepydd supports the following subset of Python built-in functions:
- abs
(x: T1) -> T1
- all
(iterable: Array(BT)) -> bool
(iterable: List(BT)) -> bool
- any
(iterable: Array(BT)) -> bool
(iterable: List(BT)) -> bool
- len
(s: Array(BT)) -> int64
(s: List(BT)) -> int64
- max
(arr: Array(T)) -> T
- min
(arr: Array(T)) -> T
- pow
(base: float64, exp: float64) -> float64
- Note: the last argument
z
is not supported
- print
(v: BT)
(ls: List(BT))
- Note: only the first argument is supported, and only printing primitive type is supported. General calls to print can be performed in the Python main program that invokes the Intrepydd code.
- range
(len: int64) -> List(int)
- Note: When used together with
for ... in
, the prototype is(start: int64, stop: int64, step: int64) -> List(int)
- sum
(arr: Array(T)) -> T
Intrepydd supports the following subset of NumPy libraries. Each function name points to the Numpy reference page for the function, and can have some bullets to note its prototype in Intrepydd (often only supports a subset of parameters) and other differences from the Numpy version.
- acos
(arr: Array(T)) -> Array(double)
(val: T) -> double
- add
(x1: Array(T1), x2: T2) -> Array(double)
(x1: T1, x2: Array(T2)) -> Array(double)
(x1: Array(T1), x2: Array(T2)) -> Array(double)
(x1: Array(T), x2: Array(T)) -> Array(T)
- allclose
(arr: Array(T), eps: T) -> bool
- asin
(arr: Array(T)) -> Array(double)
(val: T) -> double
- atan
(arr: Array(T)) -> Array(double)
(val: T) -> double
- cos
(arr: Array(T)) -> Array(double)
(val: T) -> double
- div
(x1: Array(T1), x2: T2) -> Array(double)
(x1: T1, x2: Array(T2)) -> Array(double)
(x1: Array(T1), x2: Array(T2)) -> Array(double)
- elemwise_not
(arr: Array(T)) -> Array(bool)
- empty
(shape: List(int32), dtype: T) -> Array()
(shape: List(int64), dtype: T) -> Array()
(shape: int64, dtype: T) -> Array()
- Note: argument
order
is not supported.dtype
is supported by specifying a number of desired type. - Example:
empty([2,3], int32())
- eq
(x1: Array(BT1), x2: BT2) -> Array(bool)
(x1: BT1, x2: Array(BT2)) -> Array(bool)
(x1: Array(BT1), x2: Array(BT2)) -> Array(bool)
- exp
(arr: Array(T)) -> Array(double)
(val: T) -> double
- Note: the first argument can be either an array or a scalar
- float32
() -> float32
(x: T) -> float32
- Convert a number to float32 type
- float64
() -> float64
(x: T) -> float64
- Convert a number to float64 type
- ge
(x1: Array(T1), x2: T2) -> Array(bool)
(x1: T1, x2: Array(T2)) -> Array(bool)
(x1: Array(T1), x2: Array(T2)) -> Array(bool)
- gt
(x1: Array(T1), x2: T2) -> Array(bool)
(x1: T1, x2: Array(T2)) -> Array(bool)
(x1: Array(T1), x2: Array(T2)) -> Array(bool)
- innerprod
(arr1: Array(T1), arr2: Array(T2)) -> double
- int32
() -> int32
(x: T) -> int32
- Convert a number to int32 type
- int64
() -> int64
(x: T) -> int64
- Convert a number to int64 type
- isinf
(arr: Array(T)) -> Array(bool)
(val: T) -> bool
- isnan
(arr: Array(T)) -> Array(bool)
(val: T) -> bool
- le
(x1: Array(T1), x2: T2) -> Array(bool)
(x1: T1, x2: Array(T2)) -> Array(bool)
(x1: Array(T1), x2: Array(T2)) -> Array(bool)
- log
(x1: Array(T1), x2: T2) -> Array(double)
(x1: T1, x2: Array(T2)) -> Array(double)
(x1: Array(T1), x2: Array(T2)) -> Array(double)
(x1: T1, x2: T2) -> double
- lt
(x1: Array(T1), x2: T2) -> Array(bool)
(x1: T1, x2: Array(T2)) -> Array(bool)
(x1: Array(T1), x2: Array(T2)) -> Array(bool)
- minus
(arr: Array(T)) -> Array(T)
- mul
(x1: Array(T1), x2: T2) -> Array(double)
(x1: T1, x2: Array(T2)) -> Array(double)
(x1: Array(T1), x2: Array(T2)) -> Array(double)
(x1: Array(T), x2: Array(T)) -> Array(T)
- neq
(x1: Array(BT1), x2: BT2) -> Array(bool)
(x1: BT1, x2: Array(BT2)) -> Array(bool)
(x1: Array(BT1), x2: Array(BT2)) -> Array(bool)
- pow
(x1: Array(T1), x2: T2) -> Array(double)
(x1: T1, x2: Array(T2)) -> Array(double)
(x1: Array(T1), x2: Array(T2)) -> Array(double)
(x1: T1, x2: T2) -> double
- The first argument can be either an array or a scalar
- prod
(arr: Array(T)) -> T
- shape
(arr: Array(BT), i: int) -> int
- Note: is a function rather than an attribute. Example:
shape(arr, index)
- sin
(arr: Array(T)) -> Array(double)
(val: T) -> double
- sqrt
(arr: Array(T)) -> Array(double)
(var: T) -> double
- sub
(x1: Array(T1), x2: T2) -> Array(double)
(x1: T1, x2: Array(T2)) -> Array(double)
(x1: Array(T1), x2: Array(T2)) -> Array(double)
(x1: Array(T), x2: Array(T)) -> Array(T)
- tan
(arr: Array(T)) -> Array(double)
(val: T) -> double
- transpose
(arr: Array(T)) -> Array(T)
- zeros
(shape: List(int32), dtype: BT) -> Array()
(shape: List(int64), dtype: BT) -> Array()
(shape: int64, dtype: BT) -> Array()
- Note: argument
order
is not supported.dtype
is supported by specifying a number of desired type. - Example:
zeros([2,3], int32())
- @
- Convenient syntax for matrix-matrix multiplication (equivalent to
matmult
)
- Convenient syntax for matrix-matrix multiplication (equivalent to
Intrepydd supports interfaces to the following subset of CombBLAS libraries for
sparse matrices.
Currently, only float64
is supported as an element type for sparse
matrices in Intrepydd. The
Triangle Counting
Jupyter notebook illustrates the use of Intrepydd to implement a
sparse matrix application, especially in the sections titled
"An Intrepydd version: Domain-specific wrappers"
and "Another Intrepydd version: "lowering" the implementation".
- csr_to_spm
(values: Array(float64), columns: Array(int32), indexes: Array(int32), nc: int32) -> SparseMat(float64)
- Construct and return a sparse matrix from three 1-D arrays and a scalar ---
values
,columns
,indexes
, andnc
(number of columns) --- with the values corresponding to a CSR representation of spm.
- empty_spm
(nr: int32, nc: int32) -> SparseMat(float64)
- Construct and return an empty sparse matrix with
nr
rows andnc
columns.
- spmm
(spm1, spm2) -> SparseMat(float64)
- Return the matrix product of sparse matrices
spm1
andspm2
as a sparse matrix.
- spmm_dense
(spm1, spm2) -> Array(float64)
(spm, arr) -> Array(float64)
(arr, spm) -> Array(float64)
- Return the matrix product of sparse matrices
spm1
andspm2
as a dense matrix.- Also accepts a dense matrix as the first or second argument
- spm_add
(spm1, spm2) -> SparseMat(float64)
(spm, arr) -> SparseMat(float64)
- Return the element-wise sum of sparse matrices
spm1
andspm2
as a sparse matrix.- The second argument can be a dense matrix.
- spm_mul
(spm1, spm2) -> SparseMat(float64)
(spm, arr) -> SparseMat(float64)
- Return the element-wise product of sparse matrices
spm1
andspm2
as a sparse matrix.- The second argument can be a dense matrix.
- spm_set_item
(spm, v: float64, r: int32, c: int32)
- Set item
[r,c]
of sparse matrixspm
tov
. If item[r,c]
already had a nonzero entry inspm
, its value is overwritten withv
.
- spm_set_item_unsafe
(spm, v: float64, r: int32, c: int32)
- Set item
[r,c]
of sparse matrixspm
tov
; assume without checking that item[r,c]
does not already have a nonzero entry inspm
.
- spm_to_csr
(spm, values: Array(float64), columns: Array(int32), indexes: Array(int32))
- Takes sparse matrix spm as input, and fills in three 1-D arrays --- values, columns, indexes --- with the values corresponding to a CSR representation of spm.
- spmv
(spm, arr) -> Array(float64)
- Returns the product of sparse matrix
spm
and dense vectorarr
as a new dense vector.
Note that the data types of arguments spm
, spm1
, and spm2
are
SparseMat(float64)
while the data type of arr
is Array(float64)
.