Blaze 3.9
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>
62#include <blaze/util/Assert.h>
63#include <blaze/util/EnableIf.h>
65#include <blaze/util/mpl/If.h>
66#include <blaze/util/Types.h>
67
68
69namespace blaze {
70
71//=================================================================================================
72//
73// CLASS TSMATTSMATKRONEXPR
74//
75//=================================================================================================
76
77//*************************************************************************************************
84template< typename MT1 // Type of the left-hand side sparse matrix
85 , typename MT2 > // Type of the right-hand side sparse matrix
87 : public MatMatKronExpr< SparseMatrix< TSMatTSMatKronExpr<MT1,MT2>, true > >
88 , private Computation
89{
90 private:
91 //**Type definitions****************************************************************************
98 //**********************************************************************************************
99
100 //**Return type evaluation**********************************************************************
102
107 static constexpr bool returnExpr = ( !IsTemporary_v<RN1> && !IsTemporary_v<RN2> );
108
110 using ExprReturnType = decltype( std::declval<RN1>() * std::declval<RN2>() );
111 //**********************************************************************************************
112
113 public:
114 //**Type definitions****************************************************************************
117
120
125
128
131
133 using LeftOperand = If_t< IsExpression_v<MT1>, const MT1, const MT1& >;
134
136 using RightOperand = If_t< IsExpression_v<MT2>, const MT2, const MT2& >;
137 //**********************************************************************************************
138
139 //**Compilation flags***************************************************************************
141 static constexpr bool smpAssignable = false;
142 //**********************************************************************************************
143
144 //**Constructor*********************************************************************************
150 inline TSMatTSMatKronExpr( const MT1& lhs, const MT2& rhs ) noexcept
151 : lhs_( lhs ) // Left-hand side sparse matrix of the Kronecker product expression
152 , rhs_( rhs ) // Right-hand side sparse matrix of the Kronecker product expression
153 {}
154 //**********************************************************************************************
155
156 //**Access operator*****************************************************************************
163 inline ReturnType operator()( size_t i, size_t j ) const {
164 BLAZE_INTERNAL_ASSERT( i < rows() , "Invalid row access index" );
165 BLAZE_INTERNAL_ASSERT( j < columns(), "Invalid column access index" );
166 return lhs_( i/rhs_.rows(), j/rhs_.columns() ) * rhs_( i%rhs_.rows(), j%rhs_.columns() );
167 }
168 //**********************************************************************************************
169
170 //**At function*********************************************************************************
178 inline ReturnType at( size_t i, size_t j ) const {
179 if( i >= rows() ) {
180 BLAZE_THROW_OUT_OF_RANGE( "Invalid row access index" );
181 }
182 if( j >= columns() ) {
183 BLAZE_THROW_OUT_OF_RANGE( "Invalid column access index" );
184 }
185 return (*this)(i,j);
186 }
187 //**********************************************************************************************
188
189 //**Rows function*******************************************************************************
194 inline size_t rows() const noexcept {
195 return lhs_.rows() * rhs_.rows();
196 }
197 //**********************************************************************************************
198
199 //**Columns function****************************************************************************
204 inline size_t columns() const noexcept {
205 return lhs_.columns() * rhs_.columns();
206 }
207 //**********************************************************************************************
208
209 //**NonZeros function***************************************************************************
214 inline size_t nonZeros() const {
215 return lhs_.nonZeros() * rhs_.nonZeros();
216 }
217 //**********************************************************************************************
218
219 //**NonZeros function***************************************************************************
225 inline size_t nonZeros( size_t i ) const {
226 return lhs_.nonZeros( i/rhs_.columns() ) * rhs_.nonZeros( i%rhs_.columns() );
227 }
228 //**********************************************************************************************
229
230 //**Left operand access*************************************************************************
235 inline LeftOperand leftOperand() const noexcept {
236 return lhs_;
237 }
238 //**********************************************************************************************
239
240 //**Right operand access************************************************************************
245 inline RightOperand rightOperand() const noexcept {
246 return rhs_;
247 }
248 //**********************************************************************************************
249
250 //**********************************************************************************************
256 template< typename T >
257 inline bool canAlias( const T* alias ) const noexcept {
258 return ( lhs_.canAlias( alias ) || rhs_.canAlias( alias ) );
259 }
260 //**********************************************************************************************
261
262 //**********************************************************************************************
268 template< typename T >
269 inline bool isAliased( const T* alias ) const noexcept {
270 return ( lhs_.isAliased( alias ) || rhs_.isAliased( alias ) );
271 }
272 //**********************************************************************************************
273
274 private:
275 //**Member variables****************************************************************************
278 //**********************************************************************************************
279
280 //**Assignment to dense matrices****************************************************************
293 template< typename MT // Type of the target dense matrix
294 , bool SO2 > // Storage order of the target dense matrix
295 friend inline void assign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
296 {
298
299 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
300 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
301
302 if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
303 return;
304 }
305
306 CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
307 CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
308
309 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
310 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
311 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
312 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
313
314 const size_t M( B.rows() );
315 const size_t N( B.columns() );
316
317 for( size_t j=0UL; j<A.columns(); ++j )
318 for( size_t l=0UL; l<N; ++l )
319 for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
320 for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
321 (*lhs)(aelem->index()*M+belem->index(),j*N+l) = aelem->value() * belem->value();
322 }
324 //**********************************************************************************************
325
326 //**Assignment to row-major sparse matrices*****************************************************
339 template< typename MT > // Type of the target sparse matrix
340 friend inline void assign( SparseMatrix<MT,false>& lhs, const TSMatTSMatKronExpr& rhs )
341 {
343
344 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
345 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
346
347 if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
348 return;
349 }
350
351 CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
352 CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
353
354 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
355 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
356 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
357 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
358
359 const size_t M( B.rows() );
360 const size_t N( B.columns() );
361
362 // Counting the number of elements per row in A
363 std::vector<size_t> lnonzeros( A.rows(), 0UL );
364 for( size_t j=0UL; j<A.columns(); ++j ) {
365 const auto end( A.end(j) );
366 for( auto aelem=A.begin(j); aelem!=end; ++aelem ) {
367 ++lnonzeros[aelem->index()];
368 }
369 }
370
371 // Counting the number of elements per row in B
372 std::vector<size_t> rnonzeros( M, 0UL );
373 for( size_t j=0UL; j<N; ++j ) {
374 const auto end( B.end(j) );
375 for( auto belem=B.begin(j); belem!=end; ++belem ) {
376 ++rnonzeros[belem->index()];
377 }
378 }
379
380 // Resizing the left-hand side sparse matrix
381 for( size_t i=0UL; i<A.rows(); ++i ) {
382 for( size_t j=0UL; j<M; ++j ) {
383 (*lhs).reserve( i*M+j, lnonzeros[i]*rnonzeros[j] );
384 }
385 }
386
387 // Performing the Kronecker product
388 for( size_t j=0UL; j<A.columns(); ++j )
389 for( size_t l=0UL; l<N; ++l )
390 for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
391 for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
392 (*lhs).append( aelem->index()*M+belem->index(), j*N+l, aelem->value() * belem->value(), true );
393 }
395 //**********************************************************************************************
396
397 //**Assignment to column-major sparse matrices**************************************************
410 template< typename MT > // Type of the target sparse matrix
411 friend inline void assign( SparseMatrix<MT,true>& lhs, const TSMatTSMatKronExpr& rhs )
412 {
414
415 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
416 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
417
418 if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
419 return;
420 }
421
422 CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
423 CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
424
425 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
426 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
427 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
428 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
429
430 const size_t M( B.rows() );
431 const size_t N( B.columns() );
432
433 for( size_t j=0UL; j<A.columns(); ++j ) {
434 for( size_t l=0UL; l<N; ++l ) {
435 for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
436 for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
437 (*lhs).append( aelem->index()*M+belem->index(), j*N+l, aelem->value() * belem->value(), true );
438 (*lhs).finalize( j*N+l );
439 }
440 }
441 }
443 //**********************************************************************************************
444
445 //**Addition assignment to dense matrices*******************************************************
458 template< typename MT // Type of the target dense matrix
459 , bool SO2 > // Storage order of the target dense matrix
460 friend inline void addAssign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
461 {
463
464 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
465 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
466
467 if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
468 return;
469 }
470
471 CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
472 CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
473
474 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
475 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
476 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
477 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
478
479 const size_t M( B.rows() );
480 const size_t N( B.columns() );
481
482 for( size_t j=0UL; j<A.columns(); ++j )
483 for( size_t l=0UL; l<N; ++l )
484 for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
485 for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
486 (*lhs)(aelem->index()*M+belem->index(),j*N+l) += aelem->value() * belem->value();
487 }
489 //**********************************************************************************************
490
491 //**Addition assignment to sparse matrices******************************************************
492 // No special implementation for the addition assignment to sparse matrices.
493 //**********************************************************************************************
494
495 //**Subtraction assignment to dense matrices****************************************************
508 template< typename MT // Type of the target dense matrix
509 , bool SO2 > // Storage order of the target dense matrix
510 friend inline void subAssign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
511 {
513
514 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
515 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
516
517 if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
518 return;
519 }
520
521 CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
522 CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
523
524 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
525 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
526 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
527 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
528
529 const size_t M( B.rows() );
530 const size_t N( B.columns() );
531
532 for( size_t j=0UL; j<A.columns(); ++j )
533 for( size_t l=0UL; l<N; ++l )
534 for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem )
535 for( auto belem=B.begin(l); belem!=B.end(l); ++belem )
536 (*lhs)(aelem->index()*M+belem->index(),j*N+l) -= aelem->value() * belem->value();
537 }
539 //**********************************************************************************************
540
541 //**Subtraction assignment to sparse matrices***************************************************
542 // No special implementation for the subtraction assignment to sparse matrices.
543 //**********************************************************************************************
544
545 //**Schur product assignment to dense matrices**************************************************
558 template< typename MT // Type of the target dense matrix
559 , bool SO2 > // Storage order of the target dense matrix
560 friend inline void schurAssign( DenseMatrix<MT,SO2>& lhs, const TSMatTSMatKronExpr& rhs )
561 {
563
564 BLAZE_INTERNAL_ASSERT( (*lhs).rows() == rhs.rows() , "Invalid number of rows" );
565 BLAZE_INTERNAL_ASSERT( (*lhs).columns() == rhs.columns(), "Invalid number of columns" );
566
567 if( rhs.rows() == 0UL || rhs.columns() == 0UL ) {
568 return;
569 }
570
571 CT1 A( serial( rhs.lhs_ ) ); // Evaluation of the left-hand side sparse matrix operand
572 CT2 B( serial( rhs.rhs_ ) ); // Evaluation of the right-hand side sparse matrix operand
573
574 BLAZE_INTERNAL_ASSERT( A.rows() == rhs.lhs_.rows() , "Invalid number of rows" );
575 BLAZE_INTERNAL_ASSERT( A.columns() == rhs.lhs_.columns(), "Invalid number of columns" );
576 BLAZE_INTERNAL_ASSERT( B.rows() == rhs.rhs_.rows() , "Invalid number of rows" );
577 BLAZE_INTERNAL_ASSERT( B.columns() == rhs.rhs_.columns(), "Invalid number of columns" );
578
579 const size_t M( B.rows() );
580 const size_t N( B.columns() );
581
582 for( size_t j=0UL; j<A.columns(); ++j ) {
583 for( size_t l=0UL; l<N; ++l )
584 {
585 size_t i( 0UL );
586
587 for( auto aelem=A.begin(j); aelem!=A.end(j); ++aelem ) {
588 for( auto belem=B.begin(l); belem!=B.end(l); ++belem, ++i ) {
589 const size_t index( aelem->index()*M+belem->index() );
590 for( ; i<index; ++i )
591 reset( (*lhs)(i,j*N+l) );
592 (*lhs)(i,j*N+l) *= aelem->value() * belem->value();
593 }
594 }
595
596 for( ; i<(*lhs).rows(); ++i )
597 reset( (*lhs)(i,j*N+l) );
598 }
599 }
600 }
602 //**********************************************************************************************
603
604 //**Schur product assignment to sparse matrices*************************************************
605 // No special implementation for the Schur product assignment to sparse matrices.
606 //**********************************************************************************************
607
608 //**Multiplication assignment to dense matrices*************************************************
609 // No special implementation for the multiplication assignment to dense matrices.
610 //**********************************************************************************************
611
612 //**Multiplication assignment to sparse matrices************************************************
613 // No special implementation for the multiplication assignment to sparse matrices.
614 //**********************************************************************************************
615
616 //**Compile time checks*************************************************************************
626 //**********************************************************************************************
627};
628//*************************************************************************************************
629
630
631
632
633//=================================================================================================
634//
635// GLOBAL FUNCTIONS
636//
637//=================================================================================================
638
639//*************************************************************************************************
652template< typename MT1 // Type of the left-hand side sparse matrix
653 , typename MT2 // Type of the right-hand side sparse matrix
654 , DisableIf_t< ( IsIdentity_v<MT1> && IsIdentity_v<MT2> ) ||
655 ( IsZero_v<MT1> || IsZero_v<MT2> ) >* = nullptr >
656inline const TSMatTSMatKronExpr<MT1,MT2>
657 tsmattsmatkron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
658{
660
661 return TSMatTSMatKronExpr<MT1,MT2>( *lhs, *rhs );
662}
664//*************************************************************************************************
665
666
667//*************************************************************************************************
680template< typename MT1 // Type of the left-hand side sparse matrix
681 , typename MT2 // Type of the right-hand side sparse matrix
682 , EnableIf_t< IsIdentity_v<MT1> && IsIdentity_v<MT2> >* = nullptr >
683inline decltype(auto)
684 tsmattsmatkron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
685{
687
688 using ReturnType = const KronTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
689
692
693 return ReturnType( (*lhs).rows()*(*rhs).rows() );
694}
696//*************************************************************************************************
697
698
699//*************************************************************************************************
712template< typename MT1 // Type of the left-hand side sparse matrix
713 , typename MT2 // Type of the right-hand side sparse matrix
714 , EnableIf_t< IsZero_v<MT1> || IsZero_v<MT2> >* = nullptr >
715inline decltype(auto)
716 tsmattsmatkron( const SparseMatrix<MT1,true>& lhs, const SparseMatrix<MT2,true>& rhs )
717{
719
720 using ReturnType = const KronTrait_t< ResultType_t<MT1>, ResultType_t<MT2> >;
721
724
725 return ReturnType( (*lhs).rows()*(*rhs).rows(), (*lhs).columns()*(*rhs).columns() );
726}
728//*************************************************************************************************
729
730
731//*************************************************************************************************
754template< typename MT1 // Type of the left-hand side sparse matrix
755 , typename MT2 > // Type of the right-hand side sparse matrix
756inline decltype(auto)
758{
760
761 return tsmattsmatkron( *lhs, *rhs );
762}
763//*************************************************************************************************
764
765} // namespace blaze
766
767#endif
Header file for auxiliary alias declarations.
typename T::CompositeType CompositeType_t
Alias declaration for nested CompositeType type definitions.
Definition: Aliases.h:110
typename T::ReturnType ReturnType_t
Alias declaration for nested ReturnType type definitions.
Definition: Aliases.h:470
typename T::ResultType ResultType_t
Alias declaration for nested ResultType type definitions.
Definition: Aliases.h:450
typename T::ElementType ElementType_t
Alias declaration for nested ElementType type definitions.
Definition: Aliases.h:190
typename T::OppositeType OppositeType_t
Alias declaration for nested OppositeType type definitions.
Definition: Aliases.h:310
typename T::TransposeType TransposeType_t
Alias declaration for nested TransposeType type definitions.
Definition: Aliases.h:550
Header file for run time assertion macros.
Constraints on the storage order of matrix types.
Header file for the EnableIf class template.
Header file for the function trace functionality.
Constraint on the data type.
Header file for the If class template.
Header file for the IsExpression type trait class.
Header file for the IsIdentity type trait.
Header file for the IsTemporary type trait class.
Header file for the Kron product trait.
Constraint on the data type.
Base class for dense matrices.
Definition: DenseMatrix.h:82
Base class for sparse matrices.
Definition: SparseMatrix.h:77
Expression object for transpose sparse matrix-transpose sparse matrix Kronecker product.
Definition: TSMatTSMatKronExpr.h:89
ResultType_t< MT1 > RT1
Result type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:92
LeftOperand lhs_
Left-hand side sparse matrix of the Kronecker product expression.
Definition: TSMatTSMatKronExpr.h:276
KronTrait_t< RT1, RT2 > ResultType
Result type for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:121
ReturnType_t< MT2 > RN2
Return type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:95
const ResultType CompositeType
Data type for composite expression templates.
Definition: TSMatTSMatKronExpr.h:130
static constexpr bool smpAssignable
Compilation switch for the expression template assignment strategy.
Definition: TSMatTSMatKronExpr.h:141
decltype(std::declval< RN1 >() *std::declval< RN2 >()) ExprReturnType
Expression return type for the subscript operator.
Definition: TSMatTSMatKronExpr.h:110
ReturnType_t< MT1 > RN1
Return type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:94
LeftOperand leftOperand() const noexcept
Returns the left-hand side sparse matrix operand.
Definition: TSMatTSMatKronExpr.h:235
CompositeType_t< MT1 > CT1
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:96
size_t rows() const noexcept
Returns the current number of rows of the matrix.
Definition: TSMatTSMatKronExpr.h:194
static constexpr bool returnExpr
Compilation switch for the selection of the subscript operator return type.
Definition: TSMatTSMatKronExpr.h:107
const If_t< returnExpr, ExprReturnType, ElementType > ReturnType
Return type for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:127
TransposeType_t< ResultType > TransposeType
Transpose type for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:123
CompositeType_t< MT2 > CT2
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:97
ReturnType at(size_t i, size_t j) const
Checked access to the matrix elements.
Definition: TSMatTSMatKronExpr.h:178
ElementType_t< ResultType > ElementType
Resulting element type.
Definition: TSMatTSMatKronExpr.h:124
bool canAlias(const T *alias) const noexcept
Returns whether the expression can alias with the given address alias.
Definition: TSMatTSMatKronExpr.h:257
TSMatTSMatKronExpr(const MT1 &lhs, const MT2 &rhs) noexcept
Constructor for the TSMatTSMatKronExpr class.
Definition: TSMatTSMatKronExpr.h:150
RightOperand rightOperand() const noexcept
Returns the right-hand side sparse matrix operand.
Definition: TSMatTSMatKronExpr.h:245
If_t< IsExpression_v< MT2 >, const MT2, const MT2 & > RightOperand
Composite type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:136
ReturnType operator()(size_t i, size_t j) const
2D-access to the matrix elements.
Definition: TSMatTSMatKronExpr.h:163
size_t nonZeros() const
Returns the number of non-zero elements in the sparse matrix.
Definition: TSMatTSMatKronExpr.h:214
ResultType_t< MT2 > RT2
Result type of the right-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:93
If_t< IsExpression_v< MT1 >, const MT1, const MT1 & > LeftOperand
Composite type of the left-hand side sparse matrix expression.
Definition: TSMatTSMatKronExpr.h:133
bool isAliased(const T *alias) const noexcept
Returns whether the expression is aliased with the given address alias.
Definition: TSMatTSMatKronExpr.h:269
size_t columns() const noexcept
Returns the current number of columns of the matrix.
Definition: TSMatTSMatKronExpr.h:204
OppositeType_t< ResultType > OppositeType
Result type with opposite storage order for expression template evaluations.
Definition: TSMatTSMatKronExpr.h:122
size_t nonZeros(size_t i) const
Returns the number of non-zero elements in the specified row.
Definition: TSMatTSMatKronExpr.h:225
RightOperand rhs_
Right-hand side sparse matrix of the Kronecker product expression.
Definition: TSMatTSMatKronExpr.h:277
Constraint on the data type.
Constraint on the data type.
Header file for the Computation base class.
Header file for the MatMatKronExpr base class.
Header file for the SparseMatrix base class.
decltype(auto) serial(const DenseMatrix< MT, SO > &dm)
Forces the serial evaluation of the given dense matrix expression dm.
Definition: DMatSerialExpr.h:812
decltype(auto) kron(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the Kronecker product of two dense matrices ( ).
Definition: DMatDMatKronExpr.h:957
#define BLAZE_CONSTRAINT_MUST_NOT_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:81
#define BLAZE_CONSTRAINT_MUST_BE_SPARSE_MATRIX_TYPE(T)
Constraint on the data type.
Definition: SparseMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_FORM_VALID_MATMATKRONEXPR(T1, T2)
Constraint on the data type.
Definition: MatMatKronExpr.h:102
#define BLAZE_CONSTRAINT_MUST_BE_IDENTITY_MATRIX_TYPE(T)
Constraint on the data type.
Definition: Identity.h:60
#define BLAZE_CONSTRAINT_MUST_BE_COLUMN_MAJOR_MATRIX_TYPE(T)
Constraint on the data type.
Definition: ColumnMajorMatrix.h:61
#define BLAZE_CONSTRAINT_MUST_BE_ZERO_TYPE(T)
Constraint on the data type.
Definition: Zero.h:61
typename KronTrait< T1, T2 >::Type KronTrait_t
Auxiliary alias declaration for the KronTrait class template.
Definition: KronTrait.h:137
constexpr void reset(Matrix< MT, SO > &matrix)
Resetting the given matrix.
Definition: Matrix.h:806
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:584
#define BLAZE_INTERNAL_ASSERT(expr, msg)
Run time assertion macro for internal checks.
Definition: Assert.h:101
typename If< Condition >::template Type< T1, T2 > If_t
Auxiliary alias template for the If class template.
Definition: If.h:108
#define BLAZE_THROW_OUT_OF_RANGE(MESSAGE)
Macro for the emission of a std::out_of_range exception.
Definition: Exception.h:331
typename EnableIf<!Condition, T >::Type DisableIf_t
Auxiliary type for the EnableIf class template.
Definition: EnableIf.h:175
#define BLAZE_FUNCTION_TRACE
Function trace macro.
Definition: FunctionTrace.h:94
Header file for the exception macros of the math module.
Constraints on the storage order of matrix types.
Header file for the reset shim.
Header file for the serial shim.
Base class for all compute expression templates.
Definition: Computation.h:68
Base class for all matrix/matrix Kronecker expression templates.
Definition: MatMatKronExpr.h:69
Header file for the IsZero type trait.
Header file for basic type definitions.