HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Protected Attributes | Friends | List of all members
HyperPoint Class Reference

Detailed Description

HyperPlot, Author: Sam Harnew, sam.h.nosp@m.arne.nosp@m.w@gma.nosp@m.il.c.nosp@m.om , Date: Dec 2015

A point in multi-dimensional space

Definition at line 26 of file HyperPoint.h.

#include <HyperPoint.h>

Inheritance diagram for HyperPoint:
Weights

Public Member Functions

 HyperPoint (int dimension)
 
 HyperPoint (int dimension, double val)
 
 HyperPoint (std::vector< double > coords)
 
 HyperPoint (double x1)
 
 HyperPoint (double x1, double x2)
 
 HyperPoint (double x1, double x2, double x3)
 
 HyperPoint (double x1, double x2, double x3, double x4)
 
 HyperPoint (double x1, double x2, double x3, double x4, double x5)
 
const std::vector< double > & getVector ()
 
HyperPoint linearTransformation (const TMatrixD &matrix)
 
virtual void print (std::ostream &os=std::cout, int endline=1) const
 
const double & at (int i) const
 
double & at (int i)
 
HyperPointoperator= (const HyperPoint &other)
 
HyperPoint operator+ (const HyperPoint &other) const
 
HyperPoint operator- (const HyperPoint &other) const
 
HyperPoint operator- (const double &other) const
 
HyperPoint operator+ (const double &other) const
 
HyperPoint operator/ (const double &other) const
 
HyperPoint operator* (const double &other) const
 
bool operator< (const HyperPoint &other) const
 
bool operator> (const HyperPoint &other) const
 
bool operator<= (const HyperPoint &other) const
 
bool operator>= (const HyperPoint &other) const
 
bool operator== (const HyperPoint &other) const
 
bool operator!= (const HyperPoint &other) const
 
bool allLT (const HyperPoint &other) const
 
bool allGT (const HyperPoint &other) const
 
bool allLTOE (const HyperPoint &other) const
 
bool allGTOE (const HyperPoint &other) const
 
bool operator< (const double &other) const
 
bool operator> (const double &other) const
 
bool operator<= (const double &other) const
 
bool operator>= (const double &other) const
 
bool operator== (const double &other) const
 
double multiplyElements () const
 
double dotProduct (const HyperPoint &other) const
 
void fillRandom (double min=-1.0, double max=1.0)
 
HyperPoint project (const HyperPoint &other) const
 
double distanceTo (const HyperPoint &other) const
 
double norm () const
 
double norm2 () const
 
int size () const
 
int getDimension () const
 
bool compatible (const HyperPoint &other, bool printError=true) const
 
 ~HyperPoint ()
 
- Public Member Functions inherited from Weights
 Weights ()
 
 Weights (double weight)
 
int numWeights () const
 
const std::vector< double > & getWeightsVector ()
 
void printWeight (std::ostream &os=std::cout, int endline=1) const
 
double getWeight (int i=0) const
 
void setWeight (int i, double w)
 
void setWeight (double w)
 
void addWeight (const double &weight)
 

Protected Attributes

std::vector< double > _coords
 
- Protected Attributes inherited from Weights
std::vector< double > _weights
 

Friends

std::ostream & operator<< (std::ostream &os, const HyperPoint &point)
 

Constructor & Destructor Documentation

HyperPoint::HyperPoint ( int  dimension)

Most basic constructor that makes a HyperPoint with a specified dimension, and filled with 0.0 for each element.

Definition at line 5 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( int  dimension,
double  val 
)

Constructor that makes a HyperPoint with a specified dimension, and fills each element with a specified value.

Definition at line 13 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( std::vector< double >  coords)

Constuctor that takes a std::vector of elements

Definition at line 20 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( double  x1)

Constuctor for a 1D space.

Definition at line 27 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( double  x1,
double  x2 
)

Constuctor for a 2D space.

Definition at line 35 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( double  x1,
double  x2,
double  x3 
)

Constuctor for a 3D space.

Definition at line 44 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( double  x1,
double  x2,
double  x3,
double  x4 
)

Constuctor for a 4D space.

Definition at line 54 of file HyperPoint.cpp.

HyperPoint::HyperPoint ( double  x1,
double  x2,
double  x3,
double  x4,
double  x5 
)

Constuctor for a 5D space.

Definition at line 65 of file HyperPoint.cpp.

HyperPoint::~HyperPoint ( )

Destructor

Definition at line 452 of file HyperPoint.cpp.

Member Function Documentation

bool HyperPoint::allGT ( const HyperPoint other) const

Checks if every element of v2 is greater than the same element in v2. i.e. v1_0 > v2_0 && v1_1 > v2_1 && ...

Definition at line 321 of file HyperPoint.cpp.

bool HyperPoint::allGTOE ( const HyperPoint other) const

Checks if every element of v1 is greater than or equal to the same element in v2. i.e. v1_0 >= v2_0 && v1_1 >= v2_1 && ...

Definition at line 343 of file HyperPoint.cpp.

bool HyperPoint::allLT ( const HyperPoint other) const

Checks if every element of v1 is less than the same element in v2. i.e. v1_0 < v2_0 && v1_1 < v2_1 && ...

Definition at line 310 of file HyperPoint.cpp.

bool HyperPoint::allLTOE ( const HyperPoint other) const

Checks if every element of v1 is less than or equal to the same element in v2. i.e. v1_0 <= v2_0 && v1_1 <= v2_1 && ...

Definition at line 332 of file HyperPoint.cpp.

const double & HyperPoint::at ( int  i) const

returns a const reference to a choosen element of the HyperPoint. Can be used for getting the value, but not setting

Definition at line 407 of file HyperPoint.cpp.

double & HyperPoint::at ( int  i)

returns a reference to a choosen element of the HyperPoint. Can be used for getting or setting it's value.

Definition at line 417 of file HyperPoint.cpp.

bool HyperPoint::compatible ( const HyperPoint other,
bool  printError = true 
) const

Check if two HyperPoints are compatible (of the same dimension)

Definition at line 85 of file HyperPoint.cpp.

double HyperPoint::distanceTo ( const HyperPoint other) const

Find the distance between this point and another

Definition at line 97 of file HyperPoint.cpp.

double HyperPoint::dotProduct ( const HyperPoint other) const

Find the dot product of two points

Definition at line 121 of file HyperPoint.cpp.

void HyperPoint::fillRandom ( double  min = -1.0,
double  max = 1.0 
)

Fill the point with random numbers, uniformly distributed between min and max. Uses gRandom for random number.

Definition at line 131 of file HyperPoint.cpp.

int HyperPoint::getDimension ( ) const
inline

get the dimensionality of the HyperPoint

Definition at line 97 of file HyperPoint.h.

const std::vector<double>& HyperPoint::getVector ( )
inline

Get the std::vector<double> that contains the coordinates

Definition at line 46 of file HyperPoint.h.

HyperPoint HyperPoint::linearTransformation ( const TMatrixD &  matrix)

Perform a linear transformation on the HyperPoint using a specified matrix. v_new = v_old M Leave weights unchanged.

Definition at line 240 of file HyperPoint.cpp.

double HyperPoint::multiplyElements ( ) const

Multiply all the elements together.

Definition at line 77 of file HyperPoint.cpp.

double HyperPoint::norm ( ) const

Find the norm = sqrt(x1^2 + x2^2 + ...)

Definition at line 105 of file HyperPoint.cpp.

double HyperPoint::norm2 ( ) const

Find the norm squared =(x1^2 + x2^2 + ...)

Definition at line 113 of file HyperPoint.cpp.

bool HyperPoint::operator!= ( const HyperPoint other) const

Checks if two HyperPoints are not identical

Definition at line 363 of file HyperPoint.cpp.

HyperPoint HyperPoint::operator* ( const double &  other) const

Multiply all elements of a HyperPoint by one value. Leave weights unchanged.

Definition at line 227 of file HyperPoint.cpp.

HyperPoint HyperPoint::operator+ ( const HyperPoint other) const

Add elements of two HyperPoints together - leave weights unchanged.

Definition at line 163 of file HyperPoint.cpp.

HyperPoint HyperPoint::operator+ ( const double &  other) const

Add one value to all elements of the HyperPoint. Leave weights unchanged.

Definition at line 203 of file HyperPoint.cpp.

HyperPoint HyperPoint::operator- ( const HyperPoint other) const

Subtract one HyperPoint from another - leave weights unchanged.

Definition at line 177 of file HyperPoint.cpp.

HyperPoint HyperPoint::operator- ( const double &  other) const

Subtract one value from all elements of the HyperPoint. Leave weights unchanged.

Definition at line 191 of file HyperPoint.cpp.

HyperPoint HyperPoint::operator/ ( const double &  other) const

Divide all elements of a HyperPoint by one value. Leave weights unchanged.

Definition at line 215 of file HyperPoint.cpp.

bool HyperPoint::operator< ( const HyperPoint other) const

Perform a linear transformation on the HyperPoint using a specified matrix. v_new = v_old M Leave weights unchanged.

Definition at line 259 of file HyperPoint.cpp.

bool HyperPoint::operator< ( const double &  other) const

Checks if all elements of a HyperPoint are smaller than a given value

Definition at line 372 of file HyperPoint.cpp.

bool HyperPoint::operator<= ( const HyperPoint other) const

Compare two HyperPoints. First compares 0th element of each HyperPoint, if these are the same, compares the next, etc.

Definition at line 285 of file HyperPoint.cpp.

bool HyperPoint::operator<= ( const double &  other) const

Checks if all elements of a HyperPoint are smaller than or equal to a given value

Definition at line 386 of file HyperPoint.cpp.

HyperPoint & HyperPoint::operator= ( const HyperPoint other)

Copy all elements and weights from other HyperPoint to this. Only function that allows the dimensionality of a point to be changed after it is created. Should be careful with this, for instance a HyperPointSet only accepts HyperPoint's of the same dimension. If you change the dimensionality of a point after it has been added, this could cause big problems.

Definition at line 152 of file HyperPoint.cpp.

bool HyperPoint::operator== ( const HyperPoint other) const

Checks if two HyperPoints are identical

Definition at line 354 of file HyperPoint.cpp.

bool HyperPoint::operator== ( const double &  other) const

Checks if all elements of a HyperPoint are equal to a given value

Definition at line 400 of file HyperPoint.cpp.

bool HyperPoint::operator> ( const HyperPoint other) const

Compare two HyperPoints. First compares 0th element of each HyperPoint, if these are the same, compares the next, etc.

Definition at line 272 of file HyperPoint.cpp.

bool HyperPoint::operator> ( const double &  other) const

Checks if all elements of a HyperPoint are greater than a given value

Definition at line 379 of file HyperPoint.cpp.

bool HyperPoint::operator>= ( const HyperPoint other) const

Compare two HyperPoints. First compares 0th element of each HyperPoint, if these are the same, compares the next, etc.

Definition at line 298 of file HyperPoint.cpp.

bool HyperPoint::operator>= ( const double &  other) const

Checks if all elements of a HyperPoint are greater than or equal to a given value

Definition at line 393 of file HyperPoint.cpp.

void HyperPoint::print ( std::ostream &  os = std::cout,
int  endline = 1 
) const
virtual

Print the HyperPoint to the given std::ostream (default is std::cout).

Definition at line 427 of file HyperPoint.cpp.

HyperPoint HyperPoint::project ( const HyperPoint other) const

Project this vector onto another = v1 (v1.v2/v1.v1)

Definition at line 138 of file HyperPoint.cpp.

int HyperPoint::size ( ) const
inline

get the dimensionality of the HyperPoint

Definition at line 94 of file HyperPoint.h.

Member Data Documentation

std::vector<double> HyperPoint::_coords
protected

The coordinates of the point in muli-dimensional spave

Definition at line 30 of file HyperPoint.h.


The documentation for this class was generated from the following files: