1 core.vectors.L1Norm
core.vectors.L1Norm(vector)L1 (Manhattan) norm of a vector: ||x||_1 = |x[0]| + |x[1]| + … + |x[n-1]|.
This is a scalar expression representing the sum of absolute values.
1.1 Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| vector | VectorVariable | VectorExpression | The vector to compute the norm of. | required |
1.2 Example
x = VectorVariable(“x”, 3) n = L1Norm(x) n.evaluate({“x[0]”: 1, “x[1]”: -2, “x[2]”: 3}) 6.0
1.3 Methods
| Name | Description |
|---|---|
| evaluate | Evaluate the L1 norm given variable values. |
| get_variables | Return all variables this expression depends on. |
1.3.1 evaluate
core.vectors.L1Norm.evaluate(values)Evaluate the L1 norm given variable values.
1.3.2 get_variables
core.vectors.L1Norm.get_variables()Return all variables this expression depends on.