|
- /*!
- * \file v4.cpp
- * \brief vv3 part of the exercise.
- *
- * \author
- * Christos Choutouridis AEM:8997
- * <cchoutou@ece.auth.gr>
- */
-
- #include <iostream>
- #include <random>
- #include <v4.h>
-
- namespace v4 {
-
- using index_t = typename matrix::indexType;
- using value_t = typename matrix::dataType;
-
-
- std::vector<value_t> mmacc_v(matrix& A, matrix& B) {
- std::vector<value_t> c(A.size());
- for (int i=0 ; i<A.size() ; ++i) {
- for (auto j = A.getRow(i); j.index() != j.end() ; ++j){
- c[i] += A.getRow(i)*B.getCol(j.index());
- }
- }
- return c;
- }
-
-
- value_t sum (std::vector<value_t>& v) {
- value_t s =0;
- for (auto& it : v)
- s += it;
- return s;
- }
-
- value_t triang_count (matrix& A) {
- auto v = mmacc_v(A, A);
- return (session.makeSymmetric) ? sum(v)/6 : sum(v);
- }
-
- }
|