Jameo Core Library
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
jm::Vector Struct Reference

An n-dimensional vector. More...

Public Member Functions

 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.
 
Vectoroperator= (const Vector &another)
 

Public Attributes

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.
 

Friends

DllExport friend std::ostream & operator<< (std::ostream &out, const Vector &str)
 

Detailed Description

An n-dimensional vector.

Constructor & Destructor Documentation

◆ Vector() [1/3]

jm::Vector::Vector ( )

Constructor creates empty vector (m=0)

◆ Vector() [2/3]

jm::Vector::Vector ( const Vector another)

Copy constructor.

◆ Vector() [3/3]

jm::Vector::Vector ( size_t  rows)
explicit

Constructor creates an n-dimensional vector.

Parameters
rowsNumber of rows (dimensions) in the vector.

◆ ~Vector()

jm::Vector::~Vector ( )

Destructor.

Member Function Documentation

◆ 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
anotherThe 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=()

Vector & jm::Vector::operator= ( const Vector another)

◆ zeros()

void jm::Vector::zeros ( )

This method zeroes all entries of the vector.

Friends And Related Symbol Documentation

◆ operator<<

DllExport friend std::ostream & operator<< ( std::ostream &  out,
const Vector str 
)
friend

Member Data Documentation

◆ data

double* jm::Vector::data

This field stores the data of the vector. The length must always be m.

◆ m

size_t jm::Vector::m

This variable stores the number of rows in the vector.