Skip to content

Generalize Mat×Vec operator* to support mixed scalar types#9

Merged
csparker247 merged 6 commits intodevelopfrom
generalize-mat-vec
Mar 20, 2026
Merged

Generalize Mat×Vec operator* to support mixed scalar types#9
csparker247 merged 6 commits intodevelopfrom
generalize-mat-vec

Conversation

@csparker247
Copy link
Member

@csparker247 csparker247 commented Aug 25, 2025

The matrix-vector operator* was overly generic, accepting any Vector type, which obscured intent and prevented mixed-type scalar multiplication.

Changes

  • Mat.hpp: Replace unconstrained Vector template parameter with explicit Vec<T2, N>, returning Vec<T1, N> (matrix scalar type). Enables multiplying a Mat<M,N,T1> by a Vec<T2,N> with differing scalar types.
    // Now supported:
    Mat<4, 4, double> m{...};
    Vec<float, 4> v{...};
    auto result = m * v;  // Vec<double, 4>
  • Mat.hpp: Remove spurious trailing semicolon from default constructor.
  • String.hpp: Take structured binding by const& in split() range loop to avoid unnecessary copies.

@csparker247 csparker247 marked this pull request as draft August 25, 2025 13:22
@csparker247 csparker247 changed the title Generalize mat vec Generalize Mat×Vec operator* to support mixed scalar types Mar 20, 2026
@csparker247 csparker247 marked this pull request as ready for review March 20, 2026 23:44
@educelab educelab deleted a comment from Copilot AI Mar 20, 2026
@csparker247 csparker247 merged commit 1252163 into develop Mar 20, 2026
5 checks passed
@csparker247 csparker247 deleted the generalize-mat-vec branch March 20, 2026 23:49
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

Successfully merging this pull request may close these issues.

1 participant