#pragma once #include #include #include using namespace std; class ProductMatrix { private: vector u; vector v; size_t n; size_t m; public: vector Mult(const vector &x) const { vector y(n,0); for(int i = 0; i < n; ++i) { for(int j = 0; j < m; ++j) { y[i] += v[j]*x[j]; } y[i] *= u[i]; } return y; } vector MultT(const vector &y) const { vector x(m,0); for(int j = 0; j < m; ++j) { for(int i = 0; i < n; ++i) { x[j] += y[i]*u[i]; } x[j] *= v[j]; } return x; } ProductMatrix(const vector &u, const vector &v) { n = u.size(); m = v.size(); this->u = u; this->v = v; } };