MiniTensor Version of the Day
Loading...
Searching...
No Matches
MiniTensor_Vector.h
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MiniTensor Package
4//
5// Copyright 2016 NTESS and the MiniTensor contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#if !defined(MiniTensor_Vector_h)
11#define MiniTensor_Vector_h
12
13#include <algorithm>
14#include <cassert>
15#include <iomanip>
16#include <iostream>
17#include <vector>
18#include <Kokkos_Core.hpp>
20
21namespace minitensor {
22
25
29template<typename T, Index N>
31
35template<typename T, Index N = DYNAMIC>
36class Vector: public TensorBase<T, vector_store<T, N>>
37{
38public:
39
43 static constexpr
44 Index
45 ORDER = 1;
46
50 static constexpr
51 bool
53
58
63 static constexpr
64 Index
66 {
67 return ORDER;
68 }
69
73 explicit
76
81 explicit
83 Vector(Index const dimension);
84
89 explicit
91 Vector(Filler const value);
92
98 explicit
100 Vector(Index const dimension, Filler const value);
101
108 template<class ArrayT>
111 Source const source,
112 ArrayT & data,
113 Index index1);
114
122 template<class ArrayT>
125 Source const source,
126 ArrayT & data,
127 Index index1,
128 Index index2);
129
138 template<class ArrayT>
141 Source const source,
142 ArrayT & data,
143 Index index1,
144 Index index2,
145 Index index3);
146
156 template<class ArrayT>
159 Source const source,
160 ArrayT & data,
161 Index index1,
162 Index index2,
163 Index index3,
164 Index index4);
165
176 template<class ArrayT>
179 Source const source,
180 ArrayT & data,
181 Index index1,
182 Index index2,
183 Index index3,
184 Index index4,
185 Index index5);
186
198 template<class ArrayT>
201 Source const source,
202 ArrayT & data,
203 Index index1,
204 Index index2,
205 Index index3,
206 Index index4,
207 Index index5,
208 Index index6);
209
217 template<class ArrayT>
220 Source const source,
221 Index const dimension,
222 ArrayT & data,
223 Index index1);
224
233 template<class ArrayT>
236 Source const source,
237 Index const dimension,
238 ArrayT & data,
239 Index index1,
240 Index index2);
241
251 template<class ArrayT>
254 Source const source,
255 Index const dimension,
256 ArrayT & data,
257 Index index1,
258 Index index2,
259 Index index3);
260
271 template<class ArrayT>
274 Source const source,
275 Index const dimension,
276 ArrayT & data,
277 Index index1,
278 Index index2,
279 Index index3,
280 Index index4);
281
293 template<class ArrayT>
296 Source const source,
297 Index const dimension,
298 ArrayT & data,
299 Index index1,
300 Index index2,
301 Index index3,
302 Index index4,
303 Index index5);
304
317 template<class ArrayT>
320 Source const source,
321 Index const dimension,
322 ArrayT & data,
323 Index index1,
324 Index index2,
325 Index index3,
326 Index index4,
327 Index index5,
328 Index index6);
329
335 Vector(T const * data_ptr);
336
343 Vector(Index const dimension, T const * data_ptr);
344
350
357 Vector(T const & s0, T const & s1);
358
367 Vector(T const & s0, T const & s1, T const & s2);
368
372 virtual
375
381 T const &
382 operator()(Index const i) const;
383
389 T &
391
397 T const &
398 operator()(Index const i, Index const) const;
399
405 T &
406 operator()(Index const i, Index const);
407
412 Index
414
419 Index
421
426 Index
428
433 void
434 set_dimension(Index const dimension);
435
436};
437
442template<typename S, typename T, Index N>
445operator+(Vector<S, N> const & u, Vector<T, N> const & v);
446
451template<typename S, typename T, Index N>
454operator-(Vector<S, N> const & u, Vector<T, N> const & v);
455
460template<typename T, Index N>
463operator-(Vector<T, N> const & u);
464
469template<typename S, typename T, Index N>
471typename Promote<S, T>::type
472operator*(Vector<S, N> const & u, Vector<T, N> const & v);
473
478template<typename T, Index N>
480bool
481operator==(Vector<T, N> const & u, Vector<T, N> const & v);
482
487template<typename T, Index N>
489bool
490operator!=(Vector<T, N> const & u, Vector<T, N> const & v);
491
498template<typename S, typename T, Index N>
500typename lazy_disable_if<order_1234<S>, apply_vector<Promote<S, T>, N>>::type
501operator*(S const & s, Vector<T, N> const & u);
502
509template<typename S, typename T, Index N>
511typename lazy_disable_if<order_1234<S>, apply_vector<Promote<S, T>, N>>::type
512operator*(Vector<T, N> const & u, S const & s);
513
520template<typename S, typename T, Index N>
523operator/(Vector<T, N> const & u, S const & s);
524
531template<typename S, typename T, Index N>
534operator/(S const & s, Vector<T, N> const & u);
535
540template<typename S, typename T, Index N>
542typename Promote<S, T>::type
543dot(Vector<S, N> const & u, Vector<T, N> const & v);
544
550template<typename S, typename T, Index N>
553cross(Vector<S, N> const & u, Vector<T, N> const & v);
554
559template<typename T, Index N>
561T
562norm(Vector<T, N> const & u);
563
568template<typename T, Index N>
570T
571norm_square(Vector<T, N> const & u);
572
577template<typename T, Index N>
579T
580norm_1(Vector<T, N> const & u);
581
586template<typename T, Index N>
588T
589norm_infinity(Vector<T, N> const & u);
590
594template<typename T, Index N>
597unit(Vector<T, N> const & u);
598
605template<typename T, Index N>
606std::pair<Vector<T, N>, T>
607house(Vector<T, N> const & x);
608
615template<typename T, Index N>
616std::istream &
617operator>>(std::istream & is, Vector<T, N> & u);
618
625template<typename T, Index N>
626std::ostream &
627operator<<(std::ostream & os, Vector<T, N> const & u);
628
629} // namespace minitensor
630
631
632namespace minitensor
633{
634
635//
636// Default constructor
637//
638template<typename T, Index N>
642{
643 set_dimension(N);
644 return;
645}
646
647//
648// Constructor that initializes to NaNs
649//
650template<typename T, Index N>
652Vector<T, N>::Vector(Index const dimension) :
653 TensorBase<T, Store>::TensorBase(dimension, ORDER)
654{
655 return;
656}
657
658//
659// Create vector from a specified value
660//
661template<typename T, Index N>
663Vector<T, N>::Vector(Index const dimension, Filler const value) :
664 TensorBase<T, Store>::TensorBase(dimension, ORDER, value)
665{
666 return;
667}
668
669template<typename T, Index N>
672 TensorBase<T, Store>::TensorBase(N, ORDER, value)
673{
674 return;
675}
676
677//
678// Create vector from array
679//
680template<typename T, Index N>
681template<class ArrayT>
684 Source const,
685 ArrayT & data,
686 Index index1) :
687 TensorBase<T, Store>::TensorBase(N, ORDER, data, index1)
688{
689 return;
690}
691
692template<typename T, Index N>
693template<class ArrayT>
696 Source const,
697 ArrayT & data,
698 Index index1,
699 Index index2) :
700 TensorBase<T, Store>::TensorBase(N, ORDER, data, index1, index2)
701{
702 return;
703}
704
705template<typename T, Index N>
706template<class ArrayT>
709 Source const,
710 ArrayT & data,
711 Index index1,
712 Index index2,
713 Index index3) :
714 TensorBase<T, Store>::TensorBase(N, ORDER, data, index1, index2, index3)
715{
716 return;
717}
718
719template<typename T, Index N>
720template<class ArrayT>
723 Source const,
724 ArrayT & data,
725 Index index1,
726 Index index2,
727 Index index3,
728 Index index4) :
730 N,
731 ORDER,
732 data,
733 index1,
734 index2,
735 index3,
736 index4)
737{
738 return;
739}
740
741template<typename T, Index N>
742template<class ArrayT>
745 Source const,
746 ArrayT & data,
747 Index index1,
748 Index index2,
749 Index index3,
750 Index index4,
751 Index index5) :
753 N,
754 ORDER,
755 data,
756 index1,
757 index2,
758 index3,
759 index4,
760 index5)
761{
762 return;
763}
764
765template<typename T, Index N>
766template<class ArrayT>
769 Source const,
770 ArrayT & data,
771 Index index1,
772 Index index2,
773 Index index3,
774 Index index4,
775 Index index5,
776 Index index6) :
778 N,
779 ORDER,
780 data,
781 index1,
782 index2,
783 index3,
784 index4,
785 index5,
786 index6)
787{
788 return;
789}
790
791template<typename T, Index N>
792template<class ArrayT>
795 Source const,
796 Index const dimension,
797 ArrayT & data,
798 Index index1) :
799 TensorBase<T, Store>::TensorBase(dimension, ORDER, data, index1)
800{
801 return;
802}
803
804template<typename T, Index N>
805template<class ArrayT>
808 Source const,
809 Index const dimension,
810 ArrayT & data,
811 Index index1,
812 Index index2) :
813 TensorBase<T, Store>::TensorBase(dimension, ORDER, data, index1, index2)
814{
815 return;
816}
817
818template<typename T, Index N>
819template<class ArrayT>
822 Source const,
823 Index const dimension,
824 ArrayT & data,
825 Index index1,
826 Index index2,
827 Index index3) :
829 dimension,
830 ORDER,
831 data,
832 index1,
833 index2,
834 index3)
835{
836 return;
837}
838
839template<typename T, Index N>
840template<class ArrayT>
843 Source const,
844 Index const dimension,
845 ArrayT & data,
846 Index index1,
847 Index index2,
848 Index index3,
849 Index index4) :
851 dimension,
852 ORDER,
853 data,
854 index1,
855 index2,
856 index3,
857 index4)
858{
859 return;
860}
861
862template<typename T, Index N>
863template<class ArrayT>
866 Source const,
867 Index const dimension,
868 ArrayT & data,
869 Index index1,
870 Index index2,
871 Index index3,
872 Index index4,
873 Index index5) :
875 dimension,
876 ORDER,
877 data,
878 index1,
879 index2,
880 index3,
881 index4,
882 index5)
883{
884 return;
885}
886
887template<typename T, Index N>
888template<class ArrayT>
891 Source const,
892 Index const dimension,
893 ArrayT & data,
894 Index index1,
895 Index index2,
896 Index index3,
897 Index index4,
898 Index index5,
899 Index index6) :
901 dimension,
902 ORDER,
903 data,
904 index1,
905 index2,
906 index3,
907 index4,
908 index5,
909 index6)
910{
911 return;
912}
913
914
915template<typename T, Index N>
917Vector<T, N>::Vector(Index const dimension, T const * data_ptr) :
918 TensorBase<T, Store>::TensorBase(dimension, ORDER, data_ptr)
919{
920 return;
921}
922
923template<typename T, Index N>
925Vector<T, N>::Vector(T const * data_ptr) :
926 TensorBase<T, Store>::TensorBase(N, ORDER, data_ptr)
927{
928 return;
929}
930
931//
932// Copy constructor
933//
934template<typename T, Index N>
938{
939 return;
940}
941
942//
943// Create vector specifying components
944//
945template<typename T, Index N>
947Vector<T, N>::Vector(T const & s0, T const & s1)
948{
949 Vector <T, N> &
950 self = (*this);
951
952 self.set_dimension(2);
953
954 self[0] = s0;
955 self[1] = s1;
956
957 return;
958}
959
960//
961// Create vector specifying components
962//
963template<typename T, Index N>
965Vector<T, N>::Vector(T const & s0, T const & s1, T const & s2)
966{
967 Vector <T, N> &
968 self = (*this);
969
970 self.set_dimension(3);
971
972 self[0] = s0;
973 self[1] = s1;
974 self[2] = s2;
975
976 return;
977}
978
979//
980// Simple destructor
981//
982template<typename T, Index N>
985{
986 return;
987}
988
989//
990// Get dimension
991//
992template<typename T, Index N>
994Index
999
1000//
1001// Get number rows
1002//
1003template<typename T, Index N>
1005Index
1007{
1008 return get_dimension();
1009}
1010
1011//
1012// Get number columns
1013//
1014template<typename T, Index N>
1016Index
1018{
1019 return static_cast<Index>(1);
1020}
1021
1022//
1023// Set dimension
1024//
1025template<typename T, Index N>
1027void
1029{
1030 TensorBase<T, Store>::set_dimension(dimension, ORDER);
1031 return;
1032}
1033
1034//
1035// Indexing for constant vector
1036//
1037template<typename T, Index N>
1039T const &
1041{
1042 return (*this)[i];
1043}
1044
1045//
1046// Indexing for vector
1047//
1048template<typename T, Index N>
1050T &
1052{
1053 return (*this)[i];
1054}
1055
1056//
1057// Indexing for constant vector (convenience)
1058//
1059template<typename T, Index N>
1061T const &
1063{
1064 return (*this)[i];
1065}
1066
1067//
1068// Indexing for vector (convenience)
1069//
1070template<typename T, Index N>
1072T &
1074{
1075 return (*this)[i];
1076}
1077
1078//
1079// Vector addition
1080//
1081template<typename S, typename T, Index N>
1085{
1087 w(u.get_dimension());
1088
1089 add(u, v, w);
1090
1091 return w;
1092}
1093
1094//
1095// Vector subtraction
1096//
1097template<typename S, typename T, Index N>
1099Vector<typename Promote<S, T>::type, N>
1101{
1103 w(u.get_dimension());
1104
1105 subtract(u, v, w);
1106
1107 return w;
1108}
1109
1110//
1111// Vector minus
1112//
1113template<typename T, Index N>
1115Vector<T, N>
1117{
1119 v(u.get_dimension());
1120
1121 minus(u, v);
1122
1123 return v;
1124}
1125
1126//
1127// Vector dot product
1128//
1129template<typename S, typename T, Index N>
1131typename Promote<S, T>::type
1133{
1134 return dot(u, v);
1135}
1136
1137//
1138// Vector equality tested by components
1139//
1140template<typename T, Index N>
1142
1143bool
1145{
1146 return equal(u, v);
1147}
1148
1149//
1150// Vector inequality tested by components
1151//
1152template<typename T, Index N>
1154
1155bool
1157{
1158 return not_equal(u, v);
1159}
1160
1161//
1162// Scalar vector product
1163//
1164template<typename S, typename T, Index N>
1166typename
1167lazy_disable_if<order_1234<S>, apply_vector<Promote<S, T>, N>>::type
1168operator*(S const & s, Vector<T, N> const & u)
1169{
1171 v(u.get_dimension());
1172
1173 scale(u, s, v);
1174
1175 return v;
1176}
1177
1178//
1179// Vector scalar product
1180//
1181template<typename S, typename T, Index N>
1183typename
1184lazy_disable_if<order_1234<S>, apply_vector<Promote<S, T>, N>>::type
1185operator*(Vector<T, N> const & u, S const & s)
1186{
1188 v(u.get_dimension());
1189
1190 scale(u, s, v);
1191
1192 return v;
1193}
1194
1195//
1196// Vector scalar division
1197//
1198template<typename S, typename T, Index N>
1200Vector<typename Promote<S, T>::type, N>
1201operator/(Vector<T, N> const & u, S const & s)
1202{
1204 v(u.get_dimension());
1205
1206 divide(u, s, v);
1207
1208 return v;
1209}
1210
1211//
1212// Scalar vector division
1213//
1214template<typename S, typename T, Index N>
1216Vector<typename Promote<S, T>::type, N>
1217operator/(S const & s, Vector<T, N> const & u)
1218{
1220 v(u.get_dimension());
1221
1222 split(u, s, v);
1223
1224 return v;
1225}
1226
1227//
1228// Vector dot product
1229//
1230template<typename S, typename T, Index N>
1232typename Promote<S, T>::type
1233dot(Vector<S, N> const & u, Vector<T, N> const & v)
1234{
1235 Index const
1236 dimension = u.get_dimension();
1237
1238 assert(v.get_dimension() == dimension);
1239
1240 typename Promote<S, T>::type
1241 s = 0.0;
1242
1243 switch (dimension) {
1244
1245 default:
1246 for (Index i = 0; i < dimension; ++i) {
1247 s += u(i) * v(i);
1248 }
1249 break;
1250
1251 case 3:
1252 s = u(0) * v(0) + u(1) * v(1) + u(2) * v(2);
1253 break;
1254
1255 case 2:
1256 s = u(0) * v(0) + u(1) * v(1);
1257 break;
1258
1259 }
1260
1261 return s;
1262}
1263
1264//
1265// Cross product only valid for R^3.
1266//
1267template<typename S, typename T, Index N>
1269Vector<typename Promote<S, T>::type, N>
1270cross(Vector<S, N> const & u, Vector<T, N> const & v)
1271{
1272 Index const
1273 dimension = u.get_dimension();
1274
1275 assert(v.get_dimension() == dimension);
1276
1278 w(dimension);
1279
1280 switch (dimension) {
1281
1282 case 3:
1283 w(0) = u(1) * v(2) - u(2) * v(1);
1284 w(1) = u(2) * v(0) - u(0) * v(2);
1285 w(2) = u(0) * v(1) - u(1) * v(0);
1286 break;
1287
1288 default:
1289 MT_ERROR_EXIT("Cross product defined for 3D only.");
1290 break;
1291
1292 }
1293
1294 return w;
1295}
1296
1297//
1298// R^N vector 2-norm
1299// \return \f$ \sqrt{u \cdot u} \f$
1300//
1301template<typename T, Index N>
1303T
1305{
1306 T const
1307 s = norm_square(u);
1308
1309 if (s > 0.0) return std::sqrt(s);
1310
1311 return 0.0;
1312}
1313
1314//
1315// R^N vector 2-norm square for fast distance calculations.
1316// \return \f$ u \cdot u \f$
1317//
1318template<typename T, Index N>
1320T
1322{
1323 Index const
1324 dimension = u.get_dimension();
1325
1326 T
1327 s = 0.0;
1328
1329 switch (dimension) {
1330
1331 default:
1332 s = dot(u, u);
1333 break;
1334
1335 case 3:
1336 s = u(0) * u(0) + u(1) * u(1) + u(2) * u(2);
1337 break;
1338
1339 case 2:
1340 s = u(0) * u(0) + u(1) * u(1);
1341 break;
1342
1343 }
1344
1345 return s;
1346}
1347
1348//
1349// R^N vector 1-norm
1350// \return \f$ \sum_i |u_i| \f$
1351//
1352template<typename T, Index N>
1354T
1356{
1357 Index const
1358 dimension = u.get_dimension();
1359
1360 T
1361 s = 0.0;
1362
1363 switch (dimension) {
1364
1365 default:
1366 for (Index i = 0; i < dimension; ++i) {
1367 s += std::abs(u(i));
1368 }
1369 break;
1370
1371 case 3:
1372 s = std::abs(u(0)) + std::abs(u(1)) + std::abs(u(2));
1373 break;
1374
1375 case 2:
1376 s = std::abs(u(0)) + std::abs(u(1));
1377 break;
1378 }
1379
1380 return s;
1381}
1382
1383//
1384// R^N vector infinity-norm
1385// \return \f$ \max(|u_0|,...|u_i|,...|u_N|) \f$
1386//
1387template<typename T, Index N>
1389T
1391{
1392 Index const
1393 dimension = u.get_dimension();
1394
1395 T
1396 s = 0.0;
1397
1398 switch (dimension) {
1399
1400 default:
1401 for (Index i = 0; i < dimension; ++i) {
1402 s = max(minitensor::abs(u(i)), s);
1403 }
1404 break;
1405
1406 case 3:
1407 s = max(max(minitensor::abs(u(0)), minitensor::abs(u(1))), minitensor::abs(u(2)));
1408 break;
1409
1410 case 2:
1411 s = max(minitensor::abs(u(0)), minitensor::abs(u(1)));
1412 break;
1413 }
1414
1415 return s;
1416}
1417
1418//
1419// \return u / |u|, fails for |u| = 0
1420//
1421template<typename T, Index N>
1423Vector<T, N>
1425{
1426 return u / norm(u);
1427}
1428
1429//
1430// Compute Householder vector
1431//
1432template <typename T, Index N>
1433std::pair<Vector<T, N>, T> house(Vector<T, N> const &x) {
1435 v = x;
1436
1437 v[0] = 1.0;
1438
1439 Index const
1440 dimension = x.get_dimension();
1441
1442 T
1443 sigma = 0.0;
1444
1445 for (Index i = 1; i < dimension; ++i) {
1446 sigma = v[i] * v[i];
1447 }
1448
1449 T
1450 beta = 0.0;
1451
1452 if (sigma > 0.0) {
1453 T const
1454 mu = std::sqrt(x[0] * x[0] + sigma);
1455 v[0] = x[0] > 0.0 ? -sigma / (x[0] + mu) : x[0] - mu;
1456 beta = 2.0 * v[0] * v[0] / (sigma + v[0] * v[0]);
1457 v = v / v[0];
1458 }
1459
1460 return std::make_pair(v, beta);
1461}
1462
1463} // namespace minitensor
1464namespace minitensor {
1465
1466//
1467// R^N vector input
1468// \param u vector
1469// \param is input stream
1470// \return is input stream
1471//
1472template<typename T, Index N>
1473std::istream &
1474operator>>(std::istream & is, Vector<T, N> & u)
1475{
1476 Index const
1477 dimension = u.get_dimension();
1478
1479 for (Index i = 0; i < dimension; ++i) {
1480 is >> u(i);
1481 }
1482
1483 return is;
1484}
1485
1486//
1487// R^N vector output
1488// \param u vector
1489// \param os output stream
1490// \return os output stream
1491//
1492template<typename T, Index N>
1493std::ostream &
1494operator<<(std::ostream & os, Vector<T, N> const & u)
1495{
1496 Index const
1497 dimension = u.get_dimension();
1498
1499 if (dimension == 0) {
1500 return os;
1501 }
1502
1503 os << std::scientific << std::setprecision(17);
1504
1505 os << std::setw(24) << u(0);
1506
1507 for (Index i = 1; i < dimension; ++i) {
1508 os << "," << std::setw(24) << u(i);
1509 }
1510
1511 return os;
1512}
1513
1515} // namespace minitensor
1516
1517#endif //MiniTensor_Vector_h
#define KOKKOS_INLINE_FUNCTION
#define MT_ERROR_EXIT(...)
KOKKOS_INLINE_FUNCTION Vector(Source const source, Index const dimension, ArrayT &data, Index index1, Index index2, Index index3, Index index4, Index index5)
KOKKOS_INLINE_FUNCTION T const & operator()(Index const i) const
KOKKOS_INLINE_FUNCTION Vector(Source const source, ArrayT &data, Index index1, Index index2, Index index3, Index index4)
KOKKOS_INLINE_FUNCTION Matrix< typename Promote< S, T >::type, M, N > operator+(Matrix< S, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION void minus(TensorBase< T, ST > const &A, TensorBase< T, ST > &B)
static constexpr bool IS_DYNAMIC
KOKKOS_INLINE_FUNCTION Vector()
KOKKOS_INLINE_FUNCTION Index get_num_cols() const
KOKKOS_INLINE_FUNCTION Matrix< typename Promote< S, T >::type, M, N > operator-(Matrix< S, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION Vector(Index const dimension, Filler const value)
std::ostream & operator<<(std::ostream &os, Matrix< T, M, N > const &A)
KOKKOS_INLINE_FUNCTION void add(TensorBase< R, SR > const &A, TensorBase< S, SS > const &B, TensorBase< T, ST > &C)
KOKKOS_INLINE_FUNCTION Vector< typename Promote< S, T >::type, N > cross(Vector< S, N > const &u, Vector< T, N > const &v)
KOKKOS_INLINE_FUNCTION Vector(Source const source, Index const dimension, ArrayT &data, Index index1, Index index2, Index index3, Index index4, Index index5, Index index6)
std::istream & operator>>(std::istream &is, Matrix< T, M, N > &A)
KOKKOS_INLINE_FUNCTION Vector(T const &s0, T const &s1, T const &s2)
KOKKOS_INLINE_FUNCTION Matrix< typename Promote< S, T >::type, M, N > operator/(Matrix< T, M, N > const &A, S const &s)
KOKKOS_INLINE_FUNCTION Vector< typename Promote< S, T >::type, M > operator*(Matrix< T, M, N > const &A, Vector< S, N > const &u)
KOKKOS_INLINE_FUNCTION Index get_dimension() const
KOKKOS_INLINE_FUNCTION bool equal(TensorBase< T, ST > const &A, TensorBase< T, ST > const &B)
KOKKOS_INLINE_FUNCTION Index get_dimension(Index const order) const
KOKKOS_INLINE_FUNCTION void set_dimension(Index const dimension)
KOKKOS_INLINE_FUNCTION Vector(Source const source, ArrayT &data, Index index1, Index index2, Index index3)
KOKKOS_INLINE_FUNCTION Vector(Index const dimension)
KOKKOS_INLINE_FUNCTION Index get_num_rows() const
KOKKOS_INLINE_FUNCTION Vector(Source const source, ArrayT &data, Index index1)
KOKKOS_INLINE_FUNCTION void scale(TensorBase< R, SR > const &A, S const &s, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION bool operator!=(Matrix< T, M, N > const &A, Matrix< T, M, N > const &B)
std::pair< Vector< T, N >, T > house(Vector< T, N > const &x)
KOKKOS_INLINE_FUNCTION Vector(T const *data_ptr)
KOKKOS_INLINE_FUNCTION bool operator==(Matrix< T, M, N > const &A, Matrix< T, M, N > const &B)
KOKKOS_INLINE_FUNCTION Vector< typename Promote< S, T >::type, M > dot(Matrix< T, M, N > const &A, Vector< S, N > const &u)
KOKKOS_INLINE_FUNCTION Vector(Vector< T, N > const &v)
KOKKOS_INLINE_FUNCTION Vector(Index const dimension, T const *data_ptr)
KOKKOS_INLINE_FUNCTION Vector(Source const source, Index const dimension, ArrayT &data, Index index1)
static KOKKOS_INLINE_FUNCTION constexpr Index get_order()
KOKKOS_INLINE_FUNCTION Vector(Source const source, Index const dimension, ArrayT &data, Index index1, Index index2)
KOKKOS_INLINE_FUNCTION Vector(Filler const value)
KOKKOS_INLINE_FUNCTION void split(TensorBase< R, SR > const &A, S const &s, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION T & operator()(Index const i, Index const)
KOKKOS_INLINE_FUNCTION Vector(T const &s0, T const &s1)
KOKKOS_INLINE_FUNCTION T & operator()(Index const i)
static constexpr Index ORDER
KOKKOS_INLINE_FUNCTION Vector(Source const source, Index const dimension, ArrayT &data, Index index1, Index index2, Index index3, Index index4)
KOKKOS_INLINE_FUNCTION bool not_equal(TensorBase< T, ST > const &A, TensorBase< T, ST > const &B)
virtual KOKKOS_INLINE_FUNCTION ~Vector()
KOKKOS_INLINE_FUNCTION Vector(Source const source, ArrayT &data, Index index1, Index index2, Index index3, Index index4, Index index5)
KOKKOS_INLINE_FUNCTION void set_dimension(Index const dimension, Index const order)
KOKKOS_INLINE_FUNCTION T const & operator()(Index const i, Index const) const
KOKKOS_INLINE_FUNCTION Vector(Source const source, Index const dimension, ArrayT &data, Index index1, Index index2, Index index3)
KOKKOS_INLINE_FUNCTION T norm_square(Vector< T, N > const &u)
KOKKOS_INLINE_FUNCTION Vector(Source const source, ArrayT &data, Index index1, Index index2, Index index3, Index index4, Index index5, Index index6)
KOKKOS_INLINE_FUNCTION void divide(TensorBase< R, SR > const &A, S const &s, TensorBase< T, ST > &B)
KOKKOS_INLINE_FUNCTION Vector(Source const source, ArrayT &data, Index index1, Index index2)
KOKKOS_INLINE_FUNCTION void subtract(TensorBase< R, SR > const &A, TensorBase< S, SS > const &B, TensorBase< T, ST > &C)
KOKKOS_INLINE_FUNCTION T norm(Tensor< T, N > const &A)
KOKKOS_INLINE_FUNCTION T norm_1(Tensor< T, N > const &A)
KOKKOS_INLINE_FUNCTION T norm_infinity(Tensor< T, N > const &A)
KOKKOS_INLINE_FUNCTION Quaternion< T > unit(Quaternion< T > const &q)
uint32_t Index
Indexing type.
constexpr Index DYNAMIC
Indicator for dynamic storage.
KOKKOS_INLINE_FUNCTION T abs(T const &a)
KOKKOS_INLINE_FUNCTION T max(T const &a, T const &b)