Time series data storage (stripped down circular buffer)
More...
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
sa_time_series_int * | sa_create_time_series_int (int rows, uint64_t ns_per_row) |
| Allocates and initializes the data structure. More...
|
|
void | sa_init_time_series_int (sa_time_series_int *ts) |
| Zeros out the time series. More...
|
|
int | sa_add_time_series_int (sa_time_series_int *ts, uint64_t ns, int v) |
| Adds the specified value to the time series row. More...
|
|
int | sa_set_time_series_int (sa_time_series_int *ts, uint64_t ns, int v) |
| Sets the time series row to the specified value. More...
|
|
int | sa_get_time_series_int (sa_time_series_int *ts, uint64_t ns) |
| Gets the value of the time series row. More...
|
|
uint64_t | sa_timestamp_time_series_int (sa_time_series_int *ts) |
| Returns the timestamp of the most recent row. More...
|
|
int | sa_mp_time_series_int (sa_time_series_int *ts, uint64_t ns, int n, int m, double percent, double *mp[], int *mpi[]) |
| Computes the matrix profile for a time series or sub set of the series. More...
|
|
void | sa_destroy_time_series_int (sa_time_series_int *ts) |
| Free the associated memory. More...
|
|
char * | sa_serialize_time_series_int (sa_time_series_int *ts, size_t *len) |
| Serialize the internal state to a buffer. More...
|
|
int | sa_deserialize_time_series_int (sa_time_series_int *ts, const char *buf, size_t len) |
| Restores the internal state from the serialized output. More...
|
|
Time series data storage (stripped down circular buffer)
Definition in file time_series.h.
Adds the specified value to the time series row.
- Parameters
-
ts | Pointer to time_series_int |
ns | Timestamp (nanoseconds since Jan 1 1970) associated with value |
v | Value to add |
- Returns
- current value
Allocates and initializes the data structure.
- Parameters
-
rows | Number of observation slots |
ns_per_row | Nanoseconds represented in each row |
- Returns
- Pointer to time_series_int
int sa_deserialize_time_series_int |
( |
sa_time_series_int * |
ts, |
|
|
const char * |
buf, |
|
|
size_t |
len |
|
) |
| |
Restores the internal state from the serialized output.
- Parameters
-
ts | Pointer to time_series_int |
buf | Buffer containing the output of serialize_time_series_int |
len | Length of the buffer |
- Returns
- 0 = success 1 = invalid buffer length 2 = invalid cnt 3 = mis-matched dimensions
Free the associated memory.
- Parameters
-
ts | Pointer to time_series_int |
Gets the value of the time series row.
- Parameters
-
ts | Pointer to time_series_int |
ns | Timestamp (nanoseconds since Jan 1 1970) of the row |
- Returns
- current value
Zeros out the time series.
- Parameters
-
ts | Pointer to time_series_int |
int sa_mp_time_series_int |
( |
sa_time_series_int * |
ts, |
|
|
uint64_t |
ns, |
|
|
int |
n, |
|
|
int |
m, |
|
|
double |
percent, |
|
|
double * |
mp[], |
|
|
int * |
mpi[] |
|
) |
| |
Computes the matrix profile for a time series or sub set of the series.
See: http://www.cs.ucr.edu/~eamonn/MatrixProfile.html
- Parameters
-
ts | Pointer to time_series_int |
ns | The start of the interval to analyze |
n | Sequence length (<= ts->rows) |
m | Sub-sequence length (n / 4 >= m > 3) |
percent | Percentage of data to base the calculation on (0.0 < percent <= 100). Use less than 100 to produce an estimate of the matrix profile trading accuracy for speed. |
mp | Returned pointer to the matrix profile array (MUST be freed by the caller) |
mpi | Returned pointer to the matrix profile index array (MUST be freed by the caller) |
- Returns
- int Length of the returned matrix profile arrays (0 on failure). The mp/i pointers are not modified on failure.
Serialize the internal state to a buffer.
- Parameters
-
ts | Pointer to time_series_int |
len | Length of the returned buffer |
- Returns
- char* Serialized representation MUST be freed by the caller
Sets the time series row to the specified value.
- Parameters
-
ts | Pointer to time_series_int |
ns | Timestamp (nanoseconds since Jan 1 1970) associated with value |
v | Value to set |
- Returns
- current value
Returns the timestamp of the most recent row.
- Parameters
-
ts | Pointer to time_series_int |
- Returns
- Timestamp (nanoseconds since Jan 1 1970)