1 core.matrices.MatrixVectorProduct

core.matrices.MatrixVectorProduct(matrix, vector)

Matrix-vector product: A @ x where A is a constant matrix.

This creates a VectorExpression where each element is a linear combination of the vector elements weighted by the corresponding matrix row.

1.1 Parameters

Name Type Description Default
matrix np.ndarray 2D NumPy array (constant coefficients). required
vector VectorVariable | VectorExpression VectorVariable or VectorExpression to multiply. required

1.2 Example

import numpy as np A = np.array([[1, 2], [3, 4]]) x = VectorVariable(“x”, 2) product = MatrixVectorProduct(A, x) product.evaluate({“x[0]”: 1, “x[1]”: 2}) [5.0, 11.0] # [11+22, 31+42]

1.3 Methods

Name Description
evaluate Evaluate the matrix-vector product.
get_variables Return all variables this expression depends on.

1.3.1 evaluate

core.matrices.MatrixVectorProduct.evaluate(values)

Evaluate the matrix-vector product.

1.3.2 get_variables

core.matrices.MatrixVectorProduct.get_variables()

Return all variables this expression depends on.