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/Exception.h>
54 #include <blaze/math/Forward.h>
55 #include <blaze/math/Functions.h>
79 #include <blaze/util/Assert.h>
80 #include <blaze/util/EnableIf.h>
82 #include <blaze/util/TrueType.h>
85 #include <blaze/util/Unused.h>
86 
87 
88 namespace blaze {
89 
90 //=================================================================================================
91 //
92 // SYMMETRICMATRIX OPERATORS
93 //
94 //=================================================================================================
95 
96 //*************************************************************************************************
99 template< typename MT, bool SO, bool DF, bool NF >
100 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m );
101 
102 template< typename MT, bool SO, bool DF, bool NF >
103 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m, size_t i );
104 
105 template< typename MT, bool SO, bool DF, bool NF >
106 inline void clear( SymmetricMatrix<MT,SO,DF,NF>& m );
107 
108 template< bool RF, typename MT, bool SO, bool DF, bool NF >
109 inline bool isDefault( const SymmetricMatrix<MT,SO,DF,NF>& m );
110 
111 template< typename MT, bool SO, bool DF, bool NF >
112 inline bool isIntact( const SymmetricMatrix<MT,SO,DF,NF>& m );
113 
114 template< typename MT, bool SO, bool DF, bool NF >
115 inline void swap( SymmetricMatrix<MT,SO,DF,NF>& a, SymmetricMatrix<MT,SO,DF,NF>& b ) noexcept;
117 //*************************************************************************************************
118 
119 
120 //*************************************************************************************************
127 template< typename MT // Type of the adapted matrix
128  , bool SO // Storage order of the adapted matrix
129  , bool DF // Density flag
130  , bool NF > // Numeric flag
132 {
133  m.reset();
134 }
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
151 template< typename MT // Type of the adapted matrix
152  , bool SO // Storage order of the adapted matrix
153  , bool DF // Density flag
154  , bool NF > // Numeric flag
155 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m, size_t i )
156 {
157  m.reset( i );
158 }
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
169 template< typename MT // Type of the adapted matrix
170  , bool SO // Storage order of the adapted matrix
171  , bool DF // Density flag
172  , bool NF > // Numeric flag
174 {
175  m.clear();
176 }
177 //*************************************************************************************************
178 
179 
180 //*************************************************************************************************
205 template< bool RF // Relaxation flag
206  , typename MT // Type of the adapted matrix
207  , bool SO // Storage order of the adapted matrix
208  , bool DF // Density flag
209  , bool NF > // Numeric flag
211 {
212  return isDefault<RF>( m.matrix_ );
213 }
214 //*************************************************************************************************
215 
216 
217 //*************************************************************************************************
238 template< typename MT // Type of the adapted matrix
239  , bool SO // Storage order of the adapted matrix
240  , bool DF // Density flag
241  , bool NF > // Numeric flag
242 inline bool isIntact( const SymmetricMatrix<MT,SO,DF,NF>& m )
243 {
244  return m.isIntact();
245 }
246 //*************************************************************************************************
247 
248 
249 //*************************************************************************************************
257 template< typename MT // Type of the adapted matrix
258  , bool SO // Storage order of the adapted matrix
259  , bool DF // Density flag
260  , bool NF > // Numeric flag
262 {
263  a.swap( b );
264 }
265 //*************************************************************************************************
266 
267 
268 //*************************************************************************************************
291 template< InversionFlag IF // Inversion algorithm
292  , typename MT // Type of the dense matrix
293  , bool SO > // Storage order of the dense matrix
295 {
297 
298  if( IF == asUniLower || IF == asUniUpper ) {
299  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
300  return;
301  }
302 
303  constexpr InversionFlag flag( ( IF == byLU || IF == byLDLT || IF == byLDLH ||
304  IF == asGeneral || IF == asSymmetric || IF == asHermitian )
305  ? ( byLDLT )
306  : ( ( IF == byLLH )
307  ?( byLLH )
308  :( asDiagonal ) ) );
309 
310  MT tmp( m.matrix_ );
311  invert<flag>( tmp );
312  m.matrix_ = std::move( tmp );
313 
314  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
315 }
317 //*************************************************************************************************
318 
319 
320 //*************************************************************************************************
336 template< typename MT1 // Type of the adapted matrix
337  , bool SO1 // Storage order of the adapted matrix
338  , bool DF // Density flag
339  , bool NF // Numeric flag
340  , typename MT2 // Type of the right-hand side matrix
341  , bool SO2 > // Storage order of the right-hand side matrix
342 inline bool tryAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
343  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
344 {
346 
347  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
348  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
349  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
350  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
351 
352  UNUSED_PARAMETER( lhs );
353 
354  const size_t M( (~rhs).rows() );
355  const size_t N( (~rhs).columns() );
356 
357  if( ( row + M <= column ) || ( column + N <= row ) )
358  return true;
359 
360  const bool lower( row > column );
361  const size_t size ( min( row + M, column + N ) - ( lower ? row : column ) );
362 
363  if( size < 2UL )
364  return true;
365 
366  const size_t subrow( lower ? 0UL : column - row );
367  const size_t subcol( lower ? row - column : 0UL );
368 
369  return isSymmetric( submatrix( ~rhs, subrow, subcol, size, size ) );
370 }
372 //*************************************************************************************************
373 
374 
375 //*************************************************************************************************
391 template< typename MT1 // Type of the adapted matrix
392  , bool SO1 // Storage order of the adapted matrix
393  , bool DF // Density flag
394  , bool NF // Numeric flag
395  , typename MT2 // Type of the right-hand side matrix
396  , bool SO2 > // Storage order of the right-hand side matrix
397 inline bool tryAddAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
398  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
399 {
400  return tryAssign( lhs, ~rhs, row, column );
401 }
403 //*************************************************************************************************
404 
405 
406 //*************************************************************************************************
423 template< typename MT1 // Type of the adapted matrix
424  , bool SO1 // Storage order of the adapted matrix
425  , bool DF // Density flag
426  , bool NF // Numeric flag
427  , typename MT2 // Type of the right-hand side matrix
428  , bool SO2 > // Storage order of the right-hand side matrix
429 inline bool trySubAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
430  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
431 {
432  return tryAssign( lhs, ~rhs, row, column );
433 }
435 //*************************************************************************************************
436 
437 
438 
439 
440 //=================================================================================================
441 //
442 // ROWS SPECIALIZATIONS
443 //
444 //=================================================================================================
445 
446 //*************************************************************************************************
448 template< typename MT, bool SO, bool DF, bool NF >
449 struct Rows< SymmetricMatrix<MT,SO,DF,NF> > : public Rows<MT>
450 {};
452 //*************************************************************************************************
453 
454 
455 
456 
457 //=================================================================================================
458 //
459 // COLUMNS SPECIALIZATIONS
460 //
461 //=================================================================================================
462 
463 //*************************************************************************************************
465 template< typename MT, bool SO, bool DF, bool NF >
466 struct Columns< SymmetricMatrix<MT,SO,DF,NF> > : public Columns<MT>
467 {};
469 //*************************************************************************************************
470 
471 
472 
473 
474 //=================================================================================================
475 //
476 // ISSQUARE SPECIALIZATIONS
477 //
478 //=================================================================================================
479 
480 //*************************************************************************************************
482 template< typename MT, bool SO, bool DF, bool NF >
483 struct IsSquare< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
484 {};
486 //*************************************************************************************************
487 
488 
489 
490 
491 //=================================================================================================
492 //
493 // ISSYMMETRIC SPECIALIZATIONS
494 //
495 //=================================================================================================
496 
497 //*************************************************************************************************
499 template< typename MT, bool SO, bool DF, bool NF >
500 struct IsSymmetric< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
501 {};
503 //*************************************************************************************************
504 
505 
506 
507 
508 //=================================================================================================
509 //
510 // ISHERMITIAN SPECIALIZATIONS
511 //
512 //=================================================================================================
513 
514 //*************************************************************************************************
516 template< typename MT, bool SO, bool DF, bool NF >
517 struct IsHermitian< SymmetricMatrix<MT,SO,DF,NF> >
518  : public BoolConstant< IsBuiltin< ElementType_<MT> >::value >
519 {};
521 //*************************************************************************************************
522 
523 
524 
525 
526 //=================================================================================================
527 //
528 // ISADAPTOR SPECIALIZATIONS
529 //
530 //=================================================================================================
531 
532 //*************************************************************************************************
534 template< typename MT, bool SO, bool DF, bool NF >
535 struct IsAdaptor< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
536 {};
538 //*************************************************************************************************
539 
540 
541 
542 
543 //=================================================================================================
544 //
545 // ISRESTRICTED SPECIALIZATIONS
546 //
547 //=================================================================================================
548 
549 //*************************************************************************************************
551 template< typename MT, bool SO, bool DF, bool NF >
552 struct IsRestricted< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
553 {};
555 //*************************************************************************************************
556 
557 
558 
559 
560 //=================================================================================================
561 //
562 // HASCONSTDATAACCESS SPECIALIZATIONS
563 //
564 //=================================================================================================
565 
566 //*************************************************************************************************
568 template< typename MT, bool SO, bool NF >
569 struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,NF> > : public TrueType
570 {};
572 //*************************************************************************************************
573 
574 
575 
576 
577 //=================================================================================================
578 //
579 // ISALIGNED SPECIALIZATIONS
580 //
581 //=================================================================================================
582 
583 //*************************************************************************************************
585 template< typename MT, bool SO, bool DF, bool NF >
586 struct IsAligned< SymmetricMatrix<MT,SO,DF,NF> > : public BoolConstant< IsAligned<MT>::value >
587 {};
589 //*************************************************************************************************
590 
591 
592 
593 
594 //=================================================================================================
595 //
596 // ISPADDED SPECIALIZATIONS
597 //
598 //=================================================================================================
599 
600 //*************************************************************************************************
602 template< typename MT, bool SO, bool DF, bool NF >
603 struct IsPadded< SymmetricMatrix<MT,SO,DF,NF> > : public BoolConstant< IsPadded<MT>::value >
604 {};
606 //*************************************************************************************************
607 
608 
609 
610 
611 //=================================================================================================
612 //
613 // ISRESIZABLE SPECIALIZATIONS
614 //
615 //=================================================================================================
616 
617 //*************************************************************************************************
619 template< typename MT, bool SO, bool DF, bool NF >
620 struct IsResizable< SymmetricMatrix<MT,SO,DF,NF> > : public BoolConstant< IsResizable<MT>::value >
621 {};
623 //*************************************************************************************************
624 
625 
626 
627 
628 //=================================================================================================
629 //
630 // REMOVEADAPTOR SPECIALIZATIONS
631 //
632 //=================================================================================================
633 
634 //*************************************************************************************************
636 template< typename MT, bool SO, bool DF, bool NF >
637 struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
638 {
639  using Type = MT;
640 };
642 //*************************************************************************************************
643 
644 
645 
646 
647 //=================================================================================================
648 //
649 // ADDTRAIT SPECIALIZATIONS
650 //
651 //=================================================================================================
652 
653 //*************************************************************************************************
655 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
656 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, StaticMatrix<T,M,N,SO2> >
657 {
659 };
660 
661 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
662 struct AddTrait< StaticMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
663 {
664  using Type = AddTrait_< StaticMatrix<T,M,N,SO1>, MT >;
665 };
666 
667 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
668 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, HybridMatrix<T,M,N,SO2> >
669 {
671 };
672 
673 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
674 struct AddTrait< HybridMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
675 {
676  using Type = AddTrait_< HybridMatrix<T,M,N,SO1>, MT >;
677 };
678 
679 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
680 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, DynamicMatrix<T,SO2> >
681 {
683 };
684 
685 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
686 struct AddTrait< DynamicMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
687 {
688  using Type = AddTrait_< DynamicMatrix<T,SO1>, MT >;
689 };
690 
691 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool AF, bool PF, bool SO2 >
692 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, CustomMatrix<T,AF,PF,SO2> >
693 {
695 };
696 
697 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF, bool NF >
698 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
699 {
700  using Type = AddTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
701 };
702 
703 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
704 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, CompressedMatrix<T,SO2> >
705 {
707 };
708 
709 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
710 struct AddTrait< CompressedMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
711 {
712  using Type = AddTrait_< CompressedMatrix<T,SO1>, MT >;
713 };
714 
715 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
716 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
717 {
719 };
721 //*************************************************************************************************
722 
723 
724 
725 
726 //=================================================================================================
727 //
728 // SUBTRAIT SPECIALIZATIONS
729 //
730 //=================================================================================================
731 
732 //*************************************************************************************************
734 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
735 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, StaticMatrix<T,M,N,SO2> >
736 {
738 };
739 
740 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
741 struct SubTrait< StaticMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
742 {
743  using Type = SubTrait_< StaticMatrix<T,M,N,SO1>, MT >;
744 };
745 
746 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
747 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, HybridMatrix<T,M,N,SO2> >
748 {
750 };
751 
752 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
753 struct SubTrait< HybridMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
754 {
755  using Type = SubTrait_< HybridMatrix<T,M,N,SO1>, MT >;
756 };
757 
758 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
759 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, DynamicMatrix<T,SO2> >
760 {
762 };
763 
764 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
765 struct SubTrait< DynamicMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
766 {
767  using Type = SubTrait_< DynamicMatrix<T,SO1>, MT >;
768 };
769 
770 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool AF, bool PF, bool SO2 >
771 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, CustomMatrix<T,AF,PF,SO2> >
772 {
774 };
775 
776 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF, bool NF >
777 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
778 {
779  using Type = SubTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
780 };
781 
782 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
783 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, CompressedMatrix<T,SO2> >
784 {
786 };
787 
788 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
789 struct SubTrait< CompressedMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
790 {
791  using Type = SubTrait_< CompressedMatrix<T,SO1>, MT >;
792 };
793 
794 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
795 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
796 {
798 };
800 //*************************************************************************************************
801 
802 
803 
804 
805 //=================================================================================================
806 //
807 // MULTTRAIT SPECIALIZATIONS
808 //
809 //=================================================================================================
810 
811 //*************************************************************************************************
813 template< typename MT, bool SO, bool DF, bool NF, typename T >
814 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, T, EnableIf_< IsNumeric<T> > >
815 {
816  using Type = SymmetricMatrix< MultTrait_<MT,T> >;
817 };
818 
819 template< typename T, typename MT, bool SO, bool DF, bool NF >
820 struct MultTrait< T, SymmetricMatrix<MT,SO,DF,NF>, EnableIf_< IsNumeric<T> > >
821 {
822  using Type = SymmetricMatrix< MultTrait_<T,MT> >;
823 };
824 
825 template< typename MT, bool SO, bool DF, bool NF, typename T, size_t N >
826 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, StaticVector<T,N,false> >
827 {
829 };
830 
831 template< typename T, size_t N, typename MT, bool SO, bool DF, bool NF >
832 struct MultTrait< StaticVector<T,N,true>, SymmetricMatrix<MT,SO,DF,NF> >
833 {
834  using Type = MultTrait_< StaticVector<T,N,true>, MT >;
835 };
836 
837 template< typename MT, bool SO, bool DF, bool NF, typename T, size_t N >
838 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, HybridVector<T,N,false> >
839 {
841 };
842 
843 template< typename T, size_t N, typename MT, bool SO, bool DF, bool NF >
844 struct MultTrait< HybridVector<T,N,true>, SymmetricMatrix<MT,SO,DF,NF> >
845 {
846  using Type = MultTrait_< HybridVector<T,N,true>, MT >;
847 };
848 
849 template< typename MT, bool SO, bool DF, bool NF, typename T >
850 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, DynamicVector<T,false> >
851 {
853 };
854 
855 template< typename T, typename MT, bool SO, bool DF, bool NF >
856 struct MultTrait< DynamicVector<T,true>, SymmetricMatrix<MT,SO,DF,NF> >
857 {
858  using Type = MultTrait_< DynamicVector<T,true>, MT >;
859 };
860 
861 template< typename MT, bool SO, bool DF, bool NF, typename T, bool AF, bool PF >
862 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, CustomVector<T,AF,PF,false> >
863 {
865 };
866 
867 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF, bool NF >
868 struct MultTrait< CustomVector<T,AF,PF,true>, SymmetricMatrix<MT,SO,DF,NF> >
869 {
870  using Type = MultTrait_< CustomVector<T,AF,PF,true>, MT >;
871 };
872 
873 template< typename MT, bool SO, bool DF, bool NF, typename T >
874 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, CompressedVector<T,false> >
875 {
877 };
878 
879 template< typename T, typename MT, bool SO, bool DF, bool NF >
880 struct MultTrait< CompressedVector<T,true>, SymmetricMatrix<MT,SO,DF,NF> >
881 {
882  using Type = MultTrait_< CompressedVector<T,true>, MT >;
883 };
884 
885 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
886 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, StaticMatrix<T,M,N,SO2> >
887 {
889 };
890 
891 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
892 struct MultTrait< StaticMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
893 {
894  using Type = MultTrait_< StaticMatrix<T,M,N,SO1>, MT >;
895 };
896 
897 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
898 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, HybridMatrix<T,M,N,SO2> >
899 {
901 };
902 
903 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
904 struct MultTrait< HybridMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
905 {
906  using Type = MultTrait_< HybridMatrix<T,M,N,SO1>, MT >;
907 };
908 
909 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
910 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, DynamicMatrix<T,SO2> >
911 {
913 };
914 
915 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
916 struct MultTrait< DynamicMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
917 {
918  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
919 };
920 
921 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool AF, bool PF, bool SO2 >
922 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, CustomMatrix<T,AF,PF,SO2> >
923 {
925 };
926 
927 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF, bool NF >
928 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
929 {
930  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
931 };
932 
933 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
934 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, CompressedMatrix<T,SO2> >
935 {
937 };
938 
939 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
940 struct MultTrait< CompressedMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
941 {
942  using Type = MultTrait_< CompressedMatrix<T,SO1>, MT >;
943 };
944 
945 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
946 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
947 {
948  using Type = MultTrait_<MT1,MT2>;
949 };
951 //*************************************************************************************************
952 
953 
954 
955 
956 //=================================================================================================
957 //
958 // DIVTRAIT SPECIALIZATIONS
959 //
960 //=================================================================================================
961 
962 //*************************************************************************************************
964 template< typename MT, bool SO, bool DF, bool NF, typename T >
965 struct DivTrait< SymmetricMatrix<MT,SO,DF,NF>, T, EnableIf_< IsNumeric<T> > >
966 {
967  using Type = SymmetricMatrix< DivTrait_<MT,T> >;
968 };
970 //*************************************************************************************************
971 
972 
973 
974 
975 //=================================================================================================
976 //
977 // FOREACHTRAIT SPECIALIZATIONS
978 //
979 //=================================================================================================
980 
981 //*************************************************************************************************
983 template< typename MT, bool SO, bool DF, bool NF >
984 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Abs >
985 {
987 };
988 
989 template< typename MT, bool SO, bool DF, bool NF >
990 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Floor >
991 {
993 };
994 
995 template< typename MT, bool SO, bool DF, bool NF >
996 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Ceil >
997 {
999 };
1000 
1001 template< typename MT, bool SO, bool DF, bool NF >
1002 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Conj >
1003 {
1005 };
1006 
1007 template< typename MT, bool SO, bool DF, bool NF >
1008 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Real >
1009 {
1011 };
1012 
1013 template< typename MT, bool SO, bool DF, bool NF >
1014 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Imag >
1015 {
1017 };
1018 
1019 template< typename MT, bool SO, bool DF, bool NF >
1020 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Sqrt >
1021 {
1023 };
1024 
1025 template< typename MT, bool SO, bool DF, bool NF >
1026 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Cbrt >
1027 {
1029 };
1030 
1031 template< typename MT, bool SO, bool DF, bool NF >
1032 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, InvCbrt >
1033 {
1035 };
1036 
1037 template< typename MT, bool SO, bool DF, bool NF, typename ET >
1038 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Pow<ET> >
1039 {
1041 };
1042 
1043 template< typename MT, bool SO, bool DF, bool NF >
1044 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Exp >
1045 {
1047 };
1048 
1049 template< typename MT, bool SO, bool DF, bool NF >
1050 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Log >
1051 {
1053 };
1054 
1055 template< typename MT, bool SO, bool DF, bool NF >
1056 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Log10 >
1057 {
1059 };
1060 
1061 template< typename MT, bool SO, bool DF, bool NF >
1062 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Sin >
1063 {
1065 };
1066 
1067 template< typename MT, bool SO, bool DF, bool NF >
1068 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Asin >
1069 {
1071 };
1072 
1073 template< typename MT, bool SO, bool DF, bool NF >
1074 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Sinh >
1075 {
1077 };
1078 
1079 template< typename MT, bool SO, bool DF, bool NF >
1080 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Asinh >
1081 {
1083 };
1084 
1085 template< typename MT, bool SO, bool DF, bool NF >
1086 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Cos >
1087 {
1089 };
1090 
1091 template< typename MT, bool SO, bool DF, bool NF >
1092 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Acos >
1093 {
1095 };
1096 
1097 template< typename MT, bool SO, bool DF, bool NF >
1098 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Cosh >
1099 {
1101 };
1102 
1103 template< typename MT, bool SO, bool DF, bool NF >
1104 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Acosh >
1105 {
1107 };
1108 
1109 template< typename MT, bool SO, bool DF, bool NF >
1110 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Tan >
1111 {
1113 };
1114 
1115 template< typename MT, bool SO, bool DF, bool NF >
1116 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Atan >
1117 {
1119 };
1120 
1121 template< typename MT, bool SO, bool DF, bool NF >
1122 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Tanh >
1123 {
1125 };
1126 
1127 template< typename MT, bool SO, bool DF, bool NF >
1128 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Atanh >
1129 {
1131 };
1132 
1133 template< typename MT, bool SO, bool DF, bool NF >
1134 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Erf >
1135 {
1137 };
1138 
1139 template< typename MT, bool SO, bool DF, bool NF >
1140 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Erfc >
1141 {
1143 };
1145 //*************************************************************************************************
1146 
1147 
1148 
1149 
1150 //=================================================================================================
1151 //
1152 // HIGHTYPE SPECIALIZATIONS
1153 //
1154 //=================================================================================================
1155 
1156 //*************************************************************************************************
1158 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
1159 struct HighType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1160 {
1162 };
1164 //*************************************************************************************************
1165 
1166 
1167 
1168 
1169 //=================================================================================================
1170 //
1171 // LOWTYPE SPECIALIZATIONS
1172 //
1173 //=================================================================================================
1174 
1175 //*************************************************************************************************
1177 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
1178 struct LowType< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1179 {
1181 };
1183 //*************************************************************************************************
1184 
1185 
1186 
1187 
1188 //=================================================================================================
1189 //
1190 // SUBMATRIXTRAIT SPECIALIZATIONS
1191 //
1192 //=================================================================================================
1193 
1194 //*************************************************************************************************
1196 template< typename MT, bool SO, bool DF, bool NF >
1197 struct SubmatrixTrait< SymmetricMatrix<MT,SO,DF,NF> >
1198 {
1199  using Type = SubmatrixTrait_<MT>;
1200 };
1202 //*************************************************************************************************
1203 
1204 
1205 
1206 
1207 //=================================================================================================
1208 //
1209 // ROWTRAIT SPECIALIZATIONS
1210 //
1211 //=================================================================================================
1212 
1213 //*************************************************************************************************
1215 template< typename MT, bool SO, bool DF, bool NF >
1216 struct RowTrait< SymmetricMatrix<MT,SO,DF,NF> >
1217 {
1218  using Type = RowTrait_<MT>;
1219 };
1221 //*************************************************************************************************
1222 
1223 
1224 
1225 
1226 //=================================================================================================
1227 //
1228 // COLUMNTRAIT SPECIALIZATIONS
1229 //
1230 //=================================================================================================
1231 
1232 //*************************************************************************************************
1234 template< typename MT, bool SO, bool DF, bool NF >
1235 struct ColumnTrait< SymmetricMatrix<MT,SO,DF,NF> >
1236 {
1237  using Type = ColumnTrait_<MT>;
1238 };
1240 //*************************************************************************************************
1241 
1242 } // namespace blaze
1243 
1244 #endif
Header file for auxiliary alias declarations.
Header file for mathematical functions.
Compile time check for low-level access to constant data.This type trait tests whether the given data...
Definition: HasConstDataAccess.h:75
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
Header file for the row trait.
Base template for the SubmatrixTrait class.
Definition: SubmatrixTrait.h:118
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
Base template for the ColumnTrait class.
Definition: ColumnTrait.h:117
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
typename RowTrait< MT >::Type RowTrait_
Auxiliary alias declaration for the RowTrait type trait.The RowTrait_ alias declaration provides a co...
Definition: RowTrait.h:152
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:261
Generic wrapper for a compile time constant integral value.The IntegralConstant class template repres...
Definition: IntegralConstant.h:71
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:533
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1755
Matrix adapter for symmetric matrices.
Definition: Forward.h:52
typename MultTrait< T1, T2 >::Type MultTrait_
Auxiliary alias declaration for the MultTrait class template.The MultTrait_ alias declaration provide...
Definition: MultTrait.h:245
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:1679
Compile time check for data types with restricted data access.This type trait tests whether the given...
Definition: IsRestricted.h:82
Header file for the IsSquare type trait.
Compile time check for the alignment of data types.This type trait tests whether the given data type ...
Definition: IsAligned.h:87
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Base template for the RowTrait class.
Definition: RowTrait.h:117
Constraint on the data type.
SymmetricMatrix specialization for dense matrices with non-numeric element type.
Header file for the LowType type trait.
Base template for the HighType type trait.
Definition: HighType.h:133
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Base template for the ForEachTrait class.The ForEachTrait class template offers the possibility to se...
Definition: ForEachTrait.h:79
Header file for all forward declarations of the math module.
Compile time check for data types with padding.This type trait tests whether the given data type empl...
Definition: IsPadded.h:76
SymmetricMatrix specialization for sparse matrices with numeric element type.
Header file for the Columns type trait.
Header file for the implementation of a fixed-size matrix.
typename T::ElementType ElementType_
Alias declaration for nested ElementType type definitions.The ElementType_ alias declaration provides...
Definition: Aliases.h:163
Flag for the inversion of a Hermitian matrix (same as byLDLH).
Definition: InversionFlag.h:110
Compile time check for square matrices.This type trait tests whether or not the given template parame...
Definition: IsSquare.h:88
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:336
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, RowExprTrait_< MT > > row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:128
Compile time check for symmetric matrices.This type trait tests whether or not the given template par...
Definition: IsSymmetric.h:85
Header file for the exception macros of the math module.
Header file for the RemoveAdaptor type trait.
Constraint on the data type.
Compile time check for adaptors.This type trait tests whether the given template parameter is an adap...
Definition: IsAdaptor.h:88
DisableIf_< Or< IsComputation< MT >, IsTransExpr< MT >, IsDeclExpr< MT > >, ColumnExprTrait_< MT > > column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:128
Header file for the EnableIf class template.
void clear(const DiagonalProxy< MT > &proxy)
Clearing the represented element.
Definition: DiagonalProxy.h:553
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
Header file for the IsNumeric type trait.
Base template for the LowType type trait.
Definition: LowType.h:133
Header file for the HasConstDataAccess type trait.
Compile time check for resizable data types.This type trait tests whether the given data type is a re...
Definition: IsResizable.h:75
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.
Base template for the AddTrait class.
Definition: AddTrait.h:143
Base template for the MultTrait class.
Definition: MultTrait.h:143
Header file for the addition trait.
Header file for the division trait.
Header file for the submatrix trait.
Header file for the column 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:267
Compile time check for Hermitian matrices.This type trait tests whether or not the given template par...
Definition: IsHermitian.h:85
Base class for matrices.The Matrix class is a base class for all dense and sparse matrix classes with...
Definition: Forward.h:94
#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:697
#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
typename SubmatrixTrait< MT >::Type SubmatrixTrait_
Auxiliary alias declaration for the SubmatrixTrait type trait.The SubmatrixTrait_ alias declaration p...
Definition: SubmatrixTrait.h:153
Base template for the DivTrait class.
Definition: DivTrait.h:143
SymmetricMatrix specialization for dense matrices with numeric element type.
typename ColumnTrait< MT >::Type ColumnTrait_
Auxiliary alias declaration for the ColumnTrait type trait.The ColumnTrait_ alias declaration provide...
Definition: ColumnTrait.h:152
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:320
Removal of top level adaptor types.In case the given type is an adaptor type (SymmetricMatrix, LowerMatrix, UpperMatrix, ...), the RemoveAdaptor type trait removes the adaptor and extracts the contained general matrix type. Else the given type is returned as is. Note that cv-qualifiers are preserved.
Definition: RemoveAdaptor.h:76
Header file for the IsBuiltin type trait.
typename SubTrait< T1, T2 >::Type SubTrait_
Auxiliary alias declaration for the SubTrait class template.The SubTrait_ alias declaration provides ...
Definition: SubTrait.h:245
Header file for the for-each trait.
Header file for the isDivisor shim.
Header file for the IntegralConstant class template.
Compile time evaluation of the number of columns of a matrix.The Columns type trait evaluates the num...
Definition: Columns.h:76
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:249
Compile time evaluation of the number of rows of a matrix.The Rows type trait evaluates the number of...
Definition: Rows.h:76
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Base template for the SubTrait class.
Definition: SubTrait.h:143
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
SubmatrixExprTrait_< MT, unaligned > submatrix(Matrix< MT, SO > &matrix, size_t row, size_t column, size_t m, size_t n)
Creating a view on a specific submatrix of the given matrix.
Definition: Submatrix.h:168
Header file for the IsHermitian type trait.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
typename AddTrait< T1, T2 >::Type AddTrait_
Auxiliary alias declaration for the AddTrait class template.The AddTrait_ alias declaration provides ...
Definition: AddTrait.h:245
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, the program execution is terminated. The BLAZE_INTERNAL_ASSERT macro can be disabled by setting the BLAZE_USER_ASSERTION flag to zero or by defining NDEBUG during the compilation.
Definition: Assert.h:101
Header file for the HighType type trait.
Header file for the TrueType type/value trait base class.