CARLsim  4.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 }
norm
double norm(const Point3D &p)
Definition: linear_algebra.cpp:14
norm2
double norm2(const Point3D &p)
calculate norm^2
Definition: linear_algebra.cpp:9
linear_algebra.h
dist
double dist(Point3D &p1, Point3D &p2)
Definition: linear_algebra.cpp:5
Point3D
a point in 3D space
Definition: linear_algebra.h:57
Point3D::y
double y
Definition: linear_algebra.h:85
Point3D::x
double x
Definition: linear_algebra.h:85
Point3D::z
double z
Definition: linear_algebra.h:85