Blaze  3.6
TSMatTSMatKronExpr.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_EXPRESSIONS_TSMATTSMATKRONEXPR_H_
36 #define _BLAZE_MATH_EXPRESSIONS_TSMATTSMATKRONEXPR_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <utility>
44 #include <blaze/math/Aliases.h>
51 #include <blaze/math/Exception.h>
55 #include <blaze/math/shims/Reset.h>
62 #include <blaze/util/Assert.h>
63 #include <blaze/util/DisableIf.h>
64 #include <blaze/util/EnableIf.h>
66 #include <blaze/util/mpl/If.h>
67 #include <blaze/util/Types.h>
68 
69 
70 namespace blaze {
71 
72 //=================================================================================================
73 //
74 // CLASS TSMATTSMATKRONEXPR
75 //
76 //=================================================================================================
77 
78 //*************************************************************************************************
85 template< typename MT1 // Type of the left-hand side sparse matrix
86  , typename MT2 > // Type of the right-hand side sparse matrix
87 class TSMatTSMatKronExpr
88  : public MatMatKronExpr< SparseMatrix< TSMatTSMatKronExpr<MT1,MT2>, true > >
89  , private Computation
90 {
91  private:
92  //**Type definitions****************************************************************************
99  //**********************************************************************************************
100 
101  //**Return type evaluation**********************************************************************
103 
108  static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
109 
111  using ExprReturnType = decltype( std::declval<RN1>() * std::declval<RN2>() );
112  //**********************************************************************************************
113 
114  public:
115  //**Type definitions****************************************************************************
122 
125 
127  using CompositeType = const ResultType;
128 
130  using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
131 
133  using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
134  //**********************************************************************************************
135 
136  //**Compilation flags***************************************************************************
138  static constexpr bool smpAssignable = false;
139  //**********************************************************************************************
140 
141  //**Constructor*********************************************************************************
147  explicit inline TSMatTSMatKronExpr( const MT1& lhs, const MT2& rhs ) noexcept
148  : lhs_( lhs ) // Left-hand side sparse matrix of the Kronecker product expression
149  , rhs_( rhs ) // Right-hand side sparse matrix of the Kronecker product expression
150  {}
151  //**********************************************************************************************
152 
153  //**Access operator*****************************************************************************
160  inline ReturnType operator()( size_t i, size_t j ) const {
161  BLAZE_INTERNAL_ASSERT( i < rows() , "Invalid row access index" );
162  BLAZE_INTERNAL_ASSERT( j < columns(), "Invalid column access index" );
163  return lhs_( i/rhs_.rows(), j/rhs_.columns() ) * rhs_( i%rhs_.rows(), j%rhs_.columns() );
164  }
165  //**********************************************************************************************
166 
167  //**At function*********************************************************************************
175  inline ReturnType at( size_t i, size_t j ) const {
176  if( i >= rows() ) {
177  BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
178  }
179  if( j >= columns() ) {
180  BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
181  }
182  return (*this)(i,j);
183  }
184  //**********************************************************************************************
185 
186  //**Rows function*******************************************************************************
191  inline size_t rows() const noexcept {
192  return lhs_.rows() * rhs_.rows();
193  }
194  //**********************************************************************************************
195 
196  //**Columns function****************************************************************************
201  inline size_t columns() const noexcept {
202  return lhs_.columns() * rhs_.columns();
203  }
204  //**********************************************************************************************
205 
206  //**NonZeros function***************************************************************************
211  inline size_t nonZeros() const {
212  return lhs_.nonZeros() * rhs_.nonZeros();
213  }
214  //**********************************************************************************************
215 
216  //**NonZeros function***************************************************************************
222  inline size_t nonZeros( size_t i ) const {
223  return lhs_.nonZeros( i/rhs_.columns() ) * rhs_.nonZeros( i%rhs_.columns() );
224  }
225  //**********************************************************************************************
226 
227  //**Left operand access*************************************************************************
232  inline LeftOperand leftOperand() const noexcept {
233  return lhs_;
234  }
235  //**********************************************************************************************
236 
237  //**Right operand access************************************************************************
242  inline RightOperand rightOperand() const noexcept {
243  return rhs_;
244  }
245  //**********************************************************************************************
246 
247  //**********************************************************************************************
253  template< typename T >
254  inline bool canAlias( const T* alias ) const noexcept {
255  return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
256  }
257  //**********************************************************************************************
258 
259  //**********************************************************************************************
265  template< typename T >
266  inline bool isAliased( const T* alias ) const noexcept {
267  return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
268  }
269  //**********************************************************************************************
270 
271  private:
272  //**Member variables****************************************************************************
275  //**********************************************************************************************
276 
277  //**Assignment to dense matrices****************************************************************
290  template< typename MT // Type of the target dense matrix
291  , bool SO2 > // Storage order of the target dense matrix
292  friend inline void assign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
293  {
295 
296  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
297  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
298 
299  if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
300  return;
301  }
302 
303  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
304  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
305 
306  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
307  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
308  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
309  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
310 
311  const size_t M( B.rows() );
312  const size_t N( B.columns() );
313 
314  for( size_t j=0UL; j<A.columns(); ++j )
315  for( size_t l=0UL; l<N; ++l )
316  for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
317  for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
318  (~lhs)(aelem->index()*M+belem->index(),j*N+l) = aelem->value() * belem->value();
319  }
321  //**********************************************************************************************
322 
323  //**Assignment to row-major sparse matrices*****************************************************
336  template< typename MT > // Type of the target sparse matrix
337  friend inline void assign( SparseMatrix<MT,false>& lhs, const TSMatTSMatKronExpr& rhs )
338  {
340 
341  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
342  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
343 
344  if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
345  return;
346  }
347 
348  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
349  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
350 
351  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
352  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
353  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
354  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
355 
356  const size_t M( B.rows() );
357  const size_t N( B.columns() );
358 
359  // Counting the number of elements per row in A
360  std::vector<size_t> lnonzeros( A.rows(), 0UL );
361  for( size_t j=0UL; j<A.columns(); ++j ) {
362  const auto end( A.end(j) );
363  for( auto aelem=A.begin(j); aelem!=end; ++aelem ) {
364  ++lnonzeros[aelem->index()];
365  }
366  }
367 
368  // Counting the number of elements per row in B
369  std::vector<size_t> rnonzeros( M, 0UL );
370  for( size_t j=0UL; j<N; ++j ) {
371  const auto end( B.end(j) );
372  for( auto belem=B.begin(j); belem!=end; ++belem ) {
373  ++rnonzeros[belem->index()];
374  }
375  }
376 
377  // Resizing the left-hand side sparse matrix
378  for( size_t i=0UL; i<A.rows(); ++i ) {
379  for( size_t j=0UL; j<M; ++j ) {
380  (~lhs).reserve( i*M+j, lnonzeros[i]*rnonzeros[j] );
381  }
382  }
383 
384  // Performing the Kronecker product
385  for( size_t j=0UL; j<A.columns(); ++j )
386  for( size_t l=0UL; l<N; ++l )
387  for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
388  for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
389  (~lhs).append( aelem->index()*M+belem->index(), j*N+l, aelem->value() * belem->value(), true );
390  }
392  //**********************************************************************************************
393 
394  //**Assignment to column-major sparse matrices**************************************************
407  template< typename MT > // Type of the target sparse matrix
408  friend inline void assign( SparseMatrix<MT,true>& lhs, const TSMatTSMatKronExpr& rhs )
409  {
411 
412  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
413  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
414 
415  if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
416  return;
417  }
418 
419  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
420  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
421 
422  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
423  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
424  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
425  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
426 
427  const size_t M( B.rows() );
428  const size_t N( B.columns() );
429 
430  for( size_t j=0UL; j<A.columns(); ++j ) {
431  for( size_t l=0UL; l<N; ++l ) {
432  for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
433  for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
434  (~lhs).append( aelem->index()*M+belem->index(), j*N+l, aelem->value() * belem->value(), true );
435  (~lhs).finalize( j*N+l );
436  }
437  }
438  }
440  //**********************************************************************************************
441 
442  //**Addition assignment to dense matrices*******************************************************
455  template< typename MT // Type of the target dense matrix
456  , bool SO2 > // Storage order of the target dense matrix
457  friend inline void addAssign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
458  {
460 
461  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
462  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
463 
464  if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
465  return;
466  }
467 
468  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
469  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
470 
471  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
472  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
473  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
474  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
475 
476  const size_t M( B.rows() );
477  const size_t N( B.columns() );
478 
479  for( size_t j=0UL; j<A.columns(); ++j )
480  for( size_t l=0UL; l<N; ++l )
481  for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
482  for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
483  (~lhs)(aelem->index()*M+belem->index(),j*N+l) += aelem->value() * belem->value();
484  }
486  //**********************************************************************************************
487 
488  //**Addition assignment to sparse matrices******************************************************
489  // No special implementation for the addition assignment to sparse matrices.
490  //**********************************************************************************************
491 
492  //**Subtraction assignment to dense matrices****************************************************
505  template< typename MT // Type of the target dense matrix
506  , bool SO2 > // Storage order of the target dense matrix
507  friend inline void subAssign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
508  {
510 
511  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
512  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
513 
514  if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
515  return;
516  }
517 
518  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
519  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
520 
521  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
522  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
523  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
524  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
525 
526  const size_t M( B.rows() );
527  const size_t N( B.columns() );
528 
529  for( size_t j=0UL; j<A.columns(); ++j )
530  for( size_t l=0UL; l<N; ++l )
531  for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
532  for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
533  (~lhs)(aelem->index()*M+belem->index(),j*N+l) -= aelem->value() * belem->value();
534  }
536  //**********************************************************************************************
537 
538  //**Subtraction assignment to sparse matrices***************************************************
539  // No special implementation for the subtraction assignment to sparse matrices.
540  //**********************************************************************************************
541 
542  //**Schur product assignment to dense matrices**************************************************
555  template< typename MT // Type of the target dense matrix
556  , bool SO2 > // Storage order of the target dense matrix
557  friend inline void schurAssign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
558  {
560 
561  BLAZE_INTERNAL_ASSERT( (~lhs).rows() == rhs.rows() , "Invalid number of rows" );
562  BLAZE_INTERNAL_ASSERT( (~lhs).columns() == rhs.columns(), "Invalid number of columns" );
563 
564  if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
565  return;
566  }
567 
568  CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
569  CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
570 
571  BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
572  BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
573  BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
574  BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
575 
576  const size_t M( B.rows() );
577  const size_t N( B.columns() );
578 
579  for( size_t j=0UL; j<A.columns(); ++j ) {
580  for( size_t l=0UL; l<N; ++l )
581  {
582  size_t i( 0UL );
583 
584  for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem ) {
585  for( auto belem=B.begin(l); belem!=B.end(l); ++belem, ++i ) {
586  const size_t index( aelem->index()*M+belem->index() );
587  for( ; i<index; ++i )
588  reset( (~lhs)(i,j*N+l) );
589  (~lhs)(i,j*N+l) *= aelem->value() * belem->value();
590  }
591  }
592 
593  for( ; i<(~lhs).rows(); ++i )
594  reset( (~lhs)(i,j*N+l) );
595  }
596  }
597  }
599  //**********************************************************************************************
600 
601  //**Schur product assignment to sparse matrices*************************************************
602  // No special implementation for the Schur product assignment to sparse matrices.
603  //**********************************************************************************************
604 
605  //**Multiplication assignment to dense matrices*************************************************
606  // No special implementation for the multiplication assignment to dense matrices.
607  //**********************************************************************************************
608 
609  //**Multiplication assignment to sparse matrices************************************************
610  // No special implementation for the multiplication assignment to sparse matrices.
611  //**********************************************************************************************
612 
613  //**Compile time checks*************************************************************************
623  //**********************************************************************************************
624 };
625 //*************************************************************************************************
626 
627 
628 
629 
630 //=================================================================================================
631 //
632 // GLOBAL FUNCTIONS
633 //
634 //=================================================================================================
635 
636 //*************************************************************************************************
649 template< typename MT1 // Type of the left-hand side sparse matrix
650  , typename MT2 // Type of the right-hand side sparse matrix
651  , DisableIf_t< ( IsIdentity_v<MT1> && IsIdentity_v<MT2> ) ||
652  ( IsZero_v<MT1> || IsZero_v<MT2> ) >* = nullptr >
653 inline const TSMatTSMatKronExpr<MT1,MT2>
654  tsmattsmatkron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
655 {
657 
658  return TSMatTSMatKronExpr<MT1,MT2>( ~lhs, ~rhs );
659 }
661 //*************************************************************************************************
662 
663 
664 //*************************************************************************************************
677 template< typename MT1 // Type of the left-hand side sparse matrix
678  , typename MT2 // Type of the right-hand side sparse matrix
679  , EnableIf_t< IsIdentity_v<MT1> && IsIdentity_v<MT2> >* = nullptr >
680 inline decltype(auto)
681  tsmattsmatkron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
682 {
684 
685  using ReturnType = const KronTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
686 
689 
690  return ReturnType( (~lhs).rows()*(~rhs).rows() );
691 }
693 //*************************************************************************************************
694 
695 
696 //*************************************************************************************************
709 template< typename MT1 // Type of the left-hand side sparse matrix
710  , typename MT2 // Type of the right-hand side sparse matrix
711  , EnableIf_t< IsZero_v<MT1> || IsZero_v<MT2> >* = nullptr >
712 inline decltype(auto)
713  tsmattsmatkron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
714 {
716 
717  using ReturnType = const KronTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
718 
721 
722  return ReturnType( (~lhs).rows()*(~rhs).rows(), (~lhs).columns()*(~rhs).columns() );
723 }
725 //*************************************************************************************************
726 
727 
728 //*************************************************************************************************
751 template< typename MT1 // Type of the left-hand side sparse matrix
752  , typename MT2 > // Type of the right-hand side sparse matrix
753 inline decltype(auto)
754  kron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
755 {
757 
758  return tsmattsmatkron( ~lhs, ~rhs );
759 }
760 //*************************************************************************************************
761 
762 } // namespace blaze
763 
764 #endif
Constraint on the data type.
ReturnType_t< MT2 > RN2
Return type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:96
Header file for auxiliary alias declarations.
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: TSMatTSMatKronExpr.h:232
#define BLAZE_CONSTRAINT_MUST_BE_IDENTITY_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not an identity matrix type,...
Definition: Identity.h:60
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:130
Header file for basic type definitions.
typename If< Condition, T1, T2 >::Type If_t
Auxiliary alias template for the If class template.The If_t alias template provides a convenient shor...
Definition: If.h:109
Expression object for transpose sparse matrix-transpose sparse matrix Kronecker product....
Definition: Forward.h:190
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.The ResultType_t alias declaration provides ...
Definition: Aliases.h:390
Header file for the serial shim.
RightOperand rhs_
Right-hand side sparse matrix of the Kronecker product expression.
Definition: TSMatTSMatKronExpr.h:274
void reset(const DiagonalProxy< MT > &proxy)
Resetting the represented element to the default initial values.
Definition: DiagonalProxy.h:595
Constraint on the data type.
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:119
Header file for the IsIdentity type trait.
Header file for the Computation base class.
Header file for the reset shim.
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.The ReturnType_t alias declaration provides ...
Definition: Aliases.h:410
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TSMatTSMatKronExpr.h:242
decltype(auto) kron(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the Kronecker product of two dense matrices ( ).
Definition: DMatDMatKronExpr.h:954
constexpr size_t columns(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of columns of the matrix.
Definition: Matrix.h:514
Header file for the MatMatKronExpr base class.
Base class for dense matrices.The DenseMatrix class is a base class for all dense matrix classes....
Definition: DenseMatrix.h:81
Base class for sparse matrices.The SparseMatrix class is a base class for all sparse matrix classes....
Definition: Forward.h:145
ReturnType_t< MT1 > RN1
Return type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:95
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.The ElementType_t alias declaration provide...
Definition: Aliases.h:170
Header file for the SparseMatrix base class.
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: TSMatTSMatKronExpr.h:222
Constraint on the data type.
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:120
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatTSMatKronExpr.h:191
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatTSMatKronExpr.h:254
Header file for the DisableIf class template.
Header file for the IsTemporary type trait class.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
Header file for the If class template.
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatTSMatKronExpr.h:201
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a column-major dense or sparse matri...
Definition: ColumnMajorMatrix.h:61
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatTSMatKronExpr.h:160
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is not a zero vector or matrix type,...
Definition: Zero.h:61
typename KronTrait< T1, T2 >::Type KronTrait_t
Auxiliary alias declaration for the KronTrait class template.The KronTrait_t alias declaration provid...
Definition: KronTrait.h:163
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:93
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatTSMatKronExpr.h:138
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.This macro encapsulates the default way of Bl...
Definition: Exception.h:331
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:133
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatTSMatKronExpr.h:127
Header file for the Kron product trait.
Constraints on the storage order of matrix types.
Header file for the exception macros of the math module.
Constraint on the data type.
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:438
Header file for the EnableIf class template.
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:94
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.The OppositeType_t alias declaration provi...
Definition: Aliases.h:270
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatTSMatKronExpr.h:266
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatTSMatKronExpr.h:211
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:97
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.The TransposeType_t alias declaration pro...
Definition: Aliases.h:470
Header file for run time assertion macros.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.The CompositeType_t alias declaration pro...
Definition: Aliases.h:90
KronTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:118
TSMatTSMatKronExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatTSMatKronExpr class.
Definition: TSMatTSMatKronExpr.h:147
Header file for the IsZero type trait.
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: TSMatTSMatKronExpr.h:111
#define BLAZE_FUNCTION_TRACE
Function trace macro.This macro can be used to reliably trace function calls. In case function tracin...
Definition: FunctionTrace.h:94
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatTSMatKronExpr.h:121
LeftOperand lhs_
Left-hand side sparse matrix of the Kronecker product expression.
Definition: TSMatTSMatKronExpr.h:273
Constraints on the storage order of matrix types.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:808
constexpr size_t rows(const Matrix< MT, SO > &matrix) noexcept
Returns the current number of rows of the matrix.
Definition: Matrix.h:498
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatTSMatKronExpr.h:175
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: TSMatTSMatKronExpr.h:108
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATKRONEXPR(T1, T2)
Constraint on the data type.In case the given data types T1 and T2 do not form a valid matrix/matrix ...
Definition: MatMatKronExpr.h:102
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:124
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:98
typename DisableIf< Condition, T >::Type DisableIf_t
Auxiliary type for the DisableIf class template.The DisableIf_t alias declaration provides a convenie...
Definition: DisableIf.h:138
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.In case the given data type T is a zero vector or matrix type,...
Definition: Zero.h:81
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.In case of an invalid run time expression,...
Definition: Assert.h:101
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.In case the given data type T is not a sparse, N-dimensional matrix type,...
Definition: SparseMatrix.h:61
Header file for the IsExpression type trait class.
Header file for the function trace functionality.