Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Why no Dependent Matrix Type?

Дата публикации: 08-10-2026 11:21:07


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

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Type erasure and dyn lifetime in a NonNull/Box struct field08.5504-10-2026
2Trait object with associated types in field - requires generic param?011.0807-10-2026
3Array initialization post declaration016.7906-10-2026
4Arena's and alignment07.304-10-2026
5Strategies for dyn trait objects with optional behavior?07.1206-10-2026
6Why is f32/f64::sqrt not const?022.7206-10-2026
7Optimization of inlined functions returning Result?07.3606-10-2026
8Calling static C++ method from Rust09.9404-10-2026
9Does my lockfree stack impl look correct?06.0605-10-2026
10Are there wait-free priority queue crates?016.0905-10-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 5.16. Источник: users.rust-lang.org.