Work on testing.

This commit is contained in:
jgoppert
2015-11-05 10:44:21 -05:00
parent a703c8169e
commit f7b1c63b86
12 changed files with 242 additions and 165 deletions
+14 -5
View File
@@ -47,20 +47,24 @@ public:
return v(i, 0);
}
Type dot(const Vector & b) {
Vector &a(*this);
Type dot(const Vector & b) const {
const Vector &a(*this);
Type r = 0;
for (int i = 0; i<3; i++) {
for (int i = 0; i<M; i++) {
r += a(i)*b(i);
}
return r;
}
Type norm() {
Vector &a(*this);
Type norm() const {
const Vector &a(*this);
return sqrt(a.dot(a));
}
inline void normalize() {
(*this) /= norm();
}
/**
* Vector Operations
*/
@@ -131,6 +135,11 @@ public:
return res;
}
Vector<Type, M> operator/(Type scalar) const
{
return (*this)*(1.0/scalar);
}
Vector<Type, M> operator+(Type scalar) const
{
Vector<Type, M> res;