Hello,
I don't really know how to really introduce this topic.
Background: I want to implement compile time safe matrix multiplication.
For that i want to have a struct with const generics for the number of columns and rows.
Then i want a function which takes two const generics and does the matrix multiplication.
The result would be a matrix with the different sizes.
So far so good i was able to implement this. One idea is sketched in this old post.
Now the caveat is that this works only at compile time and not at runtime.
1. Problem: currently for my thesis i am implementing a compiler and a library which transforms some DSL to a matrix. In my opinion it would be great if the library for matrixes has these const generics since this should remove many runtime dependencies. Are there any ideas on how to implement this?
2. Problem: I want to implement something like matrix concatenation. given two $n \times m$ and $n\times k$ matrix. the result of concatenation should be a $n \times m+k$ matrix. apparently this also does not work.
Any more inside into these dependent type problems in rust would be great.
I think from my point of view with safety in mind this should be inside the language.
4 posts - 3 participants
Read full topic
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Type erasure and dyn lifetime in a NonNull/Box struct field | 0 | 8.55 | 04-10-2026 |
| 2 | Trait object with associated types in field - requires generic param? | 0 | 11.08 | 07-10-2026 |
| 3 | Array initialization post declaration | 0 | 16.79 | 06-10-2026 |
| 4 | Arena's and alignment | 0 | 7.3 | 04-10-2026 |
| 5 | Strategies for dyn trait objects with optional behavior? | 0 | 7.12 | 06-10-2026 |
| 6 | Why is f32/f64::sqrt not const? | 0 | 22.72 | 06-10-2026 |
| 7 | Optimization of inlined functions returning Result? | 0 | 7.36 | 06-10-2026 |
| 8 | Calling static C++ method from Rust | 0 | 9.94 | 04-10-2026 |
| 9 | Does my lockfree stack impl look correct? | 0 | 6.06 | 05-10-2026 |
| 10 | Are there wait-free priority queue crates? | 0 | 16.09 | 05-10-2026 |