Skip to content

[Usage]: Typed Linear Algebra: Interoperability with std::linalg and Eigen #775

@FrancoisCarouge

Description

@FrancoisCarouge

Organization Type

Individual Developer

Organization Name (Optional)

FrancoisCarouge/TypedLinearAlgebra

Primary Domain/Industry

Research & Development

Other Domain (if selected above)

No response

Project Stage

Research/Academic

Development Team Size

Small team (2-5)

Use Case Description

We use the mp-units facilities as one of the strong types in our typed linear algebra tests and samples. The usage demonstrates how the library composes the Eigen or std::linalg linear algebra backends with the level of safeties, ergonomics, and facilities of the mp-units library. [GitHub] [Slides]

Example with mp-units and Eigen:

state x{3. * m,
        2. * m / s,
        1. * m / s2};

std::println("{}", x * transposed(x));

// [[9 m²,    6 m²/s,  3 m²/s²],
//  [6 m²/s,  4 m²/s², 2 m²/s³],
//  [3 m²/s², 2 m²/s³, 1 m²/s⁴]]

Features Used

  • Basic quantity arithmetic (addition, subtraction, multiplication, division)
  • Unit conversions (m to km, s to h, etc.)
  • Dimensional analysis and compile-time validation
  • Custom units and dimensions
  • Quantity points
  • Text formatting and I/O
  • C++ modules support
  • Interoperability with other libraries
  • SI unit system
  • Other unit systems (CGS, Imperial, etc.)
  • Natural units
  • Freestanding mode

Key Benefits Experienced

  • The idiomatic, canonical, and modern standard C++ ergonomics implemented in the mp-units library made its discovery, learning, integration, usage, and troubleshooting an easy, even pleasant experience.
  • The compile-time dimensional analysis was instrumental in identifying implementation defects in the project.
  • The formatting, printing support worked, composed in the project out of the box.

Impact on Your Project

Very helpful - Significant improvements

Usage Permissions

  • You can use our testimonial in documentation and presentations
  • You can mention our organization name publicly

Metadata

Metadata

Assignees

Labels

usage experienceUsage experience story from our form

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions