56 template <
typename T,
unsigned Dim>
58 unsigned int i)
const {
63 template <
typename T,
unsigned Dim>
70 template <
typename T,
unsigned Dim>
72 unsigned int i)
const {
82 template <
typename T,
unsigned Dim>
83 template <
typename E,
size_t N>
85 const detail::Expression<E, N>& expr) {
86 for (
unsigned int i = 0; i < Dim; ++i) {
92 template <
typename T,
unsigned Dim>
93 template <
typename E,
size_t N>
95 const detail::Expression<E, N>& expr) {
96 for (
unsigned int i = 0; i < Dim; ++i) {
102 template <
typename T,
unsigned Dim>
103 template <
typename E,
size_t N>
105 const detail::Expression<E, N>& expr) {
106 for (
unsigned int i = 0; i < Dim; ++i) {
107 data_m[i] -= expr[i];
112 template <
typename T,
unsigned Dim>
113 template <
typename E,
size_t N>
115 const detail::Expression<E, N>& expr) {
116 for (
unsigned int i = 0; i < Dim; ++i) {
117 data_m[i] *= expr[i];
122 template <
typename T,
unsigned Dim>
123 template <
typename E,
size_t N>
125 const detail::Expression<E, N>& expr) {
126 for (
unsigned int i = 0; i < Dim; ++i) {
127 data_m[i] /= expr[i];
132 template <
typename T,
unsigned Dim>
134 for (
unsigned int i = 0; i < Dim; ++i) {
140 template <
typename T,
unsigned Dim>
142 return this->operator+=(-val);
145 template <
typename T,
unsigned Dim>
147 for (
unsigned int i = 0; i < Dim; ++i) {
153 template <
typename T,
unsigned Dim>
155 return this->operator*=(T(1.0) / val);
158 template <
typename T,
unsigned Dim>
163 template <
typename T,
unsigned Dim>
168 template <
typename T,
unsigned Dim>
174 template <
typename T,
unsigned Dim>
175 KOKKOS_INLINE_FUNCTION
constexpr typename Vector<T, Dim>::const_iterator
Vector<T, Dim>::end()
180 template <
typename T,
unsigned Dim>
183 for (
unsigned i = 0; i < Dim; ++i) {
184 res += data_m[i] * rhs[i];
189 template <
typename T,
unsigned Dim>
193 for(
unsigned i = 0; i < Dim; ++i) {
194 val += Kokkos::pow(Kokkos::abs(data_m[i]), p);
197 return Kokkos::pow(val, T(1.0) / T(p));
200 template <
typename T,
unsigned Dim>
201 inline std::ostream& operator<<(std::ostream& out,
const Vector<T, Dim>& v) {
202 std::streamsize sw = out.width();
204 if constexpr (Dim > 1) {
206 for (
unsigned int i = 0; i < Dim - 1; i++) {
207 out << std::setw(sw) << v[i] <<
" , ";
209 out << std::setw(sw) << v[Dim - 1] <<
" )";
211 out <<
"( " << std::setw(sw) << v[0] <<
" )";
215 template <
typename T,
unsigned Dim>
219 for (
unsigned d = 0; d < Dim; d++) {
220 ret[d] = min(a[d], b[d]);
224 template <
typename T,
unsigned Dim>
228 for (
unsigned d = 0; d < Dim; d++) {
229 ret[d] = max(a[d], b[d]);