34#ifndef __TSEQUENCE_H__
35#define __TSEQUENCE_H__
41#include "temporal/meos_catalog.h"
42#include "temporal/temporal.h"
48extern bool float_collinear(
double x1,
double x2,
double x3,
double ratio);
67 bool *removelast,
bool *removefirst);
69 bool removelast,
bool removefirst);
78 int count,
int totalseqs);
81 bool lower_inc,
bool upper_inc,
interpType interp);
83 int maxcount,
bool lower_inc,
bool upper_inc,
interpType interp,
84 bool normalize,
void *bbox);
120 bool component,
outfunc value_out);
125 const TInstant *inst2,
bool strict);
130 bool lower_inc,
bool upper_inc,
interpType interp);
135 Datum delta,
bool hasdelta,
double scale);
meosType
Enumeration that defines the built-in and temporal types used in MobilityDB.
Definition: meos_catalog.h:55
char *(* outfunc)(Datum value, meosType type, int maxdd)
Definition: temporal.h:277
int tnumbersegm_intersection(Datum start1, Datum end1, Datum start2, Datum end2, meosType basetype, TimestampTz lower, TimestampTz upper, TimestampTz *t)
Compute the intersection, if any, of two segments of temporal sequences.
Definition: tsequence.c:2671
TSequence ** tseqarr2_to_tseqarr(TSequence ***sequences, int *countseqs, int count, int totalseqs)
Return an array of temporal sequences converted from an array of arrays of temporal sequences.
Definition: tsequence.c:735
int tsequence_segments_iter(const TSequence *seq, TSequence **result)
Return the array of segments of a temporal sequence (iterator function)
Definition: tsequence.c:2048
bool tsequence_join_test(const TSequence *seq1, const TSequence *seq2, bool *removelast, bool *removefirst)
Test whether two sequences can be joined during normalization.
Definition: tsequence.c:505
int tsegment_intersection_value(Datum start, Datum end, Datum value, meosType temptype, TimestampTz lower, TimestampTz upper, TimestampTz *t1, TimestampTz *t2)
Return true if a segment of a temporal sequence intersects a base value at a timestamptz.
Definition: tsequence.c:2614
char * tsequence_to_string(const TSequence *seq, int maxdd, bool component, outfunc value_out)
Return the Well-Known Text (WKT) representation of a temporal sequence.
Definition: tsequence.c:791
void bbox_expand(const void *box1, void *box2, meosType temptype)
Expand the second bounding box with the first one.
Definition: tsequence.c:1024
void tnumberseq_shift_scale_value_iter(TSequence *seq, Datum origin, Datum delta, bool hasdelta, double scale)
Shift and/or scale the values of the instants of a temporal sequence (iterator function)
Definition: tsequence.c:1659
bool intersection_tinstant_tsequence(const TInstant *inst, const TSequence *seq, TInstant **inter1, TInstant **inter2)
Temporally intersect two temporal values.
Definition: tsequence.c:2818
bool intersection_tdiscseq_tcontseq(const TSequence *is, const TSequence *seq2, TSequence **inter1, TSequence **inter2)
Temporally intersect two temporal values.
Definition: tsequence.c:2553
bool ensure_valid_tinstarr(const TInstant **instants, int count, bool merge, interpType interp)
Ensure that all temporal instants of the array are valid.
Definition: tsequence.c:1083
int tstepseq_to_linear_iter(const TSequence *seq, TSequence **result)
Return a temporal sequence with continuous base type transformed from step to linear interpolation (i...
Definition: tsequence.c:1558
TSequence * tsequence_make_exp1(const TInstant **instants, int count, int maxcount, bool lower_inc, bool upper_inc, interpType interp, bool normalize, void *bbox)
Return a temporal sequence from an array of temporal instants.
Definition: tsequence.c:913
bool float_collinear(double x1, double x2, double x3, double ratio)
Basic functions for temporal sequences.
Definition: tsequence.c:95
TInstant ** tinstarr_normalize(const TInstant **instants, interpType interp, int count, int *newcount)
Normalize the array of temporal instants.
Definition: tsequence.c:458
double tnumberseq_cont_twavg(const TSequence *seq)
Return the time-weighted average of a temporal sequence number.
Definition: tsequence.c:2888
bool synchronize_tsequence_tsequence(const TSequence *seq1, const TSequence *seq2, TSequence **sync1, TSequence **sync2, bool interpoint)
Synchronize two temporal sequences.
Definition: tsequence.c:2314
TSequenceSet * tstepseq_to_linear(const TSequence *seq)
Return a temporal sequence with continuous base type transformed from step to linear interpolation.
Definition: tsequence.c:1606
bool tsequence_make_valid(const TInstant **instants, int count, bool lower_inc, bool upper_inc, interpType interp)
Ensure the validity of the arguments when creating a temporal sequence.
Definition: tsequence.c:1124
Datum tsegment_value_at_timestamptz(Datum start, Datum end, meosType temptype, TimestampTz lower, TimestampTz upper, TimestampTz t)
Return the base value of the segment of a temporal sequence at a timestamptz.
Definition: tsequence.c:2212
bool intersection_tdiscseq_tdiscseq(const TSequence *seq1, const TSequence *seq2, TSequence **inter1, TSequence **inter2)
Temporally intersect two temporal discrete sequences.
Definition: tsequence.c:2459
double floatsegm_interpolate(double value1, double value2, long double value)
Return a float interpolated from a float segment with respect to a fraction of its total length.
Definition: tsequence.c:294
int tfloatsegm_intersection_value(Datum start, Datum end, Datum value, TimestampTz lower, TimestampTz upper, TimestampTz *t)
Return true if the segment of a temporal number intersects the base value at a timestamptz.
Definition: tsequence.c:2580
long double floatsegm_locate(double value1, double value2, double value)
Return a float in (0,1) if a float segment intersects a float with respect to an epsilon value,...
Definition: tsequence.c:227
int tcontseq_find_timestamptz(const TSequence *seq, TimestampTz t)
Return the index of the segment of a temporal continuous sequence containing a timestamp using binary...
Definition: tsequence.c:654
int tsequence_timestamps_iter(const TSequence *seq, TimestampTz *result)
Return the array of timestamptz values of a temporal sequence (iterator function)
Definition: tsequence.c:2175
TSequence * tsequence_join(const TSequence *seq1, const TSequence *seq2, bool removelast, bool removefirst)
Join two temporal sequences.
Definition: tsequence.c:601
bool intersection_tsequence_tinstant(const TSequence *seq, const TInstant *inst, TInstant **inter1, TInstant **inter2)
Temporally intersect two temporal sequences.
Definition: tsequence.c:2797
void tsequence_shift_scale_time_iter(TSequence *seq, TimestampTz delta, double scale)
Shift and/or scale the timestamps of the instants of a temporal sequence (iterator function)
Definition: tsequence.c:1692
bool ensure_increasing_timestamps(const TInstant *inst1, const TInstant *inst2, bool strict)
Ensure that the timestamp of the first temporal instant is smaller (or equal if the merge parameter i...
Definition: tsequence.c:996
int tdiscseq_find_timestamptz(const TSequence *seq, TimestampTz t)
Return the index of a timestamp in a temporal discrete sequence value using binary search.
Definition: tsequence.c:702
bool intersection_tcontseq_tdiscseq(const TSequence *seq1, const TSequence *seq2, TSequence **inter1, TSequence **inter2)
Temporally intersect two temporal sequences.
Definition: tsequence.c:2509
bool ensure_valid_tinstarr_common(const TInstant **instants, int count, bool lower_inc, bool upper_inc, interpType interp)
Ensure the validity of the arguments when creating a temporal sequence.
Definition: tsequence.c:1044
bool tsequence_norm_test(Datum value1, Datum value2, Datum value3, meosType basetype, interpType interp, TimestampTz t1, TimestampTz t2, TimestampTz t3)
Test whether we can remove the middle instant among 3 consecutive ones during normalization.
Definition: tsequence.c:419
int tsegment_intersection(Datum start1, Datum end1, Datum start2, Datum end2, meosType temptype, TimestampTz lower, TimestampTz upper, TimestampTz *t1, TimestampTz *t2)
Return true if two segments of a temporal sequence intersect at a timestamptz.
Definition: tsequence.c:2737
interpType
Enumeration that defines the interpolation types used in MEOS.
Definition: meos.h:161
External API of the Mobility Engine Open Source (MEOS) library.
int64 TimestampTz
Definition: postgres_ext_defs.in.h:22
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
Structure to represent temporal values of instant subtype.
Definition: meos.h:185
Structure to represent temporal values of sequence set subtype.
Definition: meos.h:224
Structure to represent temporal values of sequence subtype.
Definition: meos.h:202