Stratax
Scientific computing containers and operations
Loading...
Searching...
No Matches
Creation.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
10
11namespace creation {
12
21template<typename T>
22requires Numeric<T>
27
36template<typename T>
37requires Numeric<T>
42
52template<typename T>
53requires Numeric<T>
55{
56 return stratax::container::Tensor<T>(shape, value);
57}
58
67template<typename T>
68requires Numeric<T>
70{
71 auto I = zeros<T>({size, size});
72 for (std::size_t i = 0; i < size; ++i)
73 {
74 I(i, i) = T{1};
75 }
76
77 return I;
78}
79
80}
Stores a list of dimension lengths for an array shape.
Definition Shape.hpp:20
Matches all scalar types supported by Stratax numeric containers.
Definition Concepts.hpp:152
stratax::container::Tensor< T > zeros(const stratax::core::Shape &shape)
Creates a tensor filled with zeros.
Definition Creation.hpp:23
stratax::container::Tensor< T > full(const stratax::core::Shape &shape, const T &value)
Creates a tensor filled with a constant value.
Definition Creation.hpp:54
stratax::container::Tensor< T > identity(const std::size_t size)
Creates a square identity tensor.
Definition Creation.hpp:69
stratax::container::Tensor< T > ones(const stratax::core::Shape &shape)
Creates a tensor filled with ones.
Definition Creation.hpp:38