/** * @brief Ones matrix * * @param col Column * @param lin Rows * @param cha Dimension * @param set Dimension * @param eco Dimension * @param phs Dimension * @param rep Dimension * @param seg Dimension * @param par Dimension * @param slc Dimension * @param ida Dimension * @param idb Dimension * @param idc Dimension * @param idd Dimension * @param ide Dimension * @param ave Dimension * * @return Ones matrix * */ template <class T> inline static Matrix<T> ones (const size_t& col, const size_t& lin, const size_t& cha = 1, const size_t& set = 1, const size_t& eco = 1, const size_t& phs = 1, const size_t& rep = 1, const size_t& seg = 1, const size_t& par = 1, const size_t& slc = 1, const size_t& ida = 1, const size_t& idb = 1, const size_t& idc = 1, const size_t& idd = 1, const size_t& ide = 1, const size_t& ave = 1) { Matrix<T> res (col, lin, cha, set, eco, phs, rep, seg, par, slc, ida, idb, idc, idd, ide, ave); std::fill (res.Begin(), res.End(), T(1)); return res; }
template <class T> inline static T sum2 (const Matrix<T>& M) { return std::accumulate (M.Begin(), M.End(), (T)1, std::plus<T>()); }
/** * @brief Product of all elements * * Usage: * @code * Matrix<cxfl> m = rand<double> (8,7,6); * m = prod (m); * @endcode * * @param M Matrix * @return Sum of M along dimension d */ template <class T> inline static T prod (const Matrix<T>& M) { return std::accumulate(M.Begin(), M.End(), T(1), c_multiply<T>); }
template<class T> inline static T mmin (const Matrix<T>& M) { return *std::min_element(M.Begin(), M.End()); }