CARLsim  6.1.0
CARLsim: a GPU-accelerated SNN simulator
linear_algebra.cpp
Go to the documentation of this file.
1 #include <linear_algebra.h>
2 
3 #include <cmath> // sqrt
4 
5 double dist(Point3D& p1, Point3D& p2) {
6  return norm((p1-p2)*(p1-p2));
7 }
8 
9 double norm2(const Point3D& p) {
10  return (p.x*p.x+p.y*p.y+p.z*p.z);
11 }
12 
14 double norm(const Point3D& p) {
15  return sqrt(norm2(p));
16 }
double z
double x
double norm2(const Point3D &p)
calculate norm^2
a point in 3D space
double norm(const Point3D &p)
double dist(Point3D &p1, Point3D &p2)
double y