mir_series.opBinary

  1. typeof(this) opBinary(typeof(this) rhs)
    struct mir_series(IndexIterator_, Iterator_, size_t N_ = 1, SliceKind kind_ = Contiguous)
    @optmath
    typeof(this)
    opBinary
    (
    string op : "~"
    )
    (
    typeof(this) rhs
    )
  2. auto opBinary(typeof(this) rhs)

Examples

import mir.date: Date;

//////////////////////////////////////
// Constructs two time-series.
//////////////////////////////////////
auto index0 = [1,3,4];
auto data0 = [1.0, 3, 4];
auto series0 = index0.series(data0);

auto index1 = [1,2,5];
auto data1 = [10.0, 20, 50];
auto series1 = index1.series(data1);

//////////////////////////////////////
// Merges multiple series into one.
//////////////////////////////////////
// Order is matter.
// The first slice has higher priority.
auto m0 = series0 ~ series1;
auto m1 = series1 ~ series0;

assert(m0.index == m1.index);
assert(m0.data == [ 1, 20,  3,  4, 50]);
assert(m1.data == [10, 20,  3,  4, 50]);

Meta