![]() |
MobilityDB 1.3
|
Analytics function for temporal types. More...
#include "temporal/temporal_analytics.h"
#include <assert.h>
#include <math.h>
#include <float.h>
#include <postgres.h>
#include <utils/timestamp.h>
#include <liblwgeom_internal.h>
#include <meos.h>
#include <meos_internal.h>
#include <meos_internal_geo.h>
#include "temporal/postgres_types.h"
#include "temporal/set.h"
#include "temporal/span.h"
#include "temporal/spanset.h"
#include "temporal/temporal_tile.h"
#include "temporal/tsequence.h"
#include "temporal/type_util.h"
#include "geo/tgeo_distance.h"
#include "geo/tgeo_spatialfuncs.h"
Macros | |
#define | DP_STACK_SIZE 256 |
#define | MAX_MATRIX_LEN 65536 |
Functions | |
static double | dist2d_pt_pt (POINT2D *p1, POINT2D *p2) |
Return the 2D distance between the points. More... | |
static double | dist2d_pt_seg (POINT2D *p, POINT2D *A, POINT2D *B) |
Return the 2D distance between the point the segment. More... | |
static double | dist3d_pt_pt (POINT3DZ *p1, POINT3DZ *p2) |
Return the 3D distance between the points. More... | |
static double | dist3d_pt_seg (POINT3DZ *p, POINT3DZ *A, POINT3DZ *B) |
Return the 3D distance between the point the segment. More... | |
static int | int_cmp (const void *a, const void *b) |
Return a negative or a positive value depending on whether the first number is less than or greater than the second one. More... | |
double | temporal_dyntimewarp_distance (const Temporal *temp1, const Temporal *temp2) |
Return the Dynamic Time Warp distance between two temporal values. More... | |
Match * | temporal_dyntimewarp_path (const Temporal *temp1, const Temporal *temp2, int *count) |
Return the Dynamic Time Warp distance between two temporal values. More... | |
double | temporal_frechet_distance (const Temporal *temp1, const Temporal *temp2) |
Return the Frechet distance between two temporal values. More... | |
Match * | temporal_frechet_path (const Temporal *temp1, const Temporal *temp2, int *count) |
Return the Frechet distance between two temporal values. More... | |
double | temporal_hausdorff_distance (const Temporal *temp1, const Temporal *temp2) |
Return the Hausdorf distance between two temporal values. More... | |
double | temporal_similarity (const Temporal *temp1, const Temporal *temp2, SimFunc simfunc) |
Return the similarity distance between two temporal values. More... | |
Match * | temporal_similarity_path (const Temporal *temp1, const Temporal *temp2, int *count, SimFunc simfunc) |
Return the similarity path between two temporal values. More... | |
Temporal * | temporal_simplify_dp (const Temporal *temp, double dist, bool syncdist) |
Return a temporal float/point simplified using the Douglas-Peucker line simplification algorithm. More... | |
Temporal * | temporal_simplify_max_dist (const Temporal *temp, double dist, bool syncdist) |
Return a temporal float/point simplified using a single-pass Douglas-Peucker line simplification algorithm. More... | |
Temporal * | temporal_simplify_min_dist (const Temporal *temp, double dist) |
Return a temporal float/point sequence simplified ensuring that consecutive values are at least a given distance apart. More... | |
Temporal * | temporal_simplify_min_tdelta (const Temporal *temp, const Interval *mint) |
Return a temporal float/point sequence simplified ensuring that consecutive values are at least a certain time interval apart. More... | |
Temporal * | temporal_tprecision (const Temporal *temp, const Interval *duration, TimestampTz torigin) |
Return a temporal value with the precision set to time bins. More... | |
Temporal * | temporal_tsample (const Temporal *temp, const Interval *duration, TimestampTz torigin, interpType interp) |
Return a temporal value sampled according to time bins. More... | |
static void | tfloatseq_findsplit (const TSequence *seq, int i1, int i2, int *split, double *dist) |
Find a split when simplifying the temporal float sequence using the Douglas-Peucker line simplification algorithm. More... | |
TimestampTz | timestamptz_tprecision (TimestampTz t, const Interval *duration, TimestampTz torigin) |
Return a timestamptz with the precision set to a time bin. More... | |
double | tinstant_distance (const TInstant *inst1, const TInstant *inst2, datum_func2 func) |
Return the distance between two temporal instants. More... | |
TInstant * | tinstant_tprecision (const TInstant *inst, const Interval *duration, TimestampTz torigin) |
Return a temporal instant with the precision set to a time bin. More... | |
TInstant * | tinstant_tsample (const TInstant *inst, const Interval *duration, TimestampTz torigin) |
Return a temporal value sampled at time bins. More... | |
static double | tinstarr_hausdorff_distance (const TInstant **instants1, int count1, const TInstant **instants2, int count2) |
Return the discrete Hausdorff distance between two temporal values. More... | |
static double | tinstarr_similarity (const TInstant **instants1, int count1, const TInstant **instants2, int count2, SimFunc simfunc) |
Linear space computation of the similarity distance between two temporal values. More... | |
static double | tinstarr_similarity1 (double *dist, const TInstant **instants1, int count1, const TInstant **instants2, int count2, SimFunc simfunc) |
Linear space computation of the similarity distance between two temporal values. More... | |
static Match * | tinstarr_similarity_matrix (const TInstant **instants1, int count1, const TInstant **instants2, int count2, SimFunc simfunc, int *count) |
Return the similarity distance between two temporal values. More... | |
static void | tinstarr_similarity_matrix1 (const TInstant **instants1, int count1, const TInstant **instants2, int count2, SimFunc simfunc, double *dist) |
Return the similarity distance between two temporal values using a full matrix. More... | |
static Match * | tinstarr_similarity_path (double *dist, int count1, int count2, int *count) |
Return the similarity path between two temporal values based on the distance matrix. More... | |
static void | tpointseq_findsplit (const TSequence *seq, int i1, int i2, bool syncdist, int *split, double *dist) |
Find a split when simplifying the temporal point sequence using the Douglas-Peucker line simplification algorithm. More... | |
static TSequence * | tsequence_simplify_dp (const TSequence *seq, double dist, bool syncdist, uint32_t minpts) |
Return a temporal float sequence set/point simplified using the Douglas-Peucker line simplification algorithm. More... | |
TSequence * | tsequence_simplify_max_dist (const TSequence *seq, double dist, bool syncdist, uint32_t minpts) |
Return a temporal float/point sequence simplified using a single-pass implementation of the Douglas-Peucker line simplification algorithm that checks whether the provided distance threshold is exceeded. More... | |
TSequence * | tsequence_simplify_min_dist (const TSequence *seq, double dist) |
Return a temporal float/point sequence simplified ensuring that consecutive values are at least a given distance apart. More... | |
TSequence * | tsequence_simplify_min_tdelta (const TSequence *seq, const Interval *mint) |
Return a temporal float/point sequence simplified ensuring that consecutive values are at least a certain time interval apart. More... | |
TSequence * | tsequence_tprecision (const TSequence *seq, const Interval *duration, TimestampTz torigin) |
Return a temporal sequence with the precision set to a time bin. More... | |
TSequence * | tsequence_tsample (const TSequence *seq, const Interval *duration, TimestampTz torigin, interpType interp) |
Return a temporal value sampled according to time bins. More... | |
int | tsequence_tsample_iter (const TSequence *seq, TimestampTz lower_bin, TimestampTz upper_bin, int64 tunits, TInstant **result) |
Return a temporal value sampled according to time bins. More... | |
TSequenceSet * | tsequenceset_cont_tsample (const TSequenceSet *ss, const Interval *duration, TimestampTz torigin, interpType interp) |
Return a temporal value sampled according to time bins. More... | |
TSequence * | tsequenceset_disc_tsample (const TSequenceSet *ss, const Interval *duration, TimestampTz torigin) |
Return a temporal value sampled according to time bins. More... | |
static TSequenceSet * | tsequenceset_simplify_dp (const TSequenceSet *ss, double dist, bool syncdist, uint32_t minpts) |
Return a temporal float sequence set/point simplified using the Douglas-Peucker line simplification algorithm. More... | |
static TSequenceSet * | tsequenceset_simplify_max_dist (const TSequenceSet *ss, double dist, bool syncdist, uint32_t minpts) |
Return a temporal float sequence set/point simplified using a single-pass Douglas-Peucker line simplification algorithm. More... | |
TSequenceSet * | tsequenceset_simplify_min_dist (const TSequenceSet *ss, double dist) |
Return a temporal float/point sequence simplified ensuring that consecutive values are at least a given distance apart. More... | |
TSequenceSet * | tsequenceset_simplify_min_tdelta (const TSequenceSet *ss, const Interval *mint) |
Return a temporal float/point sequence simplified ensuring that consecutive values are at least a certain time interval apart. More... | |
TSequenceSet * | tsequenceset_tprecision (const TSequenceSet *ss, const Interval *duration, TimestampTz torigin) |
Return a temporal sequence set with the precision set to a time bin. More... | |
Temporal * | tsequenceset_tsample (const TSequenceSet *ss, const Interval *duration, TimestampTz torigin, interpType interp) |
Return a temporal value sampled according to time bins. More... | |
Set * | tstzset_tprecision (const Set *s, const Interval *duration, TimestampTz torigin) |
Return a timestamptz set with the precision set to a time bin. More... | |
Span * | tstzspan_tprecision (const Span *s, const Interval *duration, TimestampTz torigin) |
Return a timestamptz span with the precision set to a time bin. More... | |
SpanSet * | tstzspanset_tprecision (const SpanSet *ss, const Interval *duration, TimestampTz torigin) |
Return a timestamptz span set with the precision set to a time bin. More... | |
Analytics function for temporal types.