35#ifndef _BLAZE_MATH_SPARSE_IDENTITYMATRIX_H_
36#define _BLAZE_MATH_SPARSE_IDENTITYMATRIX_H_
192template<
typename Type
196 :
public Expression< SparseMatrix< IdentityMatrix<Type,SO,Tag>, SO > >
204 using ResultType =
This;
223 template<
typename NewType >
232 template<
size_t NewM
339 constexpr size_t index() const noexcept {
351 return index_ == rhs.index_;
362 return index_ != rhs.index_;
373 return index_ - rhs.index_;
402 template< typename MT,
bool SO2 >
422 constexpr ConstIterator
begin (
size_t i ) const noexcept;
423 constexpr ConstIterator
cbegin(
size_t i ) const noexcept;
424 constexpr ConstIterator
end (
size_t i ) const noexcept;
425 constexpr ConstIterator
cend (
size_t i ) const noexcept;
432 template< typename MT,
bool SO2 >
443 constexpr
size_t rows() const noexcept;
446 constexpr
size_t capacity(
size_t i ) const noexcept;
448 constexpr
size_t nonZeros(
size_t i ) const noexcept;
450 constexpr
void resize(
size_t n ) noexcept;
458 inline ConstIterator
find (
size_t i,
size_t j ) const;
475 template< typename Other > inline
bool canAlias ( const Other* alias ) const noexcept;
476 template< typename Other > inline
bool isAliased( const Other* alias ) const noexcept;
514template< typename
Type
528template<
typename Type
546template<
typename Type
581template<
typename Type
609template<
typename Type
637template<
typename Type
661template<
typename Type
685template<
typename Type
709template<
typename Type
740template<
typename Type
774template<
typename Type
789template<
typename Type
804template<
typename Type
825template<
typename Type
844template<
typename Type
865template<
typename Type
886template<
typename Type
906template<
typename Type
922template<
typename Type
927 const size_t tmp(
n_ );
955template<
typename Type
967 return end( SO ? j : i );
985template<
typename Type
994 if( ( !SO && j <= i ) || ( SO && i <= j ) )
995 return begin( SO ? j : i );
997 return end( SO ? j : i );
1015template<
typename Type
1024 if( ( !SO && j < i ) || ( SO && i < j ) )
1025 return begin( SO ? j : i );
1027 return end( SO ? j : i );
1045template<
typename Type
1060template<
typename Type
1088template<
typename Type
1091template<
typename Other >
1111template<
typename Type
1114template<
typename Other >
1134template<
typename Type
1159template< RelaxationFlag RF,
typename Type,
bool SO,
typename Tag >
1162template<
typename Type,
bool SO,
typename Tag >
1165template<
typename Type,
bool SO,
typename Tag >
1202 return ( m.rows() == 0UL );
1225template<
typename Type
1245template<
typename Type
1282template<
typename MT
1284inline IdentityMatrix<ElementType_t<MT>,SO>
1308template<
typename MT,
bool SO,
typename Tag >
1309struct IsSquare< IdentityMatrix<MT,SO,Tag> >
1326template<
typename MT,
bool SO,
typename Tag >
1344template<
typename MT,
bool SO,
typename Tag >
1362template<
typename MT,
bool SO,
typename Tag >
1380template<
typename MT,
bool SO,
typename Tag >
1398template<
typename T1,
typename T2 >
1399struct SchurTraitEval1< T1, T2
1437template<
typename T1,
typename T2 >
1438struct MultTraitEval1< T1, T2
1446template<
typename T1,
typename T2 >
1447struct MultTraitEval1< T1, T2
1455template<
typename T1,
typename T2 >
1456struct MultTraitEval1< T1, T2
1482template<
typename T1,
typename T2 >
1483struct KronTraitEval1< T1, T2
1506template<
typename T,
typename OP >
1507struct UnaryMapTraitEval1< T, OP
1511 using ElementType =
decltype( std::declval<OP>()( std::declval< ElementType_t<T> >() ) );
1523template<
typename T1,
typename T2,
typename OP >
1524struct BinaryMapTraitEval1< T1, T2, OP
1529 using ElementType =
decltype( std::declval<OP>()( std::declval< ElementType_t<T1> >()
1530 , std::declval< ElementType_t<T2> >() ) );
1550template<
typename T,
bool SO,
typename Tag >
1553 using Type = IdentityMatrix<T,SO,Tag>;
1569template<
typename T,
bool SO,
typename Tag >
1572 using Type = IdentityMatrix<T,SO,Tag>;
1588template<
typename T,
bool SO,
typename Tag >
1591 using Type = IdentityMatrix<T,SO,Tag>;
1607template<
typename T,
bool SO,
typename Tag >
1610 using Type = IdentityMatrix<T,SO,Tag>;
1626template<
typename T,
bool SO,
typename Tag >
1629 using Type = INVALID_TYPE;
1645template<
typename T,
bool SO,
typename Tag >
1648 using Type = IdentityMatrix<T,SO,Tag>;
1664template<
typename T,
bool SO,
typename Tag >
1667 using Type = IdentityMatrix<T,SO,Tag>;
1683template<
typename T,
bool SO,
typename Tag >
1686 using Type = INVALID_TYPE;
1702template<
typename T,
bool SO,
typename Tag >
1705 using Type = IdentityMatrix<T,SO,Tag>;
1721template<
typename T1,
bool SO,
typename Tag,
typename T2 >
1724 using Type = IdentityMatrix< typename HighType<T1,T2>::Type, SO, Tag >;
1740template<
typename T1,
bool SO,
typename Tag,
typename T2 >
1743 using Type = IdentityMatrix< typename LowType<T1,T2>::Type, SO, Tag >;
Header file for the addition trait.
Header file for auxiliary alias declarations.
typename T1::template Rebind< T2 >::Other Rebind_t
Alias declaration for nested Rebind class templates.
Definition Aliases.h:350
typename ResultType_t< T >::TagType TagType_t
Alias declaration for nested TagType type definitions.
Definition Aliases.h:530
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition Aliases.h:190
Header file for run time assertion macros.
Constraint on the data type.
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 EnableIf class template.
Header file for the EvaluateTrait class template.
Header file for the function trace functionality.
Header file for the HighType type trait.
Header file for the IntegralConstant class template.
Utility type for generic codes.
Header file for the isDefault shim.
Header file for the IsDenseMatrix type trait.
Header file for the IsHermitian type trait.
Header file for the IsIdentity type trait.
Header file for the IsMatrix type trait.
Header file for the IsSMPAssignable type trait.
Header file for the IsSame and IsStrictlySame type traits.
Header file for the IsSparseMatrix type trait.
Header file for the IsSquare type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniLower type trait.
Header file for the IsUniTriangular type trait.
Header file for the IsUniUpper 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.
Constraint on the data type.
Constraint on the data type.
Header file for the relaxation flag enumeration.
Constraint on the data type.
Header file for the Schur product trait.
Header file for the ValueIndexPair class.
Constraint on the data type.
Header file for the YieldsIdentity type trait.
Iterator over the elements of the identity matrix.
Definition IdentityMatrix.h:243
Element ValueType
Type of the underlying pointers.
Definition IdentityMatrix.h:250
ValueIndexPair< Type > Element
Element type of the identity matrix.
Definition IdentityMatrix.h:247
IteratorCategory iterator_category
The iterator category.
Definition IdentityMatrix.h:256
constexpr size_t index() const noexcept
Access to the current index of the sparse element.
Definition IdentityMatrix.h:339
constexpr ConstIterator() noexcept
Default constructor for the ConstIterator class.
Definition IdentityMatrix.h:266
constexpr DifferenceType operator-(const ConstIterator &rhs) const noexcept
Calculating the number of elements between two ConstIterator objects.
Definition IdentityMatrix.h:372
constexpr ConstIterator(size_t index) noexcept
Constructor for the ConstIterator class.
Definition IdentityMatrix.h:276
constexpr const Element operator*() const noexcept
Direct access to the sparse matrix element at the current iterator position.
Definition IdentityMatrix.h:309
constexpr ConstIterator operator++(int) noexcept
Post-increment operator.
Definition IdentityMatrix.h:297
constexpr ConstIterator & operator++() noexcept
Pre-increment operator.
Definition IdentityMatrix.h:286
std::forward_iterator_tag IteratorCategory
The iterator category.
Definition IdentityMatrix.h:249
ValueType * PointerType
Pointer return type.
Definition IdentityMatrix.h:251
ReferenceType reference
Reference return type.
Definition IdentityMatrix.h:259
constexpr bool operator!=(const ConstIterator &rhs) const noexcept
Inequality comparison between two ConstIterator objects.
Definition IdentityMatrix.h:361
ValueType value_type
Type of the underlying pointers.
Definition IdentityMatrix.h:257
constexpr const ConstIterator * operator->() const noexcept
Direct access to the sparse matrix element at the current iterator position.
Definition IdentityMatrix.h:319
DifferenceType difference_type
Difference between two iterators.
Definition IdentityMatrix.h:260
ValueType & ReferenceType
Reference return type.
Definition IdentityMatrix.h:252
constexpr Type value() const noexcept
Access to the current value of the sparse element.
Definition IdentityMatrix.h:329
size_t index_
Index to the current identity matrix element.
Definition IdentityMatrix.h:379
constexpr bool operator==(const ConstIterator &rhs) const noexcept
Equality comparison between two ConstIterator objects.
Definition IdentityMatrix.h:350
PointerType pointer
Pointer return type.
Definition IdentityMatrix.h:258
ptrdiff_t DifferenceType
Difference between two iterators.
Definition IdentityMatrix.h:253
Efficient implementation of an identity matrix.
Definition IdentityMatrix.h:197
constexpr IdentityMatrix & transpose() noexcept
bool isAliased(const Other *alias) const noexcept
ConstIterator find(size_t i, size_t j) const
constexpr ConstIterator cend(size_t i) const noexcept
constexpr ConstIterator begin(size_t i) const noexcept
IdentityMatrix< Type,!SO, Tag > TransposeType
Definition IdentityMatrix.h:210
constexpr size_t capacity() const noexcept
const Type ReturnType
Definition IdentityMatrix.h:214
ConstIterator lowerBound(size_t i, size_t j) const
bool canAlias(const Other *alias) const noexcept
constexpr size_t columns() const noexcept
const This & CompositeType
Definition IdentityMatrix.h:215
constexpr ConstIterator cbegin(size_t i) const noexcept
ConstIterator Iterator
Definition IdentityMatrix.h:385
constexpr void swap(IdentityMatrix &m) noexcept
ConstReference at(size_t i, size_t j) const
const Type ConstReference
Definition IdentityMatrix.h:217
IdentityMatrix< Type,!SO, Tag > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition IdentityMatrix.h:207
const Type Reference
Definition IdentityMatrix.h:216
static constexpr bool smpAssignable
Definition IdentityMatrix.h:393
size_t n_
Definition IdentityMatrix.h:486
constexpr void resize(size_t n) noexcept
Expression< SparseMatrix< This, SO > > BaseType
Base type of this IdentityMatrix instance.
Definition IdentityMatrix.h:201
IdentityMatrix< Type, SO, Tag > This
Type of this IdentityMatrix instance.
Definition IdentityMatrix.h:200
Type ElementType
Definition IdentityMatrix.h:212
constexpr IdentityMatrix & ctranspose() noexcept
Tag TagType
Definition IdentityMatrix.h:213
constexpr size_t nonZeros() const noexcept
constexpr ConstReference operator()(size_t i, size_t j) const noexcept
2D-access to the identity matrix elements.
Definition IdentityMatrix.h:585
ConstIterator upperBound(size_t i, size_t j) const
constexpr ConstIterator end(size_t i) const noexcept
constexpr size_t rows() const noexcept
bool canSMPAssign() const noexcept
constexpr void clear() noexcept
constexpr IdentityMatrix() noexcept
The default constructor for IdentityMatrix.
Definition IdentityMatrix.h:517
Base class for matrices.
Definition Matrix.h:85
Index-value-pair for sparse vectors and matrices.
Definition ValueIndexPair.h:75
Pointer difference type of the Blaze library.
Header file for the DenseMatrix base class.
Header file for the DenseVector base class.
Header file for the Expression base class.
Header file for the SparseMatrix base class.
Header file for the SparseVector base class.
#define BLAZE_CONSTRAINT_MUST_NOT_BE_VOLATILE(T)
Constraint on the data type.
Definition Volatile.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_POINTER_TYPE(T)
Constraint on the data type.
Definition Pointer.h:79
#define BLAZE_CONSTRAINT_MUST_NOT_BE_CONST(T)
Constraint on the data type.
Definition Const.h:79
#define BLAZE_CONSTRAINT_MUST_BE_SAME_TAG(A, B)
Data type constraint.
Definition SameTag.h:68
#define BLAZE_CONSTRAINT_MUST_NOT_BE_REFERENCE_TYPE(T)
Constraint on the data type.
Definition Reference.h:79
bool isIdentity(const DenseMatrix< MT, SO > &dm)
Checks if the given dense matrix is an identity matrix.
Definition DenseMatrix.h:2561
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
IdentityMatrix< ElementType_t< MT >, SO > declid(const Matrix< MT, SO > &m)
Declares the given matrix expression m as identity matrix.
Definition IdentityMatrix.h:1285
#define BLAZE_CONSTRAINT_MUST_BE_SCALAR_TYPE(T)
Constraint on the data type.
Definition Scalar.h:61
typename AddTrait< T1, T2 >::Type AddTrait_t
Auxiliary alias declaration for the AddTrait class template.
Definition AddTrait.h:163
typename MapTrait< Args... >::Type MapTrait_t
Auxiliary alias declaration for the MapTrait class template.
Definition MapTrait.h:131
typename MultTrait< T1, T2 >::Type MultTrait_t
Auxiliary alias declaration for the MultTrait class template.
Definition MultTrait.h:165
constexpr bool YieldsIdentity_v
Auxiliary variable template for the YieldsIdentity type trait.
Definition YieldsIdentity.h:126
constexpr bool IsUniUpper_v
Auxiliary variable template for the IsUniUpper type trait.
Definition IsUniUpper.h:173
constexpr bool StorageOrder_v
Auxiliary variable template for the StorageOrder type trait.
Definition StorageOrder.h:93
constexpr bool IsZero_v
Auxiliary variable template for the IsZero type trait.
Definition IsZero.h:166
constexpr bool IsMatrix_v
Auxiliary variable template for the IsMatrix type trait.
Definition IsMatrix.h:124
constexpr bool IsSparseMatrix_v
Auxiliary variable template for the IsSparseMatrix type trait.
Definition IsSparseMatrix.h:124
constexpr bool IsIdentity_v
Auxiliary variable template for the IsIdentity type trait.
Definition IsIdentity.h:137
constexpr bool IsSMPAssignable_v
Auxiliary variable template for the IsSMPAssignable type trait.
Definition IsSMPAssignable.h:132
constexpr bool IsDenseMatrix_v
Auxiliary variable template for the IsDenseMatrix type trait.
Definition IsDenseMatrix.h:124
constexpr bool IsUniTriangular_v
Auxiliary variable template for the IsUniTriangular type trait.
Definition IsUniTriangular.h:106
constexpr bool IsUniLower_v
Auxiliary variable template for the IsUniLower type trait.
Definition IsUniLower.h:173
RelaxationFlag
Relaxation flag for strict or relaxed semantics.
Definition RelaxationFlag.h:66
bool isSquare(const Matrix< MT, SO > &matrix) noexcept
Checks if the given matrix is a square matrix.
Definition Matrix.h:1383
#define BLAZE_USER_ASSERT(expr, msg)
Run time assertion macro for user checks.
Definition Assert.h:117
constexpr void MAYBE_UNUSED(const Args &...)
Suppression of unused parameter warnings.
Definition MaybeUnused.h:81
typename EnableIf< Condition, T >::Type EnableIf_t
Auxiliary type for the EnableIf class template.
Definition EnableIf.h:138
BoolConstant< true > TrueType
Type traits base class.
Definition IntegralConstant.h:132
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition Exception.h:331
#define BLAZE_THROW_INVALID_ARGUMENT(MESSAGE)
Macro for the emission of a std::invalid_argument exception.
Definition Exception.h:235
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition FunctionTrace.h:94
Header file for the exception macros of the math module.
Header file for all forward declarations of the math module.
Header file for all forward declarations for sparse vectors and matrices.
Header file for the StorageOrder type trait.
Base template for the DeclDiagTrait class.
Definition DeclDiagTrait.h:127
Base template for the DeclHermTrait class.
Definition DeclHermTrait.h:126
Base template for the DeclLowTrait class.
Definition DeclLowTrait.h:126
Base template for the DeclStrLowTrait class.
Definition DeclStrLowTrait.h:128
Base template for the DeclStrUppTrait class.
Definition DeclStrUppTrait.h:128
Base template for the DeclSymTrait class.
Definition DeclSymTrait.h:126
Base template for the DeclUniLowTrait class.
Definition DeclUniLowTrait.h:128
Base template for the DeclUniUppTrait class.
Definition DeclUniUppTrait.h:128
Base template for the DeclUppTrait class.
Definition DeclUppTrait.h:126
Base class for all expression templates.
Definition Expression.h:60
Base template for the HighType type trait.
Definition HighType.h:322
Rebind mechanism to obtain an IdentityMatrix with different data/element type.
Definition IdentityMatrix.h:224
IdentityMatrix< NewType, SO, Tag > Other
The type of the other IdentityMatrix.
Definition IdentityMatrix.h:225
Resize mechanism to obtain a IdentityMatrix with different fixed dimensions.
Definition IdentityMatrix.h:234
IdentityMatrix< Type, SO, Tag > Other
The type of the other IdentityMatrix.
Definition IdentityMatrix.h:235
Compile time check for Hermitian matrices.
Definition IsHermitian.h:115
Compile time check for symmetric matrices.
Definition IsSymmetric.h:115
Compile time check for lower unitriangular matrices.
Definition IsUniLower.h:116
Compile time check for upper unitriangular matrices.
Definition IsUniUpper.h:116
Base template for the LowType type trait.
Definition LowType.h:322
Header file for the IsZero type trait.
Header file for basic type definitions.