Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 JNullType &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

JMATH::JMatrix1D::JMatrix1D ( )
inline

Default constructor.

Definition at line 44 of file JMatrix1D.hh.

44  :
45  a00(0.0)
46  {}
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

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  }
1 x 1 matrix
Definition: JMatrix1D.hh:32
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  }
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  }
JMatrix1D()
Default constructor.
Definition: JMatrix1D.hh:44
1 x 1 matrix
Definition: JMatrix1D.hh:32
JMatrix1D & setIdentity()
Set to identity matrix.
Definition: JMatrix1D.hh:77
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  }
1 x 1 matrix
Definition: JMatrix1D.hh:32
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
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  }
JMatrix1D()
Default constructor.
Definition: JMatrix1D.hh:44
JMatrix1D& JMATH::JMatrix1D::transpose ( )
inline

Transpose.

Returns
this matrix

Definition at line 127 of file JMatrix1D.hh.

128  {
129  return *this;
130  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
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  }
static const JMatrix1D & getIdentity()
Get reference to unique instance of this class object.
Definition: JMatrix1D.hh:90
bool equals(const JMatrix1D &A, const double eps=std::numeric_limits< double >::min()) const
Equality.
Definition: JMatrix1D.hh:225
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  }
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  }
JMatrix1D & JMATH::JMath< JMatrix1D , JNullType >::mul ( const JNullType &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Friends And Related Function Documentation

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  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:38
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  }
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  const JFormat format(out, getFormat<JMatrix1D>(JFormat_t(10, 3, std::ios::fixed | std::ios::showpos)));
308 
309  out << format << A.a00 << endl;
310 
311  return out;
312  }
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632
Data structure for format specifications.
Definition: JManip.hh:522

Member Data Documentation

double JMATH::JMatrix1D::a00

Definition at line 315 of file JMatrix1D.hh.


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