Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify the Euclidean metric types #288

Open
sethaxen opened this issue Apr 19, 2022 · 0 comments
Open

Unify the Euclidean metric types #288

sethaxen opened this issue Apr 19, 2022 · 0 comments

Comments

@sethaxen
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant