Commit Graph

5 Commits

Author SHA1 Message Date
Sébastien Crozet 711ac67da9 Deplecate Dynamic and Dynamic::new 2023-01-14 16:22:40 +01:00
Crozet Sébastien d17088398a Replace generic-array with a regular array based on min-const-generics. 2021-04-11 13:53:45 +02:00
Crozet Sébastien 8e483a5434 Fix reshaping test. 2020-10-25 16:31:10 +01:00
Crozet Sébastien 7af509ee8d Reformat the reshaping example. 2020-10-25 16:02:43 +01:00
Nathan Kent 4a6022d9bf Add methods for in-place reshaping of matrices
There are two major additions in this commit. The first is a new storage
trait, `ReshapableStorage`, that can be implemented for storage types
that can be reshaped in-place. I have implemented this for both the
`ArrayStorage` and `VecStorage` types, as they are the most common and
they are just interpretations of a flat list.

The second is a `Matrix::reshape_generic` method that allows matrices to
be in-place reshaped provided that the underlying storage can handle it.
In practice, this means that the standard matrix types (`MatrixMN` and
`DMatrix`) can be resized to any size that has the same element count.
Resizing between array and vector storage is not implemented due to
`Storage` only being implemented for `VecStorage` variants where at
least one dimension is `Dynamic`.

Additionally, only the generic reshape function is added as it can be a
basis for other reshaping functions (see the resizing functions) and I
am not particularly in the mood to implement a variety of reshaping
methods.
2020-10-25 15:37:18 +01:00