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