31 my_num_dim(num_dimensions), my_num_obs(num_observations), my_data(
data), my_long_num_dim(num_dimensions) {}
37 size_t my_long_num_dim;
43 typedef Data_ data_type;
45 typedef Index_ index_type;
47 typedef Dim_ dimension_type;
49 struct RandomAccessWorkspace{};
51 struct ConsecutiveAccessWorkspace {
52 ConsecutiveAccessWorkspace(index_type start) : at(start) {}
56 struct IndexedAccessWorkspace {
57 IndexedAccessWorkspace(
const index_type* sequence) : sequence(sequence) {}
58 const index_type* sequence;
63 Index_ num_observations()
const {
67 dimension_type num_dimensions()
const {
71 RandomAccessWorkspace create_workspace()
const {
72 return RandomAccessWorkspace();
75 ConsecutiveAccessWorkspace create_workspace(index_type start, index_type)
const {
76 return ConsecutiveAccessWorkspace(start);
79 IndexedAccessWorkspace create_workspace(
const index_type* sequence, index_type)
const {
80 return IndexedAccessWorkspace(sequence);
83 const data_type* get_observation(Index_ i, [[maybe_unused]] RandomAccessWorkspace& workspace)
const {
84 return my_data +
static_cast<size_t>(i) * my_long_num_dim;
87 const data_type* get_observation(ConsecutiveAccessWorkspace& workspace)
const {
88 return my_data + (workspace.at++) * my_long_num_dim;
91 const data_type* get_observation(IndexedAccessWorkspace& workspace)
const {
92 return my_data +
static_cast<size_t>(workspace.sequence[workspace.at++]) * my_long_num_dim;