UniUpperMatrix.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_ADAPTORS_UNIUPPERMATRIX_H_
36 #define _BLAZE_MATH_ADAPTORS_UNIUPPERMATRIX_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
55 #include <blaze/math/Forward.h>
56 #include <blaze/math/Functions.h>
59 #include <blaze/math/shims/IsOne.h>
80 #include <blaze/util/Assert.h>
81 #include <blaze/util/EnableIf.h>
83 #include <blaze/util/Unused.h>
85 
86 
87 namespace blaze {
88 
89 //=================================================================================================
90 //
91 // UNIUPPERMATRIX OPERATORS
92 //
93 //=================================================================================================
94 
95 //*************************************************************************************************
98 template< typename MT, bool SO, bool DF >
99 inline void reset( UniUpperMatrix<MT,SO,DF>& m );
100 
101 template< typename MT, bool SO, bool DF >
102 inline void reset( UniUpperMatrix<MT,SO,DF>& m, size_t i );
103 
104 template< typename MT, bool SO, bool DF >
105 inline void clear( UniUpperMatrix<MT,SO,DF>& m );
106 
107 template< typename MT, bool SO, bool DF >
108 inline bool isDefault( const UniUpperMatrix<MT,SO,DF>& m );
109 
110 template< typename MT, bool SO, bool DF >
111 inline bool isIntact( const UniUpperMatrix<MT,SO,DF>& m );
112 
113 template< typename MT, bool SO, bool DF >
114 inline void swap( UniUpperMatrix<MT,SO,DF>& a, UniUpperMatrix<MT,SO,DF>& b ) /* throw() */;
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
130 {
131  m.reset();
132 }
133 //*************************************************************************************************
134 
135 
136 //*************************************************************************************************
149 template< typename MT // Type of the adapted matrix
150  , bool SO // Storage order of the adapted matrix
151  , bool DF > // Density flag
152 inline void reset( UniUpperMatrix<MT,SO,DF>& m, size_t i )
153 {
154  m.reset( i );
155 }
156 //*************************************************************************************************
157 
158 
159 //*************************************************************************************************
166 template< typename MT // Type of the adapted matrix
167  , bool SO // Storage order of the adapted matrix
168  , bool DF > // Density flag
170 {
171  m.clear();
172 }
173 //*************************************************************************************************
174 
175 
176 //*************************************************************************************************
186 template< typename MT // Type of the adapted matrix
187  , bool SO // Storage order of the adapted matrix
188  , bool DF > // Density flag
189 inline bool isDefault_backend( const UniUpperMatrix<MT,SO,DF>& m, TrueType )
190 {
191  return ( m.rows() == 0UL );
192 }
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
207 template< typename MT // Type of the adapted matrix
208  , bool SO // Storage order of the adapted matrix
209  , bool DF > // Density flag
210 inline bool isDefault_backend( const UniUpperMatrix<MT,SO,DF>& m, FalseType )
211 {
212  return isIdentity( m );
213 }
215 //*************************************************************************************************
216 
217 
218 //*************************************************************************************************
239 template< typename MT // Type of the adapted matrix
240  , bool SO // Storage order of the adapted matrix
241  , bool DF > // Density flag
242 inline bool isIntact( const UniUpperMatrix<MT,SO,DF>& m )
243 {
244  return m.isIntact();
245 }
246 //*************************************************************************************************
247 
248 
249 //*************************************************************************************************
269 template< typename MT // Type of the adapted matrix
270  , bool SO // Storage order of the adapted matrix
271  , bool DF > // Density flag
272 inline bool isDefault( const UniUpperMatrix<MT,SO,DF>& m )
273 {
274  return isDefault_backend( m, typename IsResizable<MT>::Type() );
275 }
276 //*************************************************************************************************
277 
278 
279 //*************************************************************************************************
288 template< typename MT // Type of the adapted matrix
289  , bool SO // Storage order of the adapted matrix
290  , bool DF > // Density flag
291 inline void swap( UniUpperMatrix<MT,SO,DF>& a, UniUpperMatrix<MT,SO,DF>& b ) /* throw() */
292 {
293  a.swap( b );
294 }
295 //*************************************************************************************************
296 
297 
298 //*************************************************************************************************
312 template< typename MT // Type of the dense matrix
313  , bool SO > // Storage order of the dense matrix
314 inline void invert2x2( UniUpperMatrix<MT,SO,true>& m )
315 {
317 
318  BLAZE_INTERNAL_ASSERT( m.rows() == 2UL, "Invalid number of rows detected" );
319  BLAZE_INTERNAL_ASSERT( m.columns() == 2UL, "Invalid number of columns detected" );
320 
321  typedef typename MT::ElementType ET;
322 
323  typename DerestrictTrait<MT>::Type A( derestrict( m ) );
324 
325  A(0,1) = -A(0,1);
326 
327  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
328 }
330 //*************************************************************************************************
331 
332 
333 //*************************************************************************************************
347 template< typename MT // Type of the dense matrix
348  , bool SO > // Storage order of the dense matrix
349 inline void invert3x3( UniUpperMatrix<MT,SO,true>& m )
350 {
352 
353  BLAZE_INTERNAL_ASSERT( m.rows() == 3UL, "Invalid number of rows detected" );
354  BLAZE_INTERNAL_ASSERT( m.columns() == 3UL, "Invalid number of columns detected" );
355 
356  typedef typename MT::ElementType ET;
357 
358  const StaticMatrix<ET,3UL,3UL,SO> A( m );
359  typename DerestrictTrait<MT>::Type B( derestrict( m ) );
360 
361  B(0,1) = - A(0,1);
362  B(0,2) = A(0,1)*A(1,2) - A(0,2);
363  B(1,2) = - A(1,2);
364 
365  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
366 }
368 //*************************************************************************************************
369 
370 
371 //*************************************************************************************************
385 template< typename MT // Type of the dense matrix
386  , bool SO > // Storage order of the dense matrix
387 inline void invert4x4( UniUpperMatrix<MT,SO,true>& m )
388 {
390 
391  BLAZE_INTERNAL_ASSERT( m.rows() == 4UL, "Invalid number of rows detected" );
392  BLAZE_INTERNAL_ASSERT( m.columns() == 4UL, "Invalid number of columns detected" );
393 
394  typedef typename MT::ElementType ET;
395 
396  const StaticMatrix<ET,4UL,4UL,SO> A( m );
397  typename DerestrictTrait<MT>::Type B( derestrict( m ) );
398 
399  ET tmp( A(0,1)*A(1,2) - A(0,2) );
400 
401  B(0,1) = - A(0,1);
402  B(0,2) = tmp;
403  B(1,2) = - A(1,2);
404  B(0,3) = A(0,1)*A(1,3) - A(0,3) - A(2,3)*tmp;
405  B(1,3) = A(2,3)*A(1,2) - A(1,3);
406  B(2,3) = - A(2,3);
407 
408  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
409 }
411 //*************************************************************************************************
412 
413 
414 //*************************************************************************************************
428 template< typename MT // Type of the dense matrix
429  , bool SO > // Storage order of the dense matrix
430 inline void invert5x5( UniUpperMatrix<MT,SO,true>& m )
431 {
433 
434  BLAZE_INTERNAL_ASSERT( m.rows() == 5UL, "Invalid number of rows detected" );
435  BLAZE_INTERNAL_ASSERT( m.columns() == 5UL, "Invalid number of columns detected" );
436 
437  typedef typename MT::ElementType ET;
438 
439  const StaticMatrix<ET,5UL,5UL,SO> A( m );
440  typename DerestrictTrait<MT>::Type B( derestrict( m ) );
441 
442  const ET tmp2( A(0,1)*A(1,2) - A(0,2) );
443 
444  const ET tmp8 ( A(2,3)*tmp2 - A(0,1)*A(1,3) + A(0,3) );
445  const ET tmp9 ( A(2,3)*A(1,2) - A(1,3) );
446  const ET tmp10( A(2,3) );
447 
448  B(0,1) = - A(0,1);
449  B(0,2) = A(0,1)*A(1,2) - A(0,2);
450  B(1,2) = - A(1,2);
451  B(0,3) = - tmp8;
452  B(1,3) = tmp9;
453  B(2,3) = - A(2,3);
454  B(0,4) = A(3,4)*tmp8 - A(2,4)*tmp2 + A(0,1)*A(1,4) - A(0,4);
455  B(1,4) = A(2,4)*A(1,2) - A(1,4) - A(3,4)*tmp9;
456  B(2,4) = A(3,4)*A(2,3) - A(2,4);
457  B(3,4) = - A(3,4);
458 
459  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
460 }
462 //*************************************************************************************************
463 
464 
465 //*************************************************************************************************
479 template< typename MT // Type of the dense matrix
480  , bool SO > // Storage order of the dense matrix
481 inline void invert6x6( UniUpperMatrix<MT,SO,true>& m )
482 {
484 
485  BLAZE_INTERNAL_ASSERT( m.rows() == 6UL, "Invalid number of rows detected" );
486  BLAZE_INTERNAL_ASSERT( m.columns() == 6UL, "Invalid number of columns detected" );
487 
488  typedef typename MT::ElementType ET;
489 
490  const StaticMatrix<ET,6UL,6UL,SO> A( m );
491  typename DerestrictTrait<MT>::Type B( derestrict( m ) );
492 
493  const ET tmp1( A(0,1)*A(1,2) - A(0,2) );
494  const ET tmp2( A(2,3)*tmp1 - A(0,1)*A(1,3) + A(0,3) );
495  const ET tmp3( A(2,3)*A(1,2) - A(1,3) );
496  const ET tmp4( A(2,4)*tmp1 - A(0,1)*A(1,4) + A(0,4) - A(3,4)*tmp2 );
497  const ET tmp5( A(2,4)*A(1,2) - A(1,4) - A(3,4)*tmp3 );
498  const ET tmp6( A(2,4) - A(3,4)*A(2,3) );
499 
500  B(0,1) = - A(0,1);
501  B(0,2) = A(0,1)*A(1,2) - A(0,2);
502  B(1,2) = - A(1,2);
503  B(0,3) = - tmp2;
504  B(1,3) = tmp3;
505  B(2,3) = - A(2,3);
506  B(0,4) = - tmp4;
507  B(1,4) = tmp5;
508  B(2,4) = - tmp6;
509  B(3,4) = - A(3,4);
510  B(0,5) = - A(2,5)*tmp1 + A(0,1)*A(1,5) - A(0,5) + A(3,5)*tmp2 + A(4,5)*tmp4;
511  B(1,5) = A(2,5)*A(1,2) - A(1,5) - A(3,5)*tmp3 - A(4,5)*tmp5;
512  B(2,5) = - A(2,5) + A(3,5)*A(2,3) + A(4,5)*tmp6;
513  B(3,5) = - A(3,5) + A(4,5)*A(3,4);
514  B(4,5) = - A(4,5);
515 
516  BLAZE_INTERNAL_ASSERT( isIntact( m ), "Broken invariant detected" );
517 }
519 //*************************************************************************************************
520 
521 
522 //*************************************************************************************************
543 template< typename MT // Type of the dense matrix
544  , bool SO > // Storage order of the dense matrix
545 inline void invertByDefault( UniUpperMatrix<MT,SO,true>& m )
546 {
547  invertByLU( m );
548 }
550 //*************************************************************************************************
551 
552 
553 //*************************************************************************************************
573 template< typename MT // Type of the dense matrix
574  , bool SO > // Storage order of the dense matrix
575 inline void invertByLU( UniUpperMatrix<MT,SO,true>& m )
576 {
578 
579  typename DerestrictTrait<MT>::Type A( derestrict( ~m ) );
580 
581  trtri( A, 'U', 'U' );
582 }
584 //*************************************************************************************************
585 
586 
587 //*************************************************************************************************
604 template< typename MT // Type of the dense matrix
605  , bool SO > // Storage order of the dense matrix
606 inline void invertByLDLT( UniUpperMatrix<MT,SO,true>& m )
607 {
608  invertByLLH( m );
609 }
611 //*************************************************************************************************
612 
613 
614 //*************************************************************************************************
631 template< typename MT // Type of the dense matrix
632  , bool SO > // Storage order of the dense matrix
633 inline void invertByLDLH( UniUpperMatrix<MT,SO,true>& m )
634 {
635  invertByLLH( m );
636 }
638 //*************************************************************************************************
639 
640 
641 //*************************************************************************************************
655 template< typename MT // Type of the dense matrix
656  , bool SO > // Storage order of the dense matrix
657 inline void invertByLLH( UniUpperMatrix<MT,SO,true>& m )
658 {
660 
661  BLAZE_INTERNAL_ASSERT( isIdentity( ~m ), "Violation of preconditions detected" );
662 
663  UNUSED_PARAMETER( m );
664 }
666 //*************************************************************************************************
667 
668 
669 //*************************************************************************************************
688 template< typename MT1, bool SO1, typename MT2, typename MT3, typename MT4, bool SO2 >
689 inline void lu( const UniUpperMatrix<MT1,SO1,true>& A, DenseMatrix<MT2,SO1>& L,
690  DenseMatrix<MT3,SO1>& U, Matrix<MT4,SO2>& P )
691 {
693 
698 
703 
704  typedef typename MT2::ElementType ET2;
705  typedef typename MT4::ElementType ET4;
706 
707  const size_t n( (~A).rows() );
708 
709  typename DerestrictTrait<MT2>::Type L2( derestrict( ~L ) );
710 
711  (~U) = A;
712 
713  resize( ~L, n, n );
714  reset( L2 );
715 
716  resize( ~P, n, n );
717  reset( ~P );
718 
719  for( size_t i=0UL; i<n; ++i ) {
720  L2(i,i) = ET2(1);
721  (~P)(i,i) = ET4(1);
722  }
723 }
725 //*************************************************************************************************
726 
727 
728 //*************************************************************************************************
744 template< typename MT // Type of the adapted matrix
745  , bool SO // Storage order of the adapted matrix
746  , bool DF // Density flag
747  , typename VT > // Type of the right-hand side dense vector
748 inline bool tryAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
749  const DenseVector<VT,false>& rhs, size_t row, size_t column )
750 {
752 
753  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
754  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
755  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
756 
757  UNUSED_PARAMETER( lhs );
758 
759  if( column >= row + (~rhs).size() )
760  return true;
761 
762  const bool containsDiagonal( column >= row );
763  const size_t ibegin( ( !containsDiagonal )?( 0UL ):( column - row + 1UL ) );
764 
765  if( containsDiagonal && !isOne( (~rhs)[column-row] ) )
766  return false;
767 
768  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
769  if( !isDefault( (~rhs)[i] ) )
770  return false;
771  }
772 
773  return true;
774 }
776 //*************************************************************************************************
777 
778 
779 //*************************************************************************************************
795 template< typename MT // Type of the adapted matrix
796  , bool SO // Storage order of the adapted matrix
797  , bool DF // Density flag
798  , typename VT > // Type of the right-hand side dense vector
799 inline bool tryAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
800  const DenseVector<VT,true>& rhs, size_t row, size_t column )
801 {
803 
804  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
805  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
806  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
807 
808  UNUSED_PARAMETER( lhs );
809 
810  if( row < column )
811  return true;
812 
813  const bool containsDiagonal( row < column + (~rhs).size() );
814  const size_t iend( min( row - column, (~rhs).size() ) );
815 
816  for( size_t i=0UL; i<iend; ++i ) {
817  if( !isDefault( (~rhs)[i] ) )
818  return false;
819  }
820 
821  if( containsDiagonal && !isOne( (~rhs)[iend] ) )
822  return false;
823 
824  return true;
825 }
827 //*************************************************************************************************
828 
829 
830 //*************************************************************************************************
846 template< typename MT // Type of the adapted matrix
847  , bool SO // Storage order of the adapted matrix
848  , bool DF // Density flag
849  , typename VT > // Type of the right-hand side sparse vector
850 inline bool tryAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
851  const SparseVector<VT,false>& rhs, size_t row, size_t column )
852 {
854 
855  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
856  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
857  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
858 
859  UNUSED_PARAMETER( lhs );
860 
861  typedef typename VT::ConstIterator RhsIterator;
862 
863  if( column >= row + (~rhs).size() )
864  return true;
865 
866  const bool containsDiagonal( column >= row );
867  const size_t index( ( containsDiagonal )?( column - row ):( 0UL ) );
868  const RhsIterator last( (~rhs).end() );
869  RhsIterator element( (~rhs).lowerBound( index ) );
870 
871  if( containsDiagonal ) {
872  if( element == last || element->index() != index || !isOne( element->value() ) )
873  return false;
874  ++element;
875  }
876 
877  for( ; element!=last; ++element ) {
878  if( !isDefault( element->value() ) )
879  return false;
880  }
881 
882  return true;
883 }
885 //*************************************************************************************************
886 
887 
888 //*************************************************************************************************
904 template< typename MT // Type of the adapted matrix
905  , bool SO // Storage order of the adapted matrix
906  , bool DF // Density flag
907  , typename VT > // Type of the right-hand side sparse vector
908 inline bool tryAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
909  const SparseVector<VT,true>& rhs, size_t row, size_t column )
910 {
912 
913  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
914  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
915  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
916 
917  UNUSED_PARAMETER( lhs );
918 
919  typedef typename VT::ConstIterator RhsIterator;
920 
921  if( row < column )
922  return true;
923 
924  const bool containsDiagonal( row < column + (~rhs).size() );
925  const size_t index( row - column );
926  const RhsIterator last( (~rhs).lowerBound( index ) );
927 
928  if( containsDiagonal ) {
929  if( last == (~rhs).end() || last->index() != index || !isOne( last->value() ) )
930  return false;
931  }
932 
933  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
934  if( !isDefault( element->value() ) )
935  return false;
936  }
937 
938  return true;
939 }
941 //*************************************************************************************************
942 
943 
944 //*************************************************************************************************
960 template< typename MT1 // Type of the adapted matrix
961  , bool SO // Storage order of the adapted matrix
962  , bool DF // Density flag
963  , typename MT2 > // Type of the right-hand side dense matrix
964 inline bool tryAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
965  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
966 {
968 
969  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
970  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
971  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
972  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
973 
974  UNUSED_PARAMETER( lhs );
975 
976  const size_t M( (~rhs).rows() );
977  const size_t N( (~rhs).columns() );
978 
979  if( column + 1UL >= row + M )
980  return true;
981 
982  const size_t ibegin( ( column < row )?( 0UL ):( column - row ) );
983 
984  for( size_t i=ibegin; i<M; ++i )
985  {
986  const size_t jend( min( row + i - column, N ) );
987 
988  for( size_t j=0UL; j<jend; ++j ) {
989  if( !isDefault( (~rhs)(i,j) ) )
990  return false;
991  }
992 
993  const bool containsDiagonal( row + i < column + N );
994 
995  if( containsDiagonal && !isOne( (~rhs)(i,jend) ) )
996  return false;
997  }
998 
999  return true;
1000 }
1002 //*************************************************************************************************
1003 
1004 
1005 //*************************************************************************************************
1021 template< typename MT1 // Type of the adapted matrix
1022  , bool SO // Storage order of the adapted matrix
1023  , bool DF // Density flag
1024  , typename MT2 > // Type of the right-hand side dense matrix
1025 inline bool tryAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1026  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
1027 {
1029 
1030  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1031  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1032  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1033  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1034 
1035  UNUSED_PARAMETER( lhs );
1036 
1037  const size_t M( (~rhs).rows() );
1038  const size_t N( (~rhs).columns() );
1039 
1040  if( column + 1UL >= row + M )
1041  return true;
1042 
1043  const size_t jend( min( row + M - column, N ) );
1044 
1045  for( size_t j=0UL; j<jend; ++j )
1046  {
1047  const bool containsDiagonal( column + j >= row );
1048 
1049  if( containsDiagonal && !isOne( (~rhs)(column+j-row,j) ) )
1050  return false;
1051 
1052  const size_t ibegin( ( containsDiagonal )?( column + j - row + 1UL ):( 0UL ) );
1053 
1054  for( size_t i=ibegin; i<M; ++i ) {
1055  if( !isDefault( (~rhs)(i,j) ) )
1056  return false;
1057  }
1058  }
1059 
1060  return true;
1061 }
1063 //*************************************************************************************************
1064 
1065 
1066 //*************************************************************************************************
1082 template< typename MT1 // Type of the adapted matrix
1083  , bool SO // Storage order of the adapted matrix
1084  , bool DF // Density flag
1085  , typename MT2 > // Type of the right-hand side sparse matrix
1086 inline bool tryAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1087  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
1088 {
1090 
1091  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1092  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1093  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1094  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1095 
1096  UNUSED_PARAMETER( lhs );
1097 
1098  typedef typename MT2::ConstIterator RhsIterator;
1099 
1100  const size_t M( (~rhs).rows() );
1101  const size_t N( (~rhs).columns() );
1102 
1103  if( column + 1UL >= row + M )
1104  return true;
1105 
1106  const size_t ibegin( ( column < row )?( 0UL ):( column - row ) );
1107 
1108  for( size_t i=ibegin; i<M; ++i )
1109  {
1110  const bool containsDiagonal( row + i < column + N );
1111 
1112  const size_t index( row + i - column );
1113  const RhsIterator last( (~rhs).lowerBound( i, min( index, N ) ) );
1114 
1115  if( containsDiagonal ) {
1116  if( last == (~rhs).end(i) || ( last->index() != index ) || !isOne( last->value() ) )
1117  return false;
1118  }
1119 
1120  for( RhsIterator element=(~rhs).begin(i); element!=last; ++element ) {
1121  if( !isDefault( element->value() ) )
1122  return false;
1123  }
1124  }
1125 
1126  return true;
1127 }
1129 //*************************************************************************************************
1130 
1131 
1132 //*************************************************************************************************
1148 template< typename MT1 // Type of the adapted matrix
1149  , bool SO // Storage order of the adapted matrix
1150  , bool DF // Density flag
1151  , typename MT2 > // Type of the right-hand side sparse matrix
1152 inline bool tryAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1153  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
1154 {
1156 
1157  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1158  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1159  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1160  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1161 
1162  UNUSED_PARAMETER( lhs );
1163 
1164  typedef typename MT2::ConstIterator RhsIterator;
1165 
1166  const size_t M( (~rhs).rows() );
1167  const size_t N( (~rhs).columns() );
1168 
1169  if( column + 1UL >= row + M )
1170  return true;
1171 
1172  const size_t jend( min( row + M - column, N ) );
1173 
1174  for( size_t j=0UL; j<jend; ++j )
1175  {
1176  const bool containsDiagonal( column + j >= row );
1177  const size_t index( ( containsDiagonal )?( column + j - row ):( 0UL ) );
1178 
1179  const RhsIterator last( (~rhs).end(j) );
1180  RhsIterator element( (~rhs).lowerBound( index, j ) );
1181 
1182  if( containsDiagonal ) {
1183  if( element == last || ( element->index() != index ) || !isOne( element->value() ) )
1184  return false;
1185  ++element;
1186  }
1187 
1188  for( ; element!=last; ++element ) {
1189  if( !isDefault( element->value() ) )
1190  return false;
1191  }
1192  }
1193 
1194  return true;
1195 }
1197 //*************************************************************************************************
1198 
1199 
1200 //*************************************************************************************************
1217 template< typename MT // Type of the adapted matrix
1218  , bool SO // Storage order of the adapted matrix
1219  , bool DF // Density flag
1220  , typename VT > // Type of the right-hand side dense vector
1221 inline bool tryAddAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1222  const DenseVector<VT,false>& rhs, size_t row, size_t column )
1223 {
1225 
1226  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1227  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1228  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
1229 
1230  UNUSED_PARAMETER( lhs );
1231 
1232  const size_t ibegin( ( column <= row )?( 0UL ):( column - row ) );
1233 
1234  for( size_t i=ibegin; i<(~rhs).size(); ++i ) {
1235  if( !isDefault( (~rhs)[i] ) )
1236  return false;
1237  }
1238 
1239  return true;
1240 }
1242 //*************************************************************************************************
1243 
1244 
1245 //*************************************************************************************************
1262 template< typename MT // Type of the adapted matrix
1263  , bool SO // Storage order of the adapted matrix
1264  , bool DF // Density flag
1265  , typename VT > // Type of the right-hand side dense vector
1266 inline bool tryAddAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1267  const DenseVector<VT,true>& rhs, size_t row, size_t column )
1268 {
1270 
1271  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1272  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1273  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
1274 
1275  UNUSED_PARAMETER( lhs );
1276 
1277  if( row < column )
1278  return true;
1279 
1280  const size_t iend( min( row - column + 1UL, (~rhs).size() ) );
1281 
1282  for( size_t i=0UL; i<iend; ++i ) {
1283  if( !isDefault( (~rhs)[i] ) )
1284  return false;
1285  }
1286 
1287  return true;
1288 }
1290 //*************************************************************************************************
1291 
1292 
1293 //*************************************************************************************************
1310 template< typename MT // Type of the adapted matrix
1311  , bool SO // Storage order of the adapted matrix
1312  , bool DF // Density flag
1313  , typename VT > // Type of the right-hand side sparse vector
1314 inline bool tryAddAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1315  const SparseVector<VT,false>& rhs, size_t row, size_t column )
1316 {
1318 
1319  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1320  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1321  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
1322 
1323  UNUSED_PARAMETER( lhs );
1324 
1325  typedef typename VT::ConstIterator RhsIterator;
1326 
1327  const RhsIterator last( (~rhs).end() );
1328  RhsIterator element( (~rhs).lowerBound( ( column <= row )?( 0UL ):( column - row ) ) );
1329 
1330  for( ; element!=last; ++element ) {
1331  if( !isDefault( element->value() ) )
1332  return false;
1333  }
1334 
1335  return true;
1336 }
1338 //*************************************************************************************************
1339 
1340 
1341 //*************************************************************************************************
1358 template< typename MT // Type of the adapted matrix
1359  , bool SO // Storage order of the adapted matrix
1360  , bool DF // Density flag
1361  , typename VT > // Type of the right-hand side sparse vector
1362 inline bool tryAddAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1363  const SparseVector<VT,true>& rhs, size_t row, size_t column )
1364 {
1366 
1367  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1368  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1369  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
1370 
1371  UNUSED_PARAMETER( lhs );
1372 
1373  typedef typename VT::ConstIterator RhsIterator;
1374 
1375  if( row < column )
1376  return true;
1377 
1378  const RhsIterator last( (~rhs).lowerBound( row - column + 1UL ) );
1379 
1380  for( RhsIterator element=(~rhs).begin(); element!=last; ++element ) {
1381  if( !isDefault( element->value() ) )
1382  return false;
1383  }
1384 
1385  return true;
1386 }
1388 //*************************************************************************************************
1389 
1390 
1391 //*************************************************************************************************
1408 template< typename MT1 // Type of the adapted matrix
1409  , bool SO // Storage order of the adapted matrix
1410  , bool DF // Density flag
1411  , typename MT2 > // Type of the right-hand side dense matrix
1412 inline bool tryAddAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1413  const DenseMatrix<MT2,false>& rhs, size_t row, size_t column )
1414 {
1416 
1417  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1418  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1419  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1420  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1421 
1422  UNUSED_PARAMETER( lhs );
1423 
1424  const size_t M( (~rhs).rows() );
1425  const size_t N( (~rhs).columns() );
1426 
1427  if( column + 1UL >= row + M )
1428  return true;
1429 
1430  const size_t ibegin( ( column <= row )?( 0UL ):( column - row ) );
1431 
1432  for( size_t i=ibegin; i<M; ++i )
1433  {
1434  const size_t jend( min( row + i - column + 1UL, N ) );
1435 
1436  for( size_t j=0UL; j<jend; ++j ) {
1437  if( !isDefault( (~rhs)(i,j) ) )
1438  return false;
1439  }
1440  }
1441 
1442  return true;
1443 }
1445 //*************************************************************************************************
1446 
1447 
1448 //*************************************************************************************************
1465 template< typename MT1 // Type of the adapted matrix
1466  , bool SO // Storage order of the adapted matrix
1467  , bool DF // Density flag
1468  , typename MT2 > // Type of the right-hand side dense matrix
1469 inline bool tryAddAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1470  const DenseMatrix<MT2,true>& rhs, size_t row, size_t column )
1471 {
1473 
1474  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1475  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1476  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1477  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1478 
1479  UNUSED_PARAMETER( lhs );
1480 
1481  const size_t M( (~rhs).rows() );
1482  const size_t N( (~rhs).columns() );
1483 
1484  if( column + 1UL >= row + M )
1485  return true;
1486 
1487  const size_t jend( min( row + M - column, N ) );
1488 
1489  for( size_t j=0UL; j<jend; ++j )
1490  {
1491  const bool containsDiagonal( column + j >= row );
1492  const size_t ibegin( ( containsDiagonal )?( column + j - row ):( 0UL ) );
1493 
1494  for( size_t i=ibegin; i<M; ++i ) {
1495  if( !isDefault( (~rhs)(i,j) ) )
1496  return false;
1497  }
1498  }
1499 
1500  return true;
1501 }
1503 //*************************************************************************************************
1504 
1505 
1506 //*************************************************************************************************
1523 template< typename MT1 // Type of the adapted matrix
1524  , bool SO // Storage order of the adapted matrix
1525  , bool DF // Density flag
1526  , typename MT2 > // Type of the right-hand side sparse matrix
1527 inline bool tryAddAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1528  const SparseMatrix<MT2,false>& rhs, size_t row, size_t column )
1529 {
1531 
1532  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1533  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1534  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1535  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1536 
1537  UNUSED_PARAMETER( lhs );
1538 
1539  typedef typename MT2::ConstIterator RhsIterator;
1540 
1541  const size_t M( (~rhs).rows() );
1542  const size_t N( (~rhs).columns() );
1543 
1544  if( column + 1UL >= row + M )
1545  return true;
1546 
1547  const size_t ibegin( ( column < row )?( 0UL ):( column - row ) );
1548 
1549  for( size_t i=ibegin; i<M; ++i )
1550  {
1551  const size_t index( row + i - column + 1UL );
1552  const RhsIterator last( (~rhs).lowerBound( i, min( index, N ) ) );
1553 
1554  for( RhsIterator element=(~rhs).begin(i); element!=last; ++element ) {
1555  if( !isDefault( element->value() ) )
1556  return false;
1557  }
1558  }
1559 
1560  return true;
1561 }
1563 //*************************************************************************************************
1564 
1565 
1566 //*************************************************************************************************
1583 template< typename MT1 // Type of the adapted matrix
1584  , bool SO // Storage order of the adapted matrix
1585  , bool DF // Density flag
1586  , typename MT2 > // Type of the right-hand side sparse matrix
1587 inline bool tryAddAssign( const UniUpperMatrix<MT1,SO,DF>& lhs,
1588  const SparseMatrix<MT2,true>& rhs, size_t row, size_t column )
1589 {
1591 
1592  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1593  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1594  BLAZE_INTERNAL_ASSERT( (~rhs).rows() <= lhs.rows() - row, "Invalid number of rows" );
1595  BLAZE_INTERNAL_ASSERT( (~rhs).columns() <= lhs.columns() - column, "Invalid number of columns" );
1596 
1597  UNUSED_PARAMETER( lhs );
1598 
1599  typedef typename MT2::ConstIterator RhsIterator;
1600 
1601  const size_t M( (~rhs).rows() );
1602  const size_t N( (~rhs).columns() );
1603 
1604  if( column + 1UL >= row + M )
1605  return true;
1606 
1607  const size_t jend( min( row + M - column, N ) );
1608 
1609  for( size_t j=0UL; j<jend; ++j )
1610  {
1611  const bool containsDiagonal( column + j >= row );
1612  const size_t index( ( containsDiagonal )?( column + j - row ):( 0UL ) );
1613 
1614  const RhsIterator last( (~rhs).end(j) );
1615  RhsIterator element( (~rhs).lowerBound( index, j ) );
1616 
1617  for( ; element!=last; ++element ) {
1618  if( !isDefault( element->value() ) )
1619  return false;
1620  }
1621  }
1622 
1623  return true;
1624 }
1626 //*************************************************************************************************
1627 
1628 
1629 //*************************************************************************************************
1646 template< typename MT // Type of the adapted matrix
1647  , bool SO // Storage order of the adapted matrix
1648  , bool DF // Density flag
1649  , typename VT // Type of the right-hand side vector
1650  , bool TF > // Transpose flag of the right-hand side vector
1651 inline bool trySubAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1652  const Vector<VT,TF>& rhs, size_t row, size_t column )
1653 {
1654  return tryAddAssign( lhs, ~rhs, row, column );
1655 }
1657 //*************************************************************************************************
1658 
1659 
1660 //*************************************************************************************************
1677 template< typename MT1 // Type of the adapted matrix
1678  , bool SO1 // Storage order of the adapted matrix
1679  , bool DF // Density flag
1680  , typename MT2 // Type of the right-hand side matrix
1681  , bool SO2 > // Storage order of the right-hand side matrix
1682 inline bool trySubAssign( const UniUpperMatrix<MT1,SO1,DF>& lhs,
1683  const Matrix<MT2,SO2>& rhs, size_t row, size_t column )
1684 {
1685  return tryAddAssign( lhs, ~rhs, row, column );
1686 }
1688 //*************************************************************************************************
1689 
1690 
1691 //*************************************************************************************************
1708 template< typename MT // Type of the adapted matrix
1709  , bool SO // Storage order of the adapted matrix
1710  , bool DF // Density flag
1711  , typename VT > // Type of the right-hand side vector
1712 inline bool tryMultAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1713  const Vector<VT,false>& rhs, size_t row, size_t column )
1714 {
1716 
1717  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1718  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1719  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.rows() - row, "Invalid number of rows" );
1720 
1721  UNUSED_PARAMETER( lhs );
1722 
1723  return ( column < row || (~rhs).size() <= column - row || isOne( (~rhs)[column-row] ) );
1724 }
1726 //*************************************************************************************************
1727 
1728 
1729 //*************************************************************************************************
1746 template< typename MT // Type of the adapted matrix
1747  , bool SO // Storage order of the adapted matrix
1748  , bool DF // Density flag
1749  , typename VT > // Type of the right-hand side vector
1750 inline bool tryMultAssign( const UniUpperMatrix<MT,SO,DF>& lhs,
1751  const Vector<VT,true>& rhs, size_t row, size_t column )
1752 {
1754 
1755  BLAZE_INTERNAL_ASSERT( row <= lhs.rows(), "Invalid row access index" );
1756  BLAZE_INTERNAL_ASSERT( column <= lhs.columns(), "Invalid column access index" );
1757  BLAZE_INTERNAL_ASSERT( (~rhs).size() <= lhs.columns() - column, "Invalid number of columns" );
1758 
1759  UNUSED_PARAMETER( lhs );
1760 
1761  return ( row < column || (~rhs).size() <= row - column || isOne( (~rhs)[row-column] ) );
1762 }
1764 //*************************************************************************************************
1765 
1766 
1767 //*************************************************************************************************
1781 template< typename MT // Type of the adapted matrix
1782  , bool SO // Storage order of the adapted matrix
1783  , bool DF > // Density flag
1784 inline MT& derestrict( UniUpperMatrix<MT,SO,DF>& m )
1785 {
1786  return m.matrix_;
1787 }
1789 //*************************************************************************************************
1790 
1791 
1792 
1793 
1794 //=================================================================================================
1795 //
1796 // ROWS SPECIALIZATIONS
1797 //
1798 //=================================================================================================
1799 
1800 //*************************************************************************************************
1802 template< typename MT, bool SO, bool DF >
1803 struct Rows< UniUpperMatrix<MT,SO,DF> > : public Rows<MT>
1804 {};
1806 //*************************************************************************************************
1807 
1808 
1809 
1810 
1811 //=================================================================================================
1812 //
1813 // COLUMNS SPECIALIZATIONS
1814 //
1815 //=================================================================================================
1816 
1817 //*************************************************************************************************
1819 template< typename MT, bool SO, bool DF >
1820 struct Columns< UniUpperMatrix<MT,SO,DF> > : public Columns<MT>
1821 {};
1823 //*************************************************************************************************
1824 
1825 
1826 
1827 
1828 //=================================================================================================
1829 //
1830 // ISSQUARE SPECIALIZATIONS
1831 //
1832 //=================================================================================================
1833 
1834 //*************************************************************************************************
1836 template< typename MT, bool SO, bool DF >
1837 struct IsSquare< UniUpperMatrix<MT,SO,DF> > : public IsTrue<true>
1838 {};
1840 //*************************************************************************************************
1841 
1842 
1843 
1844 
1845 //=================================================================================================
1846 //
1847 // ISUNIUPPER SPECIALIZATIONS
1848 //
1849 //=================================================================================================
1850 
1851 //*************************************************************************************************
1853 template< typename MT, bool SO, bool DF >
1854 struct IsUniUpper< UniUpperMatrix<MT,SO,DF> > : public IsTrue<true>
1855 {};
1857 //*************************************************************************************************
1858 
1859 
1860 
1861 
1862 //=================================================================================================
1863 //
1864 // ISADAPTOR SPECIALIZATIONS
1865 //
1866 //=================================================================================================
1867 
1868 //*************************************************************************************************
1870 template< typename MT, bool SO, bool DF >
1871 struct IsAdaptor< UniUpperMatrix<MT,SO,DF> > : public IsTrue<true>
1872 {};
1874 //*************************************************************************************************
1875 
1876 
1877 
1878 
1879 //=================================================================================================
1880 //
1881 // ISRESTRICTED SPECIALIZATIONS
1882 //
1883 //=================================================================================================
1884 
1885 //*************************************************************************************************
1887 template< typename MT, bool SO, bool DF >
1888 struct IsRestricted< UniUpperMatrix<MT,SO,DF> > : public IsTrue<true>
1889 {};
1891 //*************************************************************************************************
1892 
1893 
1894 
1895 
1896 //=================================================================================================
1897 //
1898 // HASCONSTDATAACCESS SPECIALIZATIONS
1899 //
1900 //=================================================================================================
1901 
1902 //*************************************************************************************************
1904 template< typename MT, bool SO >
1905 struct HasConstDataAccess< UniUpperMatrix<MT,SO,true> > : public IsTrue<true>
1906 {};
1908 //*************************************************************************************************
1909 
1910 
1911 
1912 
1913 //=================================================================================================
1914 //
1915 // ISALIGNED SPECIALIZATIONS
1916 //
1917 //=================================================================================================
1918 
1919 //*************************************************************************************************
1921 template< typename MT, bool SO, bool DF >
1922 struct IsAligned< UniUpperMatrix<MT,SO,DF> > : public IsTrue< IsAligned<MT>::value >
1923 {};
1925 //*************************************************************************************************
1926 
1927 
1928 
1929 
1930 //=================================================================================================
1931 //
1932 // ISPADDED SPECIALIZATIONS
1933 //
1934 //=================================================================================================
1935 
1936 //*************************************************************************************************
1938 template< typename MT, bool SO, bool DF >
1939 struct IsPadded< UniUpperMatrix<MT,SO,DF> > : public IsTrue< IsPadded<MT>::value >
1940 {};
1942 //*************************************************************************************************
1943 
1944 
1945 
1946 
1947 //=================================================================================================
1948 //
1949 // ISRESIZABLE SPECIALIZATIONS
1950 //
1951 //=================================================================================================
1952 
1953 //*************************************************************************************************
1955 template< typename MT, bool SO, bool DF >
1956 struct IsResizable< UniUpperMatrix<MT,SO,DF> > : public IsTrue< IsResizable<MT>::value >
1957 {};
1959 //*************************************************************************************************
1960 
1961 
1962 
1963 
1964 //=================================================================================================
1965 //
1966 // REMOVEADAPTOR SPECIALIZATIONS
1967 //
1968 //=================================================================================================
1969 
1970 //*************************************************************************************************
1972 template< typename MT, bool SO, bool DF >
1973 struct RemoveAdaptor< UniUpperMatrix<MT,SO,DF> >
1974 {
1975  typedef MT Type;
1976 };
1978 //*************************************************************************************************
1979 
1980 
1981 
1982 
1983 //=================================================================================================
1984 //
1985 // DERESTRICTTRAIT SPECIALIZATIONS
1986 //
1987 //=================================================================================================
1988 
1989 //*************************************************************************************************
1991 template< typename MT, bool SO, bool DF >
1992 struct DerestrictTrait< UniUpperMatrix<MT,SO,DF> >
1993 {
1994  typedef MT& Type;
1995 };
1997 //*************************************************************************************************
1998 
1999 
2000 
2001 
2002 //=================================================================================================
2003 //
2004 // ADDTRAIT SPECIALIZATIONS
2005 //
2006 //=================================================================================================
2007 
2008 //*************************************************************************************************
2010 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2011 struct AddTrait< UniUpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2012 {
2013  typedef typename AddTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
2014 };
2015 
2016 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2017 struct AddTrait< StaticMatrix<T,M,N,SO1>, UniUpperMatrix<MT,SO2,DF> >
2018 {
2019  typedef typename AddTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
2020 };
2021 
2022 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2023 struct AddTrait< UniUpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2024 {
2025  typedef typename AddTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
2026 };
2027 
2028 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2029 struct AddTrait< HybridMatrix<T,M,N,SO1>, UniUpperMatrix<MT,SO2,DF> >
2030 {
2031  typedef typename AddTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
2032 };
2033 
2034 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2035 struct AddTrait< UniUpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2036 {
2037  typedef typename AddTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
2038 };
2039 
2040 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2041 struct AddTrait< DynamicMatrix<T,SO1>, UniUpperMatrix<MT,SO2,DF> >
2042 {
2043  typedef typename AddTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
2044 };
2045 
2046 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
2047 struct AddTrait< UniUpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2048 {
2049  typedef typename AddTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
2050 };
2051 
2052 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
2053 struct AddTrait< CustomMatrix<T,AF,PF,SO1>, UniUpperMatrix<MT,SO2,DF> >
2054 {
2055  typedef typename AddTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
2056 };
2057 
2058 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2059 struct AddTrait< UniUpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2060 {
2061  typedef typename AddTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
2062 };
2063 
2064 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2065 struct AddTrait< CompressedMatrix<T,SO1>, UniUpperMatrix<MT,SO2,DF> >
2066 {
2067  typedef typename AddTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
2068 };
2069 
2070 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
2071 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2072 {
2073  typedef typename AddTrait<MT1,MT2>::Type Type;
2074 };
2075 
2076 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
2077 struct AddTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniUpperMatrix<MT2,SO2,DF2> >
2078 {
2079  typedef typename AddTrait<MT1,MT2>::Type Type;
2080 };
2081 
2082 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2083 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2084 {
2085  typedef typename AddTrait<MT1,MT2>::Type Type;
2086 };
2087 
2088 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2089 struct AddTrait< HermitianMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2090 {
2091  typedef typename AddTrait<MT1,MT2>::Type Type;
2092 };
2093 
2094 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2095 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2096 {
2097  typedef typename AddTrait<MT1,MT2>::Type Type;
2098 };
2099 
2100 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2101 struct AddTrait< LowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2102 {
2103  typedef typename AddTrait<MT1,MT2>::Type Type;
2104 };
2105 
2106 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2107 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2108 {
2109  typedef typename AddTrait<MT1,MT2>::Type Type;
2110 };
2111 
2112 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2113 struct AddTrait< UniLowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2114 {
2115  typedef typename AddTrait<MT1,MT2>::Type Type;
2116 };
2117 
2118 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2119 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
2120 {
2121  typedef typename AddTrait<MT1,MT2>::Type Type;
2122 };
2123 
2124 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2125 struct AddTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2126 {
2127  typedef typename AddTrait<MT1,MT2>::Type Type;
2128 };
2129 
2130 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2131 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
2132 {
2133  typedef UpperMatrix< typename AddTrait<MT1,MT2>::Type > Type;
2134 };
2135 
2136 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2137 struct AddTrait< UpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2138 {
2139  typedef UpperMatrix< typename AddTrait<MT1,MT2>::Type > Type;
2140 };
2141 
2142 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2143 struct AddTrait< UniUpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2144 {
2145  typedef UpperMatrix< typename AddTrait<MT1,MT2>::Type > Type;
2146 };
2148 //*************************************************************************************************
2149 
2150 
2151 
2152 
2153 //=================================================================================================
2154 //
2155 // SUBTRAIT SPECIALIZATIONS
2156 //
2157 //=================================================================================================
2158 
2159 //*************************************************************************************************
2161 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2162 struct SubTrait< UniUpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2163 {
2164  typedef typename SubTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
2165 };
2166 
2167 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2168 struct SubTrait< StaticMatrix<T,M,N,SO1>, UniUpperMatrix<MT,SO2,DF> >
2169 {
2170  typedef typename SubTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
2171 };
2172 
2173 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2174 struct SubTrait< UniUpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2175 {
2176  typedef typename SubTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
2177 };
2178 
2179 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2180 struct SubTrait< HybridMatrix<T,M,N,SO1>, UniUpperMatrix<MT,SO2,DF> >
2181 {
2182  typedef typename SubTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
2183 };
2184 
2185 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2186 struct SubTrait< UniUpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2187 {
2188  typedef typename SubTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
2189 };
2190 
2191 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2192 struct SubTrait< DynamicMatrix<T,SO1>, UniUpperMatrix<MT,SO2,DF> >
2193 {
2194  typedef typename SubTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
2195 };
2196 
2197 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
2198 struct SubTrait< UniUpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2199 {
2200  typedef typename SubTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
2201 };
2202 
2203 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
2204 struct SubTrait< CustomMatrix<T,AF,PF,SO1>, UniUpperMatrix<MT,SO2,DF> >
2205 {
2206  typedef typename SubTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
2207 };
2208 
2209 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2210 struct SubTrait< UniUpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2211 {
2212  typedef typename SubTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
2213 };
2214 
2215 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2216 struct SubTrait< CompressedMatrix<T,SO1>, UniUpperMatrix<MT,SO2,DF> >
2217 {
2218  typedef typename SubTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
2219 };
2220 
2221 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
2222 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2223 {
2224  typedef typename SubTrait<MT1,MT2>::Type Type;
2225 };
2226 
2227 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
2228 struct SubTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniUpperMatrix<MT2,SO2,DF2> >
2229 {
2230  typedef typename SubTrait<MT1,MT2>::Type Type;
2231 };
2232 
2233 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2234 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2235 {
2236  typedef typename SubTrait<MT1,MT2>::Type Type;
2237 };
2238 
2239 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2240 struct SubTrait< HermitianMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2241 {
2242  typedef typename SubTrait<MT1,MT2>::Type Type;
2243 };
2244 
2245 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2246 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2247 {
2248  typedef typename SubTrait<MT1,MT2>::Type Type;
2249 };
2250 
2251 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2252 struct SubTrait< LowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2253 {
2254  typedef typename SubTrait<MT1,MT2>::Type Type;
2255 };
2256 
2257 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2258 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2259 {
2260  typedef typename SubTrait<MT1,MT2>::Type Type;
2261 };
2262 
2263 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2264 struct SubTrait< UniLowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2265 {
2266  typedef typename SubTrait<MT1,MT2>::Type Type;
2267 };
2268 
2269 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2270 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
2271 {
2272  typedef typename SubTrait<MT1,MT2>::Type Type;
2273 };
2274 
2275 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2276 struct SubTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2277 {
2278  typedef typename SubTrait<MT1,MT2>::Type Type;
2279 };
2280 
2281 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2282 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
2283 {
2284  typedef UpperMatrix< typename SubTrait<MT1,MT2>::Type > Type;
2285 };
2286 
2287 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2288 struct SubTrait< UpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2289 {
2290  typedef UpperMatrix< typename SubTrait<MT1,MT2>::Type > Type;
2291 };
2292 
2293 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2294 struct SubTrait< UniUpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2295 {
2296  typedef UpperMatrix< typename SubTrait<MT1,MT2>::Type > Type;
2297 };
2299 //*************************************************************************************************
2300 
2301 
2302 
2303 
2304 //=================================================================================================
2305 //
2306 // MULTTRAIT SPECIALIZATIONS
2307 //
2308 //=================================================================================================
2309 
2310 //*************************************************************************************************
2312 template< typename MT, bool SO, bool DF, typename T >
2313 struct MultTrait< UniUpperMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
2314 {
2315  typedef UpperMatrix< typename MultTrait<MT,T>::Type > Type;
2316 };
2317 
2318 template< typename T, typename MT, bool SO, bool DF >
2319 struct MultTrait< T, UniUpperMatrix<MT,SO,DF>, typename EnableIf< IsNumeric<T> >::Type >
2320 {
2321  typedef UpperMatrix< typename MultTrait<T,MT>::Type > Type;
2322 };
2323 
2324 template< typename MT, bool SO, bool DF, typename T, size_t N >
2325 struct MultTrait< UniUpperMatrix<MT,SO,DF>, StaticVector<T,N,false> >
2326 {
2327  typedef typename MultTrait< MT, StaticVector<T,N,false> >::Type Type;
2328 };
2329 
2330 template< typename T, size_t N, typename MT, bool SO, bool DF >
2331 struct MultTrait< StaticVector<T,N,true>, UniUpperMatrix<MT,SO,DF> >
2332 {
2333  typedef typename MultTrait< StaticVector<T,N,true>, MT >::Type Type;
2334 };
2335 
2336 template< typename MT, bool SO, bool DF, typename T, size_t N >
2337 struct MultTrait< UniUpperMatrix<MT,SO,DF>, HybridVector<T,N,false> >
2338 {
2339  typedef typename MultTrait< MT, HybridVector<T,N,false> >::Type Type;
2340 };
2341 
2342 template< typename T, size_t N, typename MT, bool SO, bool DF >
2343 struct MultTrait< HybridVector<T,N,true>, UniUpperMatrix<MT,SO,DF> >
2344 {
2345  typedef typename MultTrait< HybridVector<T,N,true>, MT >::Type Type;
2346 };
2347 
2348 template< typename MT, bool SO, bool DF, typename T >
2349 struct MultTrait< UniUpperMatrix<MT,SO,DF>, DynamicVector<T,false> >
2350 {
2351  typedef typename MultTrait< MT, DynamicVector<T,false> >::Type Type;
2352 };
2353 
2354 template< typename T, typename MT, bool SO, bool DF >
2355 struct MultTrait< DynamicVector<T,true>, UniUpperMatrix<MT,SO,DF> >
2356 {
2357  typedef typename MultTrait< DynamicVector<T,true>, MT >::Type Type;
2358 };
2359 
2360 template< typename MT, bool SO, bool DF, typename T, bool AF, bool PF >
2361 struct MultTrait< UniUpperMatrix<MT,SO,DF>, CustomVector<T,AF,PF,false> >
2362 {
2363  typedef typename MultTrait< MT, CustomVector<T,AF,PF,false> >::Type Type;
2364 };
2365 
2366 template< typename T, bool AF, bool PF, typename MT, bool SO, bool DF >
2367 struct MultTrait< CustomVector<T,AF,PF,true>, UniUpperMatrix<MT,SO,DF> >
2368 {
2369  typedef typename MultTrait< CustomVector<T,AF,PF,true>, MT >::Type Type;
2370 };
2371 
2372 template< typename MT, bool SO, bool DF, typename T >
2373 struct MultTrait< UniUpperMatrix<MT,SO,DF>, CompressedVector<T,false> >
2374 {
2375  typedef typename MultTrait< MT, CompressedVector<T,false> >::Type Type;
2376 };
2377 
2378 template< typename T, typename MT, bool SO, bool DF >
2379 struct MultTrait< CompressedVector<T,true>, UniUpperMatrix<MT,SO,DF> >
2380 {
2381  typedef typename MultTrait< CompressedVector<T,true>, MT >::Type Type;
2382 };
2383 
2384 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2385 struct MultTrait< UniUpperMatrix<MT,SO1,DF>, StaticMatrix<T,M,N,SO2> >
2386 {
2387  typedef typename MultTrait< MT, StaticMatrix<T,M,N,SO2> >::Type Type;
2388 };
2389 
2390 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2391 struct MultTrait< StaticMatrix<T,M,N,SO1>, UniUpperMatrix<MT,SO2,DF> >
2392 {
2393  typedef typename MultTrait< StaticMatrix<T,M,N,SO1>, MT >::Type Type;
2394 };
2395 
2396 template< typename MT, bool SO1, bool DF, typename T, size_t M, size_t N, bool SO2 >
2397 struct MultTrait< UniUpperMatrix<MT,SO1,DF>, HybridMatrix<T,M,N,SO2> >
2398 {
2399  typedef typename MultTrait< MT, HybridMatrix<T,M,N,SO2> >::Type Type;
2400 };
2401 
2402 template< typename T, size_t M, size_t N, bool SO1, typename MT, bool SO2, bool DF >
2403 struct MultTrait< HybridMatrix<T,M,N,SO1>, UniUpperMatrix<MT,SO2,DF> >
2404 {
2405  typedef typename MultTrait< HybridMatrix<T,M,N,SO1>, MT >::Type Type;
2406 };
2407 
2408 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2409 struct MultTrait< UniUpperMatrix<MT,SO1,DF>, DynamicMatrix<T,SO2> >
2410 {
2411  typedef typename MultTrait< MT, DynamicMatrix<T,SO2> >::Type Type;
2412 };
2413 
2414 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2415 struct MultTrait< DynamicMatrix<T,SO1>, UniUpperMatrix<MT,SO2,DF> >
2416 {
2417  typedef typename MultTrait< DynamicMatrix<T,SO1>, MT >::Type Type;
2418 };
2419 
2420 template< typename MT, bool SO1, bool DF, typename T, bool AF, bool PF, bool SO2 >
2421 struct MultTrait< UniUpperMatrix<MT,SO1,DF>, CustomMatrix<T,AF,PF,SO2> >
2422 {
2423  typedef typename MultTrait< MT, CustomMatrix<T,AF,PF,SO2> >::Type Type;
2424 };
2425 
2426 template< typename T, bool AF, bool PF, bool SO1, typename MT, bool SO2, bool DF >
2427 struct MultTrait< CustomMatrix<T,AF,PF,SO1>, UniUpperMatrix<MT,SO2,DF> >
2428 {
2429  typedef typename MultTrait< CustomMatrix<T,AF,PF,SO1>, MT >::Type Type;
2430 };
2431 
2432 template< typename MT, bool SO1, bool DF, typename T, bool SO2 >
2433 struct MultTrait< UniUpperMatrix<MT,SO1,DF>, CompressedMatrix<T,SO2> >
2434 {
2435  typedef typename MultTrait< MT, CompressedMatrix<T,SO2> >::Type Type;
2436 };
2437 
2438 template< typename T, bool SO1, typename MT, bool SO2, bool DF >
2439 struct MultTrait< CompressedMatrix<T,SO1>, UniUpperMatrix<MT,SO2,DF> >
2440 {
2441  typedef typename MultTrait< CompressedMatrix<T,SO1>, MT >::Type Type;
2442 };
2443 
2444 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2, bool NF >
2445 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, SymmetricMatrix<MT2,SO2,DF2,NF> >
2446 {
2447  typedef typename MultTrait<MT1,MT2>::Type Type;
2448 };
2449 
2450 template< typename MT1, bool SO1, bool DF1, bool NF, typename MT2, bool SO2, bool DF2 >
2451 struct MultTrait< SymmetricMatrix<MT1,SO1,DF1,NF>, UniUpperMatrix<MT2,SO2,DF2> >
2452 {
2453  typedef typename MultTrait<MT1,MT2>::Type Type;
2454 };
2455 
2456 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2457 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, HermitianMatrix<MT2,SO2,DF2> >
2458 {
2459  typedef typename MultTrait<MT1,MT2>::Type Type;
2460 };
2461 
2462 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2463 struct MultTrait< HermitianMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2464 {
2465  typedef typename MultTrait<MT1,MT2>::Type Type;
2466 };
2467 
2468 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2469 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, LowerMatrix<MT2,SO2,DF2> >
2470 {
2471  typedef typename MultTrait<MT1,MT2>::Type Type;
2472 };
2473 
2474 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2475 struct MultTrait< LowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2476 {
2477  typedef typename MultTrait<MT1,MT2>::Type Type;
2478 };
2479 
2480 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2481 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, UniLowerMatrix<MT2,SO2,DF2> >
2482 {
2483  typedef typename MultTrait<MT1,MT2>::Type Type;
2484 };
2485 
2486 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2487 struct MultTrait< UniLowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2488 {
2489  typedef typename MultTrait<MT1,MT2>::Type Type;
2490 };
2491 
2492 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2493 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, StrictlyLowerMatrix<MT2,SO2,DF2> >
2494 {
2495  typedef typename MultTrait<MT1,MT2>::Type Type;
2496 };
2497 
2498 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2499 struct MultTrait< StrictlyLowerMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2500 {
2501  typedef typename MultTrait<MT1,MT2>::Type Type;
2502 };
2503 
2504 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2505 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, UpperMatrix<MT2,SO2,DF2> >
2506 {
2507  typedef UpperMatrix< typename MultTrait<MT1,MT2>::Type > Type;
2508 };
2509 
2510 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2511 struct MultTrait< UpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2512 {
2513  typedef UpperMatrix< typename MultTrait<MT1,MT2>::Type > Type;
2514 };
2515 
2516 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2517 struct MultTrait< UniUpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2518 {
2519  typedef UniUpperMatrix< typename MultTrait<MT1,MT2>::Type > Type;
2520 };
2522 //*************************************************************************************************
2523 
2524 
2525 
2526 
2527 //=================================================================================================
2528 //
2529 // DIVTRAIT SPECIALIZATIONS
2530 //
2531 //=================================================================================================
2532 
2533 //*************************************************************************************************
2535 template< typename MT, bool SO, bool DF, typename T >
2536 struct DivTrait< UniUpperMatrix<MT,SO,DF>, T, typename EnableIf< IsNumeric<T> >::Type >
2537 {
2538  typedef UpperMatrix< typename DivTrait<MT,T>::Type > Type;
2539 };
2541 //*************************************************************************************************
2542 
2543 
2544 
2545 
2546 //=================================================================================================
2547 //
2548 // MATHTRAIT SPECIALIZATIONS
2549 //
2550 //=================================================================================================
2551 
2552 //*************************************************************************************************
2554 template< typename MT1, bool SO1, bool DF1, typename MT2, bool SO2, bool DF2 >
2555 struct MathTrait< UniUpperMatrix<MT1,SO1,DF1>, UniUpperMatrix<MT2,SO2,DF2> >
2556 {
2557  typedef UniUpperMatrix< typename MathTrait<MT1,MT2>::HighType > HighType;
2558  typedef UniUpperMatrix< typename MathTrait<MT1,MT2>::LowType > LowType;
2559 };
2561 //*************************************************************************************************
2562 
2563 
2564 
2565 
2566 //=================================================================================================
2567 //
2568 // SUBMATRIXTRAIT SPECIALIZATIONS
2569 //
2570 //=================================================================================================
2571 
2572 //*************************************************************************************************
2574 template< typename MT, bool SO, bool DF >
2575 struct SubmatrixTrait< UniUpperMatrix<MT,SO,DF> >
2576 {
2577  typedef typename SubmatrixTrait<MT>::Type Type;
2578 };
2580 //*************************************************************************************************
2581 
2582 
2583 
2584 
2585 //=================================================================================================
2586 //
2587 // ROWTRAIT SPECIALIZATIONS
2588 //
2589 //=================================================================================================
2590 
2591 //*************************************************************************************************
2593 template< typename MT, bool SO, bool DF >
2594 struct RowTrait< UniUpperMatrix<MT,SO,DF> >
2595 {
2596  typedef typename RowTrait<MT>::Type Type;
2597 };
2599 //*************************************************************************************************
2600 
2601 
2602 
2603 
2604 //=================================================================================================
2605 //
2606 // COLUMNTRAIT SPECIALIZATIONS
2607 //
2608 //=================================================================================================
2609 
2610 //*************************************************************************************************
2612 template< typename MT, bool SO, bool DF >
2613 struct ColumnTrait< UniUpperMatrix<MT,SO,DF> >
2614 {
2615  typedef typename ColumnTrait<MT>::Type Type;
2616 };
2618 //*************************************************************************************************
2619 
2620 } // namespace blaze
2621 
2622 #endif
bool isOne(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is 1.
Definition: DiagonalProxy.h:609
Header file for mathematical functions.
void trtri(char uplo, char diag, int n, float *A, int lda, int *info)
LAPACK kernel for the inversion of the given dense triangular single precision column-major matrix...
Definition: trtri.h:133
Header file for the Rows type trait.
Header file for the UNUSED_PARAMETER function template.
Header file for the IsUniUpper type trait.
Header file for the subtraction trait.
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector)
Returns the current size/dimension of the vector.
Definition: Vector.h:252
Header file for the row trait.
BLAZE_ALWAYS_INLINE MT::Iterator end(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator just past the last element of row/column i.
Definition: Matrix.h:250
UniUpperMatrix specialization for sparse matrices.
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:507
BLAZE_ALWAYS_INLINE size_t rows(const Matrix< MT, SO > &matrix)
Returns the current number of rows of the matrix.
Definition: Matrix.h:308
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename ColumnExprTrait< MT >::Type >::Type column(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific column of the given matrix.
Definition: Column.h:107
void UNUSED_PARAMETER(const T1 &)
Suppression of unused parameter warnings.
Definition: Unused.h:81
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UNITRIANGULAR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower or upper unitriangular matrix ty...
Definition: UniTriangular.h:118
Header file for the implementation of the base template of the UniUpperMatrix.
Constraint on the data type.
bool isDefault(const DiagonalProxy< MT > &proxy)
Returns whether the represented element is in default state.
Definition: DiagonalProxy.h:547
Constraint on the data type.
Header file for the implementation of the base template of the UpperMatrix.
Header file for the IsSquare type trait.
Header file for the multiplication trait.
Header file for the LAPACK triangular matrix inversion functions (trtri)
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for all forward declarations of the math module.
const Element * ConstIterator
Iterator over constant elements.
Definition: CompressedMatrix.h:2592
const MT::ElementType min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1682
void lu(const DenseMatrix< MT1, SO1 > &A, DenseMatrix< MT2, SO1 > &L, DenseMatrix< MT3, SO1 > &U, Matrix< MT4, SO2 > &P)
LU decomposition of the given dense matrix.
Definition: LU.h:217
Header file for the Columns type trait.
Header file for the implementation of a fixed-size matrix.
Header file for the IsAligned type trait.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_UPPER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a upper triangular matrix type...
Definition: Upper.h:118
BLAZE_ALWAYS_INLINE MT::Iterator begin(Matrix< MT, SO > &matrix, size_t i)
Returns an iterator to the first element of row/column i.
Definition: Matrix.h:187
BLAZE_ALWAYS_INLINE void resize(Matrix< MT, SO > &matrix, size_t rows, size_t columns, bool preserve=true)
Changing the size of the matrix.
Definition: Matrix.h:532
Type ElementType
Type of the sparse matrix elements.
Definition: CompressedMatrix.h:2586
Constraint on the data type.
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:527
Header file for the IsPadded type trait.
Header file for the IsAdaptor type trait.
Header file for the isOne shim.
Header file for the DerestrictTrait class template.
Constraint on the data type.
Header file for the IsNumeric type trait.
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
DisableIf< Or< IsComputation< MT >, IsTransExpr< MT > >, typename RowExprTrait< MT >::Type >::Type row(Matrix< MT, SO > &matrix, size_t index)
Creating a view on a specific row of the given matrix.
Definition: Row.h:107
Matrix adapter for upper unitriangular matrices.
Definition: Forward.h:54
#define BLAZE_CONSTRAINT_MUST_NOT_BE_SYMMETRIC_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a symmetric matrix type, a compilation error is created.
Definition: Symmetric.h:116
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.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_LOWER_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is a lower triangular matrix type...
Definition: Lower.h:118
Header file for the column trait.
Header file for the isDefault shim.
#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:79
Constraint on the data type.
#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:118
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b)
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:256
Header file for the mathematical trait.
boost::false_type FalseType
Type/value traits base class.The FalseType class is used as base class for type traits and value trai...
Definition: FalseType.h:61
Header file for the IsTrue value trait.
BLAZE_ALWAYS_INLINE size_t columns(const Matrix< MT, SO > &matrix)
Returns the current number of columns of the matrix.
Definition: Matrix.h:324
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:237
#define BLAZE_CONSTRAINT_MUST_NOT_BE_HERMITIAN_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is an Hermitian matrix type, a compilation error is created.
Definition: Hermitian.h:116
boost::true_type TrueType
Type traits base class.The TrueType class is used as base class for type traits and value traits that...
Definition: TrueType.h:61
UniUpperMatrix specialization for dense matrices.
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
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the give dense matrix is an identity matrix.
Definition: DenseMatrix.h:1605