#include <core/scalar.h>
#include <vector>
#include <cstdio>
Go to the source code of this file.
Classes | |
class | vector3< scalar > |
Generic 3-vector. More... | |
Macros | |
#define | LOOP3(code) { for(int k=0; k<3; k++) { code } } |
Functions | |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator+ (scalar s, const vector3< scalar > &a) |
__hostanddev__ vector3< int > | operator+ (int s, const vector3< int > &a) |
__hostanddev__ vector3< int > | operator+ (const vector3< int > &a, int s) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator+ (const vector3< scalar > &a, int s) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator+ (int s, const vector3< scalar > &a) |
__hostanddev__ vector3 | operator+ (vector3<> a, vector3< int > b) |
__hostanddev__ vector3 | operator+ (vector3< int > a, vector3<> b) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > & | operator*= (vector3< scalar > &a, scalar s) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > & | operator*= (vector3< scalar > &a, double s) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > & | operator*= (vector3< scalar > &a, int s) |
__hostanddev__ vector3 & | operator*= (vector3<> &a, double s) |
__hostanddev__ vector3 & | operator*= (vector3<> &a, int s) |
__hostanddev__ vector3< int > & | operator*= (vector3< int > &a, int s) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator* (scalar s, const vector3< scalar > &a) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator* (double s, const vector3< scalar > &a) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator* (const vector3< scalar > &a, double s) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator* (int s, const vector3< scalar > &a) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | operator* (const vector3< scalar > &a, int s) |
__hostanddev__ vector3 | operator* (double s, const vector3<> &a) |
__hostanddev__ vector3 | operator* (const vector3<> &a, double s) |
__hostanddev__ vector3 | operator* (double s, const vector3< int > &a) |
__hostanddev__ vector3 | operator* (const vector3< int > &a, double s) |
__hostanddev__ vector3< complex > | operator* (complex s, const vector3<> &a) |
__hostanddev__ vector3< complex > | operator* (const vector3<> &a, complex s) |
__hostanddev__ vector3< complex > | operator* (complex s, const vector3< int > &a) |
__hostanddev__ vector3< complex > | operator* (const vector3< int > &a, complex s) |
template<typename scalar > | |
__hostanddev__ scalar | dot (const vector3< scalar > &a, const vector3< scalar > &b) |
template<typename scalar > | |
__hostanddev__ scalar | dot (const vector3< double > &a, const vector3< scalar > &b) |
template<typename scalar > | |
__hostanddev__ scalar | dot (const vector3< int > &a, const vector3< scalar > &b) |
template<typename scalar > | |
__hostanddev__ scalar | dot (const vector3< scalar > &a, const vector3< double > &b) |
template<typename scalar > | |
__hostanddev__ scalar | dot (const vector3< scalar > &a, const vector3< int > &b) |
__hostanddev__ double | dot (const vector3< double > &a, const vector3< double > &b) |
__hostanddev__ double | dot (const vector3< int > &a, const vector3< double > &b) |
__hostanddev__ double | dot (const vector3< double > &a, const vector3< int > &b) |
__hostanddev__ int | dot (const vector3< int > &a, const vector3< int > &b) |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | cross (const vector3< scalar > &a, const vector3< scalar > &b) |
cross product | |
template<typename scalar > | |
__hostanddev__ scalar | box (const vector3< scalar > &a, const vector3< scalar > &b, const vector3< scalar > &c) |
box product / triple product | |
__hostanddev__ vector3< int > | round (const vector3<> &v, double *err=0) |
Round vector3<> to vector3<int> (and optionally retrieve error) | |
__hostanddev__ double | circDistanceSquared (const vector3<> &a, const vector3<> &b) |
template<typename T > | |
T | gcd (T x, T y) |
GCD of integers, templated over integer types. | |
template<typename T > | |
vector3< T > | gcdReduce (const vector3< T > &d) |
Reduce an integer vector by its gcd. | |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | loadVector (const vector3< const scalar * > &vArr, int i) |
Load vector from a constant vector field. | |
template<typename scalar > | |
__hostanddev__ vector3< scalar > | loadVector (const vector3< scalar * > &vArr, int i) |
Load vector from a vector field. | |
template<typename scalar > | |
__hostanddev__ void | storeVector (const vector3< scalar > &v, vector3< scalar * > &vArr, int i) |
Store vector to a vector field. | |
template<typename scalar > | |
__hostanddev__ void | accumVector (const vector3< scalar > &v, vector3< scalar * > &vArr, int i) |
Accumulate vector onto a vector field. | |
3-vector and fields there of
Return squared distance between a and b, interpreted as coordinates on a unit S1xS1xS1 embedded in R^6 i.e. sum of squares of distances between each coordinate put on a circle. This is useful for checking distances in a periodic cell safely.