11template <arithmetic_or_complex ValueType, std::
size_t N>
17 using parent_type::operator();
30 static auto constexpr fill(ValueType
const& t) {
34 template <
typename RandEng = std::mt19937_64>
35 static auto constexpr randu(ValueType
min = 0, ValueType
max = 1,
36 RandEng&& eng = RandEng{std::random_device{}()}) {
40 template <
typename RandEng = std::mt19937_64>
41 static auto constexpr randn(ValueType mean = 0, ValueType stddev = 1,
42 RandEng&& eng = RandEng{std::random_device{}()}) {
46 constexpr vec() =
default;
48 constexpr vec(
vec&& other)
noexcept =
default;
54 template <
typename OtherTensor,
typename OtherReal>
58 template <
typename FillReal>
63 template <
typename RandomReal,
typename Engine>
64 requires is_arithmetic<ValueType>
68 template <arithmetic RandomReal,
typename Engine>
72 template <arithmetic RandomReal,
typename Engine>
73 requires is_arithmetic<ValueType>
77 template <arithmetic RandomReal,
typename Engine>
78 requires is_arithmetic<ValueType>
85 template <static_tensor Other>
86 requires (same_dimensions<this_type, Other>()) &&
90 this->
assign(std::forward<
decltype(other)>(other));
102 auto constexpr x() const -> auto const& requires(N >= 1) {
return at(0); }
104 auto constexpr x() ->
auto&
requires(N >= 1) {
return at(0); }
106 auto constexpr y() const -> auto const& requires(N >= 2) {
return at(1); }
108 auto constexpr xy() const requires(N >= 2) {
112 auto constexpr yx() const requires(N >= 2) {
116 auto constexpr y() ->
auto&
requires(N >= 2) {
return at(1); }
118 auto constexpr xyz() const requires(N >= 3) {
122 auto constexpr z() const -> auto const& requires(N >= 3) {
return at(2); }
124 auto constexpr z() ->
auto&
requires(N >= 3) {
return at(2); }
126 auto constexpr xyzw() const requires(N >= 3) {
130 auto constexpr w() const -> auto const& requires(N >= 4) {
return at(3); }
132 auto constexpr w() ->
auto&
requires(N >= 4) {
return at(3); }
137template <
typename ValueType, std::
size_t N>
142template <
typename ValueType, std::
size_t N>
147template <
typename ValueType, std::
size_t N>
152template <
typename... Ts>
155template <
typename V,
typename ValueType, std::
size_t N>
typename container_type::const_iterator const_iterator
Definition: cache.h:19
constexpr auto internal_container() -> auto &
Definition: static_multidim_array.h:253
Definition: concepts.h:33
Definition: concepts.h:39
Definition: algorithm.h:6
typename common_type_impl< Ts... >::type common_type
Definition: common_type.h:23
auto begin(Range &&range)
Definition: iterator_facade.h:318
typename value_type_impl< T >::type value_type
Definition: type_traits.h:280
auto end(Range &&range)
Definition: iterator_facade.h:322
constexpr auto max(A &&a, B &&b)
Definition: math.h:20
auto size(vec< ValueType, N > const &v)
Definition: vec.h:148
constexpr auto min(A &&a, B &&b)
Definition: math.h:15
Definition: base_tensor.h:23
auto constexpr assign(Other &&other) -> void
Definition: base_tensor.h:82
Definition: linspace.h:190
auto constexpr dimension() const
Definition: contracted_dynamic_tensor.h:36
auto constexpr at(integral auto const ... is) -> decltype(auto)
Definition: tensor.h:38
typename tensor_parent_type::value_type value_type
Definition: tensor.h:21
type_list_at< this_type, I > at
Definition: type_list.h:269
static auto constexpr ones()
Definition: vec.h:28
auto constexpr xyz() const
Definition: vec.h:118
auto constexpr xy() const
Definition: vec.h:108
auto begin() const
Definition: vec.h:96
constexpr vec(base_tensor< OtherTensor, OtherReal, N > const &other)
Definition: vec.h:55
constexpr vec(tag::zeros_t const zeros)
Definition: vec.h:62
auto constexpr xyzw() const
Definition: vec.h:126
constexpr vec(convertible_to< ValueType > auto &&... ts)
Definition: vec.h:50
vec< ValueType, N > this_type
Definition: vec.h:13
auto constexpr x() -> auto &requires(N >=1)
Definition: vec.h:104
auto constexpr x() const -> auto const &requires(N >=1)
Definition: vec.h:102
auto constexpr operator=(Other &&other) -> vec &
Definition: vec.h:89
constexpr vec(random::normal< RandomReal, Engine > &&rand)
Definition: vec.h:74
constexpr vec(tag::ones_t const ones)
Definition: vec.h:61
auto constexpr z() const -> auto const &requires(N >=3)
Definition: vec.h:122
auto constexpr z() -> auto &requires(N >=3)
Definition: vec.h:124
auto size() const
Definition: vec.h:100
static auto constexpr randn(ValueType mean=0, ValueType stddev=1, RandEng &&eng=RandEng{std::random_device{}()})
Definition: vec.h:41
auto constexpr y() const -> auto const &requires(N >=2)
Definition: vec.h:106
constexpr vec(tag::fill< FillReal > const f)
Definition: vec.h:60
constexpr vec(vec const &)=default
auto begin()
Definition: vec.h:97
constexpr vec(random::normal< RandomReal, Engine > &rand)
Definition: vec.h:79
auto constexpr operator=(vec const &) -> vec &=default
typename parent_type::array_parent_type::container_type::iterator iterator
Definition: vec.h:21
typename parent_type::array_parent_type::container_type::const_iterator const_iterator
Definition: vec.h:24
auto constexpr w() const -> auto const &requires(N >=4)
Definition: vec.h:130
auto constexpr operator=(vec &&other) noexcept -> vec &=default
constexpr vec(random::uniform< RandomReal, Engine > &rand)
Definition: vec.h:69
auto end() const
Definition: vec.h:98
static auto constexpr randu(ValueType min=0, ValueType max=1, RandEng &&eng=RandEng{std::random_device{}()})
Definition: vec.h:35
auto constexpr yx() const
Definition: vec.h:112
auto constexpr y() -> auto &requires(N >=2)
Definition: vec.h:116
static auto constexpr zeros()
Definition: vec.h:26
auto constexpr w() -> auto &requires(N >=4)
Definition: vec.h:132
constexpr vec(random::uniform< RandomReal, Engine > &&rand)
Definition: vec.h:65
auto end()
Definition: vec.h:99
constexpr vec(vec &&other) noexcept=default
static auto constexpr fill(ValueType const &t)
Definition: vec.h:30