/** * @file Vector.hpp * * Vector class. * * @author James Goppert */ #pragma once #include namespace matrix { template class Vector : public Matrix { public: virtual ~Vector() {}; Vector() : Matrix() { } inline Type operator()(size_t i) const { const Matrix &v = *this; return v(i, 0); } inline Type &operator()(size_t i) { Matrix &v = *this; return v(i, 0); } Type dot(const Vector & b) { Vector &a(*this); Type r = 0; for (int i = 0; i<3; i++) { r += a(i)*b(i); } return r; } Type norm() { Vector &a(*this); return sqrt(a.dot(a)); } }; }; // namespace matrix /* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */