Blaze 3.9
SymmetricMatrix.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_
36#define _BLAZE_MATH_ADAPTORS_SYMMETRICMATRIX_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <blaze/math/Aliases.h>
52#include <blaze/math/Forward.h>
102#include <blaze/util/Assert.h>
103#include <blaze/util/EnableIf.h>
107
108
109namespace blaze {
110
111//=================================================================================================
112//
113// SYMMETRICMATRIX OPERATORS
114//
115//=================================================================================================
116
117//*************************************************************************************************
120template< RelaxationFlag RF, typename MT, bool SO, bool DF, bool SF >
121bool isDefault( const SymmetricMatrix<MT,SO,DF,SF>& m );
122
123template< typename MT, bool SO, bool DF, bool SF >
124bool isIntact( const SymmetricMatrix<MT,SO,DF,SF>& m );
125
126template< typename MT, bool SO, bool DF, bool SF >
127void swap( SymmetricMatrix<MT,SO,DF,SF>& a, SymmetricMatrix<MT,SO,DF,SF>& b ) noexcept;
129//*************************************************************************************************
130
131
132//*************************************************************************************************
157template< RelaxationFlag RF // Relaxation flag
158 , typename MT // Type of the adapted matrix
159 , bool SO // Storage order of the adapted matrix
160 , bool DF // Density flag
161 , bool SF > // Scalar flag
162inline bool isDefault( const SymmetricMatrix<MT,SO,DF,SF>& m )
163{
164 if( Size_v<MT,0UL> == DefaultSize_v )
165 return m.rows() == 0UL;
166 else return isStrictlyLower<RF>( m );
167}
168//*************************************************************************************************
169
170
171//*************************************************************************************************
192template< typename MT // Type of the adapted matrix
193 , bool SO // Storage order of the adapted matrix
194 , bool DF // Density flag
195 , bool SF > // Scalar flag
196inline bool isIntact( const SymmetricMatrix<MT,SO,DF,SF>& m )
197{
198 return m.isIntact();
199}
200//*************************************************************************************************
201
202
203//*************************************************************************************************
211template< typename MT // Type of the adapted matrix
212 , bool SO // Storage order of the adapted matrix
213 , bool DF // Density flag
214 , bool SF > // Scalar flag
215inline void swap( SymmetricMatrix<MT,SO,DF,SF>& a, SymmetricMatrix<MT,SO,DF,SF>& b ) noexcept
216{
217 a.swap( b );
218}
219//*************************************************************************************************
220
221
222//*************************************************************************************************
245template< InversionFlag IF // Inversion algorithm
246 , typename MT // Type of the dense matrix
247 , bool SO > // Storage order of the dense matrix
248inline void invert( SymmetricMatrix<MT,SO,true,true>& m )
249{
251
252 if( IF == asUniLower || IF == asUniUpper ) {
253 BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
254 return;
255 }
256
257 constexpr InversionFlag flag( ( IF == byLU || IF == byLDLT || IF == byLDLH ||
258 IF == asGeneral || IF == asSymmetric || IF == asHermitian )
259 ? ( byLDLT )
260 : ( ( IF == byLLH )
261 ?( byLLH )
262 :( asDiagonal ) ) );
263
264 MT tmp( m.matrix_ );
265 invert<flag>( tmp );
266 m.matrix_ = std::move( tmp );
267
268 BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
269}
271//*************************************************************************************************
272
273
274//*************************************************************************************************
290template< typename MT1 // Type of the adapted matrix
291 , bool SO1 // Storage order of the adapted matrix
292 , bool DF // Density flag
293 , bool SF // Scalar flag
294 , typename MT2 // Type of the right-hand side matrix
295 , bool SO2 > // Storage order of the right-hand side matrix
296inline bool tryAssign( const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
297 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
298{
300
301 BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
302 BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
303 BLAZE_INTERNAL_ASSERT( (*rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
304 BLAZE_INTERNAL_ASSERT( (*rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
305
306 MAYBE_UNUSED( lhs );
307
308 const size_t M( (*rhs).rows() );
309 const size_t N( (*rhs).columns() );
310
311 if( ( row + M <= column ) || ( column + N <= row ) )
312 return true;
313
314 const bool lower( row > column );
315 const size_t size ( min( row + M, column + N ) - ( lower ? row : column ) );
316
317 if( size < 2UL )
318 return true;
319
320 const size_t subrow( lower ? 0UL : column - row );
321 const size_t subcol( lower ? row - column : 0UL );
322
323 return isSymmetric( submatrix( *rhs, subrow, subcol, size, size ) );
324}
326//*************************************************************************************************
327
328
329//*************************************************************************************************
345template< typename MT1 // Type of the adapted matrix
346 , bool SO1 // Storage order of the adapted matrix
347 , bool DF // Density flag
348 , bool SF // Scalar flag
349 , typename MT2 // Type of the right-hand side matrix
350 , bool SO2 > // Storage order of the right-hand side matrix
351inline bool tryAddAssign( const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
352 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
353{
354 return tryAssign( lhs, *rhs, row, column );
355}
357//*************************************************************************************************
358
359
360//*************************************************************************************************
377template< typename MT1 // Type of the adapted matrix
378 , bool SO1 // Storage order of the adapted matrix
379 , bool DF // Density flag
380 , bool SF // Scalar flag
381 , typename MT2 // Type of the right-hand side matrix
382 , bool SO2 > // Storage order of the right-hand side matrix
383inline bool trySubAssign( const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
384 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
385{
386 return tryAssign( lhs, *rhs, row, column );
387}
389//*************************************************************************************************
390
391
392//*************************************************************************************************
409template< typename MT1 // Type of the adapted matrix
410 , bool SO1 // Storage order of the adapted matrix
411 , bool DF // Density flag
412 , bool SF // Scalar flag
413 , typename MT2 // Type of the right-hand side matrix
414 , bool SO2 > // Storage order of the right-hand side matrix
415inline bool trySchurAssign( const SymmetricMatrix<MT1,SO1,DF,SF>& lhs,
416 const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
417{
418 return tryAssign( lhs, *rhs, row, column );
419}
421//*************************************************************************************************
422
423
424
425
426//=================================================================================================
427//
428// SIZE SPECIALIZATIONS
429//
430//=================================================================================================
431
432//*************************************************************************************************
434template< typename MT, bool SO, bool DF, bool SF >
435struct Size< SymmetricMatrix<MT,SO,DF,SF>, 0UL >
436 : public Size<MT,0UL>
437{};
438
439template< typename MT, bool SO, bool DF, bool SF >
440struct Size< SymmetricMatrix<MT,SO,DF,SF>, 1UL >
441 : public Size<MT,1UL>
442{};
444//*************************************************************************************************
445
446
447
448
449//=================================================================================================
450//
451// MAXSIZE SPECIALIZATIONS
452//
453//=================================================================================================
454
455//*************************************************************************************************
457template< typename MT, bool SO, bool DF, bool SF >
458struct MaxSize< SymmetricMatrix<MT,SO,DF,SF>, 0UL >
459 : public MaxSize<MT,0UL>
460{};
461
462template< typename MT, bool SO, bool DF, bool SF >
463struct MaxSize< SymmetricMatrix<MT,SO,DF,SF>, 1UL >
464 : public MaxSize<MT,1UL>
465{};
467//*************************************************************************************************
468
469
470
471
472//=================================================================================================
473//
474// ISSQUARE SPECIALIZATIONS
475//
476//=================================================================================================
477
478//*************************************************************************************************
480template< typename MT, bool SO, bool DF, bool SF >
481struct IsSquare< SymmetricMatrix<MT,SO,DF,SF> >
482 : public TrueType
483{};
485//*************************************************************************************************
486
487
488
489
490//=================================================================================================
491//
492// ISUNIFORM SPECIALIZATIONS
493//
494//=================================================================================================
495
496//*************************************************************************************************
498template< typename MT, bool SO, bool DF, bool SF >
499struct IsUniform< SymmetricMatrix<MT,SO,DF,SF> >
500 : public IsUniform<MT>
501{};
503//*************************************************************************************************
504
505
506
507
508//=================================================================================================
509//
510// ISSYMMETRIC SPECIALIZATIONS
511//
512//=================================================================================================
513
514//*************************************************************************************************
516template< typename MT, bool SO, bool DF, bool SF >
517struct IsSymmetric< SymmetricMatrix<MT,SO,DF,SF> >
518 : public TrueType
519{};
521//*************************************************************************************************
522
523
524
525
526//=================================================================================================
527//
528// ISHERMITIAN SPECIALIZATIONS
529//
530//=================================================================================================
531
532//*************************************************************************************************
534template< typename MT, bool SO, bool DF, bool SF >
535struct IsHermitian< SymmetricMatrix<MT,SO,DF,SF> >
536 : public IsBuiltin< ElementType_t<MT> >
537{};
539//*************************************************************************************************
540
541
542
543
544//=================================================================================================
545//
546// ISSTRICTLYLOWER SPECIALIZATIONS
547//
548//=================================================================================================
549
550//*************************************************************************************************
552template< typename MT, bool SO, bool DF, bool SF >
553struct IsStrictlyLower< SymmetricMatrix<MT,SO,DF,SF> >
554 : public IsZero<MT>
555{};
557//*************************************************************************************************
558
559
560
561
562//=================================================================================================
563//
564// ISSTRICTLYUPPER SPECIALIZATIONS
565//
566//=================================================================================================
567
568//*************************************************************************************************
570template< typename MT, bool SO, bool DF, bool SF >
571struct IsStrictlyUpper< SymmetricMatrix<MT,SO,DF,SF> >
572 : public IsZero<MT>
573{};
575//*************************************************************************************************
576
577
578
579
580//=================================================================================================
581//
582// ISADAPTOR SPECIALIZATIONS
583//
584//=================================================================================================
585
586//*************************************************************************************************
588template< typename MT, bool SO, bool DF, bool SF >
589struct IsAdaptor< SymmetricMatrix<MT,SO,DF,SF> >
590 : public TrueType
591{};
593//*************************************************************************************************
594
595
596
597
598//=================================================================================================
599//
600// ISRESTRICTED SPECIALIZATIONS
601//
602//=================================================================================================
603
604//*************************************************************************************************
606template< typename MT, bool SO, bool DF, bool SF >
607struct IsRestricted< SymmetricMatrix<MT,SO,DF,SF> >
608 : public TrueType
609{};
611//*************************************************************************************************
612
613
614
615
616//=================================================================================================
617//
618// HASCONSTDATAACCESS SPECIALIZATIONS
619//
620//=================================================================================================
621
622//*************************************************************************************************
624template< typename MT, bool SO, bool SF >
625struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,SF> >
626 : public TrueType
627{};
629//*************************************************************************************************
630
631
632
633
634//=================================================================================================
635//
636// ISALIGNED SPECIALIZATIONS
637//
638//=================================================================================================
639
640//*************************************************************************************************
642template< typename MT, bool SO, bool DF, bool SF >
643struct IsAligned< SymmetricMatrix<MT,SO,DF,SF> >
644 : public IsAligned<MT>
645{};
647//*************************************************************************************************
648
649
650
651
652//=================================================================================================
653//
654// ISCONTIGUOUS SPECIALIZATIONS
655//
656//=================================================================================================
657
658//*************************************************************************************************
660template< typename MT, bool SO, bool DF, bool SF >
661struct IsContiguous< SymmetricMatrix<MT,SO,DF,SF> >
662 : public IsContiguous<MT>
663{};
665//*************************************************************************************************
666
667
668
669
670//=================================================================================================
671//
672// ISPADDED SPECIALIZATIONS
673//
674//=================================================================================================
675
676//*************************************************************************************************
678template< typename MT, bool SO, bool DF, bool SF >
679struct IsPadded< SymmetricMatrix<MT,SO,DF,SF> >
680 : public IsPadded<MT>
681{};
683//*************************************************************************************************
684
685
686
687
688//=================================================================================================
689//
690// REMOVEADAPTOR SPECIALIZATIONS
691//
692//=================================================================================================
693
694//*************************************************************************************************
696template< typename MT, bool SO, bool DF, bool SF >
697struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,SF> >
698{
699 using Type = MT;
700};
702//*************************************************************************************************
703
704
705
706
707//=================================================================================================
708//
709// ADDTRAIT SPECIALIZATIONS
710//
711//=================================================================================================
712
713//*************************************************************************************************
715template< typename T1, typename T2 >
716struct AddTraitEval1< T1, T2
717 , EnableIf_t< IsMatrix_v<T1> &&
718 IsMatrix_v<T2> &&
719 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
720 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
721 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
722 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
723 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
724 !( IsZero_v<T1> || IsZero_v<T2> ) > >
725{
726 using Type = SymmetricMatrix< typename AddTraitEval2<T1,T2>::Type >;
727};
729//*************************************************************************************************
730
731
732
733
734//=================================================================================================
735//
736// SUBTRAIT SPECIALIZATIONS
737//
738//=================================================================================================
739
740//*************************************************************************************************
742template< typename T1, typename T2 >
743struct SubTraitEval1< T1, T2
744 , EnableIf_t< IsMatrix_v<T1> &&
745 IsMatrix_v<T2> &&
746 ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
747 ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
748 ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
749 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
750 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
751 !( IsZero_v<T1> || IsZero_v<T2> ) > >
752{
753 using Type = SymmetricMatrix< typename SubTraitEval2<T1,T2>::Type >;
754};
756//*************************************************************************************************
757
758
759
760
761//=================================================================================================
762//
763// SCHURTRAIT SPECIALIZATIONS
764//
765//=================================================================================================
766
767//*************************************************************************************************
769template< typename T1, typename T2 >
770struct SchurTraitEval1< T1, T2
771 , EnableIf_t< IsMatrix_v<T1> &&
772 IsMatrix_v<T2> &&
773 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
774 !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
775 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
776 !( IsZero_v<T1> || IsZero_v<T2> ) > >
777{
778 using Type = SymmetricMatrix< typename SchurTraitEval2<T1,T2>::Type >;
779};
781//*************************************************************************************************
782
783
784
785
786//=================================================================================================
787//
788// MULTTRAIT SPECIALIZATIONS
789//
790//=================================================================================================
791
792//*************************************************************************************************
794template< typename T1, typename T2 >
795struct MultTraitEval1< T1, T2
796 , EnableIf_t< IsMatrix_v<T1> &&
797 IsScalar_v<T2> &&
798 ( IsSymmetric_v<T1> && !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
799{
800 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
801};
802
803template< typename T1, typename T2 >
804struct MultTraitEval1< T1, T2
805 , EnableIf_t< IsScalar_v<T1> &&
806 IsMatrix_v<T2> &&
807 ( IsSymmetric_v<T2> && !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
808{
809 using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
810};
812//*************************************************************************************************
813
814
815
816
817//=================================================================================================
818//
819// KRONTRAIT SPECIALIZATIONS
820//
821//=================================================================================================
822
823//*************************************************************************************************
825template< typename T1, typename T2 >
826struct KronTraitEval1< T1, T2
827 , EnableIf_t< IsMatrix_v<T1> &&
828 IsMatrix_v<T2> &&
829 ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
830 !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
831 !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
832 !( IsZero_v<T1> || IsZero_v<T2> ) > >
833{
834 using Type = SymmetricMatrix< typename KronTraitEval2<T1,T2>::Type >;
835};
837//*************************************************************************************************
838
839
840
841
842//=================================================================================================
843//
844// DIVTRAIT SPECIALIZATIONS
845//
846//=================================================================================================
847
848//*************************************************************************************************
850template< typename T1, typename T2 >
851struct DivTraitEval1< T1, T2
852 , EnableIf_t< IsSymmetric_v<T1> && !IsDiagonal_v<T1> && IsScalar_v<T2> > >
853{
854 using Type = SymmetricMatrix< typename DivTraitEval2<T1,T2>::Type >;
855};
857//*************************************************************************************************
858
859
860
861
862//=================================================================================================
863//
864// MAPTRAIT SPECIALIZATIONS
865//
866//=================================================================================================
867
868//*************************************************************************************************
870template< typename T, typename OP >
871struct UnaryMapTraitEval1< T, OP
872 , EnableIf_t< YieldsSymmetric_v<OP,T> &&
873 !YieldsHermitian_v<OP,T> &&
874 !YieldsDiagonal_v<OP,T> &&
875 !YieldsIdentity_v<OP,T> > >
876{
877 using Type = SymmetricMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
878};
880//*************************************************************************************************
881
882
883//*************************************************************************************************
885template< typename T1, typename T2, typename OP >
886struct BinaryMapTraitEval1< T1, T2, OP
887 , EnableIf_t< YieldsSymmetric_v<OP,T1,T2> &&
888 !YieldsHermitian_v<OP,T1,T2> &&
889 !YieldsDiagonal_v<OP,T1,T2> &&
890 !YieldsIdentity_v<OP,T1,T2> > >
891{
892 using Type = SymmetricMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
893};
895//*************************************************************************************************
896
897
898
899
900//=================================================================================================
901//
902// REPEATTRAIT SPECIALIZATIONS
903//
904//=================================================================================================
905
906//*************************************************************************************************
908template< typename T, size_t R0, size_t R1 >
909struct RepeatTraitEval1< T, R0, R1, inf
910 , EnableIf_t< R0 != inf && R1 != inf && R0 == R1 &&
911 IsSymmetric_v<T> > >
912{
913 using Type = SymmetricMatrix< typename RepeatTraitEval2<T,R0,R1,inf>::Type >;
914};
916//*************************************************************************************************
917
918
919
920
921//=================================================================================================
922//
923// DECLSYMTRAIT SPECIALIZATIONS
924//
925//=================================================================================================
926
927//*************************************************************************************************
929template< typename MT, bool SO, bool DF, bool SF >
930struct DeclSymTrait< SymmetricMatrix<MT,SO,DF,SF> >
931{
932 using Type = SymmetricMatrix<MT,SO,DF,SF>;
933};
935//*************************************************************************************************
936
937
938
939
940//=================================================================================================
941//
942// DECLHERMTRAIT SPECIALIZATIONS
943//
944//=================================================================================================
945
946//*************************************************************************************************
948template< typename MT, bool SO, bool DF, bool SF >
949struct DeclHermTrait< SymmetricMatrix<MT,SO,DF,SF> >
950{
951 using Type = HermitianMatrix<MT,SO,DF>;
952};
954//*************************************************************************************************
955
956
957
958
959//=================================================================================================
960//
961// DECLLOWTRAIT SPECIALIZATIONS
962//
963//=================================================================================================
964
965//*************************************************************************************************
967template< typename MT, bool SO, bool DF, bool SF >
968struct DeclLowTrait< SymmetricMatrix<MT,SO,DF,SF> >
969{
970 using Type = DiagonalMatrix<MT,SO,DF>;
971};
973//*************************************************************************************************
974
975
976
977
978//=================================================================================================
979//
980// DECLUNILOWTRAIT SPECIALIZATIONS
981//
982//=================================================================================================
983
984//*************************************************************************************************
986template< typename MT, bool SO, bool DF, bool SF >
987struct DeclUniLowTrait< SymmetricMatrix<MT,SO,DF,SF> >
988{
989 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
990};
992//*************************************************************************************************
993
994
995
996
997//=================================================================================================
998//
999// DECLSTRLOWTRAIT SPECIALIZATIONS
1000//
1001//=================================================================================================
1002
1003//*************************************************************************************************
1005template< typename MT, bool SO, bool DF, bool SF >
1006struct DeclStrLowTrait< SymmetricMatrix<MT,SO,DF,SF> >
1007{
1008 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
1009};
1011//*************************************************************************************************
1012
1013
1014
1015
1016//=================================================================================================
1017//
1018// DECLUPPTRAIT SPECIALIZATIONS
1019//
1020//=================================================================================================
1021
1022//*************************************************************************************************
1024template< typename MT, bool SO, bool DF, bool SF >
1025struct DeclUppTrait< SymmetricMatrix<MT,SO,DF,SF> >
1026{
1027 using Type = DiagonalMatrix<MT,SO,DF>;
1028};
1030//*************************************************************************************************
1031
1032
1033
1034
1035//=================================================================================================
1036//
1037// DECLUNIUPPTRAIT SPECIALIZATIONS
1038//
1039//=================================================================================================
1040
1041//*************************************************************************************************
1043template< typename MT, bool SO, bool DF, bool SF >
1044struct DeclUniUppTrait< SymmetricMatrix<MT,SO,DF,SF> >
1045{
1046 using Type = IdentityMatrix< ElementType_t<MT>, SO >;
1047};
1049//*************************************************************************************************
1050
1051
1052
1053
1054//=================================================================================================
1055//
1056// DECLSTRUPPTRAIT SPECIALIZATIONS
1057//
1058//=================================================================================================
1059
1060//*************************************************************************************************
1062template< typename MT, bool SO, bool DF, bool SF >
1063struct DeclStrUppTrait< SymmetricMatrix<MT,SO,DF,SF> >
1064{
1065 using Type = ZeroMatrix< ElementType_t<MT>, SO >;
1066};
1068//*************************************************************************************************
1069
1070
1071
1072
1073//=================================================================================================
1074//
1075// DECLDIAGTRAIT SPECIALIZATIONS
1076//
1077//=================================================================================================
1078
1079//*************************************************************************************************
1081template< typename MT, bool SO, bool DF, bool SF >
1082struct DeclDiagTrait< SymmetricMatrix<MT,SO,DF,SF> >
1083{
1084 using Type = DiagonalMatrix<MT,SO,DF>;
1085};
1087//*************************************************************************************************
1088
1089
1090
1091
1092//=================================================================================================
1093//
1094// HIGHTYPE SPECIALIZATIONS
1095//
1096//=================================================================================================
1097
1098//*************************************************************************************************
1100template< typename MT1, bool SO1, bool DF1, bool SF1, typename MT2, bool SO2, bool DF2, bool SF2 >
1101struct HighType< SymmetricMatrix<MT1,SO1,DF1,SF1>, SymmetricMatrix<MT2,SO2,DF2,SF2> >
1102{
1103 using Type = SymmetricMatrix< typename HighType<MT1,MT2>::Type >;
1104};
1106//*************************************************************************************************
1107
1108
1109
1110
1111//=================================================================================================
1112//
1113// LOWTYPE SPECIALIZATIONS
1114//
1115//=================================================================================================
1116
1117//*************************************************************************************************
1119template< typename MT1, bool SO1, bool DF1, bool SF1, typename MT2, bool SO2, bool DF2, bool SF2 >
1120struct LowType< SymmetricMatrix<MT1,SO1,DF1,SF1>, SymmetricMatrix<MT2,SO2,DF2,SF2> >
1121{
1122 using Type = SymmetricMatrix< typename LowType<MT1,MT2>::Type >;
1123};
1125//*************************************************************************************************
1126
1127
1128
1129
1130//=================================================================================================
1131//
1132// SUBMATRIXTRAIT SPECIALIZATIONS
1133//
1134//=================================================================================================
1135
1136//*************************************************************************************************
1138template< typename MT, size_t I, size_t N >
1139struct SubmatrixTraitEval1< MT, I, I, N, N
1140 , EnableIf_t< I != inf && N != inf &&
1141 IsSymmetric_v<MT> &&
1142 !IsDiagonal_v<MT> &&
1143 !IsUniform_v<MT> &&
1144 !IsZero_v<MT> > >
1145{
1146 using Type = SymmetricMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
1147};
1149//*************************************************************************************************
1150
1151} // namespace blaze
1152
1153#endif
Header file for the addition trait.
Header file for auxiliary alias declarations.
Header file for run time assertion macros.
Constraint on the data type.
Header file for the decldiag trait.
Header file for the declherm trait.
Header file for the decllow trait.
Header file for the declstrlow trait.
Header file for the declstrupp trait.
Header file for the declsym trait.
Header file for the declunilow trait.
Header file for the decluniupp trait.
Header file for the declupp trait.
SymmetricMatrix specialization for dense matrices with non-scalar element type.
SymmetricMatrix specialization for dense matrices with scalar element type.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Header file for the dense matrix inversion flags.
Header file for the IsAdaptor type trait.
Header file for the IsAligned type trait.
Header file for the IsBuiltin type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsDiagonal type trait.
Header file for the isDivisor shim.
Header file for the IsHermitian type trait.
Header file for the IsMatrix type trait.
Header file for the IsPadded type trait.
Header file for the IsRestricted type trait.
Header file for the IsScalar type trait.
Header file for the IsSquare type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniform 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 MaxSize type trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Header file for the relaxation flag enumeration.
Header file for the RemoveAdaptor type trait.
Header file for the repeat trait.
Header file for the Schur product trait.
SymmetricMatrix specialization for sparse matrices with non-scalar element type.
SymmetricMatrix specialization for sparse matrices with scalar element type.
Header file for the subtraction trait.
Header file for the submatrix trait.
Header file for the YieldsDiagonal type trait.
Header file for the YieldsHermitian type trait.
Header file for the YieldsIdentity type trait.
Header file for the YieldsSymmetric type trait.
Header file for the implementation of the base template of the SymmetricMatrix.
Constraint on the data type.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1456
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an identity matrix.
Definition: DenseMatrix.h:2561
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
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:693
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.
Definition: BLASCompatible.h:61
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.
Definition: IsSymmetric.h:172
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition: IsMatrix.h:124
constexpr bool YieldsSymmetric_v
Auxiliary variable template for the YieldsSymmetric type trait.
Definition: YieldsSymmetric.h:124
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition: Infinity.h:1080
InversionFlag
Inversion flag.
Definition: InversionFlag.h:102
@ byLDLT
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
@ asHermitian
Flag for the inversion of a Hermitian matrix (same as byLDLH).
Definition: InversionFlag.h:110
@ asUniLower
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
@ asSymmetric
Flag for the inversion of a symmetric matrix (same as byLDLT).
Definition: InversionFlag.h:109
@ asUniUpper
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
@ byLDLH
Flag for the Bunch-Kaufman-based inversion for Hermitian matrices.
Definition: InversionFlag.h:105
@ asDiagonal
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
@ byLU
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
@ byLLH
Flag for the Cholesky-based inversion for positive-definite matrices.
Definition: InversionFlag.h:106
@ asGeneral
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:676
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:181
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for the Size type trait.
Header file for the StorageOrder type trait.
Header file for the IsZero type trait.
Header file for the generic min algorithm.