An n-dimensional vector.
More...
|
| | Vector () |
| | Constructor creates empty vector (m=0)
|
| |
| | Vector (const Vector &another) |
| | Copy constructor.
|
| |
| | Vector (size_t rows) |
| | Constructor creates an n-dimensional vector.
|
| |
| | ~Vector () |
| | Destructor.
|
| |
| double | abs () const |
| | This method returns the absolute value of the vector.
|
| |
| void | normalize () |
| | This method normalises the vector. The length of the vector is set to 1. The direction remains the same.
|
| |
| void | zeros () |
| | This method zeroes all entries of the vector.
|
| |
| void | ones () |
| | This method sets all entries of the vector to 1.0.
|
| |
| double | dotProduct (const Vector &another) const |
| | Returns the scalar product of one vector with another.
|
| |
| Vector & | operator= (const Vector &another) |
| |
|
| size_t | m |
| | This variable stores the number of rows in the vector.
|
| |
| double * | data |
| | This field stores the data of the vector. The length must always be m.
|
| |
|
| DllExport friend std::ostream & | operator<< (std::ostream &out, const Vector &str) |
| |
◆ Vector() [1/3]
Constructor creates empty vector (m=0)
◆ Vector() [2/3]
| jm::Vector::Vector |
( |
const Vector & |
another | ) |
|
◆ Vector() [3/3]
| jm::Vector::Vector |
( |
size_t |
rows | ) |
|
|
explicit |
Constructor creates an n-dimensional vector.
- Parameters
-
| rows | Number of rows (dimensions) in the vector. |
◆ ~Vector()
◆ abs()
| double jm::Vector::abs |
( |
| ) |
const |
This method returns the absolute value of the vector.
◆ dotProduct()
| double jm::Vector::dotProduct |
( |
const Vector & |
another | ) |
const |
Returns the scalar product of one vector with another.
-
If the scalar product is 0, then two vectors are perpendicular to each other.
-
If the scalar conduct > 0, then the included angle is acute.
-
If the scalar conduct < 0, then the included angle is obtuse.
-
For normalised vectors, the scalar product corresponds to the projection of one vector onto the other.
- Parameters
-
| another | The vector with which the scalar product "this × other" is formed. |
◆ normalize()
| void jm::Vector::normalize |
( |
| ) |
|
This method normalises the vector. The length of the vector is set to 1. The direction remains the same.
◆ ones()
| void jm::Vector::ones |
( |
| ) |
|
This method sets all entries of the vector to 1.0.
◆ operator=()
◆ zeros()
| void jm::Vector::zeros |
( |
| ) |
|
This method zeroes all entries of the vector.
◆ operator<<
| DllExport friend std::ostream & operator<< |
( |
std::ostream & |
out, |
|
|
const Vector & |
str |
|
) |
| |
|
friend |
◆ data
This field stores the data of the vector. The length must always be m.
This variable stores the number of rows in the vector.