 |
NumCpp
1.0
A C++ implementation of the Python Numpy library
|
Go to the documentation of this file.
43 template<
typename dtype>
74 return cube_.at(inIndex);
86 return cube_.at(inIndex);
106 return cube_.begin();
116 return cube_.cbegin();
124 void dump(
const std::string& inFilename)
const
132 std::ofstream ofile(
f.fullName().c_str(), std::ios::binary);
138 for (
auto& ndarray : cube_)
140 ofile.write(
reinterpret_cast<const char*
>(ndarray.data()), ndarray.size() *
sizeof(dtype));
153 return cube_.empty();
183 return cube_.front();
193 return elementShape_;
203 return static_cast<uint32>(cube_.size());
231 if (elementShape_.
rows == 0 && elementShape_.
cols == 0)
234 elementShape_.
rows = inputShape.
rows;
235 elementShape_.
cols = inputShape.
cols;
238 if (inputShape != elementShape_)
243 cube_.push_back(inArray);
255 if (elementShape_.
rows == 0 && elementShape_.
cols == 0)
258 elementShape_.
rows = inputShape.
rows;
259 elementShape_.
cols = inputShape.
cols;
262 if (inputShape != elementShape_)
267 cube_.push_front(inArray);
279 return cube_[inIndex];
291 return cube_[inIndex];
296 std::deque<NdArray<dtype> > cube_{};
297 Shape elementShape_{ 0, 0 };
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4296
DataCube(uint32 inSize)
Definition: DataCube.hpp:61
iterator end() noexcept
Definition: DataCube.hpp:161
std::uint32_t uint32
Definition: Types.hpp:41
NdArray< dtype > & back() noexcept
Definition: DataCube.hpp:94
bool isempty() noexcept
Definition: DataCube.hpp:151
void dump(const std::string &inFilename) const
Definition: DataCube.hpp:124
void pop_front() noexcept
Definition: DataCube.hpp:217
A Shape Class for NdArrays.
Definition: Core/Shape.hpp:41
uint32 size() const noexcept
Definition: DataCube.hpp:201
NdArray< dtype > & front() noexcept
Definition: DataCube.hpp:181
typename std::deque< NdArray< dtype > >::const_iterator const_iterator
Definition: DataCube.hpp:49
const NdArray< dtype > & operator[](uint32 inIndex) const noexcept
Definition: DataCube.hpp:289
Convenience container for holding a uniform array of NdArrays.
Definition: DataCube.hpp:44
uint32 cols
Definition: Core/Shape.hpp:46
const NdArray< dtype > & at(uint32 inIndex) const
Definition: DataCube.hpp:84
const_iterator cend() const noexcept
Definition: DataCube.hpp:171
#define THROW_RUNTIME_ERROR(msg)
Definition: Error.hpp:38
const Shape & shape() const noexcept
Definition: DataCube.hpp:191
void push_front(const NdArray< dtype > &inArray)
Definition: DataCube.hpp:251
Definition: Coordinate.hpp:45
void push_back(const NdArray< dtype > &inArray)
Definition: DataCube.hpp:227
uint32 rows
Definition: Core/Shape.hpp:45
NdArray< dtype > & operator[](uint32 inIndex) noexcept
Definition: DataCube.hpp:277
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
typename std::deque< NdArray< dtype > >::iterator iterator
Definition: DataCube.hpp:48
dtype f(dtype inDofN, dtype inDofD)
Definition: f.hpp:58
const_iterator cbegin() const noexcept
Definition: DataCube.hpp:114
NdArray< dtype > & at(uint32 inIndex)
Definition: DataCube.hpp:72
Provides simple filesystem functions.
Definition: Filesystem.hpp:40
iterator begin() noexcept
Definition: DataCube.hpp:104
void pop_back() noexcept
Definition: DataCube.hpp:209