pimathvector_tests #38

Closed
andrey wants to merge 14 commits from pimathvector_tests into master
2 changed files with 36 additions and 5 deletions
Showing only changes of commit 2b73c106e7 - Show all commits

View File

@@ -92,7 +92,7 @@ public:
/**
* @brief Constructor that calls the private resize method
*
* @return identitied matrix of type PIMathMatrixT
* @return resized matrix of type PIMathMatrixT
*/
PIMathMatrixT() { resize(Rows, Cols); }
@@ -100,7 +100,7 @@ public:
* @brief Constructor that calls the private resize method
*
* @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) {
resize(Rows, Cols);

View File

@@ -1,5 +1,7 @@
/*! \file pimathvector.h
* \brief PIMathVector
*
* This file declare math vector class, which performs various vector operations
*/
/*
PIP - Platform Independent Primitives
@@ -33,15 +35,44 @@ class PIMathMatrixT;
#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>
class PIP_EXPORT PIMathVectorT {
typedef PIMathVectorT<Size, Type> _CVector;
static_assert(std::is_arithmetic<Type>::value, "Type must be arithmetic");
public:
/**
* @brief Constructor that calls the private resize method
*
* @return resized vector of type PIMathMatrixT
*/
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];}
/**
* @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);}
/**
* @brief Method which returns size of the vector
*
* @return type uint shows number of elements in this vector
*/
uint size() const {return Size;}
_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;}