leaspy.utils.linalg¶
Functions¶
|
Householder decomposition, adapted for a non-Euclidean inner product defined by: |
Module Contents¶
- compute_orthonormal_basis(dgamma_t0, G_metric, *, strip_col=0)[source]¶
Householder decomposition, adapted for a non-Euclidean inner product defined by: (1) \(< x, y >Metric(p) = < x, G(p) y >Eucl = xT G(p) y\), where: \(G(p)\) is the symmetric positive-definite (SPD) matrix defining the metric at point p.
The Euclidean case is the special case where G is the identity matrix. Product-metric is a special case where G(p) is a diagonal matrix (identified to a vector) whose components are all > 0.
It is used to compute and set in-place the
orthonormal_basisattribute given the time-derivative of the geodesic at initial time and the G_metric. The first component of the full orthonormal basis is a vector collinear G_metric x dgamma_t0 that we get rid of.The orthonormal basis we construct is always orthonormal for the Euclidean canonical inner product. But all (but first) vectors of it lie in the sub-space orthogonal (for canonical inner product) to G_metric * dgamma_t0 which is the same thing that being orthogonal to dgamma_t0 for the inner product implied by the metric.
[We could do otherwise if we’d like a full orthonormal basis, w.r.t. the non-Euclidean inner product. But it’d imply to compute G^(-1/2) & G^(1/2) which may be computationally costly in case we don’t have direct access to them (for the special case of product-metric it is easy - just the component-wise inverse (sqrt’ed) of diagonal) TODO are there any advantages/drawbacks of one method over the other except this one? TODO are there any biases between features when only considering Euclidean orthonormal basis?]
- Parameters:
- dgamma_t0
torch.FloatTensor1D Time-derivative of the geodesic at initial time. It may also be a vector collinear to it without any change to the result.
- G_metricscalar, torch.FloatTensor 0D, 1D or 2D-square
- The G(p) defining the metric as referred in equation (1) just before :
If 0D (scalar): G is proportional to the identity matrix
If 1D (vector): G is a diagonal matrix (diagonal components > 0)
If 2D (square matrix): G is general (SPD)
- strip_col
intin 0..model_dimension-1 (default 0) Which column of the basis should be the one collinear to dgamma_t0 (that we get rid of)
- dgamma_t0
- Returns:
- torch.Tensor of shape (dimension, dimension - 1)
- Raises:
LeaspyModelInputErrorif incoherent metric G_metric
- Parameters: