Blaze 3.9
Loading...
Searching...
No Matches
ZeroVector.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SPARSE_ZEROVECTOR_H_
36#define _BLAZE_MATH_SPARSE_ZEROVECTOR_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
48#include <blaze/math/Forward.h>
80#include <blaze/util/Assert.h>
85#include <blaze/util/EnableIf.h>
89#include <blaze/util/Types.h>
91
92
93namespace blaze {
94
95//=================================================================================================
96//
97// CLASS DEFINITION
98//
99//=================================================================================================
100
101//*************************************************************************************************
178template< typename Type // Data type of the vector
179 , bool TF // Transpose flag
180 , typename Tag > // Type tag
182 : public Expression< SparseVector< ZeroVector<Type,TF,Tag>, TF > >
183{
184 private:
185 //**Type definitions****************************************************************************
187 //**********************************************************************************************
188
189 public:
190 //**Type definitions****************************************************************************
193
196
199
201 using TagType = Tag;
202 using ReturnType = const Type&;
203
204 using CompositeType = const This&;
205 using Reference = const Type&;
206 using ConstReference = const Type&;
207 using Iterator = Element*;
208 using ConstIterator = const Element*;
209 //**********************************************************************************************
210
211 //**Rebind struct definition********************************************************************
214 template< typename NewType > // Data type of the other vector
218 //**********************************************************************************************
219
220 //**Resize struct definition********************************************************************
223 template< size_t NewN > // Number of elements of the other vector
224 struct Resize {
226 };
227 //**********************************************************************************************
228
229 //**Compilation flags***************************************************************************
231
234 static constexpr bool smpAssignable = !IsSMPAssignable_v<Type>;
235 //**********************************************************************************************
236
237 //**Constructors********************************************************************************
240 constexpr ZeroVector() noexcept;
241 explicit constexpr ZeroVector( size_t size ) noexcept;
242
243 template< typename VT > inline ZeroVector( const Vector<VT,TF>& v );
244
245 ZeroVector( const ZeroVector& ) = default;
246 ZeroVector( ZeroVector&& ) = default;
248 //**********************************************************************************************
249
250 //**Destructor**********************************************************************************
253 ~ZeroVector() = default;
255 //**********************************************************************************************
256
257 //**Data access functions***********************************************************************
260 constexpr ConstReference operator[]( size_t index ) const noexcept;
261 inline ConstReference at( size_t index ) const;
262 constexpr ConstIterator begin () const noexcept;
263 constexpr ConstIterator cbegin() const noexcept;
264 constexpr ConstIterator end () const noexcept;
265 constexpr ConstIterator cend () const noexcept;
267 //**********************************************************************************************
268
269 //**Assignment operators************************************************************************
272 template< typename VT >
273 inline ZeroVector& operator=( const Vector<VT,TF>& rhs ) &;
274
275 ZeroVector& operator=( const ZeroVector& ) & = default;
276 ZeroVector& operator=( ZeroVector&& ) & = default;
278 //**********************************************************************************************
279
280 //**Utility functions***************************************************************************
283 constexpr size_t size() const noexcept;
284 constexpr size_t capacity() const noexcept;
285 constexpr size_t nonZeros() const noexcept;
286 constexpr void clear() noexcept;
287 constexpr void resize( size_t n ) noexcept;
288 constexpr void swap( ZeroVector& v ) noexcept;
290 //**********************************************************************************************
291
292 //**Lookup functions****************************************************************************
295 inline ConstIterator find ( size_t index ) const;
296 inline ConstIterator lowerBound( size_t index ) const;
297 inline ConstIterator upperBound( size_t index ) const;
299 //**********************************************************************************************
300
301 //**Expression template evaluation functions****************************************************
304 template< typename Other > inline bool canAlias ( const Other* alias ) const noexcept;
305 template< typename Other > inline bool isAliased( const Other* alias ) const noexcept;
306
307 inline bool canSMPAssign() const noexcept;
309 //**********************************************************************************************
310
311 private:
312 //**Member variables****************************************************************************
315 size_t size_;
316
317 static const Type zero_;
319 //**********************************************************************************************
320
321 //**Compile time checks*************************************************************************
328 //**********************************************************************************************
329};
330//*************************************************************************************************
331
332
333
334
335//=================================================================================================
336//
337// DEFINITION AND INITIALIZATION OF THE STATIC MEMBER VARIABLES
338//
339//=================================================================================================
340
341template< typename Type // Data type of the vector
342 , bool TF // Transpose flag
343 , typename Tag > // Type tag
344const Type ZeroVector<Type,TF,Tag>::zero_{};
345
346
347
348
349//=================================================================================================
350//
351// CONSTRUCTORS
352//
353//=================================================================================================
354
355//*************************************************************************************************
358template< typename Type // Data type of the vector
359 , bool TF // Transpose flag
360 , typename Tag > // Type tag
362 : size_( 0UL ) // The current size/dimension of the zero vector
363{}
364//*************************************************************************************************
365
366
367//*************************************************************************************************
372template< typename Type // Data type of the vector
373 , bool TF // Transpose flag
374 , typename Tag > // Type tag
375constexpr ZeroVector<Type,TF,Tag>::ZeroVector( size_t n ) noexcept
376 : size_( n ) // The current size/dimension of the zero vector
377{}
378//*************************************************************************************************
379
380
381//*************************************************************************************************
390template< typename Type // Data type of the vector
391 , bool TF // Transpose flag
392 , typename Tag > // Type tag
393template< typename VT > // Type of the foreign zero vector
395 : size_( (*v).size() ) // The current size/dimension of the zero vector
396{
398
399 if( !IsZero_v<VT> && !isZero( *v ) ) {
400 BLAZE_THROW_INVALID_ARGUMENT( "Invalid setup of zero vector" );
401 }
402}
403//*************************************************************************************************
404
405
406
407
408//=================================================================================================
409//
410// DATA ACCESS FUNCTIONS
411//
412//=================================================================================================
413
414//*************************************************************************************************
420template< typename Type // Data type of the vector
421 , bool TF // Transpose flag
422 , typename Tag > // Type tag
424 ZeroVector<Type,TF,Tag>::operator[]( size_t index ) const noexcept
425{
426 MAYBE_UNUSED( index );
427
428 BLAZE_USER_ASSERT( index < size(), "Invalid zero vector access index" );
429
430 return zero_;
431}
432//*************************************************************************************************
433
434
435//*************************************************************************************************
445template< typename Type // Data type of the vector
446 , bool TF // Transpose flag
447 , typename Tag > // Type tag
449 ZeroVector<Type,TF,Tag>::at( size_t index ) const
450{
451 if( index >= size_ ) {
452 BLAZE_THROW_OUT_OF_RANGE( "Invalid zero vector access index" );
453 }
454
455 return zero_;
456}
457//*************************************************************************************************
458
459
460//*************************************************************************************************
465template< typename Type // Data type of the vector
466 , bool TF // Transpose flag
467 , typename Tag > // Type tag
470{
471 return nullptr;
472}
473//*************************************************************************************************
474
475
476//*************************************************************************************************
481template< typename Type // Data type of the vector
482 , bool TF // Transpose flag
483 , typename Tag > // Type tag
486{
487 return nullptr;
488}
489//*************************************************************************************************
490
491
492//*************************************************************************************************
497template< typename Type // Data type of the vector
498 , bool TF // Transpose flag
499 , typename Tag > // Type tag
502{
503 return nullptr;
504}
505//*************************************************************************************************
506
507
508//*************************************************************************************************
513template< typename Type // Data type of the vector
514 , bool TF // Transpose flag
515 , typename Tag > // Type tag
518{
519 return nullptr;
520}
521//*************************************************************************************************
522
523
524
525
526//=================================================================================================
527//
528// ASSIGNMENT OPERATORS
529//
530//=================================================================================================
531
532//*************************************************************************************************
542template< typename Type // Data type of the vector
543 , bool TF // Transpose flag
544 , typename Tag > // Type tag
545template< typename VT > // Type of the right-hand side dense vector
547 ZeroVector<Type,TF,Tag>::operator=( const Vector<VT,TF>& rhs ) &
548{
550
551 if( !IsZero_v<VT> && !isZero( *rhs ) ) {
552 BLAZE_THROW_INVALID_ARGUMENT( "Invalid assignment of zero vector" );
553 }
554
555 size_ = (*rhs).size();
556
557 return *this;
558}
559//*************************************************************************************************
560
561
562
563
564//=================================================================================================
565//
566// UTILITY FUNCTIONS
567//
568//=================================================================================================
569
570//*************************************************************************************************
575template< typename Type // Data type of the vector
576 , bool TF // Transpose flag
577 , typename Tag > // Type tag
578constexpr size_t ZeroVector<Type,TF,Tag>::size() const noexcept
579{
580 return size_;
581}
582//*************************************************************************************************
583
584
585//*************************************************************************************************
590template< typename Type // Data type of the vector
591 , bool TF // Transpose flag
592 , typename Tag > // Type tag
593constexpr size_t ZeroVector<Type,TF,Tag>::capacity() const noexcept
594{
595 return 0UL;
596}
597//*************************************************************************************************
598
599
600//*************************************************************************************************
608template< typename Type // Data type of the vector
609 , bool TF // Transpose flag
610 , typename Tag > // Type tag
611constexpr size_t ZeroVector<Type,TF,Tag>::nonZeros() const noexcept
612{
613 return 0UL;
614}
615//*************************************************************************************************
616
617
618//*************************************************************************************************
625template< typename Type // Data type of the vector
626 , bool TF // Transpose flag
627 , typename Tag > // Type tag
628constexpr void ZeroVector<Type,TF,Tag>::clear() noexcept
629{
630 size_ = 0UL;
631}
632//*************************************************************************************************
633
634
635//*************************************************************************************************
645template< typename Type // Data type of the vector
646 , bool TF // Transpose flag
647 , typename Tag > // Type tag
648constexpr void ZeroVector<Type,TF,Tag>::resize( size_t n ) noexcept
649{
650 size_ = n;
651}
652//*************************************************************************************************
653
654
655//*************************************************************************************************
661template< typename Type // Data type of the vector
662 , bool TF // Transpose flag
663 , typename Tag > // Type tag
664constexpr void ZeroVector<Type,TF,Tag>::swap( ZeroVector& v ) noexcept
665{
666 const size_t tmp( size_ );
667 size_ = v.size_;
668 v.size_ = tmp;
669}
670//*************************************************************************************************
671
672
673
674
675//=================================================================================================
676//
677// LOOKUP FUNCTIONS
678//
679//=================================================================================================
680
681//*************************************************************************************************
692template< typename Type // Data type of the vector
693 , bool TF // Transpose flag
694 , typename Tag > // Type tag
696 ZeroVector<Type,TF,Tag>::find( size_t index ) const
697{
698 MAYBE_UNUSED( index );
699
700 BLAZE_USER_ASSERT( index < size(), "Invalid zero vector access index" );
701
702 return nullptr;
703}
704//*************************************************************************************************
705
706
707//*************************************************************************************************
717template< typename Type // Data type of the vector
718 , bool TF // Transpose flag
719 , typename Tag > // Type tag
722{
723 MAYBE_UNUSED( index );
724
725 BLAZE_USER_ASSERT( index < size(), "Invalid zero vector access index" );
726
727 return nullptr;
728}
729//*************************************************************************************************
730
731
732//*************************************************************************************************
742template< typename Type // Data type of the vector
743 , bool TF // Transpose flag
744 , typename Tag > // Type tag
747{
748 MAYBE_UNUSED( index );
749
750 BLAZE_USER_ASSERT( index < size(), "Invalid zero vector access index" );
751
752 return nullptr;
753}
754//*************************************************************************************************
755
756
757
758
759//=================================================================================================
760//
761// EXPRESSION TEMPLATE EVALUATION FUNCTIONS
762//
763//=================================================================================================
764
765//*************************************************************************************************
775template< typename Type // Data type of the vector
776 , bool TF // Transpose flag
777 , typename Tag > // Type tag
778template< typename Other > // Data type of the foreign expression
779inline bool ZeroVector<Type,TF,Tag>::canAlias( const Other* alias ) const noexcept
780{
781 MAYBE_UNUSED( alias );
782
783 return false;
784}
785//*************************************************************************************************
786
787
788//*************************************************************************************************
798template< typename Type // Data type of the vector
799 , bool TF // Transpose flag
800 , typename Tag > // Type tag
801template< typename Other > // Data type of the foreign expression
802inline bool ZeroVector<Type,TF,Tag>::isAliased( const Other* alias ) const noexcept
803{
804 MAYBE_UNUSED( alias );
805
806 return false;
807}
808//*************************************************************************************************
809
810
811//*************************************************************************************************
821template< typename Type // Data type of the vector
822 , bool TF // Transpose flag
823 , typename Tag > // Type tag
824inline bool ZeroVector<Type,TF,Tag>::canSMPAssign() const noexcept
825{
826 return false;
827}
828//*************************************************************************************************
829
830
831
832
833
834
835
836
837//=================================================================================================
838//
839// ZEROVECTOR OPERATORS
840//
841//=================================================================================================
842
843//*************************************************************************************************
846template< RelaxationFlag RF, typename Type, bool TF, typename Tag >
847constexpr bool isDefault( const ZeroVector<Type,TF,Tag>& v ) noexcept;
848
849template< typename Type, bool TF, typename Tag >
850constexpr bool isIntact( const ZeroVector<Type,TF,Tag>& v ) noexcept;
851
852template< typename Type, bool TF, typename Tag >
853constexpr void swap( ZeroVector<Type,TF,Tag>& a, ZeroVector<Type,TF,Tag>& b ) noexcept;
855//*************************************************************************************************
856
857
858//*************************************************************************************************
882template< RelaxationFlag RF // Relaxation flag
883 , typename Type // Data type of the vector
884 , bool TF // Transpose flag
885 , typename Tag > // Type tag
886constexpr bool isDefault( const ZeroVector<Type,TF,Tag>& v ) noexcept
887{
888 return ( v.size() == 0UL );
889}
890//*************************************************************************************************
891
892
893//*************************************************************************************************
910template< typename Type // Data type of the vector
911 , bool TF // Transpose flag
912 , typename Tag > // Type tag
913constexpr bool isIntact( const ZeroVector<Type,TF,Tag>& v ) noexcept
914{
915 MAYBE_UNUSED( v );
916
917 return true;
918}
919//*************************************************************************************************
920
921
922//*************************************************************************************************
930template< typename Type // Data type of the vector
931 , bool TF // Transpose flag
932 , typename Tag > // Type tag
933constexpr void swap( ZeroVector<Type,TF,Tag>& a, ZeroVector<Type,TF,Tag>& b ) noexcept
934{
935 a.swap( b );
936}
937//*************************************************************************************************
938
939
940//*************************************************************************************************
949template< typename Type // Data type of the vector
950 , bool TF // Transpose flag
951 , typename Tag > // Type tag
952inline void erase( ZeroVector<Type,TF,Tag>& v, size_t index )
953{
954 MAYBE_UNUSED( v, index );
955}
957//*************************************************************************************************
958
959
960//*************************************************************************************************
971template< typename Type // Data type of the vector
972 , bool TF // Transpose flag
973 , typename Tag // Type tag
974 , typename Iterator > // Type of the vector iterator
975inline Iterator erase( ZeroVector<Type,TF,Tag>& v, Iterator pos )
976{
977 MAYBE_UNUSED( v, pos );
978
979 return nullptr;
980}
982//*************************************************************************************************
983
984
985//*************************************************************************************************
997template< typename Type // Data type of the vector
998 , bool TF // Transpose flag
999 , typename Tag // Type tag
1000 , typename Iterator > // Type of the vector iterator
1001inline Iterator erase( ZeroVector<Type,TF,Tag>& m, Iterator first, Iterator last )
1002{
1003 MAYBE_UNUSED( m, first, last );
1004
1005 return nullptr;
1006}
1008//*************************************************************************************************
1009
1010
1011//*************************************************************************************************
1035template< typename Type // Data type of the vector
1036 , bool TF // Transpose flag
1037 , typename Tag // Type tag
1038 , typename Pred > // Type of the unary predicate
1039inline void erase( ZeroVector<Type,TF,Tag>& v, Pred predicate )
1040{
1041 MAYBE_UNUSED( v, predicate );
1042}
1044//*************************************************************************************************
1045
1046
1047//*************************************************************************************************
1073template< typename Type // Data type of the vector
1074 , bool TF // Transpose flag
1075 , typename Tag // Type tag
1076 , typename Iterator // Type of the vector iterator
1077 , typename Pred > // Type of the unary predicate
1078inline void erase( ZeroVector<Type,TF,Tag>& m, Iterator first, Iterator last, Pred predicate )
1079{
1080 MAYBE_UNUSED( m, first, last, predicate );
1081}
1083//*************************************************************************************************
1084
1085
1086
1087
1088//=================================================================================================
1089//
1090// GLOBAL FUNCTIONS
1091//
1092//=================================================================================================
1093
1094//*************************************************************************************************
1120template< typename T, bool TF = defaultTransposeFlag >
1121constexpr decltype(auto) zero( size_t n ) noexcept
1122{
1123 return ZeroVector<T,TF>( n );
1124}
1125//*************************************************************************************************
1126
1127
1128//*************************************************************************************************
1144template< typename VT // Type of the vector
1145 , bool TF > // Transpose flag
1146inline ZeroVector<ElementType_t<VT>,TF>
1148{
1150
1151 return ZeroVector<ElementType_t<VT>,TF>( (*v).size() );
1152}
1153//*************************************************************************************************
1154
1155
1156
1157
1158//=================================================================================================
1159//
1160// ISUNIFORM SPECIALIZATIONS
1161//
1162//=================================================================================================
1163
1164//*************************************************************************************************
1166template< typename Type, bool TF, typename Tag >
1167struct IsUniform< ZeroVector<Type,TF,Tag> >
1168 : public TrueType
1169{};
1171//*************************************************************************************************
1172
1173
1174
1175
1176//=================================================================================================
1177//
1178// ISZERO SPECIALIZATIONS
1179//
1180//=================================================================================================
1181
1182//*************************************************************************************************
1184template< typename Type, bool TF, typename Tag >
1185struct IsZero< ZeroVector<Type,TF,Tag> >
1186 : public TrueType
1187{};
1189//*************************************************************************************************
1190
1191
1192
1193
1194//=================================================================================================
1195//
1196// ADDTRAIT SPECIALIZATIONS
1197//
1198//=================================================================================================
1199
1200//*************************************************************************************************
1202template< typename T1, typename T2 >
1203struct AddTraitEval1< T1, T2
1204 , EnableIf_t< IsVector_v<T1> &&
1207{
1209};
1210
1211template< typename T1, typename T2 >
1212struct AddTraitEval1< T1, T2
1213 , EnableIf_t< IsVector_v<T1> &&
1216{
1218};
1219
1220template< typename T1, typename T2 >
1221struct AddTraitEval1< T1, T2
1222 , EnableIf_t< IsVector_v<T1> &&
1225{
1229};
1231//*************************************************************************************************
1232
1233
1234
1235
1236//=================================================================================================
1237//
1238// SUBTRAIT SPECIALIZATIONS
1239//
1240//=================================================================================================
1241
1242//*************************************************************************************************
1244template< typename T1, typename T2 >
1245struct SubTraitEval1< T1, T2
1246 , EnableIf_t< IsVector_v<T1> &&
1249{
1251};
1252
1253template< typename T1, typename T2 >
1254struct SubTraitEval1< T1, T2
1255 , EnableIf_t< IsVector_v<T1> &&
1258{
1260};
1261
1262template< typename T1, typename T2 >
1263struct SubTraitEval1< T1, T2
1264 , EnableIf_t< IsVector_v<T1> &&
1267{
1271};
1273//*************************************************************************************************
1274
1275
1276
1277
1278//=================================================================================================
1279//
1280// MULTTRAIT SPECIALIZATIONS
1281//
1282//=================================================================================================
1283
1284//*************************************************************************************************
1286template< typename T1, typename T2 >
1287struct MultTraitEval1< T1, T2
1288 , EnableIf_t< IsVector_v<T1> &&
1290 IsZero_v<T1> > >
1291{
1295};
1296
1297template< typename T1, typename T2 >
1298struct MultTraitEval1< T1, T2
1299 , EnableIf_t< IsScalar_v<T1> &&
1301 IsZero_v<T2> > >
1302{
1306};
1307
1308template< typename T1, typename T2 >
1309struct MultTraitEval1< T1, T2
1310 , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
1312 ( IsZero_v<T1> || IsZero_v<T2> ) > >
1313{
1317};
1318
1319template< typename T1, typename T2 >
1320struct MultTraitEval1< T1, T2
1321 , EnableIf_t< IsMatrix_v<T1> &&
1323 ( IsZero_v<T1> || IsZero_v<T2> ) > >
1324{
1326 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
1327
1329 , false
1331};
1332
1333template< typename T1, typename T2 >
1334struct MultTraitEval1< T1, T2
1335 , EnableIf_t< IsRowVector_v<T1> &&
1337 ( IsZero_v<T1> || IsZero_v<T2> ) > >
1338{
1340 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
1341
1343 , true
1345};
1347//*************************************************************************************************
1348
1349
1350
1351
1352//=================================================================================================
1353//
1354// KRONTRAIT SPECIALIZATIONS
1355//
1356//=================================================================================================
1357
1358//*************************************************************************************************
1360template< typename T1, typename T2 >
1361struct KronTraitEval1< T1, T2
1362 , EnableIf_t< IsVector_v<T1> &&
1364 ( IsZero_v<T1> ||
1365 IsZero_v<T2> ) > >
1366{
1370};
1372//*************************************************************************************************
1373
1374
1375
1376
1377//=================================================================================================
1378//
1379// DIVTRAIT SPECIALIZATIONS
1380//
1381//=================================================================================================
1382
1383//*************************************************************************************************
1385template< typename T1, typename T2 >
1386struct DivTraitEval1< T1, T2
1387 , EnableIf_t< IsVector_v<T1> &&
1389 IsZero_v<T1> > >
1390{
1393 , DivTrait_t< TagType_t<T1>, T2 > >;
1394};
1395
1396template< typename T1, typename T2 >
1397struct DivTraitEval1< T1, T2
1398 , EnableIf_t< ( ( IsRowVector_v<T1> && IsRowVector_v<T2> ) ||
1400 ( IsZero_v<T1> || IsZero_v<T2> ) > >
1401{
1405};
1407//*************************************************************************************************
1408
1409
1410
1411
1412//=================================================================================================
1413//
1414// CROSSTRAIT SPECIALIZATIONS
1415//
1416//=================================================================================================
1417
1418//*************************************************************************************************
1420template< typename T1, typename T2 >
1421struct CrossTraitEval1< T1, T2
1422 , EnableIf_t< IsVector_v<T1> &&
1424 ( IsZero_v<T1> || IsZero_v<T2> ) > >
1425{
1427 using MultTag = MultTrait_t< TagType_t<T1>, TagType_t<T2> >;
1428
1432};
1434//*************************************************************************************************
1435
1436
1437
1438
1439//=================================================================================================
1440//
1441// MAPTRAIT SPECIALIZATIONS
1442//
1443//=================================================================================================
1444
1445//*************************************************************************************************
1447template< typename T, typename OP >
1448struct UnaryMapTraitEval1< T, OP
1449 , EnableIf_t< IsVector_v<T> &&
1451{
1452 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
1453
1456 , MapTrait_t< TagType_t<T>, OP > >;
1457};
1459//*************************************************************************************************
1460
1461
1462//*************************************************************************************************
1464template< typename T1, typename T2, typename OP >
1465struct BinaryMapTraitEval1< T1, T2, OP
1466 , EnableIf_t< IsVector_v<T1> &&
1469{
1470 using ElementType = decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
1471 , std::declval< ElementType_t<T2> >() ) );
1472
1476};
1478//*************************************************************************************************
1479
1480
1481
1482
1483//=================================================================================================
1484//
1485// REPEATTRAIT SPECIALIZATIONS
1486//
1487//=================================================================================================
1488
1489//*************************************************************************************************
1491template< typename T, size_t R0 >
1492struct RepeatTraitEval1< T, R0, inf, inf
1493 , EnableIf_t< IsVector_v<T> &&
1494 IsZero_v<T> > >
1495{
1498 , TagType_t<T> >;
1499};
1501//*************************************************************************************************
1502
1503
1504
1505
1506//=================================================================================================
1507//
1508// HIGHTYPE SPECIALIZATIONS
1509//
1510//=================================================================================================
1511
1512//*************************************************************************************************
1514template< typename T1, bool TF, typename Tag, typename T2 >
1515struct HighType< ZeroVector<T1,TF,Tag>, ZeroVector<T2,TF,Tag> >
1516{
1517 using Type = ZeroVector< typename HighType<T1,T2>::Type, TF, Tag >;
1518};
1520//*************************************************************************************************
1521
1522
1523
1524
1525//=================================================================================================
1526//
1527// LOWTYPE SPECIALIZATIONS
1528//
1529//=================================================================================================
1530
1531//*************************************************************************************************
1533template< typename T1, bool TF, typename Tag, typename T2 >
1534struct LowType< ZeroVector<T1,TF,Tag>, ZeroVector<T2,TF,Tag> >
1535{
1536 using Type = ZeroVector< typename LowType<T1,T2>::Type, TF, Tag >;
1537};
1539//*************************************************************************************************
1540
1541
1542
1543
1544//=================================================================================================
1545//
1546// SUBVECTORTRAIT SPECIALIZATIONS
1547//
1548//=================================================================================================
1549
1550//*************************************************************************************************
1552template< typename VT, size_t I, size_t N >
1553struct SubvectorTraitEval1< VT, I, N
1554 , EnableIf_t< IsZero_v<VT> > >
1555{
1556 using Type = ZeroVector< RemoveConst_t< ElementType_t<VT> >
1557 , TransposeFlag_v<VT>
1558 , TagType_t<VT> >;
1559};
1561//*************************************************************************************************
1562
1563
1564
1565
1566//=================================================================================================
1567//
1568// ELEMENTSTRAIT SPECIALIZATIONS
1569//
1570//=================================================================================================
1571
1572//*************************************************************************************************
1574template< typename VT, size_t N >
1575struct ElementsTraitEval1< VT, N
1576 , EnableIf_t< IsZero_v<VT> > >
1577{
1578 using Type = ZeroVector< RemoveConst_t< ElementType_t<VT> >
1579 , TransposeFlag_v<VT>
1580 , TagType_t<VT> >;
1581};
1583//*************************************************************************************************
1584
1585
1586
1587
1588//=================================================================================================
1589//
1590// ROWTRAIT SPECIALIZATIONS
1591//
1592//=================================================================================================
1593
1594//*************************************************************************************************
1596template< typename MT, size_t I >
1597struct RowTraitEval1< MT, I
1598 , EnableIf_t< IsZero_v<MT> > >
1599{
1600 using Type = ZeroVector< RemoveConst_t< ElementType_t<MT> >
1601 , true
1602 , TagType_t<MT> >;
1603};
1605//*************************************************************************************************
1606
1607
1608
1609
1610//=================================================================================================
1611//
1612// COLUMNTRAIT SPECIALIZATIONS
1613//
1614//=================================================================================================
1615
1616//*************************************************************************************************
1618template< typename MT, size_t I >
1619struct ColumnTraitEval1< MT, I
1620 , EnableIf_t< IsZero_v<MT> > >
1621{
1622 using Type = ZeroVector< RemoveConst_t< ElementType_t<MT> >
1623 , false
1624 , TagType_t<MT> >;
1625};
1627//*************************************************************************************************
1628
1629
1630
1631
1632//=================================================================================================
1633//
1634// BANDTRAIT SPECIALIZATIONS
1635//
1636//=================================================================================================
1637
1638//*************************************************************************************************
1640template< typename MT, ptrdiff_t I >
1641struct BandTraitEval1< MT, I
1642 , EnableIf_t< IsZero_v<MT> > >
1643{
1644 using Type = ZeroVector< RemoveConst_t< ElementType_t<MT> >
1646 , TagType_t<MT> >;
1647};
1649//*************************************************************************************************
1650
1651} // namespace blaze
1652
1653#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename T1::template Rebind< T2 >::Other Rebind_t
Alias declaration for nested Rebind class templates.
Definition Aliases.h:350
typename ResultType_t< T >::TagType TagType_t
Alias declaration for nested TagType type definitions.
Definition Aliases.h:530
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
Header file for run time assertion macros.
Header file for the band trait.
Header file for the column trait.
Constraint on the data type.
Header file for the cross product trait.
Header file for the division trait.
Header file for the elements trait.
Header file for the EnableIf class template.
Header file for the EvaluateTrait class template.
Header file for the function trace functionality.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Header file for the IsColumnVector type trait.
Header file for the IsMatrix type trait.
Header file for the IsRowVector type trait.
Header file for the IsSMPAssignable type trait.
Header file for the IsScalar type trait.
Header file for the IsUniform type trait.
Header file for the IsVector type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Header file for the map trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Constraint on the data type.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Header file for the RemoveConst type trait.
Header file for the repeat trait.
Header file for the row trait.
Data type constraint.
Header file for the subtraction trait.
Header file for the subvector trait.
Header file for the ValueIndexPair class.
Constraint on the data type.
Header file for the YieldsZero type trait.
Index-value-pair for sparse vectors and matrices.
Definition ValueIndexPair.h:75
Base class for N-dimensional vectors.
Definition Vector.h:82
Efficient implementation of an arbitrary sized zero vector.
Definition ZeroVector.h:183
ConstIterator upperBound(size_t index) const
ConstIterator find(size_t index) const
ZeroVector< Type,!TF, Tag > TransposeType
Transpose type for expression template evaluations.
Definition ZeroVector.h:198
constexpr ConstIterator begin() const noexcept
const Type & ReturnType
Definition ZeroVector.h:202
constexpr void resize(size_t n) noexcept
constexpr size_t capacity() const noexcept
Element * Iterator
Definition ZeroVector.h:207
constexpr ConstReference operator[](size_t index) const noexcept
Subscript operator for the direct access to the zero vector elements.
Definition ZeroVector.h:424
Type ElementType
Definition ZeroVector.h:200
constexpr ZeroVector() noexcept
The default constructor for ZeroVector.
Definition ZeroVector.h:361
constexpr size_t nonZeros() const noexcept
const Element * ConstIterator
Definition ZeroVector.h:208
constexpr size_t size() const noexcept
constexpr ConstIterator cbegin() const noexcept
ConstIterator lowerBound(size_t index) const
bool canSMPAssign() const noexcept
const This & CompositeType
Definition ZeroVector.h:204
constexpr void swap(ZeroVector &v) noexcept
Tag TagType
Definition ZeroVector.h:201
ZeroVector< Type, TF, Tag > This
Type of this ZeroVector instance.
Definition ZeroVector.h:191
constexpr ConstIterator cend() const noexcept
constexpr ConstIterator end() const noexcept
static const Type zero_
Definition ZeroVector.h:317
const Type & Reference
Definition ZeroVector.h:205
This ResultType
Result type for expression template evaluations.
Definition ZeroVector.h:195
constexpr void clear() noexcept
bool isAliased(const Other *alias) const noexcept
const Type & ConstReference
Definition ZeroVector.h:206
Expression< SparseVector< This, TF > > BaseType
Base type of this ZeroVector instance.
Definition ZeroVector.h:192
ConstReference at(size_t index) const
ValueIndexPair< Type > Element
Value-index-pair for the ZeroVector class.
Definition ZeroVector.h:186
size_t size_
Definition ZeroVector.h:315
static constexpr bool smpAssignable
Definition ZeroVector.h:234
bool canAlias(const Other *alias) const noexcept
Header file for the Expression base class.
Header file for the SparseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition Const.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TAG(A, B)
Data type constraint.
Definition SameTag.h:68
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition Reference.h:79
bool isZero(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is a zero matrix.
Definition DenseMatrix.h:1819
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition DiagonalMatrix.h:225
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition DiagonalMatrix.h:169
typename SubTrait< T1, T2 >::Type SubTrait_t
Auxiliary alias declaration for the SubTrait class template.
Definition SubTrait.h:163
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition AddTrait.h:163
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition MapTrait.h:131
typename DivTrait< T1, T2 >::Type DivTrait_t
Auxiliary alias declaration for the DivTrait class template.
Definition DivTrait.h:164
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition MultTrait.h:165
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition IsScalar.h:104
constexpr bool IsVector_v
Auxiliary variable template for the IsVector type trait.
Definition IsVector.h:125
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool YieldsZero_v
Auxiliary variable template for the YieldsZero type trait.
Definition YieldsZero.h:125
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition IsMatrix.h:124
constexpr bool IsColumnVector_v
Auxiliary variable template for the IsColumnVector type trait.
Definition IsColumnVector.h:126
constexpr bool IsSMPAssignable_v
Auxiliary variable template for the IsSMPAssignable type trait.
Definition IsSMPAssignable.h:132
constexpr bool IsRowVector_v
Auxiliary variable template for the IsRowVector type trait.
Definition IsRowVector.h:126
constexpr bool TransposeFlag_v
Auxiliary variable template for the TransposeFlag type trait.
Definition TransposeFlag.h:93
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition Infinity.h:1080
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition Assert.h:117
constexpr bool defaultTransposeFlag
The default transpose flag for all vectors of the Blaze library.
Definition TransposeFlag.h:75
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
BoolConstant< true > TrueType
Type traits base class.
Definition IntegralConstant.h:132
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition FunctionTrace.h:94
ZeroMatrix< ElementType_t< MT >, SO > declzero(const Matrix< MT, SO > &m)
Declares the given matrix expression m as zero matrix.
Definition ZeroMatrix.h:1382
constexpr decltype(auto) zero(size_t m, size_t n) noexcept
Creating a zero matrix.
Definition ZeroMatrix.h:1356
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for all forward declarations for sparse vectors and matrices.
Header file for the TransposeFlag type trait.
Header file for the isZero shim.
Base class for all expression templates.
Definition Expression.h:60
Base template for the HighType type trait.
Definition HighType.h:322
Compile time check for zero vectors or matrices.
Definition IsZero.h:109
Base template for the LowType type trait.
Definition LowType.h:322
Rebind mechanism to obtain a ZeroVector with different data/element type.
Definition ZeroVector.h:215
ZeroVector< NewType, TF, Tag > Other
The type of the other ZeroVector.
Definition ZeroVector.h:216
Resize mechanism to obtain a ZeroVector with a different fixed number of elements.
Definition ZeroVector.h:224
ZeroVector< Type, TF, Tag > Other
The type of the other ZeroVector.
Definition ZeroVector.h:225
Header file for the default transpose flag for all vectors of the Blaze library.
Header file for the IsZero type trait.
Header file for basic type definitions.