bug fixes in pimathmatrix and begin of docs in pimathvector

This commit is contained in:
2020-09-17 18:28:28 +03:00
parent 0a458d28f3
commit 2b73c106e7
2 changed files with 36 additions and 5 deletions

View File

@@ -92,7 +92,7 @@ public:
/** /**
* @brief Constructor that calls the private resize method * @brief Constructor that calls the private resize method
* *
* @return identitied matrix of type PIMathMatrixT * @return resized matrix of type PIMathMatrixT
*/ */
PIMathMatrixT() { resize(Rows, Cols); } PIMathMatrixT() { resize(Rows, Cols); }
@@ -100,7 +100,7 @@ public:
* @brief Constructor that calls the private resize method * @brief Constructor that calls the private resize method
* *
* @param val is the PIVector with which the matrix is filled * @param val is the PIVector with which the matrix is filled
* @return identitied matrix of type PIMathMatrixT * @return resized matrix of type PIMathMatrixT
*/ */
PIMathMatrixT(const PIVector<Type> &val) { PIMathMatrixT(const PIVector<Type> &val) {
resize(Rows, Cols); resize(Rows, Cols);

View File

@@ -1,5 +1,7 @@
/*! \file pimathvector.h /*! \file pimathvector.h
* \brief PIMathVector * \brief PIMathVector
*
* This file declare math vector class, which performs various vector operations
*/ */
/* /*
PIP - Platform Independent Primitives PIP - Platform Independent Primitives
@@ -33,15 +35,44 @@ class PIMathMatrixT;
#define PIMV_FOR(v, s) for (uint v = s; v < Size; ++v) #define PIMV_FOR(v, s) for (uint v = s; v < Size; ++v)
//! \brief A class that works with vector operations, the input data of which are size and the data type of the vector
//! @tparam Size number of matrix elements
//! @tparam Type is the data type of the vector. There are can be basic C++ language data and different classes where the arithmetic operators(=, +=, -=, *=, /=, ==, !=, +, -, *, /)
//! of the C++ language are implemented
template<uint Size, typename Type = double> template<uint Size, typename Type = double>
class PIP_EXPORT PIMathVectorT { class PIP_EXPORT PIMathVectorT {
typedef PIMathVectorT<Size, Type> _CVector; typedef PIMathVectorT<Size, Type> _CVector;
static_assert(std::is_arithmetic<Type>::value, "Type must be arithmetic"); static_assert(std::is_arithmetic<Type>::value, "Type must be arithmetic");
public: public:
/**
* @brief Constructor that calls the private resize method
*
* @return resized vector of type PIMathMatrixT
*/
PIMathVectorT() {resize();} PIMathVectorT() {resize();}
/**
* @brief Constructor that fills a vector "PIMathVectorT" with the values of another vector "PIVector"
*
* @tparam val vector of type PIVector which is identified PIMathVectorT
* @return vector of type PIMathVectorT with values of vector val
*/
PIMathVectorT(const PIVector<Type> & val) {resize(); PIMV_FOR(i, 0) c[i] = val[i];} PIMathVectorT(const PIVector<Type> & val) {resize(); PIMV_FOR(i, 0) c[i] = val[i];}
/**
* @brief Constructor that fills a vector "PIMathVectorT" with the subtraction of two vectors
*
* @tparam st vector of type _CVector
* @tparam fn vector of type _CVector
* @return vector of type PIMathVectorT with values subtraction vectors "fn" and "st"
*/
PIMathVectorT(const _CVector & st, const _CVector & fn) {resize(); set(st, fn);} PIMathVectorT(const _CVector & st, const _CVector & fn) {resize(); set(st, fn);}
/**
* @brief Method which returns size of the vector
*
* @return type uint shows number of elements in this vector
*/
uint size() const {return Size;} uint size() const {return Size;}
_CVector & fill(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;} _CVector & fill(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
_CVector & set(const _CVector & st, const _CVector & fn) {PIMV_FOR(i, 0) c[i] = fn[i] - st[i]; return *this;} _CVector & set(const _CVector & st, const _CVector & fn) {PIMV_FOR(i, 0) c[i] = fn[i] - st[i]; return *this;}