Jpp  18.5.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
JMATH::JVectorND Struct Reference

Nx1 matrix. More...

#include <JVectorND.hh>

Inheritance diagram for JMATH::JVectorND:
std::vector< double > JFIT::JVectorNZ

Public Member Functions

 JVectorND ()
 Default constructor. More...
 
 JVectorND (size_t size)
 Constructor. More...
 
void reset ()
 Reset. More...
 
double getDot (const JVectorND &vector) const
 Get dot product. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const JVectorND &object)
 Print ASCII formatted output. More...
 

Detailed Description

Nx1 matrix.

Definition at line 21 of file JVectorND.hh.

Constructor & Destructor Documentation

JMATH::JVectorND::JVectorND ( )
inline

Default constructor.

Definition at line 27 of file JVectorND.hh.

JMATH::JVectorND::JVectorND ( size_t  size)
inline

Constructor.

Parameters
sizesize

Definition at line 37 of file JVectorND.hh.

37  :
38  std::vector<double>(size, 0.0)
39  {}

Member Function Documentation

void JMATH::JVectorND::reset ( )
inline

Reset.

Definition at line 45 of file JVectorND.hh.

46  {
47  for (iterator i = this->begin(); i != this->end(); ++i) {
48  *i = 0.0;
49  }
50  }
double JMATH::JVectorND::getDot ( const JVectorND vector) const
inline

Get dot product.

Parameters
vectorvector
Returns
dot product

Definition at line 59 of file JVectorND.hh.

60  {
61  double dot = 0.0;
62 
63  const double* p = this-> data();
64  const double* q = vector.data();
65 
66  for (size_t i = this->size(); i != 0; --i, ++p, ++q) {
67  dot += (*p) * (*q);
68  }
69 
70  return dot;
71  }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const JVectorND object 
)
friend

Print ASCII formatted output.

Parameters
outoutput stream
objectNx1 matrix
Returns
output stream

Definition at line 81 of file JVectorND.hh.

82  {
83  using namespace std;
84 
85  const JFormat format(out, getFormat<JVectorND>(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
86 
87  for (JVectorND::const_iterator i = object.begin(); i != object.end(); ++i) {
88  out << format << *i << ' ';
89  }
90 
91  out << endl;
92 
93  return out;
94  }
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:634
Data structure for format specifications.
Definition: JManip.hh:524

The documentation for this struct was generated from the following file: