Linear Algebra  arduino
Accessible implementations of linear algebra algorithms
Functions

Detailed Description

Matrix and vector addition.

+ Collaboration diagram for Addition:

Functions

Matrix operator+ (const Matrix &A, const Matrix &B)
 Matrix addition. More...
 
void operator+= (Matrix &A, const Matrix &B)
 
Matrix && operator+ (Matrix &&A, const Matrix &B)
 
Matrix && operator+ (const Matrix &A, Matrix &&B)
 
Matrix && operator+ (Matrix &&A, Matrix &&B)
 
Vector && operator+ (Vector &&a, const Vector &b)
 
Vector && operator+ (const Vector &a, Vector &&b)
 
Vector && operator+ (Vector &&a, Vector &&b)
 
RowVector && operator+ (RowVector &&a, const RowVector &b)
 
RowVector && operator+ (const RowVector &a, RowVector &&b)
 
RowVector && operator+ (RowVector &&a, RowVector &&b)
 
SquareMatrix && operator+ (SquareMatrix &&a, const SquareMatrix &b)
 
SquareMatrix && operator+ (const SquareMatrix &a, SquareMatrix &&b)
 
SquareMatrix && operator+ (SquareMatrix &&a, SquareMatrix &&b)
 
Vector operator+ (const Vector &a, const Vector &b)
 
RowVector operator+ (const RowVector &a, const RowVector &b)
 
SquareMatrix operator+ (const SquareMatrix &a, const SquareMatrix &b)
 

Function Documentation

◆ operator+() [1/16]

Matrix operator+ ( const Matrix A,
const Matrix B 
)

Matrix addition.

Implementation

Matrix operator+(const Matrix &A, const Matrix &B) {
assert(A.rows() == B.rows());
assert(A.cols() == B.cols());
Matrix C(A.rows(), A.cols());
std::transform(A.begin(), A.end(), B.begin(), C.begin(),
std::plus<double>());
return C;
}
General matrix class.
Definition: Matrix.hpp:34
storage_t::iterator end()
Get the iterator to the element past the end of the matrix.
Definition: Matrix.hpp:220
size_t rows() const
Get the number of rows of the matrix.
Definition: Matrix.hpp:81
size_t cols() const
Get the number of columns of the matrix.
Definition: Matrix.hpp:83
storage_t::iterator begin()
Get the iterator to the first element of the matrix.
Definition: Matrix.hpp:213
Matrix operator+(const Matrix &A, const Matrix &B)
Matrix addition.
Definition: Matrix.cpp:720

Definition at line 720 of file Matrix.cpp.

◆ operator+=()

void operator+= ( Matrix A,
const Matrix B 
)

Definition at line 730 of file Matrix.cpp.

◆ operator+() [2/16]

Matrix&& operator+ ( Matrix &&  A,
const Matrix B 
)

Definition at line 736 of file Matrix.cpp.

◆ operator+() [3/16]

Matrix&& operator+ ( const Matrix A,
Matrix &&  B 
)

Definition at line 740 of file Matrix.cpp.

◆ operator+() [4/16]

Matrix&& operator+ ( Matrix &&  A,
Matrix &&  B 
)

Definition at line 744 of file Matrix.cpp.

◆ operator+() [5/16]

Vector&& operator+ ( Vector &&  a,
const Vector b 
)

Definition at line 749 of file Matrix.cpp.

◆ operator+() [6/16]

Vector&& operator+ ( const Vector a,
Vector &&  b 
)

Definition at line 753 of file Matrix.cpp.

◆ operator+() [7/16]

Vector&& operator+ ( Vector &&  a,
Vector &&  b 
)

Definition at line 757 of file Matrix.cpp.

◆ operator+() [8/16]

RowVector&& operator+ ( RowVector &&  a,
const RowVector b 
)

Definition at line 762 of file Matrix.cpp.

◆ operator+() [9/16]

RowVector&& operator+ ( const RowVector a,
RowVector &&  b 
)

Definition at line 766 of file Matrix.cpp.

◆ operator+() [10/16]

RowVector&& operator+ ( RowVector &&  a,
RowVector &&  b 
)

Definition at line 770 of file Matrix.cpp.

◆ operator+() [11/16]

SquareMatrix&& operator+ ( SquareMatrix &&  a,
const SquareMatrix b 
)

Definition at line 775 of file Matrix.cpp.

◆ operator+() [12/16]

SquareMatrix&& operator+ ( const SquareMatrix a,
SquareMatrix &&  b 
)

Definition at line 779 of file Matrix.cpp.

◆ operator+() [13/16]

SquareMatrix&& operator+ ( SquareMatrix &&  a,
SquareMatrix &&  b 
)

Definition at line 783 of file Matrix.cpp.

◆ operator+() [14/16]

Vector operator+ ( const Vector a,
const Vector b 
)

Definition at line 788 of file Matrix.cpp.

◆ operator+() [15/16]

RowVector operator+ ( const RowVector a,
const RowVector b 
)

Definition at line 792 of file Matrix.cpp.

◆ operator+() [16/16]

SquareMatrix operator+ ( const SquareMatrix a,
const SquareMatrix b 
)

Definition at line 796 of file Matrix.cpp.