Jpp
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
JMATH::JMatrix1D Class Reference

1 x 1 matrix More...

#include <JMatrix1D.hh>

Inheritance diagram for JMATH::JMatrix1D:
JMATH::JMath< JMatrix1D > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JMatrix1S

Public Member Functions

 JMatrix1D ()
 Default constructor. More...
 
 JMatrix1D (const double __a00)
 Contructor. More...
 
JMatrix1D & setIdentity ()
 Set to identity matrix. More...
 
void set (const JMatrix1D &A)
 Set matrix. More...
 
JMatrix1D & reset ()
 Set matrix to the null matrix. More...
 
JMatrix1D & transpose ()
 Transpose. More...
 
JMatrix1D & negate ()
 Negate matrix. More...
 
JMatrix1D & add (const JMatrix1D &A)
 Matrix addition. More...
 
JMatrix1D & sub (const JMatrix1D &A)
 Matrix subtraction. More...
 
JMatrix1D & mul (const double factor)
 Scale matrix. More...
 
JMatrix1D & div (const double factor)
 Scale matrix. More...
 
JMatrix1D & mul (const JMatrix1D &A, const JMatrix1D &B)
 Matrix multiplication. More...
 
bool equals (const JMatrix1D &A, const double eps=std::numeric_limits< double >::min()) const
 Equality. More...
 
bool isIdentity (const double eps=std::numeric_limits< double >::min()) const
 Test identity. More...
 
double getDeterminant () const
 Get determinant of matrix. More...
 
void transform (double &__x) const
 Transform. More...
 
JMatrix1D & mul (const JSecond_t &object)
 Multiply with object. More...
 

Static Public Member Functions

static const JMatrix1D & getInstance ()
 Get reference to unique instance of this class object. More...
 
static const JMatrix1D & getIdentity ()
 Get reference to unique instance of this class object. More...
 

Public Attributes

double a00
 

Friends

JReader & operator>> (JReader &in, JMatrix1D &matrix)
 Read matrix from input. More...
 
JWriter & operator<< (JWriter &out, const JMatrix1D &matrix)
 Write matrix to output. More...
 
std::ostream & operator<< (std::ostream &out, const JMatrix1D &A)
 Print ASCII formatted output. More...
 

Detailed Description

1 x 1 matrix

Definition at line 32 of file JMatrix1D.hh.

Constructor & Destructor Documentation

◆ JMatrix1D() [1/2]

JMATH::JMatrix1D::JMatrix1D ( )
inline

Default constructor.

Definition at line 44 of file JMatrix1D.hh.

44  :
45  a00(0.0)
46  {}

◆ JMatrix1D() [2/2]

JMATH::JMatrix1D::JMatrix1D ( const double  __a00)
inline

Contructor.

Parameters
__a00(0,0)

Definition at line 54 of file JMatrix1D.hh.

54  :
55  a00(__a00)
56  {}

Member Function Documentation

◆ getInstance()

static const JMatrix1D& JMATH::JMatrix1D::getInstance ( )
inlinestatic

Get reference to unique instance of this class object.

Returns
zero matrix

Definition at line 64 of file JMatrix1D.hh.

65  {
66  static JMatrix1D matrix;
67 
68  return matrix;
69  }

◆ setIdentity()

JMatrix1D& JMATH::JMatrix1D::setIdentity ( )
inline

Set to identity matrix.

Returns
this matrix

Definition at line 77 of file JMatrix1D.hh.

78  {
79  a00 = 1.0;
80 
81  return *this;
82  }

◆ getIdentity()

static const JMatrix1D& JMATH::JMatrix1D::getIdentity ( )
inlinestatic

Get reference to unique instance of this class object.

Returns
identity matrix

Definition at line 90 of file JMatrix1D.hh.

91  {
92  static JMatrix1D matrix(JMatrix1D().setIdentity());
93 
94  return matrix;
95  }

◆ set()

void JMATH::JMatrix1D::set ( const JMatrix1D &  A)
inline

Set matrix.

Parameters
Amatrix

Definition at line 103 of file JMatrix1D.hh.

104  {
105  static_cast<JMatrix1D&>(*this) = A;
106  }

◆ reset()

JMatrix1D& JMATH::JMatrix1D::reset ( )
inline

Set matrix to the null matrix.

Returns
this matrix

Definition at line 114 of file JMatrix1D.hh.

115  {
116  *this = JMatrix1D();
117 
118  return *this;
119  }

◆ transpose()

JMatrix1D& JMATH::JMatrix1D::transpose ( )
inline

Transpose.

Returns
this matrix

Definition at line 127 of file JMatrix1D.hh.

128  {
129  return *this;
130  }

◆ negate()

JMatrix1D& JMATH::JMatrix1D::negate ( )
inline

Negate matrix.

Returns
-this matrix

Definition at line 138 of file JMatrix1D.hh.

139  {
140  a00 = -a00;
141 
142  return *this;
143  }

◆ add()

JMatrix1D& JMATH::JMatrix1D::add ( const JMatrix1D &  A)
inline

Matrix addition.

Parameters
Amatrix
Returns
this matrix + A

Definition at line 152 of file JMatrix1D.hh.

153  {
154  a00 += A.a00;
155 
156  return *this;
157  }

◆ sub()

JMatrix1D& JMATH::JMatrix1D::sub ( const JMatrix1D &  A)
inline

Matrix subtraction.

Parameters
Amatrix
Returns
this matrix - A

Definition at line 166 of file JMatrix1D.hh.

167  {
168  a00 -= A.a00;
169 
170  return *this;
171  }

◆ mul() [1/3]

JMatrix1D& JMATH::JMatrix1D::mul ( const double  factor)
inline

Scale matrix.

Parameters
factorfactor
Returns
this matrix * factor

Definition at line 180 of file JMatrix1D.hh.

181  {
182  a00 *= factor;
183 
184  return *this;
185  }

◆ div()

JMatrix1D& JMATH::JMatrix1D::div ( const double  factor)
inline

Scale matrix.

Parameters
factorfactor
Returns
this matrix / factor

Definition at line 194 of file JMatrix1D.hh.

195  {
196  a00 /= factor;
197 
198  return *this;
199  }

◆ mul() [2/3]

JMatrix1D& JMATH::JMatrix1D::mul ( const JMatrix1D &  A,
const JMatrix1D &  B 
)
inline

Matrix multiplication.

Parameters
Amatrix
Bmatrix
Returns
this matrix

Definition at line 209 of file JMatrix1D.hh.

211  {
212  a00 = A.a00 * B.a00;
213 
214  return *this;
215  }

◆ equals()

bool JMATH::JMatrix1D::equals ( const JMatrix1D &  A,
const double  eps = std::numeric_limits<double>::min() 
) const
inline

Equality.

Parameters
Amatrix
epsnumerical precision
Returns
true if matrices identical; else false

Definition at line 225 of file JMatrix1D.hh.

227  {
228  return (fabs(a00 - A.a00) <= eps);
229  }

◆ isIdentity()

bool JMATH::JMatrix1D::isIdentity ( const double  eps = std::numeric_limits<double>::min()) const
inline

Test identity.

Parameters
epsnumerical precision
Returns
true if identity matrix; else false

Definition at line 238 of file JMatrix1D.hh.

239  {
240  return equals(getIdentity(), eps);
241  }

◆ getDeterminant()

double JMATH::JMatrix1D::getDeterminant ( ) const
inline

Get determinant of matrix.

Returns
determinant of matrix

Definition at line 249 of file JMatrix1D.hh.

250  {
251  return a00;
252  }

◆ transform()

void JMATH::JMatrix1D::transform ( double &  __x) const
inline

Transform.

Parameters
__xx value

Definition at line 260 of file JMatrix1D.hh.

261  {
262  __x = a00 * __x;
263  }

◆ mul() [3/3]

JMatrix1D & JMATH::JMath< JMatrix1D , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

Friends And Related Function Documentation

◆ operator>>

JReader& operator>> ( JReader &  in,
JMatrix1D &  matrix 
)
friend

Read matrix from input.

Parameters
inreader
matrixmatrix
Returns
reader

Definition at line 273 of file JMatrix1D.hh.

274  {
275  in >> matrix.a00;
276 
277  return in;
278  }

◆ operator<< [1/2]

JWriter& operator<< ( JWriter &  out,
const JMatrix1D &  matrix 
)
friend

Write matrix to output.

Parameters
outwriter
matrixmatrix
Returns
writer

Definition at line 288 of file JMatrix1D.hh.

289  {
290  out << matrix.a00;
291 
292  return out;
293  }

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  out,
const JMatrix1D &  A 
)
friend

Print ASCII formatted output.

Parameters
outoutput stream
Amatrix
Returns
output stream

Definition at line 303 of file JMatrix1D.hh.

304  {
305  using namespace std;
306 
307  JFlags flags(out);
308 
309  out << FIXED(10,2) << A.a00 << endl;
310 
311  return out;
312  }

Member Data Documentation

◆ a00

double JMATH::JMatrix1D::a00

Definition at line 315 of file JMatrix1D.hh.


The documentation for this class was generated from the following file:
FIXED
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481
JMATH::JMatrix1D::equals
bool equals(const JMatrix1D &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
Definition: JMatrix1D.hh:225
JMATH::JMatrix1D::JMatrix1D
JMatrix1D()
Default constructor.
Definition: JMatrix1D.hh:44
JMATH::JMatrix1D
1 x 1 matrix
Definition: JMatrix1D.hh:32
JMATH::JMatrix1D::getIdentity
static const JMatrix1D & getIdentity()
Get reference to unique instance of this class object.
Definition: JMatrix1D.hh:90
JFlags
Auxiliary class to temporarily modify format specifications.
Definition: JPrint.hh:617
std
Definition: jaanetDictionary.h:36
JMATH::JMatrix1D::setIdentity
JMatrix1D & setIdentity()
Set to identity matrix.
Definition: JMatrix1D.hh:77
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JMATH::JMatrix1D::a00
double a00
Definition: JMatrix1D.hh:315