BELFEM 0.9.4
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_AR_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_AR_MATRIX_HPP
13#define BELFEM_CL_AR_MATRIX_HPP
14
15#include "typedefs.hpp"
16#include "assert.hpp"
17
18namespace belfem
19{
27 template< typename T >
28 class Matrix final
29 {
30//------------------------------------------------------------------------------
31 public :
32//------------------------------------------------------------------------------
33
34 typedef arma::Mat<T> MatrixType;
35
36//------------------------------------------------------------------------------
37 private :
38//------------------------------------------------------------------------------
39
40 // member class of underlying vector implementation
41 MatrixType mMatrix;
42
43//------------------------------------------------------------------------------
44 public :
45//------------------------------------------------------------------------------
46
47 Matrix() = default;
48
49// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50
51 Matrix( const size_t aNumRows,
52 const size_t aNumCols ) :
53 mMatrix( aNumRows, aNumCols ) {}
54
55// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56
57 Matrix( const size_t aNumRows,
58 const size_t aNumCols,
59 const T aValue ) :
60 mMatrix( aNumRows, aNumCols )
61 {
62 this->fill( aValue );
63 }
64
65// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66
67 Matrix( const std::initializer_list<std::initializer_list<T> > & aInitList )
68 : mMatrix( aInitList )
69 {
70
71 }
72
73// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
74
75 Matrix( const MatrixType & aExpression )
76 : mMatrix( aExpression ) {}
77
78// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79
84 template< typename ET >
85 Matrix( const arma::Base< T, ET > & aExpression )
86 : mMatrix( aExpression.get_ref() ) {}
87
88//------------------------------------------------------------------------------
89
93 Matrix( const Matrix< T > & aMatrix ) :
94 mMatrix( aMatrix.mMatrix )
95 {}
96
100 Matrix( Matrix< T > && aMatrix ) noexcept :
101 mMatrix( std::move( aMatrix.mMatrix ) )
102 {}
103
104
105//------------------------------------------------------------------------------
106
110 ~Matrix() = default;
111
112//------------------------------------------------------------------------------
113// MEMORY
114//------------------------------------------------------------------------------
115
116
119 inline T *
121 {
122 return mMatrix.memptr();
123 }
124
125// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
126
127 inline const T *
128 data() const
129 {
130 return mMatrix.memptr();
131 }
132
133//------------------------------------------------------------------------------
134
135 /*
136 * expose the underlying matrix implementation ( writable version )
137 */
138 inline MatrixType &
140 {
141 return mMatrix;
142 }
143
144// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
145
146 /*
147 * expose the underlying matrix implementation ( const version )
148 */
149 inline const MatrixType &
151 {
152 return mMatrix;
153 }
154
155//------------------------------------------------------------------------------
156// UTILITIES
157//------------------------------------------------------------------------------
158
159 inline void
160 fill( const T & aValue )
161 {
162 mMatrix.fill( aValue );
163 }
164
165//------------------------------------------------------------------------------
166
167 inline void
168 set_size( const size_t aNumRows, const size_t aNumCols )
169 {
170 mMatrix.set_size( aNumRows, aNumCols );
171 }
172
173// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
174
175 inline void
176 set_size( const size_t aNumRows, const size_t aNumCols, const T & aValue )
177 {
178 this->set_size( aNumRows, aNumCols );
179 this->fill( aValue );
180 }
181
182//------------------------------------------------------------------------------
183// SIZE CHECKS
184//------------------------------------------------------------------------------
185
186 inline size_t
187 n_rows() const
188 {
189 return mMatrix.n_rows;
190 }
191
192//------------------------------------------------------------------------------
193
194 inline size_t
195 n_cols() const
196 {
197 return mMatrix.n_cols;
198 }
199
200//------------------------------------------------------------------------------
201
205 inline size_t
206 capacity() const
207 {
208 return mMatrix.n_elem;
209 }
210
211//------------------------------------------------------------------------------
212
217 inline size_t
218 spacing() const
219 {
220 return mMatrix.n_rows;
221 }
222
223//------------------------------------------------------------------------------
224// OPERATORS
225//------------------------------------------------------------------------------
226
231 operator=( Matrix< T > && aMatrix ) noexcept
232 {
233 if ( this != & aMatrix )
234 {
235 mMatrix = std::move( aMatrix.mMatrix );
236 }
237 return *this;
238 }
239
244 operator=( const Matrix< T > & aMatrix )
245 {
246 if ( this != &aMatrix )
247 {
248 mMatrix = aMatrix.mMatrix;
249 }
250 return *this;
251 }
252
253
254//------------------------------------------------------------------------------
255
259 inline T &
260 operator()( const size_t aRowIndex, const size_t aColIndex )
261 {
262 BELFEM_ASSERT( aRowIndex< this->n_rows(),
263 "Row index %lu out of bounds, which must be smaller than %lu.",
264 ( long unsigned int ) aRowIndex,
265 ( long unsigned int ) this->n_rows() );
266
267 BELFEM_ASSERT( aColIndex< this->n_cols(),
268 "Col index %lu out of bounds, which must be smaller than %lu.",
269 ( long unsigned int ) aColIndex,
270 ( long unsigned int ) this->n_cols() );
271
272 return mMatrix( aRowIndex, aColIndex );
273 }
274
275// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
276
280 inline const T &
281 operator()( const size_t aRowIndex, const size_t aColIndex ) const
282 {
283 BELFEM_ASSERT( aRowIndex< this->n_rows(),
284 "Row index %lu out of bounds, which must be smaller than %lu.",
285 ( long unsigned int ) aRowIndex,
286 ( long unsigned int ) this->n_rows() );
287
288 BELFEM_ASSERT( aColIndex< this->n_cols(),
289 "Col index %lu out of bounds, which must be smaller than %lu.",
290 ( long unsigned int ) aColIndex,
291 ( long unsigned int ) this->n_cols() );
292
293 return mMatrix( aRowIndex, aColIndex );
294 }
295
296//------------------------------------------------------------------------------
297// Cols and Rows
298//------------------------------------------------------------------------------
299
300 inline auto
301 row( const size_t aRowIndex )
302 ->decltype( mMatrix.row( aRowIndex ) )
303 {
304 BELFEM_ASSERT( aRowIndex < this->n_rows(),
305 "Row index %lu out of bounds, which must be less than %lu.",
306 ( long unsigned int ) aRowIndex,
307 ( long unsigned int ) this->n_rows() );
308
309 return mMatrix.row( aRowIndex );
310 }
311
312// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
313
314 inline auto
315 row( const size_t aRowIndex ) const
316 ->decltype( mMatrix.row( aRowIndex ) )
317 {
318 BELFEM_ASSERT( aRowIndex < this->n_rows(),
319 "Row index %lu out of bounds, which must be less than %lu.",
320 ( long unsigned int ) aRowIndex,
321 ( long unsigned int ) this->n_rows() );
322
323 return mMatrix.row( aRowIndex );
324 }
325
326//------------------------------------------------------------------------------
327
328 inline auto
329 col( const size_t aColIndex )
330 ->decltype( mMatrix.col( aColIndex ) )
331 {
332 BELFEM_ASSERT( aColIndex < this->n_cols(),
333 "Col index %lu out of bounds, which must be less than %lu.",
334 ( long unsigned int ) aColIndex,
335 ( long unsigned int ) this->n_cols() );
336
337 return mMatrix.col( aColIndex );
338 }
339
340// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
341
342 inline auto
343 col( const size_t aColIndex ) const
344 ->decltype( mMatrix.col( aColIndex ) )
345 {
346 BELFEM_ASSERT( aColIndex < this->n_cols(),
347 "Col index %lu out of bounds, which must be less than %lu.",
348 ( long unsigned int ) aColIndex,
349 ( long unsigned int ) this->n_cols() );
350
351 return mMatrix.col( aColIndex );
352 }
353
354//------------------------------------------------------------------------------
355
356 inline auto
357 submat( const size_t aFirstRow,
358 const size_t aFirstCol,
359 const size_t aLastRow,
360 const size_t aLastCol )
361 -> decltype( mMatrix.submat( aFirstRow, aFirstCol, aLastRow, aLastCol ) )
362 {
363 BELFEM_ASSERT( aFirstRow < this->n_rows(),
364 "First row index %lu out of bounds, which must be less than %lu.",
365 ( long unsigned int ) aFirstRow,
366 ( long unsigned int ) this->n_rows() );
367
368 BELFEM_ASSERT( aLastRow < this->n_rows(),
369 "Last row index %lu out of bounds, which must be less than %lu.",
370 ( long unsigned int ) aLastRow,
371 ( long unsigned int ) this->n_rows() );
372
373 BELFEM_ASSERT( aFirstCol < this->n_cols(),
374 "First col index %lu out of bounds, which must be less than %lu.",
375 ( long unsigned int ) aFirstCol,
376 ( long unsigned int ) this->n_cols() );
377
378 BELFEM_ASSERT( aLastCol < this->n_cols(),
379 "Last col index %lu out of bounds, which must be less than %lu.",
380 ( long unsigned int ) aLastCol,
381 ( long unsigned int ) this->n_cols() );
382
383 return mMatrix.submat( aFirstRow, aFirstCol, aLastRow, aLastCol );
384 }
385
386// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
387
388 inline auto
389 submat( const size_t aFirstRow,
390 const size_t aFirstCol,
391 const size_t aLastRow,
392 const size_t aLastCol ) const
393 -> decltype( mMatrix.submat( aFirstRow, aFirstCol, aLastRow, aLastCol ) )
394 {
395 BELFEM_ASSERT( aFirstRow < this->n_rows(),
396 "First row index %lu out of bounds, which must be less than %lu.",
397 ( long unsigned int ) aFirstRow,
398 ( long unsigned int ) this->n_rows() );
399
400 BELFEM_ASSERT( aLastRow < this->n_rows(),
401 "Last row index %lu out of bounds, which must be less than %lu.",
402 ( long unsigned int ) aLastRow,
403 ( long unsigned int ) this->n_rows() );
404
405 BELFEM_ASSERT( aFirstCol < this->n_cols(),
406 "First col index %lu out of bounds, which must be less than %lu.",
407 ( long unsigned int ) aFirstCol,
408 ( long unsigned int ) this->n_cols() );
409
410 BELFEM_ASSERT( aLastCol < this->n_cols(),
411 "Last col index %lu out of bounds, which must be less than %lu.",
412 ( long unsigned int ) aLastCol,
413 ( long unsigned int ) this->n_cols() );
414
415 return mMatrix.submat( aFirstRow, aFirstCol, aLastRow, aLastCol );
416 }
417
418//------------------------------------------------------------------------------
419
420 inline void
421 set_row( const size_t aRowIndex, const Vector <T> & aVector )
422 {
423 // make sure that length is correct
424 BELFEM_ASSERT( aVector.length() == this->n_cols(),
425 "Wrong length of vector : %lu ( expect %lu )",
426 ( long unsigned int ) aVector.length(),
427 ( long unsigned int ) this->n_cols() );
428
429 this->row( aRowIndex ) = arma::trans( aVector.vector_data() );
430 }
431
432 template < typename ET >
433 inline void
434 set_row( const size_t aColIndex, const ET & aExpression )
435 {
436 this->row( aColIndex ) = aExpression;
437 }
438
439//------------------------------------------------------------------------------
440
441 inline void
442 set_col( const size_t aColIndex, const Vector <T> & aVector )
443 {
444 // make sure that length is correct
445 BELFEM_ASSERT( aVector.length() == this->n_rows(),
446 "Wrong length of vector : %lu ( expect %lu )",
447 ( long unsigned int ) aVector.length(),
448 ( long unsigned int ) this->n_rows() );
449
450 this->col( aColIndex ) = aVector.vector_data();
451 }
452
453 template < typename ET >
454 inline void
455 set_col( const size_t aColIndex, const ET & aExpression )
456 {
457 this->col( aColIndex ) = aExpression;
458 }
459
460
461//------------------------------------------------------------------------------
462// internal operators
463//------------------------------------------------------------------------------
464
469 operator=( const T & aValue )
470 {
471 this->fill( aValue );
472 return *this;
473 }
474
475// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
476
480 template < typename ET >
482 operator=( const ET & aExpression )
483 {
484 mMatrix = aExpression;
485 return *this;
486 }
487
488//------------------------------------------------------------------------------
489// ADD OPERATORS
490//------------------------------------------------------------------------------
491
493 operator+=( const T & aValue )
494 {
495 mMatrix += aValue;
496 return *this;
497 }
498
500 operator+=( T & aValue )
501 {
502 mMatrix += aValue;
503 return *this;
504 }
505
506// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
507
509 operator+=( const Matrix< T > & aMatrix )
510 {
511 mMatrix += aMatrix.matrix_data();
512 return *this;
513 }
514
515// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
516
518 operator+=( const MatrixType & aExpression )
519 {
520 mMatrix += aExpression;
521 return *this;
522 }
523
524// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
525
531 template< typename ET >
533 operator+=( const arma::Base< T, ET > & aExpression )
534 {
535 mMatrix += aExpression.get_ref();
536 return *this;
537 }
538
539//------------------------------------------------------------------------------
540// SUBTRACT OPERATORS
541//------------------------------------------------------------------------------
542
544 operator-=( const T & aValue )
545 {
546 mMatrix -= aValue;
547 return *this;
548 }
549
550// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
551
553 operator-=( const Matrix< T > & aMatrix )
554 {
555 mMatrix -= aMatrix.matrix_data();
556 return *this;
557 }
558
559// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
560
562 operator-=( const MatrixType & aExpression )
563 {
564 mMatrix -= aExpression;
565 return *this;
566 }
567
568// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
569
570 template< typename ET >
572 operator-=( const arma::Base< T, ET > & aExpression )
573 {
574 mMatrix -= aExpression.get_ref();
575 return *this;
576 }
577
578//------------------------------------------------------------------------------
579// MULTIPLY OPERATORS
580//------------------------------------------------------------------------------
581
583 operator*=( const T & aValue )
584 {
585 mMatrix *= aValue;
586 return *this;
587 }
588
589// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
590
592 operator*=( const Matrix< T > & aMatrix )
593 {
594 mMatrix *= aMatrix.matrix_data();
595 return *this;
596 }
597
598// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
599
601 operator*=( const MatrixType & aExpression )
602 {
603 mMatrix *= aExpression;
604 return *this;
605 }
606
607// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
608
609 template< typename ET >
611 operator*=( const arma::Base< T, ET > & aExpression )
612 {
613 mMatrix *= aExpression.get_ref();
614 return *this;
615 }
616
617//------------------------------------------------------------------------------
618// DIVIDE OPERATORS
619//------------------------------------------------------------------------------
620
622 operator/=( const T & aValue )
623 {
624 mMatrix /= aValue;
625 return *this;
626 }
627
628//------------------------------------------------------------------------------
629// PRINT OPERATION
630//------------------------------------------------------------------------------
631
632 inline void
633 print( const std::string aLabel="Matrix" ) const;
634
635//------------------------------------------------------------------------------
636 };
637
638//------------------------------------------------------------------------------
639// turn off annoying waning
640#ifdef BELFEM_GCC
641#pragma GCC diagnostic push
642#pragma GCC diagnostic ignored "-Wformat"
643#endif
644 template < typename T > void
645 Matrix< T >::print( const std::string aLabel ) const
646 {
647 FILE * tOutFile = stdout;
648
649 fprintf( tOutFile, "%s = [ ... \n", aLabel.c_str() );
650
651 // get a ref of this
652 const Matrix< T > & tThis = *this;
653
654 uint tRows = tThis.n_rows();
655 uint tCols = tThis.n_cols();
656
657 for( uint i=0; i< tRows; ++i )
658 {
659 for( uint j=0; j< tCols; ++j )
660 {
661 if( j < tCols-1 )
662 {
663 fprintf( tOutFile, "%d, ", ( int ) tThis( i, j ) );
664 }
665 else
666 {
667 fprintf( tOutFile, "%d; ", ( int ) tThis( i, j ) );
668 }
669 }
670
671 if( i < tRows-1 )
672 {
673 fprintf( tOutFile, "...\n" );
674 }
675 else
676 {
677 fprintf( tOutFile, "];\n" );
678 }
679 }
680 }
681
682// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
683
684 template <>
685 inline void
686 Matrix<real>::print( const std::string aLabel ) const
687 {
688 FILE * tOutFile = stdout;
689
690 fprintf( tOutFile, "%s = [ ... \n", aLabel.c_str() );
691
692 const Matrix< real > & tThis = *this;
693
694 uint tRows = tThis.n_rows();
695 uint tCols = tThis.n_cols();
696
697 for( uint i=0; i< tRows; ++i )
698 {
699 for( uint j=0; j< tCols; ++j )
700 {
701 if( j < tCols-1 )
702 {
703 fprintf( tOutFile, "%+.15e, ", ( double ) tThis( i, j ) );
704 }
705 else
706 {
707 fprintf( tOutFile, "%+.15e; ", ( double ) tThis( i, j ) );
708 }
709 }
710
711 if( i < tRows-1 )
712 {
713 fprintf( tOutFile, "...\n" );
714 }
715 else
716 {
717 fprintf( tOutFile, "];\n" );
718 }
719 }
720 }
721
722
723#ifdef BELFEM_GCC
724#pragma GCC diagnostic pop
725#endif
726}
727#endif //BELFEM_CL_AR_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_AR_Matrix.hpp:231
size_t spacing() const
inter-column stride of the data container ( the leading dimension in BLAS terms; here always n_rows )
Definition cl_AR_Matrix.hpp:218
Matrix< T > & operator+=(const T &aValue)
Definition cl_AR_Matrix.hpp:493
auto col(const size_t aColIndex) const -> decltype(mMatrix.col(aColIndex))
Definition cl_AR_Matrix.hpp:343
void set_size(const size_t aNumRows, const size_t aNumCols, const T &aValue)
Definition cl_AR_Matrix.hpp:176
auto col(const size_t aColIndex) -> decltype(mMatrix.col(aColIndex))
Definition cl_AR_Matrix.hpp:329
auto submat(const size_t aFirstRow, const size_t aFirstCol, const size_t aLastRow, const size_t aLastCol) const -> decltype(mMatrix.submat(aFirstRow, aFirstCol, aLastRow, aLastCol))
Definition cl_AR_Matrix.hpp:389
const MatrixType & matrix_data() const
Definition cl_AR_Matrix.hpp:150
const T & operator()(const size_t aRowIndex, const size_t aColIndex) const
access operator ( const version )
Definition cl_AR_Matrix.hpp:281
void fill(const T &aValue)
Definition cl_AR_Matrix.hpp:160
auto submat(const size_t aFirstRow, const size_t aFirstCol, const size_t aLastRow, const size_t aLastCol) -> decltype(mMatrix.submat(aFirstRow, aFirstCol, aLastRow, aLastCol))
Definition cl_AR_Matrix.hpp:357
auto row(const size_t aRowIndex) -> decltype(mMatrix.row(aRowIndex))
Definition cl_AR_Matrix.hpp:301
Matrix< T > & operator/=(const T &aValue)
Definition cl_AR_Matrix.hpp:622
Matrix(const size_t aNumRows, const size_t aNumCols)
Definition cl_AR_Matrix.hpp:51
Matrix< T > & operator+=(const arma::Base< T, ET > &aExpression)
compound assignment from any Armadillo expression, reaching the backend's in-place path; without this...
Definition cl_AR_Matrix.hpp:533
Matrix< T > & operator*=(const arma::Base< T, ET > &aExpression)
Definition cl_AR_Matrix.hpp:611
void set_row(const size_t aRowIndex, const Vector< T > &aVector)
Definition cl_AR_Matrix.hpp:421
MatrixType & matrix_data()
Definition cl_AR_Matrix.hpp:139
size_t capacity() const
The logical element count n_rows() * n_cols() ( Armadillo's n_elem ).
Definition cl_AR_Matrix.hpp:206
Matrix< T > & operator-=(const T &aValue)
Definition cl_AR_Matrix.hpp:544
Matrix(const MatrixType &aExpression)
Definition cl_AR_Matrix.hpp:75
Matrix< T > & operator-=(const MatrixType &aExpression)
Definition cl_AR_Matrix.hpp:562
void set_size(const size_t aNumRows, const size_t aNumCols)
Definition cl_AR_Matrix.hpp:168
size_t n_rows() const
Definition cl_AR_Matrix.hpp:187
void set_col(const size_t aColIndex, const Vector< T > &aVector)
Definition cl_AR_Matrix.hpp:442
Matrix(const Matrix< T > &aMatrix)
copy constructor
Definition cl_AR_Matrix.hpp:93
Matrix< T > & operator-=(const arma::Base< T, ET > &aExpression)
Definition cl_AR_Matrix.hpp:572
Matrix< T > & operator=(const Matrix< T > &aMatrix)
copy assignment operator
Definition cl_AR_Matrix.hpp:244
T & operator()(const size_t aRowIndex, const size_t aColIndex)
access operator ( writable version )
Definition cl_AR_Matrix.hpp:260
void set_row(const size_t aColIndex, const ET &aExpression)
Definition cl_AR_Matrix.hpp:434
arma::Mat< T > MatrixType
Definition cl_AR_Matrix.hpp:34
Matrix< T > & operator=(const T &aValue)
Fill with value.
Definition cl_AR_Matrix.hpp:469
Matrix< T > & operator-=(const Matrix< T > &aMatrix)
Definition cl_AR_Matrix.hpp:553
Matrix()=default
size_t n_cols() const
Definition cl_AR_Matrix.hpp:195
Matrix(Matrix< T > &&aMatrix) noexcept
move constructor
Definition cl_AR_Matrix.hpp:100
Matrix(const std::initializer_list< std::initializer_list< T > > &aInitList)
Definition cl_AR_Matrix.hpp:67
Matrix< T > & operator+=(T &aValue)
Definition cl_AR_Matrix.hpp:500
Matrix< T > & operator*=(const MatrixType &aExpression)
Definition cl_AR_Matrix.hpp:601
Matrix< T > & operator+=(const MatrixType &aExpression)
Definition cl_AR_Matrix.hpp:518
Matrix< T > & operator*=(const Matrix< T > &aMatrix)
Definition cl_AR_Matrix.hpp:592
~Matrix()=default
empty destructor
Matrix< T > & operator*=(const T &aValue)
Definition cl_AR_Matrix.hpp:583
const T * data() const
Definition cl_AR_Matrix.hpp:128
Matrix(const arma::Base< T, ET > &aExpression)
constructor from any Armadillo expression ( eOp, eGlue, Glue, mtOp, views ): the backend evaluates it...
Definition cl_AR_Matrix.hpp:85
void print(const std::string aLabel="Matrix") const
Definition cl_AR_Matrix.hpp:645
Matrix(const size_t aNumRows, const size_t aNumCols, const T aValue)
Definition cl_AR_Matrix.hpp:57
T * data()
Returns a borrowed raw buffer under the layout contract stated in cl_Matrix.hpp; may be nullptr when ...
Definition cl_AR_Matrix.hpp:120
Matrix< T > & operator+=(const Matrix< T > &aMatrix)
Definition cl_AR_Matrix.hpp:509
Matrix< T > & operator=(const ET &aExpression)
Fill with expression.
Definition cl_AR_Matrix.hpp:482
void set_col(const size_t aColIndex, const ET &aExpression)
Definition cl_AR_Matrix.hpp:455
auto row(const size_t aRowIndex) const -> decltype(mMatrix.row(aRowIndex))
Definition cl_AR_Matrix.hpp:315
size_t length() const
get the length of the vector
Definition cl_AR_Vector.hpp:333
VectorType & vector_data()
expose the underlying matrix implementation ( writable version )
Definition cl_AR_Vector.hpp:280
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30