libpressio 0.93.0
Loading...
Searching...
No Matches
pressio_data.h
Go to the documentation of this file.
1#include <stddef.h>
2#include <stdbool.h>
3#include "pressio_dtype.h"
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
9#ifndef LIBPRESSIO_DATA_H
10#define LIBPRESSIO_DATA_H
11
16struct pressio_data;
17
26typedef void (*pressio_data_delete_fn)(void* data, void* metadata);
27
33void pressio_data_libc_free_fn (void* data, void* metadata);
34
43struct pressio_data* pressio_data_new_nonowning(const enum pressio_dtype dtype, void* data, size_t const num_dimensions, size_t const dimensions[]);
44
60struct pressio_data* pressio_data_new_copy(const enum pressio_dtype dtype, void* src, size_t const num_dimensions, size_t const dimensions[]);
70struct pressio_data* pressio_data_new_owning(const enum pressio_dtype dtype, size_t const num_dimensions, size_t const dimensions[]);
80struct pressio_data* pressio_data_new_empty(const enum pressio_dtype dtype, size_t const num_dimensions, size_t const dimensions[]);
81
95 size_t const dimensions[], pressio_data_delete_fn deleter, void* metadata);
96
105
111
117void* pressio_data_copy(struct pressio_data const* data, size_t* out_bytes);
118
126void* pressio_data_ptr(struct pressio_data const* data, size_t* out_bytes);
127
148 const size_t* start,
149 const size_t* stride,
150 const size_t* count,
151 const size_t* block);
152
164struct pressio_data* pressio_data_transpose(struct pressio_data const* data, const size_t* axis);
165
179 size_t const num_dimensions,
180 size_t const dimensions[]
181 );
182
204size_t pressio_data_get_dimension(struct pressio_data const* data, size_t const dimension);
205
212
219
226
227#endif
228
229#ifdef __cplusplus
230}
231#endif
size_t pressio_data_get_dimension(struct pressio_data const *data, size_t const dimension)
struct pressio_data * pressio_data_new_owning(const enum pressio_dtype dtype, size_t const num_dimensions, size_t const dimensions[])
int pressio_data_reshape(struct pressio_data *data, size_t const num_dimensions, size_t const dimensions[])
void pressio_data_free(struct pressio_data *data)
struct pressio_data * pressio_data_new_empty(const enum pressio_dtype dtype, size_t const num_dimensions, size_t const dimensions[])
enum pressio_dtype pressio_data_dtype(struct pressio_data const *data)
struct pressio_data * pressio_data_new_nonowning(const enum pressio_dtype dtype, void *data, size_t const num_dimensions, size_t const dimensions[])
bool pressio_data_has_data(struct pressio_data const *data)
struct pressio_data * pressio_data_cast(const struct pressio_data *data, const enum pressio_dtype dtype)
void * pressio_data_copy(struct pressio_data const *data, size_t *out_bytes)
void pressio_data_libc_free_fn(void *data, void *metadata)
size_t pressio_data_num_elements(struct pressio_data const *data)
void(* pressio_data_delete_fn)(void *data, void *metadata)
Definition: pressio_data.h:26
struct pressio_data * pressio_data_select(struct pressio_data const *data, const size_t *start, const size_t *stride, const size_t *count, const size_t *block)
struct pressio_data * pressio_data_new_copy(const enum pressio_dtype dtype, void *src, size_t const num_dimensions, size_t const dimensions[])
size_t pressio_data_get_capacity_in_bytes(struct pressio_data const *data)
size_t pressio_data_num_dimensions(struct pressio_data const *data)
void * pressio_data_ptr(struct pressio_data const *data, size_t *out_bytes)
struct pressio_data * pressio_data_transpose(struct pressio_data const *data, const size_t *axis)
size_t pressio_data_get_bytes(struct pressio_data const *data)
struct pressio_data * pressio_data_new_move(const enum pressio_dtype dtype, void *data, size_t const num_dimensions, size_t const dimensions[], pressio_data_delete_fn deleter, void *metadata)
struct pressio_data * pressio_data_new_clone(const struct pressio_data *src)
Information on types used by libpressio.
pressio_dtype
Definition: pressio_dtype.h:16
Definition: data.h:52
void * data() const
Definition: data.h:327
pressio_dtype dtype() const
Definition: data.h:341
size_t num_dimensions() const
Definition: data.h:360
std::vector< size_t > const & dimensions() const
Definition: data.h:367