8 #ifndef IMPALGEBRA_VECTOR_METRICS_H
9 #define IMPALGEBRA_VECTOR_METRICS_H
20 #include <cereal/access.hpp>
21 #include <cereal/types/polymorphic.hpp>
22 #include <cereal/types/base_class.hpp>
24 IMPALGEBRA_BEGIN_NAMESPACE
38 friend class cereal::access;
39 template<
class Archive>
void serialize(Archive &ar) {
40 ar(cereal::base_class<Object>(
this));
46 return get_l2_norm(a - b);
50 VectorKD sum = std::accumulate(vs.begin(), vs.end(),
52 return sum / vs.size();
61 friend class cereal::access;
62 template<
class Archive>
void serialize(Archive &ar) {
63 ar(cereal::base_class<Object>(
this));
69 return get_linf_norm(a - b);
75 return .5 * (bb.get_corner(0) + bb.get_corner(1));
80 IMPALGEBRA_END_NAMESPACE
BoundingBoxD<-1 > BoundingBoxKD
Typedef for Python.
VectorD< D > get_zero_vector_kd(int Di)
Return a dynamically sized vector of zeros.
#define IMP_OBJECT_METHODS(Name)
Define the basic things needed by any Object.
The l2 norm on the distance vector.
Common base class for heavy weight IMP objects.
#define IMP_OBJECT_SERIALIZE_DECL(Name)
Declare methods needed for serialization of Object pointers.
A bounding box in D dimensions.
A weak pointer to an Object or RefCountedObject.
An axis-aligned bounding box.
Vector3D get_centroid(const Vector3Ds &ps)
Return the centroid of a set of vectors.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing lists of object pointers.
A nullptr-initialized pointer to an IMP Object.
A shared base class to help in debugging and things.
The base class for a metric on VectorKDs.
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
double get_distance(const Line3D &s, const Vector3D &p)
Get closest distance between a line and a point.