Skip to content

Unify the Euclidean metric types #288

@sethaxen

Description

@sethaxen

We need 4 things from a Euclidean metric:

  • a size
  • left-multiplication by the metric M⁻¹
  • a quadratic form dot(v, M⁻¹, v)
  • left-division by W, such that W'*W == inv(M⁻¹)

Current this is handled by 3 different types:

  • UnitEuclideanMetric
  • DiagonalEuclideanMetric
  • DenseEuclideanMetric

However, a user may want to initialize with a diagonal metric adapt a dense metric or vice versa. Assuming we only support metrics for which an AbstractMatrix representation is available, it seems like it would be preferable to instead have a single EuclideanMetric type that stores the matrices M⁻¹ and W (UniformScaling for UnitEuclideanMetric) and then have the convenient aliases:

const ScalarEuclideanMetric = EuclideanMetric{<:UniformScaling}
const DiagonalEuclideanMetric = EuclideanMetric{<:Diagonal}

for dispatch.

This would also eliminate the need for a custom metric type whenever a user wants to use a different matrix type for the metric for which a more efficient W is available then the Cholesky factor, see e.g. #277, #282

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions