_Norm

it.grypho.scala.leonardo.matrix._Norm
case class _Norm(x: _Expression, order: NormOrder = ...) extends _Expression

norm(x) and norm(x, kind) (F_0039): a vector's or a matrix's norm.

The shape decides the reading (Decision A, MATLAB's rule, stated because the other reading exists): a row or a column is a vector — and so is a number, as a 1×1 — anything else a matrix. The default is the 2-norm either way, since the vector 2-norm and the spectral norm agree on a column, so the shape decides only what 1 and inf mean: the sum and the largest modulus of a vector, the largest column and row sum of a matrix.

  • A vector: 1, 2, inf, fro (the 2-norm) and any p ≥ 1; a p below 1 is not a norm and stays unevaluated. A complex entry counts by its modulus. In Double the 2- and p-norms are scaled by the largest modulus before they are raised, so [[1e200], [1e200]] is 1.414…1e200 rather than an overflow (the conditioning rule). Exact cells stay exact for 1 and inf; the 2-norm's root is taken at the working precision. Symbolic cells give sum(abs(xᵢ)) or (Σ abs(xᵢ)^p)^(1/p); their max-norm stays unevaluated, since a maximum of unknown magnitudes is not decidable.
  • A matrix: 1 and inf on numeric cells, exact on exact ones; fro as above; the 2-norm is the largest singular value through the SVD, never eigen(AᵀA), which squares the condition number (2.11) — an exact matrix is demoted for it, the svd precedent, and a complex one stays unevaluated. Any other p stays unevaluated.

A SCALAR result, like Determinant, so 1 + norm(x) is a number.

Value parameters

order

which norm

x

the vector or matrix

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait _Expression
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def children: List[_Expression]

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Sub-expressions subject to recursive structural traversal. Binder positions (e.g. the differentiation variable) are excluded.

Attributes

Definition Classes
override def eval(env: Environment): Either[_Expression, _Value]

Reduces this expression in the given environment.

Reduces this expression in the given environment.

Value parameters

env

variable bindings and display precision

Attributes

Returns

Right(v) when all free variables resolved to concrete values; Left(e) when reduction is partial or impossible

Definition Classes
override def rebuild(c: List[_Expression]): _Expression

Reconstructs the same node shape with replacement sub-expressions.

Reconstructs the same node shape with replacement sub-expressions.

Value parameters

newChildren

replacements in the same order and count as children

Attributes

Definition Classes
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Inherited fields

lazy val freeVars: Set[String]

Cached set of free variable names; O(1) after the first access.

Cached set of free variable names; O(1) after the first access.

Attributes

Inherited from:
_Expression