|
Stratax 0.3.1
|
Version: v0.2.0
Status: Complete
Header: include/stratax/algorithms/Creation.hpp
Creation.hpp provides convenience constructors for common tensor initialization patterns.
All helpers return owning Tensor<T> values and require T to satisfy Numeric.
The creation module is responsible for:
The creation module is not responsible for:
Vector or Matrix containersDepends on:
include/stratax/core/dtypes/Concepts.hppinclude/stratax/containers/Tensor.hppinclude/stratax/core/Shape.hppThe following conditions are always true:
stratax::container::Tensor<T>.zeros, ones, and full preserve the input shape exactly.identity(size) returns a rank-2 square tensor with shape (size, size).T{1} and off-diagonal entries are T{}.Creates a tensor filled with T{}.
Creates a tensor filled with T{1}.
Creates a tensor filled with value.
Creates a square identity tensor.
Throws
Tensor| Operation | Complexity |
|---|---|
zeros / ones / full | O(n + r) |
identity(size) | O(size^2) |
n is element count and r is rank.
Keeping these helpers in a small creation namespace provides concise call sites without adding policy complexity to container constructors.
arrange, linspace, random initialization) when needed