BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_BZ_Matrix.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_CL_BZ_MATRIX_HPP
13#define BELFEM_CL_BZ_MATRIX_HPP
14
15#include "typedefs.hpp"
16#include "assert.hpp"
17namespace belfem
18{
26 template< typename T >
27 class Matrix
28 {
29//------------------------------------------------------------------------------
30 public :
31//------------------------------------------------------------------------------
32
33 typedef blaze::DynamicMatrix< T, BLAZE_DEFAULT_STORAGE_ORDER > MatrixType;
34
35//------------------------------------------------------------------------------
36 private :
37//------------------------------------------------------------------------------
38
39 // member class of underlying vector implementation
40 MatrixType mMatrix;
41
42//------------------------------------------------------------------------------
43 public :
44//------------------------------------------------------------------------------
45
49 Matrix() = default;
50
51// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
52
56 Matrix( const size_t aNumRows,
57 const size_t aNumCols ) :
58 mMatrix( aNumRows, aNumCols ) {}
59
60// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
61
65 Matrix( const size_t aNumRows,
66 const size_t aNumCols,
67 const real aValue ) :
68 mMatrix( aNumRows, aNumCols, aValue )
69 {}
70
71// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72
76 Matrix( const std::initializer_list<std::initializer_list<T> > & aInitList )
77 : mMatrix( aInitList )
78 {
79
80 }
81
82// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83
87 Matrix( const MatrixType & aExpression )
88 : mMatrix( aExpression ) {}
89
90// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
91
95 template< typename MT, bool SO >
96 Matrix( const blaze::Matrix< MT, SO > & aExpression )
97 : mMatrix( aExpression ) {}
98
99// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100
104 template< typename VT >
105 Matrix( const blaze::DenseVector< VT, false > & aExpression )
106 {
107 const VT & tVector = static_cast< const VT& >( aExpression );
108 mMatrix.resize( tVector.size(), 1UL, false );
109
110 for ( size_t k = 0; k < tVector.size(); ++k )
111 {
112 mMatrix( k, 0 ) = tVector[ k ];
113 }
114 }
115
116// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
117
121 template< typename VT >
122 Matrix( const blaze::DenseVector< VT, true > & aExpression )
123 {
124 const VT & tVector = static_cast< const VT& >( aExpression );
125 mMatrix.resize( 1UL, tVector.size(), false );
126
127 for ( size_t k = 0; k < tVector.size(); ++k )
128 {
129 mMatrix( 0, k ) = tVector[ k ];
130 }
131 }
132
133//------------------------------------------------------------------------------
134
138 Matrix( const Matrix< T > & aMatrix ) :
139 mMatrix( aMatrix.mMatrix )
140 {}
141
145 Matrix( Matrix< T > && aMatrix ) noexcept :
146 mMatrix( std::move( aMatrix.mMatrix ) )
147 {}
148
149//------------------------------------------------------------------------------
150
154 virtual ~Matrix() = default;
155
156//------------------------------------------------------------------------------
157// MEMORY
158//------------------------------------------------------------------------------
159
160 /*
161 * expose the underlying raw pointer
162 */
163
164 inline T *
166 {
167 return mMatrix.data();
168 }
169
170// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
171
172 /*
173 * expose the underlying raw pointer ( const version )
174 */
175 inline const T *
176 data() const
177 {
178 return mMatrix.data();
179 }
180
181//------------------------------------------------------------------------------
182
183 /*
184 * expose the underlying matrix implementation ( writable version )
185 */
186 inline MatrixType &
188 {
189 return mMatrix;
190 }
191
192// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
193
194 /*
195 * expose the underlying matrix implementation ( const version )
196 */
197 inline const MatrixType &
199 {
200 return mMatrix;
201 }
202
203//------------------------------------------------------------------------------
204// UTILITIES
205//------------------------------------------------------------------------------
206
207 inline void
208 fill( const T & aValue )
209 {
210 mMatrix = aValue;
211 }
212
213//------------------------------------------------------------------------------
214
215 inline void
216 set_size( const size_t aNumRows, const size_t aNumCols )
217 {
218 mMatrix.resize( aNumRows, aNumCols, false );
219 }
220
221// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
222
223 inline void
224 set_size( const size_t aNumRows, const size_t aNumCols, const T & aValue )
225 {
226 this->set_size( aNumRows, aNumCols );
227 this->fill( aValue );
228 }
229
230//------------------------------------------------------------------------------
231// SIZE CHECKS
232//------------------------------------------------------------------------------
233
234 inline size_t
235 n_rows() const
236 {
237 return mMatrix.rows();
238 }
239
240//------------------------------------------------------------------------------
241
242 inline size_t
243 n_cols() const
244 {
245 return mMatrix.columns();
246 }
247
248//------------------------------------------------------------------------------
249
253 inline size_t
254 capacity() const
255 {
256 return mMatrix.capacity();
257 }
258
259//------------------------------------------------------------------------------
260
266 inline size_t
267 spacing() const
268 {
269 return mMatrix.spacing();
270 }
271
272//------------------------------------------------------------------------------
273// OPERATORS
274//------------------------------------------------------------------------------
275
280 operator=( Matrix< T > && aMatrix ) noexcept
281 {
282 if ( this != & aMatrix )
283 {
284 mMatrix = std::move( aMatrix.mMatrix );
285 }
286 return *this;
287 }
288
293 operator=( const Matrix< T > & aMatrix )
294 {
295 if ( this != &aMatrix )
296 {
297 mMatrix = aMatrix.mMatrix;
298 }
299 return *this;
300 }
301
302//------------------------------------------------------------------------------
303
307 inline T &
308 operator()( const size_t aRowIndex, const size_t aColIndex )
309 {
310 BELFEM_ASSERT( aRowIndex< this->n_rows(),
311 "Row index %lu out of bounds, which must be smaller than %lu.",
312 ( long unsigned int ) aRowIndex,
313 ( long unsigned int ) this->n_rows() );
314
315 BELFEM_ASSERT( aColIndex< this->n_cols(),
316 "Col index %lu out of bounds, which must be smaller than %lu.",
317 ( long unsigned int ) aColIndex,
318 ( long unsigned int ) this->n_cols() );
319
320 return mMatrix( aRowIndex, aColIndex );
321 }
322
323// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
324
328 virtual inline const T &
329 operator()( const size_t aRowIndex, const size_t aColIndex ) const
330 {
331 BELFEM_ASSERT( aRowIndex< this->n_rows(),
332 "Row index %lu out of bounds, which must be smaller than %lu.",
333 ( long unsigned int ) aRowIndex,
334 ( long unsigned int ) this->n_rows() );
335
336 BELFEM_ASSERT( aColIndex< this->n_cols(),
337 "Col index %lu out of bounds, which must be smaller than %lu.",
338 ( long unsigned int ) aColIndex,
339 ( long unsigned int ) this->n_cols() );
340
341 return mMatrix( aRowIndex, aColIndex );
342 }
343
344//------------------------------------------------------------------------------
345// Cols and Rows
346//------------------------------------------------------------------------------
347
348 inline auto
349 row( const size_t aRowIndex )
350 ->decltype( blaze::row( mMatrix, aRowIndex ) )
351 {
352 BELFEM_ASSERT( aRowIndex < this->n_rows(),
353 "Row index %lu out of bounds, which must be less than %lu.",
354 ( long unsigned int ) aRowIndex,
355 ( long unsigned int ) this->n_rows() );
356
357 return blaze::row( mMatrix, aRowIndex );
358 }
359
360// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
361
362 inline auto
363 row( const size_t aRowIndex ) const
364 ->decltype( blaze::row( mMatrix, aRowIndex ) )
365 {
366 BELFEM_ASSERT( aRowIndex < this->n_rows(),
367 "Row index %lu out of bounds, which must be less than %lu.",
368 ( long unsigned int ) aRowIndex,
369 ( long unsigned int ) this->n_rows() );
370
371 return blaze::row( mMatrix, aRowIndex );
372 }
373
374//------------------------------------------------------------------------------
375
376 inline auto
377 col( const size_t aColIndex )
378 ->decltype( blaze::column( mMatrix, aColIndex ) )
379 {
380 BELFEM_ASSERT( aColIndex < this->n_cols(),
381 "Col index %lu out of bounds, which must be less than %lu.",
382 ( long unsigned int ) aColIndex,
383 ( long unsigned int ) this->n_cols() );
384
385 return blaze::column( mMatrix, aColIndex );
386 }
387
388// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
389
390 inline auto
391 col( const size_t aColIndex ) const
392 ->decltype( blaze::column( mMatrix, aColIndex ) )
393 {
394 BELFEM_ASSERT( aColIndex < this->n_cols(),
395 "Col index %lu out of bounds, which must be less than %lu.",
396 ( long unsigned int ) aColIndex,
397 ( long unsigned int ) this->n_cols() );
398
399 return blaze::column( mMatrix, aColIndex );
400 }
401
402//------------------------------------------------------------------------------
403
404 inline auto
405 submat( const size_t aFirstRow,
406 const size_t aFirstCol,
407 const size_t aLastRow,
408 const size_t aLastCol )
409 -> decltype( blaze::submatrix( mMatrix, aFirstRow, aFirstCol, aLastRow, aLastCol ) )
410 {
411 BELFEM_ASSERT( aFirstRow < this->n_rows(),
412 "First row index %lu out of bounds, which must be less than %lu.",
413 ( long unsigned int ) aFirstRow,
414 ( long unsigned int ) this->n_rows() );
415
416 BELFEM_ASSERT( aLastRow < this->n_rows(),
417 "Last row index %lu out of bounds, which must be less than %lu.",
418 ( long unsigned int ) aLastRow,
419 ( long unsigned int ) this->n_rows() );
420
421 BELFEM_ASSERT( aFirstCol < this->n_cols(),
422 "First col index %lu out of bounds, which must be less than %lu.",
423 ( long unsigned int ) aFirstCol,
424 ( long unsigned int ) this->n_cols() );
425
426 BELFEM_ASSERT( aLastCol < this->n_cols(),
427 "Last col index %lu out of bounds, which must be less than %lu.",
428 ( long unsigned int ) aLastCol,
429 ( long unsigned int ) this->n_cols() );
430
431 // blaze takes ( row, col, #rows, #cols ); the interface uses the
432 // Armadillo convention of INCLUSIVE last indices
433 return blaze::submatrix( mMatrix, aFirstRow, aFirstCol,
434 aLastRow - aFirstRow + 1, aLastCol - aFirstCol + 1 );
435 }
436
437// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
438
439 inline auto
440 submat( const size_t aFirstRow,
441 const size_t aFirstCol,
442 const size_t aLastRow,
443 const size_t aLastCol ) const
444 -> decltype( blaze::submatrix( mMatrix, aFirstRow, aFirstCol, aLastRow, aLastCol ) )
445 {
446 BELFEM_ASSERT( aFirstRow < this->n_rows(),
447 "First row index %lu out of bounds, which must be less than %lu.",
448 ( long unsigned int ) aFirstRow,
449 ( long unsigned int ) this->n_rows() );
450
451 BELFEM_ASSERT( aLastRow < this->n_rows(),
452 "Last row index %lu out of bounds, which must be less than %lu.",
453 ( long unsigned int ) aLastRow,
454 ( long unsigned int ) this->n_rows() );
455
456 BELFEM_ASSERT( aFirstCol < this->n_cols(),
457 "First col index %lu out of bounds, which must be less than %lu.",
458 ( long unsigned int ) aFirstCol,
459 ( long unsigned int ) this->n_cols() );
460
461 BELFEM_ASSERT( aLastCol < this->n_cols(),
462 "Last col index %lu out of bounds, which must be less than %lu.",
463 ( long unsigned int ) aLastCol,
464 ( long unsigned int ) this->n_cols() );
465
466 // blaze takes ( row, col, #rows, #cols ); the interface uses the
467 // Armadillo convention of INCLUSIVE last indices
468 return blaze::submatrix( mMatrix, aFirstRow, aFirstCol,
469 aLastRow - aFirstRow + 1, aLastCol - aFirstCol + 1 );
470 }
471
472//------------------------------------------------------------------------------
473
474 inline void
475 set_row( const size_t aRowIndex, const Vector <T> & aVector )
476 {
477
478 // make sure that length is correct
479 BELFEM_ASSERT( aVector.length() == this->n_cols(),
480 "Wrong length of vector : %lu ( expect %lu )",
481 ( long unsigned int ) aVector.length(),
482 ( long unsigned int ) this->n_cols() );
483
484 // get pointer to data
485 const T * tSource = aVector.data();
486
487 // manual copy of data
488 for( std::size_t k=0; k<aVector.length(); ++k )
489 {
490 mMatrix( aRowIndex, k ) = tSource[ k ];
491 }
492 }
493
494//------------------------------------------------------------------------------
495
496 template < typename ET >
497 inline void
498 set_row( const size_t aRowIndex, const ET & aExpression )
499 {
500 this->row( aRowIndex ) = aExpression;
501 }
502
503//------------------------------------------------------------------------------
504
505 inline void
506 set_col( const size_t aColIndex, const Vector <T> & aVector )
507 {
508 // make sure that length is correct
509 BELFEM_ASSERT( aVector.length() == this->n_rows(),
510 "Wrong length of vector : %lu ( expect %lu )",
511 ( long unsigned int ) aVector.length(),
512 ( long unsigned int ) this->n_rows() );
513
514 std::copy( aVector.data(), aVector.data() + aVector.length(),
515 this->col( aColIndex ).data() );
516 }
517
518 template < typename ET >
519 inline void
520 set_col( const size_t aRowIndex, const ET & aExpression )
521 {
522 this->col( aRowIndex ) = aExpression;
523 }
524
525//------------------------------------------------------------------------------
526// internal operators
527//------------------------------------------------------------------------------
528
533 operator=( const T & aValue )
534 {
535 this->fill( aValue );
536 return *this;
537 }
538
539// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
540
544 template < typename MT, bool SO >
546 operator=( const blaze::Matrix< MT, SO > & aExpression )
547 {
548 mMatrix = aExpression;
549 return *this;
550 }
551
552// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
553
557 template < typename VT >
559 operator=( const blaze::DenseVector< VT, false > & aExpression )
560 {
561 const VT & tVector = static_cast< const VT& >( aExpression );
562 mMatrix.resize( tVector.size(), 1UL, false );
563
564 for ( size_t k = 0; k < tVector.size(); ++k )
565 {
566 mMatrix( k, 0 ) = tVector[ k ];
567 }
568 return *this;
569 }
570
571// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
572
576 template < typename VT >
578 operator=( const blaze::DenseVector< VT, true > & aExpression )
579 {
580 const VT & tVector = static_cast< const VT& >( aExpression );
581 mMatrix.resize( 1UL, tVector.size(), false );
582
583 for ( size_t k = 0; k < tVector.size(); ++k )
584 {
585 mMatrix( 0, k ) = tVector[ k ];
586 }
587 return *this;
588 }
589
590//------------------------------------------------------------------------------
591// ADD OPERATORS
592//------------------------------------------------------------------------------
593
595 operator+=( const T & aValue )
596 {
597 mMatrix += aValue;
598 return *this;
599 }
600
601// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
602
604 operator+=( const Matrix< T > & aMatrix )
605 {
606 mMatrix += aMatrix.matrix_data();
607 return *this;
608 }
609
610// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
611
612#ifdef BELFEM_GCC
613 template < typename MT, bool SO >
615 operator+=( const blaze::Matrix< MT, SO > & aExpression )
616 {
617 mMatrix += aExpression;
618 return *this;
619 }
620#endif
621
622//------------------------------------------------------------------------------
623// SUBTRACT OPERATORS
624//------------------------------------------------------------------------------
625
627 operator-=( const T & aValue )
628 {
629 mMatrix -= aValue;
630 return *this;
631 }
632
633// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
634
636 operator-=( const Matrix< T > & aMatrix )
637 {
638 mMatrix -= aMatrix.matrix_data();
639 return *this;
640 }
641
642// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
643
644#ifdef BELFEM_GCC
645 template < typename MT, bool SO >
647 operator-=( const blaze::Matrix< MT, SO > & aExpression )
648 {
649 mMatrix -= aExpression;
650 return *this;
651 }
652
653// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
654
656 operator-=( const MatrixType & aExpression )
657 {
658 mMatrix -= aExpression;
659 return *this;
660 }
661#endif
662
663//------------------------------------------------------------------------------
664// MULTIPLY OPERATORS
665//------------------------------------------------------------------------------
666
668 operator*=( const T & aValue )
669 {
670 mMatrix *= aValue;
671 return *this;
672 }
673
674// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
675
677 operator*=( const Matrix< T > & aMatrix )
678 {
679 mMatrix *= aMatrix.matrix_data();
680 return *this;
681 }
682
683// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
684
685#ifdef BELFEM_GCC
686 template < typename MT, bool SO >
688 operator*=( const blaze::Matrix< MT, SO > & aExpression )
689 {
690 mMatrix *= aExpression;
691 return *this;
692 }
693
694// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
695
697 operator*=( const MatrixType & aExpression )
698 {
699 mMatrix *= aExpression;
700 return *this;
701 }
702#endif
703
704//------------------------------------------------------------------------------
705// DIVIDE OPERATORS
706//------------------------------------------------------------------------------
707
709 operator/=( const T & aValue )
710 {
711 mMatrix /= aValue;
712 return *this;
713 }
714
715//------------------------------------------------------------------------------
716// PRINT OPERATION
717//------------------------------------------------------------------------------
718
719 inline void
720 print( const std::string aLabel="Matrix" ) const;
721
722//------------------------------------------------------------------------------
723 };
724//------------------------------------------------------------------------------
725// turn off annoying waning
726#ifdef BELFEM_GCC
727#pragma GCC diagnostic push
728#pragma GCC diagnostic ignored "-Wformat"
729#endif
730 template < typename T > void
731 Matrix< T >::print( const std::string aLabel ) const
732 {
733 FILE * tOutFile = stdout;
734
735 fprintf( tOutFile, "%s = [ ... \n", aLabel.c_str() );
736
737 // get a ref of this
738 const Matrix< T > & tThis = *this;
739
740 uint tRows = tThis.n_rows();
741 uint tCols = tThis.n_cols();
742
743 for( uint i=0; i< tRows; ++i )
744 {
745 for( uint j=0; j< tCols; ++j )
746 {
747 if( j < tCols-1 )
748 {
749 fprintf( tOutFile, "%d, ", ( int ) tThis( i, j ) );
750 }
751 else
752 {
753 fprintf( tOutFile, "%d; ", ( int ) tThis( i, j ) );
754 }
755 }
756
757 if( i < tRows-1 )
758 {
759 fprintf( tOutFile, "...\n" );
760 }
761 else
762 {
763 fprintf( tOutFile, "];\n" );
764 }
765 }
766 }
767
768// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
769
770 template <>
771 inline void
772 Matrix<real>::print( const std::string aLabel ) const
773 {
774 FILE * tOutFile = stdout;
775
776 fprintf( tOutFile, "%s = [ ... \n", aLabel.c_str() );
777
778 const Matrix< real > & tThis = *this;
779
780 uint tRows = tThis.n_rows();
781 uint tCols = tThis.n_cols();
782
783 for( uint i=0; i< tRows; ++i )
784 {
785 for( uint j=0; j< tCols; ++j )
786 {
787 if( j < tCols-1 )
788 {
789 fprintf( tOutFile, "%+.15e, ", ( double ) tThis( i, j ) );
790 }
791 else
792 {
793 fprintf( tOutFile, "%+.15e; ", ( double ) tThis( i, j ) );
794 }
795 }
796
797 if( i < tRows-1 )
798 {
799 fprintf( tOutFile, "...\n" );
800 }
801 else
802 {
803 fprintf( tOutFile, "];\n" );
804 }
805 }
806 }
807
808#ifdef BELFEM_GCC
809#pragma GCC diagnostic pop
810#endif
811}
812#endif //BELFEM_CL_BZ_MATRIX_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Dense column-major matrix.
Definition cl_BZ_Matrix.hpp:28
Matrix< T > & operator=(Matrix< T > &&aMatrix) noexcept
move assignment operator
Definition cl_BZ_Matrix.hpp:280
size_t spacing() const
inter-column stride of the data container ( the leading dimension in BLAS terms; exceeds n_rows when ...
Definition cl_BZ_Matrix.hpp:267
Matrix< T > & operator+=(const T &aValue)
Definition cl_BZ_Matrix.hpp:595
auto submat(const size_t aFirstRow, const size_t aFirstCol, const size_t aLastRow, const size_t aLastCol) -> decltype(blaze::submatrix(mMatrix, aFirstRow, aFirstCol, aLastRow, aLastCol))
Definition cl_BZ_Matrix.hpp:405
void set_size(const size_t aNumRows, const size_t aNumCols, const T &aValue)
Definition cl_BZ_Matrix.hpp:224
virtual ~Matrix()=default
empty destructor
Matrix< T > & operator=(const blaze::DenseVector< VT, false > &aExpression)
Fill with column vector expression.
Definition cl_BZ_Matrix.hpp:559
auto col(const size_t aColIndex) -> decltype(mMatrix.col(aColIndex))
Definition cl_AR_Matrix.hpp:347
const MatrixType & matrix_data() const
Definition cl_BZ_Matrix.hpp:198
void fill(const T &aValue)
Definition cl_BZ_Matrix.hpp:208
auto row(const size_t aRowIndex) -> decltype(mMatrix.row(aRowIndex))
Definition cl_AR_Matrix.hpp:319
Matrix< T > & operator/=(const T &aValue)
Definition cl_BZ_Matrix.hpp:709
Matrix(const size_t aNumRows, const size_t aNumCols)
Constructor without fill value.
Definition cl_BZ_Matrix.hpp:56
Matrix< T > & operator=(const blaze::Matrix< MT, SO > &aExpression)
Fill with matrix expression.
Definition cl_BZ_Matrix.hpp:546
void set_row(const size_t aRowIndex, const Vector< T > &aVector)
Definition cl_BZ_Matrix.hpp:475
MatrixType & matrix_data()
Definition cl_BZ_Matrix.hpp:187
size_t capacity() const
length of data container
Definition cl_BZ_Matrix.hpp:254
Matrix< T > & operator-=(const T &aValue)
Definition cl_BZ_Matrix.hpp:627
Matrix(const MatrixType &aExpression)
Constructor from expression.
Definition cl_BZ_Matrix.hpp:87
auto row(const size_t aRowIndex) const -> decltype(blaze::row(mMatrix, aRowIndex))
Definition cl_BZ_Matrix.hpp:363
Matrix(const size_t aNumRows, const size_t aNumCols, const real aValue)
Constructor with fill value.
Definition cl_BZ_Matrix.hpp:65
void set_row(const size_t aRowIndex, const ET &aExpression)
Definition cl_BZ_Matrix.hpp:498
void set_size(const size_t aNumRows, const size_t aNumCols)
Definition cl_BZ_Matrix.hpp:216
size_t n_rows() const
Definition cl_BZ_Matrix.hpp:235
Matrix(const blaze::DenseVector< VT, true > &aExpression)
Constructor from row vector expression.
Definition cl_BZ_Matrix.hpp:122
void set_col(const size_t aColIndex, const Vector< T > &aVector)
Definition cl_BZ_Matrix.hpp:506
Matrix(const Matrix< T > &aMatrix)
copy constructor
Definition cl_BZ_Matrix.hpp:138
Matrix< T > & operator=(const Matrix< T > &aMatrix)
copy assignment operator
Definition cl_BZ_Matrix.hpp:293
T & operator()(const size_t aRowIndex, const size_t aColIndex)
access operator ( writable version )
Definition cl_BZ_Matrix.hpp:308
arma::Mat< T > MatrixType
Definition cl_AR_Matrix.hpp:34
auto col(const size_t aColIndex) const -> decltype(blaze::column(mMatrix, aColIndex))
Definition cl_BZ_Matrix.hpp:391
Matrix(const blaze::Matrix< MT, SO > &aExpression)
Constructor from matrix expression.
Definition cl_BZ_Matrix.hpp:96
Matrix< T > & operator=(const T &aValue)
Fill with value.
Definition cl_BZ_Matrix.hpp:533
Matrix< T > & operator-=(const Matrix< T > &aMatrix)
Definition cl_BZ_Matrix.hpp:636
Matrix()=default
empty constructor
virtual const T & operator()(const size_t aRowIndex, const size_t aColIndex) const
access operator ( const version )
Definition cl_BZ_Matrix.hpp:329
size_t n_cols() const
Definition cl_BZ_Matrix.hpp:243
Matrix(Matrix< T > &&aMatrix) noexcept
move constructor
Definition cl_BZ_Matrix.hpp:145
Matrix(const std::initializer_list< std::initializer_list< T > > &aInitList)
Constructor with initializer list.
Definition cl_BZ_Matrix.hpp:76
void set_col(const size_t aRowIndex, const ET &aExpression)
Definition cl_BZ_Matrix.hpp:520
Matrix(const blaze::DenseVector< VT, false > &aExpression)
Constructor from column vector expression.
Definition cl_BZ_Matrix.hpp:105
auto col(const size_t aColIndex) -> decltype(blaze::column(mMatrix, aColIndex))
Definition cl_BZ_Matrix.hpp:377
Matrix< T > & operator*=(const Matrix< T > &aMatrix)
Definition cl_BZ_Matrix.hpp:677
Matrix< T > & operator=(const blaze::DenseVector< VT, true > &aExpression)
Fill with row vector expression.
Definition cl_BZ_Matrix.hpp:578
auto submat(const size_t aFirstRow, const size_t aFirstCol, const size_t aLastRow, const size_t aLastCol) const -> decltype(blaze::submatrix(mMatrix, aFirstRow, aFirstCol, aLastRow, aLastCol))
Definition cl_BZ_Matrix.hpp:440
Matrix< T > & operator*=(const T &aValue)
Definition cl_BZ_Matrix.hpp:668
const T * data() const
Definition cl_BZ_Matrix.hpp:176
void print(const std::string aLabel="Matrix") const
auto row(const size_t aRowIndex) -> decltype(blaze::row(mMatrix, aRowIndex))
Definition cl_BZ_Matrix.hpp:349
T * data()
Definition cl_BZ_Matrix.hpp:165
Matrix< T > & operator+=(const Matrix< T > &aMatrix)
Definition cl_BZ_Matrix.hpp:604
T * data()
expose the underlying raw pointer ( writable version )
Definition cl_AR_Vector.hpp:182
size_t length() const
get the length of the vector
Definition cl_AR_Vector.hpp:257
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
double real
Definition typedefs.hpp:36