Symbol Reference API¶
Reference APIs for Scalar, Vector and Matrix as well as the diff facilities.
Scalar¶
Arithmetic Operations¶
Method |
Description |
|---|---|
|
Addition of two scalars |
|
Subtraction of two scalars |
|
Multiplication of two scalars |
|
Division of two scalars |
|
Add numeric constant |
|
Subtract numeric constant |
|
Multiply by numeric constant |
|
Divide by numeric constant |
|
Constant plus scalar |
|
Constant minus scalar |
|
Constant times scalar |
|
Constant divided by scalar |
|
Unary negation |
Assignment Operations¶
Method |
Description |
|---|---|
|
Add scalar and assign |
|
Subtract scalar and assign |
|
Multiply by scalar and assign |
|
Divide by scalar and assign |
|
Add constant and assign |
|
Subtract constant and assign |
|
Multiply by constant and assign |
|
Divide by constant and assign |
Mathematical Functions¶
Method |
Description |
|---|---|
|
Reciprocal (1/a) |
|
Integer power |
|
Floating point power |
|
Square root |
|
Exponential (e^x) |
|
Natural logarithm |
|
Natural logarithm (alias for ln) |
|
Base-10 logarithm |
|
Sine |
|
Cosine |
|
Tangent |
|
Arc sine |
|
Arc cosine |
|
Arc tangent |
Free Function Versions¶
Method |
Description |
|---|---|
|
Integer power function |
|
Floating point power function |
|
Square root function |
|
Exponential function |
|
Natural logarithm function |
|
Natural logarithm function |
|
Base-10 logarithm function |
|
Sine function |
|
Cosine function |
|
Tangent function |
|
Arc sine function |
|
Arc cosine function |
|
Arc tangent function |
Conditional Operations¶
Method |
Description |
|---|---|
|
Conditional expression with scalar branches |
|
Conditional with scalar positive, constant negative |
|
Conditional with constant positive, scalar negative |
|
Conditional with constant branches |
|
Greater than comparison |
|
Less than comparison |
|
Greater than constant |
|
Less than constant |
|
Constant greater than scalar |
|
Constant less than scalar |
|
Absolute value |
|
Sign function (-1, 0, or 1) |
|
Minimum of two scalars |
|
Maximum of two scalars |
Value Operations¶
Method |
Description |
|---|---|
|
Set the numeric value of a symbol |
|
Get the numeric value of a symbol |
|
Evaluate the expression to a numeric value |
|
Check if expression is exactly zero |
|
Check if expression is exactly one |
Expression Structure¶
Method |
Description |
|---|---|
|
Get left operand of binary operation |
|
Get right operand of binary operation |
|
Check if expression has a right operand |
|
Check if expression is unary |
|
Check if expression is a conditional |
|
Get condition of a branch expression |
Symbol Information¶
Method |
Description |
|---|---|
|
Check if expression is a basic symbol |
|
Get the index of a symbol |
|
Get pointer to underlying expression graph |
|
Get hash checksum of the expression |
Factory Methods¶
Method |
Description |
|---|---|
|
Create a zero constant |
|
Create a one constant |
|
Create a constant with given value |
|
Create a conditional expression |
Utility¶
Method |
Description |
|---|---|
|
Print expression for debugging (chainable) |
Vector¶
Construction¶
Method |
Description |
|---|---|
|
Construct from vector of scalars |
|
Create zero vector of given size |
Properties¶
Method |
Description |
|---|---|
|
Get the size of the vector |
|
Get reference to underlying scalar values |
Element Access¶
Method |
Description |
|---|---|
|
Access element by index |
|
Access element by index (alternative syntax) |
|
Extract a segment of the vector |
|
Set a segment from another vector |
Vector Operations¶
Method |
Description |
|---|---|
|
Dot product with another vector |
|
2D cross product (returns scalar) |
|
3D cross product (returns vector) |
|
Squared Euclidean norm |
|
Euclidean norm |
|
Return normalized vector |
|
Normalize this vector in-place |
Arithmetic Operations¶
Method |
Description |
|---|---|
|
Vector addition |
|
Vector subtraction |
|
Scalar multiplication |
|
Multiplication by symbolic scalar |
|
Scalar division |
|
Division by symbolic scalar |
|
Vector addition assignment |
|
Vector subtraction assignment |
|
Scalar multiplication assignment |
|
Symbolic scalar multiplication assignment |
|
Scalar division assignment |
|
Symbolic scalar division assignment |
Free Functions¶
Method |
Description |
|---|---|
|
Scalar times vector |
|
Symbolic scalar times vector |
|
Vector negation |
|
Dot product of two vectors |
Value Operations¶
Method |
Description |
|---|---|
|
Set numeric values from array-like object |
Matrix¶
Construction¶
Method |
Description |
|---|---|
|
Construct from values (row-major) and shape |
|
Create zero matrix of given shape |
|
Create identity matrix |
Properties¶
Method |
Description |
|---|---|
|
Get number of rows |
|
Get number of columns |
|
Get shape as array [rows, cols] |
|
Get reference to underlying scalar values |
Element Access¶
Method |
Description |
|---|---|
|
Access element at row i, column j |
|
Extract a block sub-matrix |
|
Extract a row as a vector |
|
Extract a column as a vector |
|
Set a block from another matrix |
|
Set a row from a vector |
|
Set a column from a vector |
Matrix Operations¶
Method |
Description |
|---|---|
|
Matrix transpose |
|
Determinant (for square matrices) |
|
Matrix inverse |
|
Symmetric matrix inverse (optimized) |
|
Matrix trace (sum of diagonal elements) |
|
Squared Frobenius norm |
|
Singular values for 2x2 matrix |
|
Matrix multiplication with another matrix |
|
Matrix-vector multiplication |
Arithmetic Operations¶
Method |
Description |
|---|---|
|
Matrix addition |
|
Matrix subtraction |
|
Scalar multiplication |
|
Multiplication by symbolic scalar |
|
Matrix-vector multiplication |
|
Matrix multiplication |
|
Scalar division |
|
Division by symbolic scalar |
|
Matrix addition assignment |
|
Matrix subtraction assignment |
|
Scalar multiplication assignment |
|
Symbolic scalar multiplication assignment |
|
Scalar division assignment |
|
Symbolic scalar division assignment |
Free Functions¶
Method |
Description |
|---|---|
|
Scalar times matrix |
|
Symbolic scalar times matrix |
|
Matrix negation |
|
Vector-matrix multiplication (row vector) |
|
Outer product of two vectors |
Value Operations¶
Method |
Description |
|---|---|
|
Set numeric values from row-major array |
Differentiation (diff)¶
Basic Differentiation¶
Method |
Description |
|---|---|
|
Compute derivative of scalar expression |
|
Compute derivative with caching |
Gradient Computation¶
Method |
Description |
|---|---|
|
Gradient of scalar w.r.t. vector of variables |
|
Gradient computation with caching |
|
Jacobian of vector w.r.t. variables |
|
Jacobian computation with caching |
Hessian Computation¶
Method |
Description |
|---|---|
|
Hessian matrix of scalar expression |
|
Hessian computation with caching |
Combined Operations¶
Method |
Description |
|---|---|
|
Compute both value and gradient |
|
Value and gradient with caching |
|
Compute value, gradient, and Hessian |
|
All three with caching |