/** * @file Vector.hpp * * Vector class. * * @author James Goppert */ #pragma once #include "math.hpp" namespace matrix { template class Matrix; template class Vector : public Matrix { public: typedef Matrix MatrixM1; Vector() : MatrixM1() { } Vector(const MatrixM1 & other) : MatrixM1(other) { } Vector(const Type *data_) : MatrixM1(data_) { } inline Type operator()(size_t i) const { const MatrixM1 &v = *this; return v(i, 0); } inline Type &operator()(size_t i) { MatrixM1 &v = *this; return v(i, 0); } Type dot(const MatrixM1 & b) const { const Vector &a(*this); Type r = 0; for (size_t i = 0; i eps) { return (*this) / n; } return Vector(); } inline Vector normalized() const { return unit(); } Vector pow(Type v) const { const Vector &a(*this); Vector r; for (size_t i = 0; i