C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Interest in Linear Algebra functionality

From: LoS <aurumpuro_at_[hidden]>
Date: Thu, 20 Apr 2023 10:31:47 +0200
I really like your container definition:

template < class T, class Extents, class Layout, class AccessPolicy, class
Alloc >
class tensor;

The classic implementation of the std::deque container uses a dynamic-size
array of references pointing to fixed-size chunks, thus allowing for very
efficient reallocations and guaranteeing random access. Of course,
std::mdspan requires the memory it operates on to be a contiguous buffer,
so the above implementation must not be applied for the tensor container.
However, it would be possible to use a rearrangement: a dynamic-size array
of references indicates the start of single chunks within the same
contiguous buffer (so, for example, operations that require the swap of
rows and columns perform a simple swap of pointers to the underlying
array). There are no advantages in buffer reallocation and shrink
operations do not allow to free single parts of the buffer. Also, there are
several side effects in this implementation, so I would avoid using it.

Received on 2023-04-20 08:32:01