35#ifndef _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_H_
36#define _BLAZE_MATH_ADAPTORS_STRICTLYUPPERMATRIX_H_
113template< RelaxationFlag RF,
typename MT,
bool SO,
bool DF >
114bool isDefault(
const StrictlyUpperMatrix<MT,SO,DF>& m );
116template<
typename MT,
bool SO,
bool DF >
117bool isIntact(
const StrictlyUpperMatrix<MT,SO,DF>& m );
119template<
typename MT,
bool SO,
bool DF >
120void swap( StrictlyUpperMatrix<MT,SO,DF>& a, StrictlyUpperMatrix<MT,SO,DF>& b )
noexcept;
156inline bool isDefault(
const StrictlyUpperMatrix<MT,SO,DF>& m )
159 return m.rows() == 0UL;
160 else return isLower<RF>( m );
189inline bool isIntact(
const StrictlyUpperMatrix<MT,SO,DF>& m )
207inline void swap( StrictlyUpperMatrix<MT,SO,DF>& a, StrictlyUpperMatrix<MT,SO,DF>& b )
noexcept
234inline bool trySet(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
270 trySet(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
279 return ( m == 0UL ) ||
308inline bool tryAdd(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
310 return trySet( mat, i, j, value );
339 tryAdd(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
341 return trySet( mat,
row,
column, m, n, value );
368inline bool trySub(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
370 return trySet( mat, i, j, value );
400 trySub(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
402 return trySet( mat,
row,
column, m, n, value );
428inline bool tryBitor(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
430 return trySet( mat, i, j, value );
460 tryBitor(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
462 return trySet( mat,
row,
column, m, n, value );
488inline bool tryBitxor(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t i,
size_t j,
const ET& value )
490 return tryAdd( mat, i, j, value );
520 tryBitxor(
const StrictlyUpperMatrix<MT,SO,DF>& mat,
size_t row,
size_t column,
size_t m,
size_t n,
const ET& value )
522 return tryAdd( mat,
row,
column, m, n, value );
549inline bool tryAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
550 const DenseVector<VT,false>& rhs,
size_t row,
size_t column )
562 for(
size_t i=ibegin; i<(*rhs).size(); ++i ) {
594inline bool tryAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
595 const DenseVector<VT,true>& rhs,
size_t row,
size_t column )
608 const size_t iend(
min(
row -
column + 1UL, (*rhs).size() ) );
610 for(
size_t i=0UL; i<iend; ++i ) {
644inline bool tryAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
const DenseVector<VT,TF>& rhs,
657 for(
size_t i=0UL; i<(*rhs).size(); ++i ) {
690inline bool tryAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
691 const SparseVector<VT,false>& rhs,
size_t row,
size_t column )
701 const auto last( (*rhs).end() );
704 for( ; element!=last; ++element ) {
736inline bool tryAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
737 const SparseVector<VT,true>& rhs,
size_t row,
size_t column )
750 const auto last( (*rhs).lowerBound(
row -
column + 1UL ) );
752 for(
auto element=(*rhs).begin(); element!=last; ++element ) {
786inline bool tryAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
const SparseVector<VT,TF>& rhs,
799 for(
const auto& element : *rhs ) {
828template<
typename MT1
832inline bool tryAssign(
const StrictlyUpperMatrix<MT1,SO,DF>& lhs,
833 const DenseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
844 const size_t M( (*rhs).rows() );
845 const size_t N( (*rhs).columns() );
852 for(
size_t i=ibegin; i<M; ++i )
856 for(
size_t j=0UL; j<jend; ++j ) {
885template<
typename MT1
889inline bool tryAssign(
const StrictlyUpperMatrix<MT1,SO,DF>& lhs,
890 const DenseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
901 const size_t M( (*rhs).rows() );
902 const size_t N( (*rhs).columns() );
909 for(
size_t j=0UL; j<jend; ++j )
911 const bool containsDiagonal(
column + j >=
row );
912 const size_t ibegin( ( containsDiagonal )?(
column + j -
row ):( 0UL ) );
914 for(
size_t i=ibegin; i<M; ++i ) {
943template<
typename MT1
947inline bool tryAssign(
const StrictlyUpperMatrix<MT1,SO,DF>& lhs,
948 const SparseMatrix<MT2,false>& rhs,
size_t row,
size_t column )
959 const size_t M( (*rhs).rows() );
960 const size_t N( (*rhs).columns() );
967 for(
size_t i=ibegin; i<M; ++i )
969 const size_t index(
row + i -
column + 1UL );
970 const auto last( (*rhs).lowerBound( i,
min( index, N ) ) );
972 for(
auto element=(*rhs).begin(i); element!=last; ++element ) {
1001template<
typename MT1
1005inline bool tryAssign(
const StrictlyUpperMatrix<MT1,SO,DF>& lhs,
1006 const SparseMatrix<MT2,true>& rhs,
size_t row,
size_t column )
1017 const size_t M( (*rhs).rows() );
1018 const size_t N( (*rhs).columns() );
1025 for(
size_t j=0UL; j<jend; ++j )
1027 const bool containsDiagonal(
column + j >=
row );
1028 const size_t index( ( containsDiagonal )?(
column + j -
row ):( 0UL ) );
1030 const auto last( (*rhs).end(j) );
1031 auto element( (*rhs).lowerBound( index, j ) );
1033 for( ; element!=last; ++element ) {
1062template<
typename MT
1067inline bool tryAddAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
1068 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1070 return tryAssign( lhs, *rhs,
row,
column );
1094template<
typename MT
1099inline bool tryAddAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
const Vector<VT,TF>& rhs,
1125template<
typename MT1
1130inline bool tryAddAssign(
const StrictlyUpperMatrix<MT1,SO1,DF>& lhs,
1131 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1133 return tryAssign( lhs, *rhs,
row,
column );
1156template<
typename MT
1161inline bool trySubAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
1162 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1164 return tryAssign( lhs, *rhs,
row,
column );
1188template<
typename MT
1193inline bool trySubAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
const Vector<VT,TF>& rhs,
1219template<
typename MT1
1224inline bool trySubAssign(
const StrictlyUpperMatrix<MT1,SO1,DF>& lhs,
1225 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1227 return tryAssign( lhs, *rhs,
row,
column );
1250template<
typename MT
1255inline bool tryBitorAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
1256 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1258 return tryAssign( lhs, *rhs,
row,
column );
1281template<
typename MT
1286inline bool tryBitorAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
const Vector<VT,TF>& rhs,
1312template<
typename MT1
1317inline bool tryBitorAssign(
const StrictlyUpperMatrix<MT1,SO1,DF>& lhs,
1318 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1320 return tryAssign( lhs, *rhs,
row,
column );
1343template<
typename MT
1348inline bool tryBitxorAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
1349 const Vector<VT,TF>& rhs,
size_t row,
size_t column )
1351 return tryAssign( lhs, *rhs,
row,
column );
1374template<
typename MT
1379inline bool tryBitxorAssign(
const StrictlyUpperMatrix<MT,SO,DF>& lhs,
const Vector<VT,TF>& rhs,
1405template<
typename MT1
1410inline bool tryBitxorAssign(
const StrictlyUpperMatrix<MT1,SO1,DF>& lhs,
1411 const Matrix<MT2,SO2>& rhs,
size_t row,
size_t column )
1413 return tryAssign( lhs, *rhs,
row,
column );
1433template<
typename MT
1436inline MT& derestrict( StrictlyUpperMatrix<MT,SO,DF>& m )
1454template<
typename MT,
bool SO,
bool DF >
1455struct Size< StrictlyUpperMatrix<MT,SO,DF>, 0UL >
1456 :
public Size<MT,0UL>
1459template<
typename MT,
bool SO,
bool DF >
1460struct Size< StrictlyUpperMatrix<MT,SO,DF>, 1UL >
1461 :
public Size<MT,1UL>
1477template<
typename MT,
bool SO,
bool DF >
1478struct MaxSize< StrictlyUpperMatrix<MT,SO,DF>, 0UL >
1479 :
public MaxSize<MT,0UL>
1482template<
typename MT,
bool SO,
bool DF >
1483struct MaxSize< StrictlyUpperMatrix<MT,SO,DF>, 1UL >
1484 :
public MaxSize<MT,1UL>
1500template<
typename MT,
bool SO,
bool DF >
1501struct IsSquare< StrictlyUpperMatrix<MT,SO,DF> >
1518template<
typename MT,
bool SO,
bool DF >
1519struct IsUniform< StrictlyUpperMatrix<MT,SO,DF> >
1520 :
public IsUniform<MT>
1536template<
typename MT,
bool SO,
bool DF >
1537struct IsSymmetric< StrictlyUpperMatrix<MT,SO,DF> >
1538 :
public IsUniform<MT>
1554template<
typename MT,
bool SO,
bool DF >
1555struct IsHermitian< StrictlyUpperMatrix<MT,SO,DF> >
1556 :
public IsUniform<MT>
1572template<
typename MT,
bool SO,
bool DF >
1573struct IsStrictlyLower< StrictlyUpperMatrix<MT,SO,DF> >
1574 :
public IsUniform<MT>
1590template<
typename MT,
bool SO,
bool DF >
1591struct IsStrictlyUpper< StrictlyUpperMatrix<MT,SO,DF> >
1608template<
typename MT,
bool SO,
bool DF >
1609struct IsAdaptor< StrictlyUpperMatrix<MT,SO,DF> >
1626template<
typename MT,
bool SO,
bool DF >
1627struct IsRestricted< StrictlyUpperMatrix<MT,SO,DF> >
1644template<
typename MT,
bool SO >
1645struct HasConstDataAccess< StrictlyUpperMatrix<MT,SO,true> >
1662template<
typename MT,
bool SO,
bool DF >
1663struct IsAligned< StrictlyUpperMatrix<MT,SO,DF> >
1664 :
public IsAligned<MT>
1680template<
typename MT,
bool SO,
bool DF >
1681struct IsContiguous< StrictlyUpperMatrix<MT,SO,DF> >
1682 :
public IsContiguous<MT>
1698template<
typename MT,
bool SO,
bool DF >
1699struct IsPadded< StrictlyUpperMatrix<MT,SO,DF> >
1700 :
public IsPadded<MT>
1716template<
typename MT,
bool SO,
bool DF >
1717struct RemoveAdaptor< StrictlyUpperMatrix<MT,SO,DF> >
1735template<
typename T1,
typename T2 >
1736struct AddTraitEval1< T1, T2
1739 ( IsStrictlyUpper_v<T1> && IsStrictlyUpper_v<T2> ) &&
1740 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1742 using Type = StrictlyUpperMatrix< typename AddTraitEval2<T1,T2>::Type >;
1758template<
typename T1,
typename T2 >
1759struct SubTraitEval1< T1, T2
1762 ( ( IsUniUpper_v<T1> && IsUniUpper_v<T2> ) ||
1763 ( IsStrictlyUpper_v<T1> && IsStrictlyUpper_v<T2> ) ) &&
1764 !( IsIdentity_v<T1> && IsIdentity_v<T2> ) &&
1765 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1767 using Type = StrictlyUpperMatrix< typename SubTraitEval2<T1,T2>::Type >;
1783template<
typename T1,
typename T2 >
1784struct SchurTraitEval1< T1, T2
1787 ( ( IsStrictlyUpper_v<T1> && !IsLower_v<T2> ) ||
1788 ( !IsLower_v<T1> && IsStrictlyUpper_v<T2> ) ) &&
1789 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1791 using Type = StrictlyUpperMatrix< typename SchurTraitEval2<T1,T2>::Type >;
1807template<
typename T1,
typename T2 >
1808struct MultTraitEval1< T1, T2
1811 ( IsStrictlyUpper_v<T1> && !IsUniform_v<T1> ) > >
1813 using Type = StrictlyUpperMatrix< typename MultTraitEval2<T1,T2>::Type >;
1816template<
typename T1,
typename T2 >
1817struct MultTraitEval1< T1, T2
1820 ( IsStrictlyUpper_v<T2> && !IsUniform_v<T2> ) > >
1822 using Type = StrictlyUpperMatrix< typename MultTraitEval2<T1,T2>::Type >;
1825template<
typename T1,
typename T2 >
1826struct MultTraitEval1< T1, T2
1829 ( ( IsStrictlyUpper_v<T1> && IsUpper_v<T2> ) ||
1830 ( IsUpper_v<T1> && IsStrictlyUpper_v<T2> ) ) &&
1831 !( IsIdentity_v<T1> || IsIdentity_v<T2> ) &&
1832 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1834 using Type = StrictlyUpperMatrix< typename MultTraitEval2<T1,T2>::Type >;
1850template<
typename T1,
typename T2 >
1851struct KronTraitEval1< T1, T2
1854 ( ( IsStrictlyUpper_v<T1> ) ||
1855 ( IsUpper_v<T1> && IsStrictlyUpper_v<T2> ) ) &&
1856 !( IsZero_v<T1> || IsZero_v<T2> ) > >
1858 using Type = StrictlyUpperMatrix< typename KronTraitEval2<T1,T2>::Type >;
1874template<
typename T1,
typename T2 >
1875struct DivTraitEval1< T1, T2
1878 using Type = StrictlyUpperMatrix< typename DivTraitEval2<T1,T2>::Type >;
1894template<
typename T,
typename OP >
1895struct UnaryMapTraitEval1< T, OP
1897 !YieldsDiagonal_v<OP,T> > >
1899 using Type = StrictlyUpperMatrix< typename UnaryMapTraitEval2<T,OP>::Type, StorageOrder_v<T> >;
1907template<
typename T1,
typename T2,
typename OP >
1908struct BinaryMapTraitEval1< T1, T2, OP
1910 !YieldsDiagonal_v<OP,T1,T2> > >
1912 using Type = StrictlyUpperMatrix< typename BinaryMapTraitEval2<T1,T2,OP>::Type >;
1928template<
typename MT,
bool SO,
bool DF >
1929struct DeclSymTrait< StrictlyUpperMatrix<MT,SO,DF> >
1931 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1947template<
typename MT,
bool SO,
bool DF >
1948struct DeclHermTrait< StrictlyUpperMatrix<MT,SO,DF> >
1950 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1966template<
typename MT,
bool SO,
bool DF >
1967struct DeclLowTrait< StrictlyUpperMatrix<MT,SO,DF> >
1969 using Type = ZeroMatrix< typename MT::ElementType, SO >;
1985template<
typename MT,
bool SO,
bool DF >
1986struct DeclUniLowTrait< StrictlyUpperMatrix<MT,SO,DF> >
1988 using Type = INVALID_TYPE;
2004template<
typename MT,
bool SO,
bool DF >
2005struct DeclStrLowTrait< StrictlyUpperMatrix<MT,SO,DF> >
2007 using Type = ZeroMatrix< typename MT::ElementType, SO >;
2023template<
typename MT,
bool SO,
bool DF >
2024struct DeclUppTrait< StrictlyUpperMatrix<MT,SO,DF> >
2026 using Type = StrictlyUpperMatrix<MT,SO,DF>;
2042template<
typename MT,
bool SO,
bool DF >
2043struct DeclUniUppTrait< StrictlyUpperMatrix<MT,SO,DF> >
2045 using Type = INVALID_TYPE;
2061template<
typename MT,
bool SO,
bool DF >
2062struct DeclStrUppTrait< StrictlyUpperMatrix<MT,SO,DF> >
2064 using Type = StrictlyUpperMatrix<MT,SO,DF>;
2080template<
typename MT,
bool SO,
bool DF >
2081struct DeclDiagTrait< StrictlyUpperMatrix<MT,SO,DF> >
2083 using Type = ZeroMatrix< typename MT::ElementType, SO >;
2099template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2100struct HighType< StrictlyUpperMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2> >
2102 using Type = StrictlyUpperMatrix< typename HighType<MT1,MT2>::Type >;
2118template<
typename MT1,
bool SO1,
bool DF1,
typename MT2,
bool SO2,
bool DF2 >
2119struct LowType< StrictlyUpperMatrix<MT1,SO1,DF1>, StrictlyUpperMatrix<MT2,SO2,DF2> >
2121 using Type = StrictlyUpperMatrix< typename LowType<MT1,MT2>::Type >;
2137template<
typename MT,
size_t I,
size_t N >
2138struct SubmatrixTraitEval1< MT, I, I, N, N
2140 IsStrictlyUpper_v<MT> &&
2143 using Type = StrictlyUpperMatrix< typename SubmatrixTraitEval2<MT,I,I,N,N>::Type >;
Header file for the addition trait.
Header file for run time assertion macros.
Header file for the decldiag trait.
Header file for the declherm trait.
Header file for the decllow trait.
Header file for the declstrlow trait.
Header file for the declstrupp trait.
Header file for the declsym trait.
Header file for the declunilow trait.
Header file for the decluniupp trait.
Header file for the declupp trait.
Header file for the division trait.
Header file for the EnableIf class template.
Header file for the HasConstDataAccess type trait.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Utility type for generic codes.
Header file for the IsAdaptor type trait.
Header file for the IsAligned type trait.
Header file for the IsContiguous type trait.
Header file for the isDefault shim.
Header file for the IsHermitian type trait.
Header file for the IsIdentity type trait.
Header file for the IsLower type trait.
Header file for the IsMatrix type trait.
Header file for the IsPadded type trait.
Header file for the IsRestricted type trait.
Header file for the IsScalar type trait.
Header file for the IsSquare type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniUpper type trait.
Header file for the IsUpper type trait.
Header file for the Kron product trait.
Header file for the LowType type trait.
Header file for the map trait.
Header file for the MAYBE_UNUSED function template.
Header file for the multiplication trait.
Header file for the relaxation flag enumeration.
Header file for the RemoveAdaptor type trait.
Header file for the Schur product trait.
Header file for the subtraction trait.
Header file for the submatrix trait.
Header file for the YieldsDiagonal type trait.
Header file for the YieldsStrictlyUpper type trait.
Header file for the implementation of the base template of the StrictlyUpperMatrix.
StrictlyUpperMatrix specialization for dense matrices.
StrictlyUpperMatrix specialization for sparse matrices.
Pointer difference type of the Blaze library.
Constraint on the data type.
decltype(auto) band(Matrix< MT, SO > &matrix, RBAs... args)
Creating a view on a specific band of the given matrix.
Definition: Band.h:140
decltype(auto) column(Matrix< MT, SO > &matrix, RCAs... args)
Creating a view on a specific column of the given matrix.
Definition: Column.h:137
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1339
bool isIntact(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the invariants of the given diagonal matrix are intact.
Definition: DiagonalMatrix.h:207
void swap(DiagonalMatrix< MT, SO, DF > &a, DiagonalMatrix< MT, SO, DF > &b) noexcept
Swapping the contents of two matrices.
Definition: DiagonalMatrix.h:225
bool isDefault(const DiagonalMatrix< MT, SO, DF > &m)
Returns whether the given diagonal matrix is in default state.
Definition: DiagonalMatrix.h:169
#define BLAZE_CONSTRAINT_MUST_NOT_REQUIRE_EVALUATION(T)
Constraint on the data type.
Definition: RequiresEvaluation.h:81
constexpr bool IsStrictlyUpper_v
Auxiliary variable template for the IsStrictlyUpper type trait.
Definition: IsStrictlyUpper.h:173
constexpr bool IsScalar_v
Auxiliary variable template for the IsScalar type trait.
Definition: IsScalar.h:104
constexpr ptrdiff_t DefaultSize_v
Default size of the Size type trait.
Definition: Size.h:72
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition: IsMatrix.h:124
constexpr bool YieldsStrictlyUpper_v
Auxiliary variable template for the YieldsStrictlyUpper type trait.
Definition: YieldsStrictlyUpper.h:124
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition: RelaxationFlag.h:66
constexpr Infinity inf
Global Infinity instance.
Definition: Infinity.h:1080
decltype(auto) row(Matrix< MT, SO > &, RRAs...)
Creating a view on a specific row of the given matrix.
Definition: Row.h:137
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
BoolConstant< true > TrueType
Type traits base class.
Definition: IntegralConstant.h:132
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:138
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition: MaybeUnused.h:81
Header file for all forward declarations of the math module.
Header file for the Size type trait.
Header file for the StorageOrder type trait.
Header file for the IsZero type trait.
Header file for the generic min algorithm.