Blaze  3.6
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>
51 #include <blaze/math/Exception.h>
53 #include <blaze/math/Forward.h>
97 #include <blaze/util/Assert.h>
98 #include <blaze/util/EnableIf.h>
100 #include <blaze/util/MaybeUnused.h>
103 
104 
105 namespace blaze {
106 
107 //=================================================================================================
108 //
109 // SYMMETRICMATRIX OPERATORS
110 //
111 //=================================================================================================
112 
113 //*************************************************************************************************
116 template< typename MT, bool SO, bool DF, bool NF >
117 void reset( SymmetricMatrix<MT,SO,DF,NF>& m );
118 
119 template< typename MT, bool SO, bool DF, bool NF >
120 void reset( SymmetricMatrix<MT,SO,DF,NF>& m, size_t i );
121 
122 template< typename MT, bool SO, bool DF, bool NF >
123 void clear( SymmetricMatrix<MT,SO,DF,NF>& m );
124 
125 template< bool RF, typename MT, bool SO, bool DF, bool NF >
126 bool isDefault( const SymmetricMatrix<MT,SO,DF,NF>& m );
127 
128 template< typename MT, bool SO, bool DF, bool NF >
129 bool isIntact( const SymmetricMatrix<MT,SO,DF,NF>& m );
130 
131 template< typename MT, bool SO, bool DF, bool NF >
132 void swap( SymmetricMatrix<MT,SO,DF,NF>& a, SymmetricMatrix<MT,SO,DF,NF>& b ) noexcept;
134 //*************************************************************************************************
135 
136 
137 //*************************************************************************************************
144 template< typename MT // Type of the adapted matrix
145  , bool SO // Storage order of the adapted matrix
146  , bool DF // Density flag
147  , bool NF > // Numeric flag
149 {
150  m.reset();
151 }
152 //*************************************************************************************************
153 
154 
155 //*************************************************************************************************
168 template< typename MT // Type of the adapted matrix
169  , bool SO // Storage order of the adapted matrix
170  , bool DF // Density flag
171  , bool NF > // Numeric flag
172 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m, size_t i )
173 {
174  m.reset( i );
175 }
176 //*************************************************************************************************
177 
178 
179 //*************************************************************************************************
186 template< typename MT // Type of the adapted matrix
187  , bool SO // Storage order of the adapted matrix
188  , bool DF // Density flag
189  , bool NF > // Numeric flag
191 {
192  m.clear();
193 }
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
222 template< bool RF // Relaxation flag
223  , typename MT // Type of the adapted matrix
224  , bool SO // Storage order of the adapted matrix
225  , bool DF // Density flag
226  , bool NF > // Numeric flag
228 {
229  return isDefault<RF>( m.matrix_ );
230 }
231 //*************************************************************************************************
232 
233 
234 //*************************************************************************************************
255 template< typename MT // Type of the adapted matrix
256  , bool SO // Storage order of the adapted matrix
257  , bool DF // Density flag
258  , bool NF > // Numeric flag
259 inline bool isIntact( const SymmetricMatrix<MT,SO,DF,NF>& m )
260 {
261  return m.isIntact();
262 }
263 //*************************************************************************************************
264 
265 
266 //*************************************************************************************************
274 template< typename MT // Type of the adapted matrix
275  , bool SO // Storage order of the adapted matrix
276  , bool DF // Density flag
277  , bool NF > // Numeric flag
279 {
280  a.swap( b );
281 }
282 //*************************************************************************************************
283 
284 
285 //*************************************************************************************************
308 template< InversionFlag IF // Inversion algorithm
309  , typename MT // Type of the dense matrix
310  , bool SO > // Storage order of the dense matrix
311 inline void invert( SymmetricMatrix<MT,SO,true,true>& m )
312 {
314 
315  if( IF == asUniLower || IF == asUniUpper ) {
316  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
317  return;
318  }
319 
320  constexpr InversionFlag flag( ( IF == byLU || IF == byLDLT || IF == byLDLH ||
321  IF == asGeneral || IF == asSymmetric || IF == asHermitian )
322  ? ( byLDLT )
323  : ( ( IF == byLLH )
324  ?( byLLH )
325  :( asDiagonal ) ) );
326 
327  MT tmp( m.matrix_ );
328  invert<flag>( tmp );
329  m.matrix_ = std::move( tmp );
330 
331  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
332 }
334 //*************************************************************************************************
335 
336 
337 //*************************************************************************************************
353 template< typename MT1 // Type of the adapted matrix
354  , bool SO1 // Storage order of the adapted matrix
355  , bool DF // Density flag
356  , bool NF // Numeric flag
357  , typename MT2 // Type of the right-hand side matrix
358  , bool SO2 > // Storage order of the right-hand side matrix
359 inline bool tryAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
360  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
361 {
363 
364  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
365  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
366  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
367  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
368 
369  MAYBE_UNUSED( lhs );
370 
371  const size_t M( (~rhs).rows() );
372  const size_t N( (~rhs).columns() );
373 
374  if( ( row + M <= column ) || ( column + N <= row ) )
375  return true;
376 
377  const bool lower( row > column );
378  const size_t size ( min( row + M, column + N ) - ( lower ? row : column ) );
379 
380  if( size < 2UL )
381  return true;
382 
383  const size_t subrow( lower ? 0UL : column - row );
384  const size_t subcol( lower ? row - column : 0UL );
385 
386  return isSymmetric( submatrix( ~rhs, subrow, subcol, size, size ) );
387 }
389 //*************************************************************************************************
390 
391 
392 //*************************************************************************************************
408 template< typename MT1 // Type of the adapted matrix
409  , bool SO1 // Storage order of the adapted matrix
410  , bool DF // Density flag
411  , bool NF // Numeric flag
412  , typename MT2 // Type of the right-hand side matrix
413  , bool SO2 > // Storage order of the right-hand side matrix
414 inline bool tryAddAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
415  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
416 {
417  return tryAssign( lhs, ~rhs, row, column );
418 }
420 //*************************************************************************************************
421 
422 
423 //*************************************************************************************************
440 template< typename MT1 // Type of the adapted matrix
441  , bool SO1 // Storage order of the adapted matrix
442  , bool DF // Density flag
443  , bool NF // Numeric flag
444  , typename MT2 // Type of the right-hand side matrix
445  , bool SO2 > // Storage order of the right-hand side matrix
446 inline bool trySubAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
447  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
448 {
449  return tryAssign( lhs, ~rhs, row, column );
450 }
452 //*************************************************************************************************
453 
454 
455 //*************************************************************************************************
472 template< typename MT1 // Type of the adapted matrix
473  , bool SO1 // Storage order of the adapted matrix
474  , bool DF // Density flag
475  , bool NF // Numeric flag
476  , typename MT2 // Type of the right-hand side matrix
477  , bool SO2 > // Storage order of the right-hand side matrix
478 inline bool trySchurAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
479  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
480 {
481  return tryAssign( lhs, ~rhs, row, column );
482 }
484 //*************************************************************************************************
485 
486 
487 
488 
489 //=================================================================================================
490 //
491 // SIZE SPECIALIZATIONS
492 //
493 //=================================================================================================
494 
495 //*************************************************************************************************
497 template< typename MT, bool SO, bool DF, bool NF >
498 struct Size< SymmetricMatrix<MT,SO,DF,NF>, 0UL >
499  : public Size<MT,0UL>
500 {};
501 
502 template< typename MT, bool SO, bool DF, bool NF >
503 struct Size< SymmetricMatrix<MT,SO,DF,NF>, 1UL >
504  : public Size<MT,1UL>
505 {};
507 //*************************************************************************************************
508 
509 
510 
511 
512 //=================================================================================================
513 //
514 // MAXSIZE SPECIALIZATIONS
515 //
516 //=================================================================================================
517 
518 //*************************************************************************************************
520 template< typename MT, bool SO, bool DF, bool NF >
521 struct MaxSize< SymmetricMatrix<MT,SO,DF,NF>, 0UL >
522  : public MaxSize<MT,0UL>
523 {};
524 
525 template< typename MT, bool SO, bool DF, bool NF >
526 struct MaxSize< SymmetricMatrix<MT,SO,DF,NF>, 1UL >
527  : public MaxSize<MT,1UL>
528 {};
530 //*************************************************************************************************
531 
532 
533 
534 
535 //=================================================================================================
536 //
537 // ISSQUARE SPECIALIZATIONS
538 //
539 //=================================================================================================
540 
541 //*************************************************************************************************
543 template< typename MT, bool SO, bool DF, bool NF >
544 struct IsSquare< SymmetricMatrix<MT,SO,DF,NF> >
545  : public TrueType
546 {};
548 //*************************************************************************************************
549 
550 
551 
552 
553 //=================================================================================================
554 //
555 // ISUNIFORM SPECIALIZATIONS
556 //
557 //=================================================================================================
558 
559 //*************************************************************************************************
561 template< typename MT, bool SO, bool DF, bool NF >
562 struct IsUniform< SymmetricMatrix<MT,SO,DF,NF> >
563  : public IsUniform<MT>
564 {};
566 //*************************************************************************************************
567 
568 
569 
570 
571 //=================================================================================================
572 //
573 // ISSYMMETRIC SPECIALIZATIONS
574 //
575 //=================================================================================================
576 
577 //*************************************************************************************************
579 template< typename MT, bool SO, bool DF, bool NF >
580 struct IsSymmetric< SymmetricMatrix<MT,SO,DF,NF> >
581  : public TrueType
582 {};
584 //*************************************************************************************************
585 
586 
587 
588 
589 //=================================================================================================
590 //
591 // ISHERMITIAN SPECIALIZATIONS
592 //
593 //=================================================================================================
594 
595 //*************************************************************************************************
597 template< typename MT, bool SO, bool DF, bool NF >
598 struct IsHermitian< SymmetricMatrix<MT,SO,DF,NF> >
599  : public IsBuiltin< ElementType_t<MT> >
600 {};
602 //*************************************************************************************************
603 
604 
605 
606 
607 //=================================================================================================
608 //
609 // ISSTRICTLYLOWER SPECIALIZATIONS
610 //
611 //=================================================================================================
612 
613 //*************************************************************************************************
615 template< typename MT, bool SO, bool DF, bool NF >
616 struct IsStrictlyLower< SymmetricMatrix<MT,SO,DF,NF> >
617  : public IsZero<MT>
618 {};
620 //*************************************************************************************************
621 
622 
623 
624 
625 //=================================================================================================
626 //
627 // ISSTRICTLYUPPER SPECIALIZATIONS
628 //
629 //=================================================================================================
630 
631 //*************************************************************************************************
633 template< typename MT, bool SO, bool DF, bool NF >
634 struct IsStrictlyUpper< SymmetricMatrix<MT,SO,DF,NF> >
635  : public IsZero<MT>
636 {};
638 //*************************************************************************************************
639 
640 
641 
642 
643 //=================================================================================================
644 //
645 // ISADAPTOR SPECIALIZATIONS
646 //
647 //=================================================================================================
648 
649 //*************************************************************************************************
651 template< typename MT, bool SO, bool DF, bool NF >
652 struct IsAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
653  : public TrueType
654 {};
656 //*************************************************************************************************
657 
658 
659 
660 
661 //=================================================================================================
662 //
663 // ISRESTRICTED SPECIALIZATIONS
664 //
665 //=================================================================================================
666 
667 //*************************************************************************************************
669 template< typename MT, bool SO, bool DF, bool NF >
670 struct IsRestricted< SymmetricMatrix<MT,SO,DF,NF> >
671  : public TrueType
672 {};
674 //*************************************************************************************************
675 
676 
677 
678 
679 //=================================================================================================
680 //
681 // HASCONSTDATAACCESS SPECIALIZATIONS
682 //
683 //=================================================================================================
684 
685 //*************************************************************************************************
687 template< typename MT, bool SO, bool NF >
688 struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,NF> >
689  : public TrueType
690 {};
692 //*************************************************************************************************
693 
694 
695 
696 
697 //=================================================================================================
698 //
699 // ISALIGNED SPECIALIZATIONS
700 //
701 //=================================================================================================
702 
703 //*************************************************************************************************
705 template< typename MT, bool SO, bool DF, bool NF >
706 struct IsAligned< SymmetricMatrix<MT,SO,DF,NF> >
707  : public IsAligned<MT>
708 {};
710 //*************************************************************************************************
711 
712 
713 
714 
715 //=================================================================================================
716 //
717 // ISCONTIGUOUS SPECIALIZATIONS
718 //
719 //=================================================================================================
720 
721 //*************************************************************************************************
723 template< typename MT, bool SO, bool DF, bool NF >
724 struct IsContiguous< SymmetricMatrix<MT,SO,DF,NF> >
725  : public IsContiguous<MT>
726 {};
728 //*************************************************************************************************
729 
730 
731 
732 
733 //=================================================================================================
734 //
735 // ISPADDED SPECIALIZATIONS
736 //
737 //=================================================================================================
738 
739 //*************************************************************************************************
741 template< typename MT, bool SO, bool DF, bool NF >
742 struct IsPadded< SymmetricMatrix<MT,SO,DF,NF> >
743  : public IsPadded<MT>
744 {};
746 //*************************************************************************************************
747 
748 
749 
750 
751 //=================================================================================================
752 //
753 // ISRESIZABLE SPECIALIZATIONS
754 //
755 //=================================================================================================
756 
757 //*************************************************************************************************
759 template< typename MT, bool SO, bool DF, bool NF >
760 struct IsResizable< SymmetricMatrix<MT,SO,DF,NF> >
761  : public IsResizable<MT>
762 {};
764 //*************************************************************************************************
765 
766 
767 
768 
769 //=================================================================================================
770 //
771 // ISSHRINKABLE SPECIALIZATIONS
772 //
773 //=================================================================================================
774 
775 //*************************************************************************************************
777 template< typename MT, bool SO, bool DF, bool NF >
778 struct IsShrinkable< SymmetricMatrix<MT,SO,DF,NF> >
779  : public IsShrinkable<MT>
780 {};
782 //*************************************************************************************************
783 
784 
785 
786 
787 //=================================================================================================
788 //
789 // REMOVEADAPTOR SPECIALIZATIONS
790 //
791 //=================================================================================================
792 
793 //*************************************************************************************************
795 template< typename MT, bool SO, bool DF, bool NF >
796 struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
797 {
798  using Type = MT;
799 };
801 //*************************************************************************************************
802 
803 
804 
805 
806 //=================================================================================================
807 //
808 // ADDTRAIT SPECIALIZATIONS
809 //
810 //=================================================================================================
811 
812 //*************************************************************************************************
814 template< typename T1, typename T2 >
815 struct AddTraitEval1< T1, T2
816  , EnableIf_t< IsMatrix_v<T1> &&
817  IsMatrix_v<T2> &&
818  ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
819  ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
820  ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
821  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
822  !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
823  !( IsZero_v<T1> || IsZero_v<T2> ) > >
824 {
825  using Type = SymmetricMatrix< typename AddTraitEval2<T1,T2>::Type >;
826 };
828 //*************************************************************************************************
829 
830 
831 
832 
833 //=================================================================================================
834 //
835 // SUBTRAIT SPECIALIZATIONS
836 //
837 //=================================================================================================
838 
839 //*************************************************************************************************
841 template< typename T1, typename T2 >
842 struct SubTraitEval1< T1, T2
843  , EnableIf_t< IsMatrix_v<T1> &&
844  IsMatrix_v<T2> &&
845  ( ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) ||
846  ( IsSymmetric_v<T1> && IsDiagonal_v<T2> ) ||
847  ( IsDiagonal_v<T1> && IsSymmetric_v<T2> ) ) &&
848  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
849  !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
850  !( IsZero_v<T1> || IsZero_v<T2> ) > >
851 {
852  using Type = SymmetricMatrix< typename SubTraitEval2<T1,T2>::Type >;
853 };
855 //*************************************************************************************************
856 
857 
858 
859 
860 //=================================================================================================
861 //
862 // SCHURTRAIT SPECIALIZATIONS
863 //
864 //=================================================================================================
865 
866 //*************************************************************************************************
868 template< typename T1, typename T2 >
869 struct SchurTraitEval1< T1, T2
870  , EnableIf_t< IsMatrix_v<T1> &&
871  IsMatrix_v<T2> &&
872  ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
873  !( IsDiagonal_v<T1> || IsDiagonal_v<T2> ) &&
874  !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
875  !( IsZero_v<T1> || IsZero_v<T2> ) > >
876 {
877  using Type = SymmetricMatrix< typename SchurTraitEval2<T1,T2>::Type >;
878 };
880 //*************************************************************************************************
881 
882 
883 
884 
885 //=================================================================================================
886 //
887 // MULTTRAIT SPECIALIZATIONS
888 //
889 //=================================================================================================
890 
891 //*************************************************************************************************
893 template< typename T1, typename T2 >
894 struct MultTraitEval1< T1, T2
895  , EnableIf_t< IsMatrix_v<T1> &&
896  IsNumeric_v<T2> &&
897  ( IsSymmetric_v<T1> && !IsDiagonal_v<T1> && !IsUniform_v<T1> ) > >
898 {
899  using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
900 };
901 
902 template< typename T1, typename T2 >
903 struct MultTraitEval1< T1, T2
904  , EnableIf_t< IsNumeric_v<T1> &&
905  IsMatrix_v<T2> &&
906  ( IsSymmetric_v<T2> && !IsDiagonal_v<T2> && !IsUniform_v<T2> ) > >
907 {
908  using Type = SymmetricMatrix< typename MultTraitEval2<T1,T2>::Type >;
909 };
911 //*************************************************************************************************
912 
913 
914 
915 
916 //=================================================================================================
917 //
918 // KRONTRAIT SPECIALIZATIONS
919 //
920 //=================================================================================================
921 
922 //*************************************************************************************************
924 template< typename T1, typename T2 >
925 struct KronTraitEval1< T1, T2
926  , EnableIf_t< IsMatrix_v<T1> &&
927  IsMatrix_v<T2> &&
928  ( IsSymmetric_v<T1> && IsSymmetric_v<T2> ) &&
929  !( IsDiagonal_v<T1> && IsDiagonal_v<T2> ) &&
930  !( IsUniform_v<T1> && IsUniform_v<T2> ) &&
931  !( IsZero_v<T1> || IsZero_v<T2> ) > >
932 {
933  using Type = SymmetricMatrix< typename KronTraitEval2<T1,T2>::Type >;
934 };
936 //*************************************************************************************************
937 
938 
939 
940 
941 //=================================================================================================
942 //
943 // DIVTRAIT SPECIALIZATIONS
944 //
945 //=================================================================================================
946 
947 //*************************************************************************************************
949 template< typename T1, typename T2 >
950 struct DivTraitEval1< T1, T2
951  , EnableIf_t< IsSymmetric_v<T1> && !IsDiagonal_v<T1> && IsNumeric_v<T2> > >
952 {
953  using Type = SymmetricMatrix< typename DivTraitEval2<T1,T2>::Type >;
954 };
956 //*************************************************************************************************
957 
958 
959 
960 
961 //=================================================================================================
962 //
963 // MAPTRAIT SPECIALIZATIONS
964 //
965 //=================================================================================================
966 
967 //*************************************************************************************************
969 template< typename T, typename OP >
970 struct UnaryMapTraitEval1< T, OP
971  , EnableIf_t< YieldsSymmetric_v<OP,T> &&
972  !YieldsHermitian_v<OP,T> &&
973  !YieldsDiagonal_v<OP,T> &&
974  !YieldsIdentity_v<OP,T> > >
975 {
976  using Type = SymmetricMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
977 };
979 //*************************************************************************************************
980 
981 
982 //*************************************************************************************************
984 template< typename T1, typename T2, typename OP >
985 struct BinaryMapTraitEval1< T1, T2, OP
986  , EnableIf_t< YieldsSymmetric_v<OP,T1,T2> &&
987  !YieldsHermitian_v<OP,T1,T2> &&
988  !YieldsDiagonal_v<OP,T1,T2> &&
989  !YieldsIdentity_v<OP,T1,T2> > >
990 {
991  using Type = SymmetricMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
992 };
994 //*************************************************************************************************
995 
996 
997 
998 
999 //=================================================================================================
1000 //
1001 // DECLSYMTRAIT SPECIALIZATIONS
1002 //
1003 //=================================================================================================
1004 
1005 //*************************************************************************************************
1007 template< typename MT, bool SO, bool DF, bool NF >
1008 struct DeclSymTrait< SymmetricMatrix<MT,SO,DF,NF> >
1009 {
1010  using Type = SymmetricMatrix<MT,SO,DF,NF>;
1011 };
1013 //*************************************************************************************************
1014 
1015 
1016 
1017 
1018 //=================================================================================================
1019 //
1020 // DECLHERMTRAIT SPECIALIZATIONS
1021 //
1022 //=================================================================================================
1023 
1024 //*************************************************************************************************
1026 template< typename MT, bool SO, bool DF, bool NF >
1027 struct DeclHermTrait< SymmetricMatrix<MT,SO,DF,NF> >
1028 {
1029  using Type = HermitianMatrix<MT>;
1030 };
1032 //*************************************************************************************************
1033 
1034 
1035 
1036 
1037 //=================================================================================================
1038 //
1039 // DECLLOWTRAIT SPECIALIZATIONS
1040 //
1041 //=================================================================================================
1042 
1043 //*************************************************************************************************
1045 template< typename MT, bool SO, bool DF, bool NF >
1046 struct DeclLowTrait< SymmetricMatrix<MT,SO,DF,NF> >
1047 {
1048  using Type = DiagonalMatrix<MT>;
1049 };
1051 //*************************************************************************************************
1052 
1053 
1054 
1055 
1056 //=================================================================================================
1057 //
1058 // DECLUPPTRAIT SPECIALIZATIONS
1059 //
1060 //=================================================================================================
1061 
1062 //*************************************************************************************************
1064 template< typename MT, bool SO, bool DF, bool NF >
1065 struct DeclUppTrait< SymmetricMatrix<MT,SO,DF,NF> >
1066 {
1067  using Type = DiagonalMatrix<MT>;
1068 };
1070 //*************************************************************************************************
1071 
1072 
1073 
1074 
1075 //=================================================================================================
1076 //
1077 // DECLDIAGTRAIT SPECIALIZATIONS
1078 //
1079 //=================================================================================================
1080 
1081 //*************************************************************************************************
1083 template< typename MT, bool SO, bool DF, bool NF >
1084 struct DeclDiagTrait< SymmetricMatrix<MT,SO,DF,NF> >
1085 {
1086  using Type = DiagonalMatrix<MT>;
1087 };
1089 //*************************************************************************************************
1090 
1091 
1092 
1093 
1094 //=================================================================================================
1095 //
1096 // HIGHTYPE SPECIALIZATIONS
1097 //
1098 //=================================================================================================
1099 
1100 //*************************************************************************************************
1102 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
1103 struct HighType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1104 {
1105  using Type = SymmetricMatrix< typename HighType<MT1,MT2>::Type >;
1106 };
1108 //*************************************************************************************************
1109 
1110 
1111 
1112 
1113 //=================================================================================================
1114 //
1115 // LOWTYPE SPECIALIZATIONS
1116 //
1117 //=================================================================================================
1118 
1119 //*************************************************************************************************
1121 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
1122 struct LowType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1123 {
1124  using Type = SymmetricMatrix< typename LowType<MT1,MT2>::Type >;
1125 };
1127 //*************************************************************************************************
1128 
1129 
1130 
1131 
1132 //=================================================================================================
1133 //
1134 // SUBMATRIXTRAIT SPECIALIZATIONS
1135 //
1136 //=================================================================================================
1137 
1138 //*************************************************************************************************
1140 template< typename MT, size_t I, size_t N >
1141 struct SubmatrixTraitEval1< MT, I, I, N, N
1142  , EnableIf_t< IsSymmetric_v<MT> &&
1143  !IsDiagonal_v<MT> > >
1144 {
1145  using Type = SymmetricMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
1146 };
1148 //*************************************************************************************************
1149 
1150 } // namespace blaze
1151 
1152 #endif
Header file for auxiliary alias declarations.
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:133
Headerfile for the generic min algorithm.
Header file for the decldiag trait.
Header file for the Schur product trait.
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.The IsMatrix_v variable template provides a c...
Definition: IsMatrix.h:138
Header file for the subtraction trait.
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
decltype(auto) submatrix(Matrix< MT, SO > &, RSAs...)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:178
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
Header file for the declherm trait.
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
constexpr bool YieldsSymmetric_v
Auxiliary variable template for the YieldsSymmetric type trait.The YieldsSymmetric_v variable templat...
Definition: YieldsSymmetric.h:124
Header file for the IsDiagonal type trait.
Header file for the dense matrix inversion flags.
Flag for the Bunch-Kaufman-based inversion for Hermitian matrices.
Definition: InversionFlag.h:105
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Header file for the YieldsIdentity type trait.
Header file for the MAYBE_UNUSED function template.
Matrix adapter for symmetric matrices.
Definition: BaseTemplate.h:608
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: IntegralConstant.h:132
Header file for all forward declarations of the math module.
Header file for the MaxSize type trait.
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Header file for the implementation of the base template of the SymmetricMatrix.
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:2433
Header file for the IsMatrix type trait.
Header file for the IsSquare type trait.
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.The EnableIf_t alias declaration provides a convenient...
Definition: EnableIf.h:138
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:779
Constraint on the data type.
SymmetricMatrix specialization for dense matrices with non-numeric element type.
Header file for the LowType type trait.
Header file for the IsUniform type trait.
Header file for the multiplication trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Header file for the IsShrinkable type trait.
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:1162
SymmetricMatrix specialization for sparse matrices with numeric element type.
Header file for the decllow trait.
constexpr bool IsNumeric_v
Auxiliary variable template for the IsNumeric type trait.The IsNumeric_v variable template provides a...
Definition: IsNumeric.h:143
Flag for the inversion of a Hermitian matrix (same as byLDLH).
Definition: InversionFlag.h:110
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for the IsAligned type trait.
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
Header file for the Kron product trait.
Header file for the exception macros of the math module.
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Header file for the EnableIf class template.
Header file for the IsStrictlyLower type trait.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:615
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
Header file for the declupp trait.
SymmetricMatrix specialization for sparse matrices with non-numeric element type.
Flag for the inversion of a symmetric matrix (same as byLDLT).
Definition: InversionFlag.h:109
Header file for run time assertion macros.
Header file for the YieldsSymmetric type trait.
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Header file for the IsContiguous type trait.
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:133
Header file for the IsZero type trait.
Header file for the declsym trait.
Header file for the isDefault shim.
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:282
constexpr size_t size(const Matrix< MT, SO > &matrix) noexcept
Returns the total number of elements of the matrix.
Definition: Matrix.h:530
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i....
Definition: BLASCompatible.h:61
Flag for the Cholesky-based inversion for positive-definite matrices.
Definition: InversionFlag.h:106
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:1328
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.In case the given data type T requires an intermediate evaluation within ...
Definition: RequiresEvaluation.h:81
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
SymmetricMatrix specialization for dense matrices with numeric element type.
Header file for the YieldsDiagonal type trait.
Header file for the IsBuiltin type trait.
Header file for the isDivisor shim.
Header file for the StorageOrder type trait.
Header file for the IntegralConstant class template.
Header file for the map trait.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:264
constexpr bool IsSymmetric_v
Auxiliary variable template for the IsSymmetric type trait.The IsSymmetric_v variable template provid...
Definition: IsSymmetric.h:172
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:635
Header file for the YieldsHermitian type trait.
Header file for the IsHermitian type trait.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
Header file for the Size type trait.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
Header file for the HighType type trait.