Some funtioncs to work with metrics.
A metric matrix has form a^2/P!u per P!u
Example
define my_svd =
gsvd(my_metric_left, my_metric_right);
my_svd(A);
bilinear_form :: for_unit a, b, c, P!u, Q!v: for_index P, Q: (a/P!u per Q!v) -> (b*P!u, c*Q!v) -> a*b*c gsvd :: for_unit r, c, a, P!u, Q!v: for_index P, Q: (r^2/P!u per P!u, c^2/Q!v per Q!v) -> (a*P!u per Q!v) -> List(Tuple(a*r/c, P!u/r, c/Q!v)) identity_metric :: for_unit a, P!u: for_index P: (P!u/a) -> a^2/P!u per P!u metric_distance :: for_unit a, P!u, b: for_index P: (a^2/P!u per P!u) -> (b*P!u, b*P!u) -> a*b metric_norm :: for_unit a, b, P!u: for_index P: (a^2/P!u per P!u) -> (b*P!u) -> a*b
:: for_unit a, b, c, P!u, Q!v: for_index P, Q: (a/P!u per Q!v) -> (b*P!u, c*Q!v) -> a*b*c
Constructs a bilinear form from a metric matrix.
A bilinear form f satisfies
The bilinear form functions is defined as
f(v,w) = v^T '*' M '*' w
:: for_unit r, c, a, P!u, Q!v: for_index P, Q: (r^2/P!u per P!u, c^2/Q!v per Q!v) -> (a*P!u per Q!v) -> List(Tuple(a*r/c, P!u/r, c/Q!v))
Generalized Singular Value Decomposition.
Computes the generalized singular value decomposition of a matrix A with respect to two positive definite metric matrices.
The result is a list of tuples (s, u, v) where s are the generalized singular values, u are the left singular vectors and v are the right singular vectors.
The left singular vectors are orthogonal with respect to the first metric, and the right singular vectors are orthogonal with respect to the second metric.
Satisfies:
svd(A) = gsvd(identity_metric(row_unit(A)), identity_metric(column_unit(A)))(A)
:: for_unit a, P!u: for_index P: (P!u/a) -> a^2/P!u per P!u
A metric with ones on the diagonal and zeros everywhere else.
:: for_unit a, P!u, b: for_index P: (a^2/P!u per P!u) -> (b*P!u, b*P!u) -> a*b
Computes the distance between two vectors with respect to a given metric.
:: for_unit a, b, P!u: for_index P: (a^2/P!u per P!u) -> (b*P!u) -> a*b
Computes the norm of a vector with respect to a given metric.
Given some bilinear form f, the norm of a vector v is sqrt(f(v,v))
Version v0.6.0, 2026-03-05T15:49:24.033328491+01:00[Europe/Amsterdam]