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>
78 #include <blaze/util/Assert.h>
79 #include <blaze/util/EnableIf.h>
81 #include <blaze/util/TrueType.h>
84 #include <blaze/util/Unused.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // SYMMETRICMATRIX OPERATORS
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
98 template< typename MT, bool SO, bool DF, bool NF >
99 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m );
100 
101 template< typename MT, bool SO, bool DF, bool NF >
102 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m, size_t i );
103 
104 template< typename MT, bool SO, bool DF, bool NF >
105 inline void clear( SymmetricMatrix<MT,SO,DF,NF>& m );
106 
107 template< typename MT, bool SO, bool DF, bool NF >
108 inline bool isDefault( const SymmetricMatrix<MT,SO,DF,NF>& m );
109 
110 template< typename MT, bool SO, bool DF, bool NF >
111 inline bool isIntact( const SymmetricMatrix<MT,SO,DF,NF>& m );
112 
113 template< typename MT, bool SO, bool DF, bool NF >
114 inline void swap( SymmetricMatrix<MT,SO,DF,NF>& a, SymmetricMatrix<MT,SO,DF,NF>& b ) noexcept;
116 //*************************************************************************************************
117 
118 
119 //*************************************************************************************************
126 template< typename MT // Type of the adapted matrix
127  , bool SO // Storage order of the adapted matrix
128  , bool DF // Density flag
129  , bool NF > // Numeric flag
131 {
132  m.reset();
133 }
134 //*************************************************************************************************
135 
136 
137 //*************************************************************************************************
150 template< typename MT // Type of the adapted matrix
151  , bool SO // Storage order of the adapted matrix
152  , bool DF // Density flag
153  , bool NF > // Numeric flag
154 inline void reset( SymmetricMatrix<MT,SO,DF,NF>& m, size_t i )
155 {
156  m.reset( i );
157 }
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
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
173 {
174  m.clear();
175 }
176 //*************************************************************************************************
177 
178 
179 //*************************************************************************************************
197 template< typename MT // Type of the adapted matrix
198  , bool SO // Storage order of the adapted matrix
199  , bool DF // Density flag
200  , bool NF > // Numeric flag
202 {
203  return isDefault( m.matrix_ );
204 }
205 //*************************************************************************************************
206 
207 
208 //*************************************************************************************************
229 template< typename MT // Type of the adapted matrix
230  , bool SO // Storage order of the adapted matrix
231  , bool DF // Density flag
232  , bool NF > // Numeric flag
233 inline bool isIntact( const SymmetricMatrix<MT,SO,DF,NF>& m )
234 {
235  return m.isIntact();
236 }
237 //*************************************************************************************************
238 
239 
240 //*************************************************************************************************
248 template< typename MT // Type of the adapted matrix
249  , bool SO // Storage order of the adapted matrix
250  , bool DF // Density flag
251  , bool NF > // Numeric flag
253 {
254  a.swap( b );
255 }
256 //*************************************************************************************************
257 
258 
259 //*************************************************************************************************
282 template< InversionFlag IF // Inversion algorithm
283  , typename MT // Type of the dense matrix
284  , bool SO > // Storage order of the dense matrix
285 inline void invert( SymmetricMatrix<MT,SO,true,true>& m )
286 {
288 
289  if( IF == asUniLower || IF == asUniUpper ) {
290  BLAZE_INTERNAL_ASSERT( isIdentity( m ), "Violation of preconditions detected" );
291  return;
292  }
293 
294  constexpr InversionFlag flag( ( IF == byLU || IF == byLDLT || IF == byLDLH ||
295  IF == asGeneral || IF == asSymmetric || IF == asHermitian )
296  ? ( byLDLT )
297  : ( ( IF == byLLH )
298  ?( byLLH )
299  :( asDiagonal ) ) );
300 
301  MT tmp( m.matrix_ );
302  invert<flag>( tmp );
303  m.matrix_ = std::move( tmp );
304 
305  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
306 }
308 //*************************************************************************************************
309 
310 
311 //*************************************************************************************************
327 template< typename MT1 // Type of the adapted matrix
328  , bool SO1 // Storage order of the adapted matrix
329  , bool DF // Density flag
330  , bool NF // Numeric flag
331  , typename MT2 // Type of the right-hand side matrix
332  , bool SO2 > // Storage order of the right-hand side matrix
333 inline bool tryAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
334  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
335 {
337 
338  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
339  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
340  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
341  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
342 
343  UNUSED_PARAMETER( lhs );
344 
345  const size_t M( (~rhs).rows() );
346  const size_t N( (~rhs).columns() );
347 
348  if( ( row + M <= column ) || ( column + N <= row ) )
349  return true;
350 
351  const bool lower( row > column );
352  const size_t size ( min( row + M, column + N ) - ( lower ? row : column ) );
353 
354  if( size < 2UL )
355  return true;
356 
357  const size_t subrow( lower ? 0UL : column - row );
358  const size_t subcol( lower ? row - column : 0UL );
359 
360  return isSymmetric( submatrix( ~rhs, subrow, subcol, size, size ) );
361 }
363 //*************************************************************************************************
364 
365 
366 //*************************************************************************************************
382 template< typename MT1 // Type of the adapted matrix
383  , bool SO1 // Storage order of the adapted matrix
384  , bool DF // Density flag
385  , bool NF // Numeric flag
386  , typename MT2 // Type of the right-hand side matrix
387  , bool SO2 > // Storage order of the right-hand side matrix
388 inline bool tryAddAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
389  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
390 {
391  return tryAssign( lhs, ~rhs, row, column );
392 }
394 //*************************************************************************************************
395 
396 
397 //*************************************************************************************************
414 template< typename MT1 // Type of the adapted matrix
415  , bool SO1 // Storage order of the adapted matrix
416  , bool DF // Density flag
417  , bool NF // Numeric flag
418  , typename MT2 // Type of the right-hand side matrix
419  , bool SO2 > // Storage order of the right-hand side matrix
420 inline bool trySubAssign( const SymmetricMatrix<MT1,SO1,DF,NF>& lhs,
421  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
422 {
423  return tryAssign( lhs, ~rhs, row, column );
424 }
426 //*************************************************************************************************
427 
428 
429 
430 
431 //=================================================================================================
432 //
433 // ROWS SPECIALIZATIONS
434 //
435 //=================================================================================================
436 
437 //*************************************************************************************************
439 template< typename MT, bool SO, bool DF, bool NF >
440 struct Rows< SymmetricMatrix<MT,SO,DF,NF> > : public Rows<MT>
441 {};
443 //*************************************************************************************************
444 
445 
446 
447 
448 //=================================================================================================
449 //
450 // COLUMNS SPECIALIZATIONS
451 //
452 //=================================================================================================
453 
454 //*************************************************************************************************
456 template< typename MT, bool SO, bool DF, bool NF >
457 struct Columns< SymmetricMatrix<MT,SO,DF,NF> > : public Columns<MT>
458 {};
460 //*************************************************************************************************
461 
462 
463 
464 
465 //=================================================================================================
466 //
467 // ISSQUARE SPECIALIZATIONS
468 //
469 //=================================================================================================
470 
471 //*************************************************************************************************
473 template< typename MT, bool SO, bool DF, bool NF >
474 struct IsSquare< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
475 {};
477 //*************************************************************************************************
478 
479 
480 
481 
482 //=================================================================================================
483 //
484 // ISSYMMETRIC SPECIALIZATIONS
485 //
486 //=================================================================================================
487 
488 //*************************************************************************************************
490 template< typename MT, bool SO, bool DF, bool NF >
491 struct IsSymmetric< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
492 {};
494 //*************************************************************************************************
495 
496 
497 
498 
499 //=================================================================================================
500 //
501 // ISHERMITIAN SPECIALIZATIONS
502 //
503 //=================================================================================================
504 
505 //*************************************************************************************************
507 template< typename MT, bool SO, bool DF, bool NF >
508 struct IsHermitian< SymmetricMatrix<MT,SO,DF,NF> >
509  : public BoolConstant< IsBuiltin< ElementType_<MT> >::value >
510 {};
512 //*************************************************************************************************
513 
514 
515 
516 
517 //=================================================================================================
518 //
519 // ISADAPTOR SPECIALIZATIONS
520 //
521 //=================================================================================================
522 
523 //*************************************************************************************************
525 template< typename MT, bool SO, bool DF, bool NF >
526 struct IsAdaptor< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
527 {};
529 //*************************************************************************************************
530 
531 
532 
533 
534 //=================================================================================================
535 //
536 // ISRESTRICTED SPECIALIZATIONS
537 //
538 //=================================================================================================
539 
540 //*************************************************************************************************
542 template< typename MT, bool SO, bool DF, bool NF >
543 struct IsRestricted< SymmetricMatrix<MT,SO,DF,NF> > : public TrueType
544 {};
546 //*************************************************************************************************
547 
548 
549 
550 
551 //=================================================================================================
552 //
553 // HASCONSTDATAACCESS SPECIALIZATIONS
554 //
555 //=================================================================================================
556 
557 //*************************************************************************************************
559 template< typename MT, bool SO, bool NF >
560 struct HasConstDataAccess< SymmetricMatrix<MT,SO,true,NF> > : public TrueType
561 {};
563 //*************************************************************************************************
564 
565 
566 
567 
568 //=================================================================================================
569 //
570 // ISALIGNED SPECIALIZATIONS
571 //
572 //=================================================================================================
573 
574 //*************************************************************************************************
576 template< typename MT, bool SO, bool DF, bool NF >
577 struct IsAligned< SymmetricMatrix<MT,SO,DF,NF> > : public BoolConstant< IsAligned<MT>::value >
578 {};
580 //*************************************************************************************************
581 
582 
583 
584 
585 //=================================================================================================
586 //
587 // ISPADDED SPECIALIZATIONS
588 //
589 //=================================================================================================
590 
591 //*************************************************************************************************
593 template< typename MT, bool SO, bool DF, bool NF >
594 struct IsPadded< SymmetricMatrix<MT,SO,DF,NF> > : public BoolConstant< IsPadded<MT>::value >
595 {};
597 //*************************************************************************************************
598 
599 
600 
601 
602 //=================================================================================================
603 //
604 // ISRESIZABLE SPECIALIZATIONS
605 //
606 //=================================================================================================
607 
608 //*************************************************************************************************
610 template< typename MT, bool SO, bool DF, bool NF >
611 struct IsResizable< SymmetricMatrix<MT,SO,DF,NF> > : public BoolConstant< IsResizable<MT>::value >
612 {};
614 //*************************************************************************************************
615 
616 
617 
618 
619 //=================================================================================================
620 //
621 // REMOVEADAPTOR SPECIALIZATIONS
622 //
623 //=================================================================================================
624 
625 //*************************************************************************************************
627 template< typename MT, bool SO, bool DF, bool NF >
628 struct RemoveAdaptor< SymmetricMatrix<MT,SO,DF,NF> >
629 {
630  using Type = MT;
631 };
633 //*************************************************************************************************
634 
635 
636 
637 
638 //=================================================================================================
639 //
640 // ADDTRAIT SPECIALIZATIONS
641 //
642 //=================================================================================================
643 
644 //*************************************************************************************************
646 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
647 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, StaticMatrix<T,M,N,SO2> >
648 {
649  using Type = AddTrait_< MT, StaticMatrix<T,M,N,SO2> >;
650 };
651 
652 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
653 struct AddTrait< StaticMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
654 {
655  using Type = AddTrait_< StaticMatrix<T,M,N,SO1>, MT >;
656 };
657 
658 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
659 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, HybridMatrix<T,M,N,SO2> >
660 {
661  using Type = AddTrait_< MT, HybridMatrix<T,M,N,SO2> >;
662 };
663 
664 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
665 struct AddTrait< HybridMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
666 {
667  using Type = AddTrait_< HybridMatrix<T,M,N,SO1>, MT >;
668 };
669 
670 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
671 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, DynamicMatrix<T,SO2> >
672 {
673  using Type = AddTrait_< MT, DynamicMatrix<T,SO2> >;
674 };
675 
676 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
677 struct AddTrait< DynamicMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
678 {
679  using Type = AddTrait_< DynamicMatrix<T,SO1>, MT >;
680 };
681 
682 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool AF, bool PF, bool SO2 >
683 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, CustomMatrix<T,AF,PF,SO2> >
684 {
685  using Type = AddTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
686 };
687 
688 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF, bool NF >
689 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
690 {
691  using Type = AddTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
692 };
693 
694 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
695 struct AddTrait< SymmetricMatrix<MT,SO1,DF,NF>, CompressedMatrix<T,SO2> >
696 {
697  using Type = AddTrait_< MT, CompressedMatrix<T,SO2> >;
698 };
699 
700 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
701 struct AddTrait< CompressedMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
702 {
703  using Type = AddTrait_< CompressedMatrix<T,SO1>, MT >;
704 };
705 
706 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
707 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
708 {
709  using Type = SymmetricMatrix< AddTrait_<MT1,MT2> >;
710 };
712 //*************************************************************************************************
713 
714 
715 
716 
717 //=================================================================================================
718 //
719 // SUBTRAIT SPECIALIZATIONS
720 //
721 //=================================================================================================
722 
723 //*************************************************************************************************
725 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
726 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, StaticMatrix<T,M,N,SO2> >
727 {
728  using Type = SubTrait_< MT, StaticMatrix<T,M,N,SO2> >;
729 };
730 
731 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
732 struct SubTrait< StaticMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
733 {
734  using Type = SubTrait_< StaticMatrix<T,M,N,SO1>, MT >;
735 };
736 
737 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
738 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, HybridMatrix<T,M,N,SO2> >
739 {
740  using Type = SubTrait_< MT, HybridMatrix<T,M,N,SO2> >;
741 };
742 
743 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
744 struct SubTrait< HybridMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
745 {
746  using Type = SubTrait_< HybridMatrix<T,M,N,SO1>, MT >;
747 };
748 
749 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
750 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, DynamicMatrix<T,SO2> >
751 {
752  using Type = SubTrait_< MT, DynamicMatrix<T,SO2> >;
753 };
754 
755 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
756 struct SubTrait< DynamicMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
757 {
758  using Type = SubTrait_< DynamicMatrix<T,SO1>, MT >;
759 };
760 
761 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool AF, bool PF, bool SO2 >
762 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, CustomMatrix<T,AF,PF,SO2> >
763 {
764  using Type = SubTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
765 };
766 
767 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF, bool NF >
768 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
769 {
770  using Type = SubTrait_< CustomMatrix<T,AF,PF,SO1>, MT >;
771 };
772 
773 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
774 struct SubTrait< SymmetricMatrix<MT,SO1,DF,NF>, CompressedMatrix<T,SO2> >
775 {
776  using Type = SubTrait_< MT, CompressedMatrix<T,SO2> >;
777 };
778 
779 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
780 struct SubTrait< CompressedMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
781 {
782  using Type = SubTrait_< CompressedMatrix<T,SO1>, MT >;
783 };
784 
785 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
786 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
787 {
788  using Type = SymmetricMatrix< SubTrait_<MT1,MT2> >;
789 };
791 //*************************************************************************************************
792 
793 
794 
795 
796 //=================================================================================================
797 //
798 // MULTTRAIT SPECIALIZATIONS
799 //
800 //=================================================================================================
801 
802 //*************************************************************************************************
804 template< typename MT, bool SO, bool DF, bool NF, typename T >
805 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, T, EnableIf_< IsNumeric<T> > >
806 {
807  using Type = SymmetricMatrix< MultTrait_<MT,T> >;
808 };
809 
810 template< typename T, typename MT, bool SO, bool DF, bool NF >
811 struct MultTrait< T, SymmetricMatrix<MT,SO,DF,NF>, EnableIf_< IsNumeric<T> > >
812 {
813  using Type = SymmetricMatrix< MultTrait_<T,MT> >;
814 };
815 
816 template< typename MT, bool SO, bool DF, bool NF, typename T, size_t N >
817 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, StaticVector<T,N,false> >
818 {
819  using Type = MultTrait_< MT, StaticVector<T,N,false> >;
820 };
821 
822 template< typename T, size_t N, typename MT, bool SO, bool DF, bool NF >
823 struct MultTrait< StaticVector<T,N,true>, SymmetricMatrix<MT,SO,DF,NF> >
824 {
825  using Type = MultTrait_< StaticVector<T,N,true>, MT >;
826 };
827 
828 template< typename MT, bool SO, bool DF, bool NF, typename T, size_t N >
829 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, HybridVector<T,N,false> >
830 {
831  using Type = MultTrait_< MT, HybridVector<T,N,false> >;
832 };
833 
834 template< typename T, size_t N, typename MT, bool SO, bool DF, bool NF >
835 struct MultTrait< HybridVector<T,N,true>, SymmetricMatrix<MT,SO,DF,NF> >
836 {
837  using Type = MultTrait_< HybridVector<T,N,true>, MT >;
838 };
839 
840 template< typename MT, bool SO, bool DF, bool NF, typename T >
841 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, DynamicVector<T,false> >
842 {
843  using Type = MultTrait_< MT, DynamicVector<T,false> >;
844 };
845 
846 template< typename T, typename MT, bool SO, bool DF, bool NF >
847 struct MultTrait< DynamicVector<T,true>, SymmetricMatrix<MT,SO,DF,NF> >
848 {
849  using Type = MultTrait_< DynamicVector<T,true>, MT >;
850 };
851 
852 template< typename MT, bool SO, bool DF, bool NF, typename T, bool AF, bool PF >
853 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, CustomVector<T,AF,PF,false> >
854 {
855  using Type = MultTrait_< MT, CustomVector<T,AF,PF,false> >;
856 };
857 
858 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF, bool NF >
859 struct MultTrait< CustomVector<T,AF,PF,true>, SymmetricMatrix<MT,SO,DF,NF> >
860 {
861  using Type = MultTrait_< CustomVector<T,AF,PF,true>, MT >;
862 };
863 
864 template< typename MT, bool SO, bool DF, bool NF, typename T >
865 struct MultTrait< SymmetricMatrix<MT,SO,DF,NF>, CompressedVector<T,false> >
866 {
867  using Type = MultTrait_< MT, CompressedVector<T,false> >;
868 };
869 
870 template< typename T, typename MT, bool SO, bool DF, bool NF >
871 struct MultTrait< CompressedVector<T,true>, SymmetricMatrix<MT,SO,DF,NF> >
872 {
873  using Type = MultTrait_< CompressedVector<T,true>, MT >;
874 };
875 
876 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
877 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, StaticMatrix<T,M,N,SO2> >
878 {
879  using Type = MultTrait_< MT, StaticMatrix<T,M,N,SO2> >;
880 };
881 
882 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
883 struct MultTrait< StaticMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
884 {
885  using Type = MultTrait_< StaticMatrix<T,M,N,SO1>, MT >;
886 };
887 
888 template< typename MT, bool SO1, bool DF, bool NF, typename T, size_t M, size_t N, bool SO2 >
889 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, HybridMatrix<T,M,N,SO2> >
890 {
891  using Type = MultTrait_< MT, HybridMatrix<T,M,N,SO2> >;
892 };
893 
894 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF, bool NF >
895 struct MultTrait< HybridMatrix<T,M,N,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
896 {
897  using Type = MultTrait_< HybridMatrix<T,M,N,SO1>, MT >;
898 };
899 
900 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
901 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, DynamicMatrix<T,SO2> >
902 {
903  using Type = MultTrait_< MT, DynamicMatrix<T,SO2> >;
904 };
905 
906 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
907 struct MultTrait< DynamicMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
908 {
909  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
910 };
911 
912 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool AF, bool PF, bool SO2 >
913 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, CustomMatrix<T,AF,PF,SO2> >
914 {
915  using Type = MultTrait_< MT, CustomMatrix<T,AF,PF,SO2> >;
916 };
917 
918 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF, bool NF >
919 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
920 {
921  using Type = MultTrait_< DynamicMatrix<T,SO1>, MT >;
922 };
923 
924 template< typename MT, bool SO1, bool DF, bool NF, typename T, bool SO2 >
925 struct MultTrait< SymmetricMatrix<MT,SO1,DF,NF>, CompressedMatrix<T,SO2> >
926 {
927  using Type = MultTrait_< MT, CompressedMatrix<T,SO2> >;
928 };
929 
930 template< typename T, bool SO1, typename MT, bool SO2, bool DF, bool NF >
931 struct MultTrait< CompressedMatrix<T,SO1>, SymmetricMatrix<MT,SO2,DF,NF> >
932 {
933  using Type = MultTrait_< CompressedMatrix<T,SO1>, MT >;
934 };
935 
936 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
937 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
938 {
939  using Type = MultTrait_<MT1,MT2>;
940 };
942 //*************************************************************************************************
943 
944 
945 
946 
947 //=================================================================================================
948 //
949 // DIVTRAIT SPECIALIZATIONS
950 //
951 //=================================================================================================
952 
953 //*************************************************************************************************
955 template< typename MT, bool SO, bool DF, bool NF, typename T >
956 struct DivTrait< SymmetricMatrix<MT,SO,DF,NF>, T, EnableIf_< IsNumeric<T> > >
957 {
958  using Type = SymmetricMatrix< DivTrait_<MT,T> >;
959 };
961 //*************************************************************************************************
962 
963 
964 
965 
966 //=================================================================================================
967 //
968 // FOREACHTRAIT SPECIALIZATIONS
969 //
970 //=================================================================================================
971 
972 //*************************************************************************************************
974 template< typename MT, bool SO, bool DF, bool NF >
975 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Abs >
976 {
977  using Type = SymmetricMatrix< ForEachTrait_<MT,Abs> >;
978 };
979 
980 template< typename MT, bool SO, bool DF, bool NF >
981 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Floor >
982 {
983  using Type = SymmetricMatrix< ForEachTrait_<MT,Floor> >;
984 };
985 
986 template< typename MT, bool SO, bool DF, bool NF >
987 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Ceil >
988 {
989  using Type = SymmetricMatrix< ForEachTrait_<MT,Ceil> >;
990 };
991 
992 template< typename MT, bool SO, bool DF, bool NF >
993 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Conj >
994 {
995  using Type = SymmetricMatrix< ForEachTrait_<MT,Conj> >;
996 };
997 
998 template< typename MT, bool SO, bool DF, bool NF >
999 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Real >
1000 {
1001  using Type = SymmetricMatrix< ForEachTrait_<MT,Real> >;
1002 };
1003 
1004 template< typename MT, bool SO, bool DF, bool NF >
1005 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Imag >
1006 {
1007  using Type = SymmetricMatrix< ForEachTrait_<MT,Imag> >;
1008 };
1009 
1010 template< typename MT, bool SO, bool DF, bool NF >
1011 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Sqrt >
1012 {
1013  using Type = SymmetricMatrix< ForEachTrait_<MT,InvSqrt> >;
1014 };
1015 
1016 template< typename MT, bool SO, bool DF, bool NF >
1017 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Cbrt >
1018 {
1019  using Type = SymmetricMatrix< ForEachTrait_<MT,Cbrt> >;
1020 };
1021 
1022 template< typename MT, bool SO, bool DF, bool NF >
1023 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, InvCbrt >
1024 {
1025  using Type = SymmetricMatrix< ForEachTrait_<MT,InvCbrt> >;
1026 };
1027 
1028 template< typename MT, bool SO, bool DF, bool NF, typename ET >
1029 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Pow<ET> >
1030 {
1031  using Type = SymmetricMatrix< ForEachTrait_< MT, Pow<ET> > >;
1032 };
1033 
1034 template< typename MT, bool SO, bool DF, bool NF >
1035 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Exp >
1036 {
1037  using Type = SymmetricMatrix< ForEachTrait_<MT,Exp> >;
1038 };
1039 
1040 template< typename MT, bool SO, bool DF, bool NF >
1041 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Log >
1042 {
1043  using Type = SymmetricMatrix< ForEachTrait_<MT,Log> >;
1044 };
1045 
1046 template< typename MT, bool SO, bool DF, bool NF >
1047 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Log10 >
1048 {
1049  using Type = SymmetricMatrix< ForEachTrait_<MT,Log10> >;
1050 };
1051 
1052 template< typename MT, bool SO, bool DF, bool NF >
1053 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Sin >
1054 {
1055  using Type = SymmetricMatrix< ForEachTrait_<MT,Sin> >;
1056 };
1057 
1058 template< typename MT, bool SO, bool DF, bool NF >
1059 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Asin >
1060 {
1061  using Type = SymmetricMatrix< ForEachTrait_<MT,Asin> >;
1062 };
1063 
1064 template< typename MT, bool SO, bool DF, bool NF >
1065 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Sinh >
1066 {
1067  using Type = SymmetricMatrix< ForEachTrait_<MT,Sinh> >;
1068 };
1069 
1070 template< typename MT, bool SO, bool DF, bool NF >
1071 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Asinh >
1072 {
1073  using Type = SymmetricMatrix< ForEachTrait_<MT,Asinh> >;
1074 };
1075 
1076 template< typename MT, bool SO, bool DF, bool NF >
1077 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Cos >
1078 {
1079  using Type = SymmetricMatrix< ForEachTrait_<MT,Cos> >;
1080 };
1081 
1082 template< typename MT, bool SO, bool DF, bool NF >
1083 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Acos >
1084 {
1085  using Type = SymmetricMatrix< ForEachTrait_<MT,Acos> >;
1086 };
1087 
1088 template< typename MT, bool SO, bool DF, bool NF >
1089 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Cosh >
1090 {
1091  using Type = SymmetricMatrix< ForEachTrait_<MT,Cosh> >;
1092 };
1093 
1094 template< typename MT, bool SO, bool DF, bool NF >
1095 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Acosh >
1096 {
1097  using Type = SymmetricMatrix< ForEachTrait_<MT,Acosh> >;
1098 };
1099 
1100 template< typename MT, bool SO, bool DF, bool NF >
1101 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Tan >
1102 {
1103  using Type = SymmetricMatrix< ForEachTrait_<MT,Tan> >;
1104 };
1105 
1106 template< typename MT, bool SO, bool DF, bool NF >
1107 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Atan >
1108 {
1109  using Type = SymmetricMatrix< ForEachTrait_<MT,Atan> >;
1110 };
1111 
1112 template< typename MT, bool SO, bool DF, bool NF >
1113 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Tanh >
1114 {
1115  using Type = SymmetricMatrix< ForEachTrait_<MT,Tanh> >;
1116 };
1117 
1118 template< typename MT, bool SO, bool DF, bool NF >
1119 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Atanh >
1120 {
1121  using Type = SymmetricMatrix< ForEachTrait_<MT,Atanh> >;
1122 };
1123 
1124 template< typename MT, bool SO, bool DF, bool NF >
1125 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Erf >
1126 {
1127  using Type = SymmetricMatrix< ForEachTrait_<MT,Erf> >;
1128 };
1129 
1130 template< typename MT, bool SO, bool DF, bool NF >
1131 struct ForEachTrait< SymmetricMatrix<MT,SO,DF,NF>, Erfc >
1132 {
1133  using Type = SymmetricMatrix< ForEachTrait_<MT,Erfc> >;
1134 };
1136 //*************************************************************************************************
1137 
1138 
1139 
1140 
1141 //=================================================================================================
1142 //
1143 // MATHTRAIT SPECIALIZATIONS
1144 //
1145 //=================================================================================================
1146 
1147 //*************************************************************************************************
1149 template< typename MT1, bool SO1, bool DF1, bool NF1, typename MT2, bool SO2, bool DF2, bool NF2 >
1150 struct MathTrait< SymmetricMatrix<MT1,SO1,DF1,NF1>, SymmetricMatrix<MT2,SO2,DF2,NF2> >
1151 {
1152  typedef SymmetricMatrix< typename MathTrait<MT1,MT2>::HighType > HighType;
1153  typedef SymmetricMatrix< typename MathTrait<MT1,MT2>::LowType > LowType;
1154 };
1156 //*************************************************************************************************
1157 
1158 
1159 
1160 
1161 //=================================================================================================
1162 //
1163 // SUBMATRIXTRAIT SPECIALIZATIONS
1164 //
1165 //=================================================================================================
1166 
1167 //*************************************************************************************************
1169 template< typename MT, bool SO, bool DF, bool NF >
1170 struct SubmatrixTrait< SymmetricMatrix<MT,SO,DF,NF> >
1171 {
1172  using Type = SubmatrixTrait_<MT>;
1173 };
1175 //*************************************************************************************************
1176 
1177 
1178 
1179 
1180 //=================================================================================================
1181 //
1182 // ROWTRAIT SPECIALIZATIONS
1183 //
1184 //=================================================================================================
1185 
1186 //*************************************************************************************************
1188 template< typename MT, bool SO, bool DF, bool NF >
1189 struct RowTrait< SymmetricMatrix<MT,SO,DF,NF> >
1190 {
1191  using Type = RowTrait_<MT>;
1192 };
1194 //*************************************************************************************************
1195 
1196 
1197 
1198 
1199 //=================================================================================================
1200 //
1201 // COLUMNTRAIT SPECIALIZATIONS
1202 //
1203 //=================================================================================================
1204 
1205 //*************************************************************************************************
1207 template< typename MT, bool SO, bool DF, bool NF >
1208 struct ColumnTrait< SymmetricMatrix<MT,SO,DF,NF> >
1209 {
1210  using Type = ColumnTrait_<MT>;
1211 };
1213 //*************************************************************************************************
1214 
1215 } // namespace blaze
1216 
1217 #endif
Header file for auxiliary alias declarations.
Header file for mathematical functions.
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the subtraction trait.
Header file for the row trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
Flag for the inversion of a Hermitian matrix (same as byLDLH).
Definition: InversionFlag.h:110
Header file for the dense matrix inversion flags.
bool isSymmetric(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is symmetric.
Definition: DenseMatrix.h:689
Flag for the inversion of a diagonal matrix.
Definition: InversionFlag.h:115
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:533
Flag for the inversion of a general matrix (same as byLU).
Definition: InversionFlag.h:108
Flag for the inversion of a upper unitriangular matrix.
Definition: InversionFlag.h:114
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Matrix adapter for symmetric matrices.
Definition: Forward.h:52
BoolConstant< true > TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
DisableIf_< Or< IsComputation< MT >, IsTransExpr< 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:126
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:573
Header file for the implementation of the base template of the SymmetricMatrix.
Header file for the IsSquare type trait.
void invert(const HermitianProxy< MT > &proxy)
In-place inversion of the represented element.
Definition: HermitianProxy.h:741
Flag for the inversion of a symmetric matrix (same as byLDLT).
Definition: InversionFlag.h:109
Flag for the Bunch-Kaufman-based inversion for Hermitian matrices.
Definition: InversionFlag.h:105
Constraint on the data type.
SymmetricMatrix specialization for dense matrices with non-numeric element type.
Flag for the LU-based matrix inversion.
Definition: InversionFlag.h:103
Header file for the multiplication trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for all forward declarations of the math module.
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.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:330
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.
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.
InversionFlag
Inversion flag.The InversionFlag type enumeration represents the different types of matrix inversion ...
Definition: InversionFlag.h:101
Flag for the Bunch-Kaufman-based inversion for symmetric matrices.
Definition: InversionFlag.h:104
Flag for the Cholesky-based inversion for positive-definite matrices.
Definition: InversionFlag.h:106
Header file for the IsNumeric type trait.
Header file for the HasConstDataAccess type trait.
DisableIf_< Or< IsComputation< MT >, IsTransExpr< 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:126
SymmetricMatrix specialization for sparse matrices with non-numeric element type. ...
Header file for run time assertion macros.
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:258
#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
#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
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:100
typename EnableIf< Condition, T >::Type EnableIf_
Auxiliary alias declaration for the EnableIf class template.The EnableIf_ alias declaration provides ...
Definition: EnableIf.h:223
SymmetricMatrix specialization for dense matrices with numeric element type.
Header file for the mathematical trait.
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:314
Header file for the IsBuiltin type trait.
Header file for the for-each trait.
Header file for the isDivisor shim.
Header file for the IntegralConstant class template.
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:240
void UNUSED_PARAMETER(const Args &...)
Suppression of unused parameter warnings.
Definition: Unused.h:81
Flag for the inversion of a lower unitriangular matrix.
Definition: InversionFlag.h:112
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:167
Header file for the IsHermitian type trait.
Header file for the IsResizable type trait.
Header file for the IsRestricted type trait.
#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 TrueType type/value trait base class.
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1593