/usr/include/libmints/vector3.h is in libpsi3-dev 3.4.0-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | #ifndef _psi_src_lib_libmints__vector3_h
#define _psi_src_lib_libmints__vector3_h
#include <cmath>
namespace psi {
class Vector3
{
private:
double v_[3];
public:
Vector3() { v_[0] = v_[1] = v_[2] = 0.0; }
Vector3(const double p[3]) {
v_[0] = p[0]; v_[1] = p[1]; v_[2] = p[2];
}
Vector3(double d) {
v_[0] = v_[1] = v_[2] = d;
}
Vector3(double x, double y, double z) {
v_[0] = x; v_[1] = y; v_[2] = z;
}
Vector3(const Vector3& p) {
v_[0] = p.v_[0]; v_[1] = p.v_[1]; v_[2] = p.v_[2];
}
void operator=(const double *x) {
v_[0] = x[0];
v_[1] = x[1];
v_[2] = x[2];
}
void operator=(const Vector3& x) {
v_[0] = x.v_[0];
v_[1] = x.v_[1];
v_[2] = x.v_[2];
}
void operator=(double d) {
v_[0] = d;
v_[1] = d;
v_[2] = d;
}
void operator+=(const Vector3& x) {
v_[0] += x.v_[0];
v_[1] += x.v_[1];
v_[2] += x.v_[2];
}
void operator-=(const Vector3& x) {
v_[0] -= x.v_[0];
v_[1] -= x.v_[1];
v_[2] -= x.v_[2];
}
void operator*=(double m) {
v_[0] *= m;
v_[1] *= m;
v_[2] *= m;
}
Vector3 operator+(const Vector3& x) {
Vector3 result;
result.v_[0] = v_[0] + x.v_[0];
result.v_[1] = v_[1] + x.v_[1];
result.v_[2] = v_[2] + x.v_[2];
return result;
}
Vector3 operator-(const Vector3& x) {
Vector3 result;
result.v_[0] = v_[0] - x.v_[0];
result.v_[1] = v_[1] - x.v_[1];
result.v_[2] = v_[2] - x.v_[2];
return result;
}
Vector3 operator-() { return Vector3(-v_[0], -v_[1], -v_[2]); }
double& operator[](int i) { return v_[i]; }
const double& operator[](int i) const { return v_[i]; }
double dot(const Vector3& x) const {
return v_[0]*x.v_[0] + v_[1]*x.v_[1] + v_[2]*x.v_[2];
}
double distance(const Vector3&) const;
void normalize();
double norm() const { return sqrt(this->dot(*this)); }
Vector3 cross(const Vector3&) const;
};
Vector3 operator*(double, const Vector3&);
#include "vector3_i.cc"
}
#endif
|