================ Lösungsvorschlag [TOC] ================ swap ==== ==== CODE (type=cc) ============================================================ #ifndef HPC_MATVEC_SWAP_H #define HPC_MATVEC_SWAP_H 1 #include #include #include #include namespace hpc { namespace matvec { template typename std::enable_if::value && IsDenseVector::value, void>::type swap(VX &&x, VY &&y) { assert(x.length==y.length); return ulmblas::swap(x.length, x.data, x.inc, y.data, y.inc); } } } // namespace matvec, hpc #endif // HPC_MATVEC_SWAP_H ================================================================================ iamax ===== ==== CODE (type=cc) ============================================================ #ifndef HPC_MATVEC_IAMAX_H #define HPC_MATVEC_IAMAX_H 1 #include #include #include #include namespace hpc { namespace matvec { template typename std::enable_if::value, typename VX::Index>::type iamax(const VX &x) { return ulmblas::iamax(x.length, x.data, x.inc); } } } // namespace matvec, hpc #endif // HPC_MATVEC_IAMAX_H ================================================================================ Rang-1 Update: r ================ ==== CODE (type=cc) ============================================================ #ifndef HPC_MATVEC_R_H #define HPC_MATVEC_R_H 1 #include #include #include #include #include namespace hpc { namespace matvec { template /* typename std::enable_if::value && IsDenseVector::value && IsGeMatrix::value, void>::type */ void r(const Alpha &alpha, const VX &x, const VY &y, MA &&A) { assert(x.length==A.numRows); assert(y.length==A.numCols); return ulmblas::ger(A.numRows, A.numCols, alpha, x.data, x.inc, y.data, y.inc, A.data, A.incRow, A.incCol); } } } // namespace matvec, hpc #endif // HPC_MATVEC_R_H ================================================================================ :navigate: up -> doc:index next -> doc:session19/page07 back -> doc:session19/page05