Commit c13779a3 authored by Pawel Sznajder's avatar Pawel Sznajder
Browse files

Add documentation for VectorComplex* and MatrixComplex* #4

parent dbc2560a
...@@ -15,55 +15,70 @@ ...@@ -15,55 +15,70 @@
namespace NumA { namespace NumA {
/** /**
* 2x2 matrix of complex numbers * @class MatrixComplex2D
*
* @brief Matrix of complex numbers of size 2x2.
*
* This class represents a matrix of complex double precision numbers. The size of this matrix is 2x2.
*/ */
class MatrixComplex2D: public MatrixComplexD { class MatrixComplex2D: public MatrixComplexD {
public: public:
/** Default constructor /**
* Default constructor.
*/ */
MatrixComplex2D(); MatrixComplex2D();
/** Copy constructor /**
@param v Object to be copied * Copy constructor.
* @param v Object to be copied.
*/ */
MatrixComplex2D(const MatrixComplex2D& v); MatrixComplex2D(const MatrixComplex2D& v);
/** Copy constructor /**
@param v Object to be copied * Copy constructor.
* @param v Object to be copied.
*/ */
MatrixComplex2D(const MatrixComplexD& v); MatrixComplex2D(const MatrixComplexD& v);
/** Destructor /**
* Destructor.
*/ */
~MatrixComplex2D(); ~MatrixComplex2D();
/** Operator = /**
* Operator =.
*/ */
void operator=(const MatrixComplex2D& rhs); void operator=(const MatrixComplex2D& rhs);
/** Operator + /**
* Operator +.
*/ */
MatrixComplex2D operator+(const MatrixComplex2D& rhs); MatrixComplex2D operator+(const MatrixComplex2D& rhs);
/** Operator - /**
* Operator -.
*/ */
MatrixComplex2D operator-(const MatrixComplex2D& rhs); MatrixComplex2D operator-(const MatrixComplex2D& rhs);
/** Operator * by real number (rhs) /**
* Operator * by real number (rhs).
*/ */
MatrixComplex2D operator*(const double& rhs); MatrixComplex2D operator*(const double& rhs);
/** Operator * by real number (lhs) /**
* Operator * by real number (lhs).
*/ */
friend MatrixComplex2D operator*(const double& lhs, MatrixComplex2D& rhs); friend MatrixComplex2D operator*(const double& lhs, MatrixComplex2D& rhs);
/** Operator * by complex number (rhs) /**
* Operator * by complex number (rhs).
*/ */
MatrixComplex2D operator*(const std::complex<double>& rhs); MatrixComplex2D operator*(const std::complex<double>& rhs);
/** Operator * by complex number (lhs) /**
* Operator * by complex number (lhs).
*/ */
friend MatrixComplex2D operator*(const std::complex<double>& lhs, friend MatrixComplex2D operator*(const std::complex<double>& lhs,
MatrixComplex2D& rhs); MatrixComplex2D& rhs);
......
...@@ -15,55 +15,69 @@ ...@@ -15,55 +15,69 @@
namespace NumA { namespace NumA {
/** /**
* 3x3 matrix of complex numbers * @class MatrixComplex3D
*
* @brief Matrix of complex numbers of size 3x3.
*
* This class represents a matrix of complex double precision numbers. The size of this matrix is 3x3.
*/ */
class MatrixComplex3D: public MatrixComplexD { class MatrixComplex3D: public MatrixComplexD {
public: public:
/** Default constructor /**
* Default constructor.
*/ */
MatrixComplex3D(); MatrixComplex3D();
/** Copy constructor /**
@param v Object to be copied * Copy constructor.
* @param v Object to be copied.
*/ */
MatrixComplex3D(const MatrixComplex3D& v); MatrixComplex3D(const MatrixComplex3D& v);
/** Copy constructor /** Copy constructor.
@param v Object to be copied * @param v Object to be copied.
*/ */
MatrixComplex3D(const MatrixComplexD& v); MatrixComplex3D(const MatrixComplexD& v);
/** Destructor /**
* Destructor.
*/ */
~MatrixComplex3D(); ~MatrixComplex3D();
/** Operator = /**
* Operator =.
*/ */
void operator=(const MatrixComplex3D& rhs); void operator=(const MatrixComplex3D& rhs);
/** Operator + /**
* Operator +.
*/ */
MatrixComplex3D operator+(const MatrixComplex3D& rhs); MatrixComplex3D operator+(const MatrixComplex3D& rhs);
/** Operator - /**
* Operator -.
*/ */
MatrixComplex3D operator-(const MatrixComplex3D& rhs); MatrixComplex3D operator-(const MatrixComplex3D& rhs);
/** Operator * by real number (rhs) /**
* Operator * by real number (rhs).
*/ */
MatrixComplex3D operator*(const double& rhs); MatrixComplex3D operator*(const double& rhs);
/** Operator * by real number (lhs) /**
* Operator * by real number (lhs).
*/ */
friend MatrixComplex3D operator*(const double& lhs, MatrixComplex3D& rhs); friend MatrixComplex3D operator*(const double& lhs, MatrixComplex3D& rhs);
/** Operator * by complex number (rhs) /**
* Operator * by complex number (rhs).
*/ */
MatrixComplex3D operator*(const std::complex<double>& rhs); MatrixComplex3D operator*(const std::complex<double>& rhs);
/** Operator * by complex number (lhs) /**
* Operator * by complex number (lhs).
*/ */
friend MatrixComplex3D operator*(const std::complex<double>& lhs, friend MatrixComplex3D operator*(const std::complex<double>& lhs,
MatrixComplex3D& rhs); MatrixComplex3D& rhs);
......
...@@ -15,55 +15,70 @@ ...@@ -15,55 +15,70 @@
namespace NumA { namespace NumA {
/** /**
* 4x4 matrix of complex numbers * @class MatrixComplex4D
*
* @brief Matrix of complex numbers of size 4x4.
*
* This class represents a matrix of complex double precision numbers. The size of this matrix is 4x4.
*/ */
class MatrixComplex4D: public MatrixComplexD { class MatrixComplex4D: public MatrixComplexD {
public: public:
/** Default constructor /**
* Default constructor.
*/ */
MatrixComplex4D(); MatrixComplex4D();
/** Copy constructor /**
@param v Object to be copied * Copy constructor.
* @param v Object to be copied.
*/ */
MatrixComplex4D(const MatrixComplex4D& v); MatrixComplex4D(const MatrixComplex4D& v);
/** Copy constructor /**
@param v Object to be copied * Copy constructor.
* @param v Object to be copied.
*/ */
MatrixComplex4D(const MatrixComplexD& v); MatrixComplex4D(const MatrixComplexD& v);
/** Destructor /**
* Destructor.
*/ */
~MatrixComplex4D(); ~MatrixComplex4D();
/** Operator = /**
* Operator =.
*/ */
void operator=(const MatrixComplex4D& rhs); void operator=(const MatrixComplex4D& rhs);
/** Operator + /**
* Operator +.
*/ */
MatrixComplex4D operator+(const MatrixComplex4D& rhs); MatrixComplex4D operator+(const MatrixComplex4D& rhs);
/** Operator - /**
* Operator -.
*/ */
MatrixComplex4D operator-(const MatrixComplex4D& rhs); MatrixComplex4D operator-(const MatrixComplex4D& rhs);
/** Operator * by real number (rhs) /**
* Operator * by real number (rhs).
*/ */
MatrixComplex4D operator*(const double& rhs); MatrixComplex4D operator*(const double& rhs);
/** Operator * by real number (lhs) /**
* Operator * by real number (lhs).
*/ */
friend MatrixComplex4D operator*(const double& lhs, MatrixComplex4D& rhs); friend MatrixComplex4D operator*(const double& lhs, MatrixComplex4D& rhs);
/** Operator * by complex number (rhs) /**
* Operator * by complex number (rhs).
*/ */
MatrixComplex4D operator*(const std::complex<double>& rhs); MatrixComplex4D operator*(const std::complex<double>& rhs);
/** Operator * by complex number (lhs) /**
* Operator * by complex number (lhs).
*/ */
friend MatrixComplex4D operator*(const std::complex<double>& lhs, friend MatrixComplex4D operator*(const std::complex<double>& lhs,
MatrixComplex4D& rhs); MatrixComplex4D& rhs);
......
...@@ -14,110 +14,152 @@ ...@@ -14,110 +14,152 @@
namespace NumA { namespace NumA {
/** /**
* Matrix of complex numbers of undefined size * @class MatrixComplexD
*
* @brief Matrix of complex numbers of undefined size.
*
* This class represents a matrix of complex double precision numbers. The size of this matrix should be defined by the user.
*/ */
class MatrixComplexD { class MatrixComplexD {
public: public:
/** Default constructor /**
*/ * Default constructor.
MatrixComplexD(); */
MatrixComplexD();
/** Constructor with number of elements to be set
@param n Number of x elements /**
@param n Number of y elements * Assignemnt constructor.
*/ * Elements will be initialized with `std::complex<double>(0., 0.).`
MatrixComplexD(const unsigned int n, const unsigned int m); * @param n Size of x dim. to be set.
* @param m Size of y dim. to be set.
/** Copy constructor */
@param v Object to be copied MatrixComplexD(const unsigned int n, const unsigned int m);
*/
MatrixComplexD(const MatrixComplexD& v); /**
* Copy constructor
/** Destructor * @param v Object to be copied.
*/ */
virtual ~MatrixComplexD(); MatrixComplexD(const MatrixComplexD& v);
/** Dimension index /**
*/ * Destructor.
enum Dim { */
X = 1, Y = 2 virtual ~MatrixComplexD();
};
/**
/** Get conjunction of matrix * Dimension index.
*/ */
MatrixComplexD Conjunct() const; enum Dim {
X = 1, ///< Dim. x.
/** Multiply this with other matrix Y = 2 ///< Dim. y.
@param v Other matrix };
*/
MatrixComplexD Mult(const MatrixComplexD& v) const; /**
* Get conjunction of matrix.
/** Clear vector (set zeros to all elements) * Return: \f$M^{*}\f$.
*/ */
void Clear(); MatrixComplexD Conjunct() const;
/** Make unit (set ones to diagonal elements) /**
*/ * Multiply this with other matrix.
void MakeUnit(); * Return: \f$M N\f$.
* @param v Other matrix,
/** Operator = */
*/ MatrixComplexD Mult(const MatrixComplexD& v) const;
void operator=(const MatrixComplexD& rhs);
/**
/** Operator + * Clear vector (set `std::complex<double>(0., 0.)` to all elements).
*/ */
MatrixComplexD operator+(const MatrixComplexD& rhs); void Clear();
/** Operator - /**
*/ * Make unit (set `std::complex<double>(1., 0.)` to diagonal elements).
MatrixComplexD operator-(const MatrixComplexD& rhs); */
void MakeUnit();
/** Operator * by real number (rhs)
*/ /**
MatrixComplexD operator*(const double& rhs); * Operator =.
*/
/** Operator * by real number (lhs) void operator=(const MatrixComplexD& rhs);
*/
friend MatrixComplexD operator*(const double& lhs, MatrixComplexD& rhs); /**
* Operator +.
/** Operator * by complex number (rhs) */
*/ MatrixComplexD operator+(const MatrixComplexD& rhs);
MatrixComplexD operator*(const std::complex<double>& rhs);
/**
/** Operator * by complex number (lhs) * Operator -.
*/ */
friend MatrixComplexD operator*(const std::complex<double>& lhs, MatrixComplexD operator-(const MatrixComplexD& rhs);
MatrixComplexD& rhs);
/**
/** Get number of elements for given dimension * Operator * by real number (rhs).
@param v Dimension */
*/ MatrixComplexD operator*(const double& rhs);
unsigned int GetNElements(const Dim v) const;
/**
/** Set element * Operator * by real number (lhs).
@param i Index of x element */
@param j Index of y element friend MatrixComplexD operator*(const double& lhs, MatrixComplexD& rhs);
@param value Value to be set
*/ /**
void SetElement(const unsigned int i, const unsigned int j, * Operator * by complex number (rhs).
const std::complex<double> value); */
MatrixComplexD operator*(const std::complex<double>& rhs);
/** Get element
@param i Index of x element /**
@param j Index of y element * Operator * by complex number (lhs).
*/ */
std::complex<double> GetElement(const unsigned int i, friend MatrixComplexD operator*(const std::complex<double>& lhs,
const unsigned int j) const; MatrixComplexD& rhs);
/**
* Get dim. size for given dimension.
* @param v Dimension.
*/
unsigned int GetNElements(const Dim v) const;
/**
* Set element
* @param i Index of x element to be set.
* @param j Index of y element to be set.
* @param value Value to be set.
*/
void SetElement(const unsigned int i, const unsigned int j,
const std::complex<double> value);
/**
* Get element.
* @param i Index of x element to be retrieved.
* @param j Index of y element to be retrieved.
*/
std::complex<double> GetElement(const unsigned int i,
const unsigned int j) const;
private: private:
void CompareNElements(const MatrixComplexD& v) const; ///< Compare number of elements of this and other vector /**
* Compare number of elements of this and other vector.
unsigned int m_n; ///< Number of x elements * @param v Other matrix.
unsigned int m_m; ///< Number of y elements */
std::vector<std::vector<std::complex<double> > > m_elements; ///< Elements void CompareNElements(const MatrixComplexD& v) const;
/**
* Size of x dim.
*/
unsigned int m_n;
/**
* Size of y dim.
*/
unsigned int m_m;
/**
* Elements
*/
std::vector<std::vector<std::complex<double> > > m_elements;
}; };
} /* namespace NumA */ } /* namespace NumA */
......
...@@ -15,55 +15,69 @@ ...@@ -15,55 +15,69 @@
namespace NumA { namespace NumA {
/** /**
* 2D vector of complex numbers * @class VectorComplex2D
*
* @brief Vector of complex numbers of size 2.
*
* This class represents a vector of complex double precision numbers. The size of this vector is 2.
*/ */
class VectorComplex2D: public VectorComplexD { class VectorComplex2D: public VectorComplexD {
public: public: