MCPcopy Create free account
hub / github.com/pybind/pybind11 / f_strides

Function f_strides

include/pybind11/buffer_info.h:31–38  ·  view source on GitHub ↗

F-style strides; default when constructing an array_t with `ExtraFlags & f_style`

Source from the content-addressed store, hash-verified

29
30// F-style strides; default when constructing an array_t with `ExtraFlags & f_style`
31inline std::vector<ssize_t> f_strides(const std::vector<ssize_t> &shape, ssize_t itemsize) {
32 auto ndim = shape.size();
33 std::vector<ssize_t> strides(ndim, itemsize);
34 for (size_t i = 1; i < ndim; ++i) {
35 strides[i] = strides[i - 1] * shape[i - 1];
36 }
37 return strides;
38}
39
40template <typename T, typename SFINAE = void>
41struct compare_buffer_info;

Callers 1

array_tFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected