Linear Algebra  master
Accessible implementations of linear algebra algorithms
Functions

Detailed Description

Matrix and vector subtraction.

+ Collaboration diagram for Subtraction:

Functions

Matrix operator- (const Matrix &A, const Matrix &B)
 Matrix subtraction. 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 subtraction.

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::minus<double>());
return C;
}
General matrix class.
Definition: Matrix.hpp:25
storage_t::iterator end()
Get the iterator to the element past the end of the matrix.
Definition: Matrix.hpp:204
size_t rows() const
Get the number of rows of the matrix.
Definition: Matrix.hpp:69
size_t cols() const
Get the number of columns of the matrix.
Definition: Matrix.hpp:71
storage_t::iterator begin()
Get the iterator to the first element of the matrix.
Definition: Matrix.hpp:197
Matrix operator-(const Matrix &A, const Matrix &B)
Matrix subtraction.
Definition: Matrix.cpp:791

Definition at line 791 of file Matrix.cpp.

◆ operator-=()

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

Definition at line 801 of file Matrix.cpp.

◆ operator-() [2/16]

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

Definition at line 807 of file Matrix.cpp.

◆ operator-() [3/16]

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

Definition at line 811 of file Matrix.cpp.

◆ operator-() [4/16]

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

Definition at line 816 of file Matrix.cpp.

◆ operator-() [5/16]

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

Definition at line 821 of file Matrix.cpp.

◆ operator-() [6/16]

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

Definition at line 825 of file Matrix.cpp.

◆ operator-() [7/16]

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

Definition at line 829 of file Matrix.cpp.

◆ operator-() [8/16]

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

Definition at line 834 of file Matrix.cpp.

◆ operator-() [9/16]

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

Definition at line 838 of file Matrix.cpp.

◆ operator-() [10/16]

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

Definition at line 842 of file Matrix.cpp.

◆ operator-() [11/16]

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

Definition at line 847 of file Matrix.cpp.

◆ operator-() [12/16]

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

Definition at line 851 of file Matrix.cpp.

◆ operator-() [13/16]

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

Definition at line 855 of file Matrix.cpp.

◆ operator-() [14/16]

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

Definition at line 860 of file Matrix.cpp.

◆ operator-() [15/16]

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

Definition at line 864 of file Matrix.cpp.

◆ operator-() [16/16]

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

Definition at line 868 of file Matrix.cpp.