Matrix of fixed dimension.
More...
#include "Imagine/Common.h"
|
| | FMatrix () |
| | Empty constructor.
|
| |
| template<typename T2> |
| | FMatrix (const FMatrix< T2, M, N > &A) |
| | Copy constructor Constructs from another FMatrix (with a possibly different type)
|
| |
| | FMatrix (const T &v) |
| | Constructor with constant value.
|
| |
| | FMatrix (const T t[M *N]) |
| | Constructor from C array.
|
| |
| | FMatrix (const T t[M][N]) |
| | Constructor from bidim C array.
|
| |
| T * | data () |
| | Data pointer (write).
|
| |
| const T * | data () const |
| | Data pointer (read).
|
| |
| FMatrix & | fill (const T &v) |
| | Filling.
|
| |
| FVector< T, M > | getCol (int j) const |
| | Get column.
|
| |
| FVector< T, N > | getRow (int i) const |
| | Get row.
|
| |
| int | ncol () const |
| | Number of columns.
|
| |
| int | nrow () const |
| | Number of rows.
|
| |
| bool | operator!= (const FMatrix &B) const |
| | Inequality test.
|
| |
| T & | operator() (int i, int j) |
| | Write access.
|
| |
| const T & | operator() (int i, int j) const |
| | Read access.
|
| |
| template<int O> |
| FMatrix< T, M, O > | operator* (const FMatrix< T, N, O > &B) const |
| | Product.
|
| |
| FVector< T, M > | operator* (const FVector< T, N > &v) const |
| | Product with vector.
|
| |
| FMatrix | operator* (T s) const |
| | Scalar multiplication.
|
| |
| FMatrix & | operator*= (T s) |
| | Scalar in place multiplication.
|
| |
| FMatrix | operator+ (const FMatrix &B) const |
| | Addition.
|
| |
| FMatrix | operator+ (T s) const |
| | Scalar Addition.
|
| |
| FMatrix & | operator+= (const FMatrix &B) |
| | In place Addition.
|
| |
| FMatrix & | operator+= (T s) |
| | Scalar in place Addition.
|
| |
| FMatrix | operator- () const |
| | Opposite.
|
| |
| FMatrix | operator- (const FMatrix &B) const |
| | Substraction.
|
| |
| FMatrix | operator- (T s) const |
| | Scalar Substraction.
|
| |
| FMatrix & | operator-= (const FMatrix &B) |
| | In place Substraction.
|
| |
| FMatrix & | operator-= (T s) |
| | Scalar in place substractrion.
|
| |
| FMatrix | operator/ (T s) const |
| | Scalar division.
|
| |
| FMatrix & | operator/= (T s) |
| | Scalar in place division.
|
| |
| template<typename T2> |
| FMatrix & | operator= (const FMatrix< T2, M, N > &B) |
| | Assignment.
|
| |
| bool | operator== (const FMatrix &B) const |
| | Equality test.
|
| |
| T & | operator[] (int k) |
| | 1D write access.
|
| |
| const T & | operator[] (int k) const |
| | 1D read access.
|
| |
| FMatrix & | setCol (int j, const FVector< T, M > &v) |
| | Set column.
|
| |
| FMatrix & | setRow (int i, const FVector< T, N > &v) |
| | Set row.
|
| |
| int | size () const |
| | Size.
|
| |
|
|
T | _data [M *N] |
| | internal storage.
|
| |
template<typename T, int M, int N>
class Imagine::FMatrix< T, M, N >
Fixed size vectors.
- Parameters
-
| T | value type |
| M,N | dimensions (M=rows N=columns) |
- Examples
- Common/test/test.cpp, Graphics/test/test.cpp, and LinAlg/test/test.cpp.
◆ FMatrix() [1/5]
template<typename T, int M, int N>
Constructs an uninitialized MxN matrix of elements of type T
FMatrix()
Empty constructor.
Definition FMatrix.h:27
◆ FMatrix() [2/5]
template<typename T, int M, int N>
Constructs an MxN matrix of elements of type T, each initialized to v
- Parameters
-
| v | value used for initialization |
◆ FMatrix() [3/5]
template<typename T, int M, int N>
Constructs an MxN matrix of elements of type T, and copies values to it. t contains elements (0,0), (1,0), ...
- Parameters
-
| t | C array used for initialization |
double t1[6]={1,2,3,4,5,6};
◆ FMatrix() [4/5]
template<typename T, int M, int N>
Constructs an MxN matrix of elements of type T, and copies values to it
- Parameters
-
| t | C bidimensional array used for initialization |
double t2[2][3]={{1,2,3},{4,5,6}};
◆ FMatrix() [5/5]
template<typename T, int M, int N>
template<typename T2>
- Parameters
-
| A | FMatrix to be copied (has to be of the same dimension) |
- Template Parameters
-
◆ CrossProd()
template<typename T, int M, int N>
Matrix corresponding to a 3D cross product, i.e. such that for all vector w, P*w gives v^w
- Parameters
-
- Returns
- matrix
Vector of fixed size.
Definition FVector.h:17
static FMatrix CrossProd(const FVector< T, 3 > &v)
Cross product matrix.
Definition FMatrix.h:212
◆ data() [1/2]
template<typename T, int M, int N>
Pointer to data for writing
- Returns
- Pointer to FMatrix elements. Element (i,j) is in position i+M*j.
◆ data() [2/2]
template<typename T, int M, int N>
◆ fill()
template<typename T, int M, int N>
Fills with constant value
- Parameters
-
| v | value to be copied to each element |
- Returns
- self reference
- Examples
- Common/test/test.cpp.
◆ getCol()
template<typename T, int M, int N>
Returns column of index j
- Parameters
-
- Returns
- column vector
◆ getRow()
template<typename T, int M, int N>
Returns row of index i
- Parameters
-
- Returns
- row vector
◆ Identity()
template<typename T, int M, int N>
Identify Matrix
- Returns
- identity
static FMatrix Identity()
Identity.
Definition FMatrix.h:197
◆ ncol()
template<typename T, int M, int N>
◆ nrow()
template<typename T, int M, int N>
◆ operator!=()
template<typename T, int M, int N>
Inequality test (component wise)
- Parameters
-
| B | FMatrix for comparison (should be of same dims) |
- Returns
- true if *this does not equal B
if (A!=B) cout << "A is different from B" << endl;
◆ operator()() [1/2]
template<typename T, int M, int N>
Writes element (i,j)
- Parameters
-
- Returns
- Reference to element (i,j)
◆ operator()() [2/2]
template<typename T, int M, int N>
Reads element (i,j)
- Parameters
-
- Returns
- const reference to element (i,j)
◆ operator*() [1/3]
template<typename T, int M, int N>
template<int O>
Matrix matrix product
- Parameters
-
- Returns
- *this * B
◆ operator*() [2/3]
template<typename T, int M, int N>
Matrix vector product
- Parameters
-
- Returns
- (this) v
◆ operator*() [3/3]
template<typename T, int M, int N>
Multiplies each element by a scalar
- Parameters
-
- Returns
- Result
◆ operator*=()
template<typename T, int M, int N>
Multiplies each element by a scalar
- Parameters
-
- Returns
- self reference
◆ operator+() [1/2]
template<typename T, int M, int N>
Addition of two FMatrix
- Parameters
-
- Returns
- sum
◆ operator+() [2/2]
template<typename T, int M, int N>
Adds a scalar to each element
- Parameters
-
| s | Scalar to be added to myself |
- Returns
- sum
◆ operator+=() [1/2]
template<typename T, int M, int N>
In place Addition of FMatrix
- Parameters
-
- Returns
- self reference
◆ operator+=() [2/2]
template<typename T, int M, int N>
Adds a scalar to each own element
- Parameters
-
| s | Scalar to be added to myself |
- Returns
- self reference
◆ operator-() [1/3]
template<typename T, int M, int N>
Opposite of a FMatrix
- Returns
- Opposite
◆ operator-() [2/3]
template<typename T, int M, int N>
Substraction of two FMatrix
- Parameters
-
| B | FMatrix to be substracted from myself |
- Returns
- difference
◆ operator-() [3/3]
template<typename T, int M, int N>
Substracts a scalar to each element
- Parameters
-
| s | Scalar to be substracted from myself |
- Returns
- difference
◆ operator-=() [1/2]
template<typename T, int M, int N>
In place Substraction of FMatrix
- Parameters
-
| B | FMatrix to be substracted from myself |
- Returns
- self reference
◆ operator-=() [2/2]
template<typename T, int M, int N>
Subtracts a scalar to each own element
- Parameters
-
| s | Scalar to be substracted from myself |
- Returns
- self reference
◆ operator/()
template<typename T, int M, int N>
Divides each element by a scalar
- Parameters
-
- Returns
- Result
◆ operator/=()
template<typename T, int M, int N>
Divides each element by a scalar
- Parameters
-
- Returns
- self reference
◆ operator=()
template<typename T, int M, int N>
template<typename T2>
Assigns from another FMatrix (of possibly different type but same dimension)
- Parameters
-
- Template Parameters
-
- Returns
- self reference
◆ operator==()
template<typename T, int M, int N>
Equality test (component wise)
- Parameters
-
| B | FMatrix for comparison (should be of same dims) |
- Returns
- true if *this equals B
if (A==B) cout << "A equals B" << endl;
◆ operator[]() [1/2]
template<typename T, int M, int N>
Writes element at position k. Element (i,j) is at position i+M*j
- Parameters
-
- Returns
- Reference to element at position k
◆ operator[]() [2/2]
template<typename T, int M, int N>
Reads element at position k. Element (i,j) is at position i+M*j
- Parameters
-
- Returns
- const ref to element at position k
◆ setCol()
template<typename T, int M, int N>
Sets column of index j
- Parameters
-
- Returns
- self reference
◆ setRow()
template<typename T, int M, int N>
Sets row of index i
- Parameters
-
- Returns
- self reference
◆ size()
template<typename T, int M, int N>
◆ Zero()
template<typename T, int M, int N>
- Returns
- matrix
static FMatrix Zero()
Zero matrix Matrix with constant 0 value.
Definition FMatrix.h:89
◆ norm
template<typename T, int M, int N>
| T norm |
( |
const FMatrix< T, M, N > & | A | ) |
|
|
friend |
Frobenius norm (provided sqrt is available for T)
- Parameters
-
- Returns
- norm
friend T norm2(const FMatrix &A)
Squared Frobenius norm.
Definition FMatrix.h:481
◆ norm2
template<typename T, int M, int N>
| T norm2 |
( |
const FMatrix< T, M, N > & | A | ) |
|
|
friend |
Squared Frobenius norm
- Parameters
-
- Returns
- squared norm
◆ operator<<
template<typename T, int M, int N>
| std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const FMatrix< T, M, N > & | A ) |
|
friend |
Writes FMatrix to stream
- Parameters
-
- Returns
- updated stream
out.open("tmp.txt");
out << A << endl;
◆ operator>>
template<typename T, int M, int N>
| std::istream & operator>> |
( |
std::istream & | in, |
|
|
FMatrix< T, M, N > & | A ) |
|
friend |
Reads FMatrix from stream
- Parameters
-
- Returns
- updated stream
in.open("tmp.txt");
in >> A;
◆ read
template<typename T, int M, int N>
| void read |
( |
std::istream & | in, |
|
|
FMatrix< T, M, N > & | A ) |
|
friend |
Reads FMatrix from binary stream
- Parameters
-
ifstream in("tmp.bin",ios::binary);
friend void read(std::istream &in, FMatrix &A)
Binary read.
Definition FMatrix.h:516
◆ write
template<typename T, int M, int N>
| void write |
( |
std::ostream & | out, |
|
|
const FMatrix< T, M, N > & | A ) |
|
friend |
Writes FMatrix to binary stream
- Parameters
-
ofstream out("tmp.bin",ios::binary);
friend void write(std::ostream &out, const FMatrix &A)
Binary write.
Definition FMatrix.h:505
The documentation for this class was generated from the following file:
- /home/pascal/Ponts/svn/ImagineQt/Imagine/Common/src/Imagine/Common/FMatrix.h