Skip to content

datatypes::tests::DataTestHelper

More...

#include <datatypes_test_helpers.hpp>

Public Types

Name
using typename CommonTypes< T >::SeriesType SeriesType
using typename CommonTypes< T >::PtrSeriesType PtrSeriesType
using typename CommonTypes< T >::EnsembleType EnsembleType
using typename CommonTypes< T >::EnsemblePtrType EnsemblePtrType
using typename CommonTypes< T >::PtrEnsemblePtrType PtrEnsemblePtrType
using typename CommonTypes< T >::TSeriesEnsemblePtrType TSeriesEnsemblePtrType
using typename CommonTypes< T >::PtrTSeriesEnsemblePtrType PtrTSeriesEnsemblePtrType
typedef std::function< T(size_t, size_t, size_t)> FullElementValueFunc
typedef std::function< T(size_t)> ElementValueFunc
typedef std::function< SeriesType(size_t)> EnsembleValueFunc
typedef std::function< EnsemblePtrType(size_t)> TsEnsembleValueFunc

Public Functions

Name
TTimeSeries< T > Create(T * data, int num, const ptime & start =ptime(date(2000, 1, 1)), const TimeStep & timeStep =TimeStep::GetHourly())
TTimeSeries< T > Ramp(int num, const ptime & start =ptime(date(2000, 1, 1)), double from =0.0, double increment =1.0)
TTimeSeries< T > Pulse(int length, T value =1, int firstPulse =0, int period =2, const ptime & start =ptime(date(2000, 1, 1)), const TimeStep & timeStep =TimeStep::GetHourly())
TTimeSeries< T > GetExpectedTestSingleTimeSeries(size_t indexInEnsemble, size_t length =kTimeSeriesLength, double constOffset =1, const ptime & startDate =TEST_START_TIME, const TimeStep & timeStep =TimeStep::GetHourly())
T * Seq(T from, T by, size_t num)
vector< T > SeqVec(T from, T by, size_t num)
vector< T > Rep(T value, size_t num)
vector< T > Add(const vector< T > & a, const vector< T > & b)
vector< T > Add(const vector< T > & a, const T & b)
vector< T > Add(const T & a, const vector< T > & b)
vector< T > Mult(const vector< T > & a, const vector< T > & b)
vector< T > Mult(const vector< T > & a, const T & b)
vector< T > Mult(const T & a, const vector< T > & b)
vector< T > Neg(const vector< T > & a)
vector< T * > * Seq(T from, T by, size_t num, size_t vecSize)
void DeleteElements(vector< T * > & vec)
bool AreEqual(PtrSeriesType expected, PtrSeriesType actual)
bool AreEqual(PtrSeriesType actual, T expected)
T DecimalRamp(size_t fcastIndex, size_t ensIndex, size_t seriesIndex)
ElementValueFunc CreateValueGen(size_t fcastIndex, size_t ensIndex, FullElementValueFunc ffun =&DecimalRamp)
T Identity(size_t i)
EnsembleValueFunc CreateTsGen(const ptime & start, size_t tsLength, size_t fcastIndex, const TimeStep & timeStep =TimeStep::GetHourly(), FullElementValueFunc ffun =&DecimalRamp)
TsEnsembleValueFunc CreateMtsGen(size_t ensSize, size_t tsLength, const ptime & start =ptime(date(2000, 1, 1)), const TimeStep & timeStep =TimeStep::GetDaily(), const TimeStep & timeStepFcasts =TimeStep::GetHourly(), FullElementValueFunc ffun =&DecimalRamp, int forecastStartOffset =1)
EnsembleValueFunc DefaultTsGen()
EnsemblePtrType CreateEnsembleTs(size_t ensSize, size_t length, const ptime & start, const TimeStep & timeStep, size_t fcastIndex =0, FullElementValueFunc ffun =&DecimalRamp)
EnsemblePtrType CreateEnsembleTs(size_t ensSize, size_t length, const ptime & start =ptime(date(2000, 1, 1)), const TimeStep & timeStep =TimeStep::GetDaily(), EnsembleValueFunc tsGen =DefaultTsGen())
TsEnsembleValueFunc DefaultMtsGen()
TSeriesEnsemblePtrType CreateTsEnsembleTs(size_t length, const ptime & start =ptime(date(2000, 1, 1)), const TimeStep & timeStep =TimeStep::GetDaily(), TsEnsembleValueFunc mtsGen =DefaultMtsGen())
TSeriesEnsemblePtrType CreateTsEnsembleTs(size_t length, size_t ensSize, size_t tsLength, const ptime & start =ptime(date(2000, 1, 1)), const TimeStep & timeStep =TimeStep::GetDaily(), const TimeStep & timeStepFcasts =TimeStep::GetHourly(), FullElementValueFunc ffun =&DecimalRamp, int forecastStartOffset =1)

Public Attributes

Name
const size_t kTimeSeriesLength

Detailed Description

template <typename T >
class datatypes::tests::DataTestHelper;

Public Types Documentation

using SeriesType

using datatypes::tests::DataTestHelper< T >::SeriesType =  typename CommonTypes<T>::SeriesType;

using PtrSeriesType

using datatypes::tests::DataTestHelper< T >::PtrSeriesType =  typename CommonTypes<T>::PtrSeriesType;

using EnsembleType

using datatypes::tests::DataTestHelper< T >::EnsembleType =  typename CommonTypes<T>::EnsembleType;

using EnsemblePtrType

using datatypes::tests::DataTestHelper< T >::EnsemblePtrType =  typename CommonTypes<T>::EnsemblePtrType;

using PtrEnsemblePtrType

using datatypes::tests::DataTestHelper< T >::PtrEnsemblePtrType =  typename CommonTypes<T>::PtrEnsemblePtrType;

using TSeriesEnsemblePtrType

using datatypes::tests::DataTestHelper< T >::TSeriesEnsemblePtrType =  typename CommonTypes<T>::TSeriesEnsemblePtrType;

using PtrTSeriesEnsemblePtrType

using datatypes::tests::DataTestHelper< T >::PtrTSeriesEnsemblePtrType =  typename CommonTypes<T>::PtrTSeriesEnsemblePtrType;

typedef FullElementValueFunc

typedef std::function<T(size_t , size_t , size_t )> datatypes::tests::DataTestHelper< T >::FullElementValueFunc;

typedef ElementValueFunc

typedef std::function<T(size_t )> datatypes::tests::DataTestHelper< T >::ElementValueFunc;

typedef EnsembleValueFunc

typedef std::function<SeriesType(size_t )> datatypes::tests::DataTestHelper< T >::EnsembleValueFunc;

typedef TsEnsembleValueFunc

typedef std::function<EnsemblePtrType(size_t )> datatypes::tests::DataTestHelper< T >::TsEnsembleValueFunc;

Public Functions Documentation

function Create

static TTimeSeries< T > Create(
    T * data,
    int num,
    const ptime & start =ptime(date(2000, 1, 1)),
    const TimeStep & timeStep =TimeStep::GetHourly()
)

function Ramp

static TTimeSeries< T > Ramp(
    int num,
    const ptime & start =ptime(date(2000, 1, 1)),
    double from =0.0,
    double increment =1.0
)

function Pulse

static TTimeSeries< T > Pulse(
    int length,
    T value =1,
    int firstPulse =0,
    int period =2,
    const ptime & start =ptime(date(2000, 1, 1)),
    const TimeStep & timeStep =TimeStep::GetHourly()
)

function GetExpectedTestSingleTimeSeries

static TTimeSeries< T > GetExpectedTestSingleTimeSeries(
    size_t indexInEnsemble,
    size_t length =kTimeSeriesLength,
    double constOffset =1,
    const ptime & startDate =TEST_START_TIME,
    const TimeStep & timeStep =TimeStep::GetHourly()
)

function Seq

static T * Seq(
    T from,
    T by,
    size_t num
)

function SeqVec

static vector< T > SeqVec(
    T from,
    T by,
    size_t num
)

function Rep

static vector< T > Rep(
    T value,
    size_t num
)

function Add

static vector< T > Add(
    const vector< T > & a,
    const vector< T > & b
)

function Add

static vector< T > Add(
    const vector< T > & a,
    const T & b
)

function Add

static vector< T > Add(
    const T & a,
    const vector< T > & b
)

function Mult

static vector< T > Mult(
    const vector< T > & a,
    const vector< T > & b
)

function Mult

static vector< T > Mult(
    const vector< T > & a,
    const T & b
)

function Mult

static vector< T > Mult(
    const T & a,
    const vector< T > & b
)

function Neg

static vector< T > Neg(
    const vector< T > & a
)

function Seq

static vector< T * > * Seq(
    T from,
    T by,
    size_t num,
    size_t vecSize
)

function DeleteElements

static void DeleteElements(
    vector< T * > & vec
)

function AreEqual

static bool AreEqual(
    PtrSeriesType expected,
    PtrSeriesType actual
)

function AreEqual

static bool AreEqual(
    PtrSeriesType actual,
    T expected
)

function DecimalRamp

static inline T DecimalRamp(
    size_t fcastIndex,
    size_t ensIndex,
    size_t seriesIndex
)

function CreateValueGen

static inline ElementValueFunc CreateValueGen(
    size_t fcastIndex,
    size_t ensIndex,
    FullElementValueFunc ffun =&DecimalRamp
)

function Identity

static inline T Identity(
    size_t i
)

function CreateTsGen

static inline EnsembleValueFunc CreateTsGen(
    const ptime & start,
    size_t tsLength,
    size_t fcastIndex,
    const TimeStep & timeStep =TimeStep::GetHourly(),
    FullElementValueFunc ffun =&DecimalRamp
)

function CreateMtsGen

static inline TsEnsembleValueFunc CreateMtsGen(
    size_t ensSize,
    size_t tsLength,
    const ptime & start =ptime(date(2000, 1, 1)),
    const TimeStep & timeStep =TimeStep::GetDaily(),
    const TimeStep & timeStepFcasts =TimeStep::GetHourly(),
    FullElementValueFunc ffun =&DecimalRamp,
    int forecastStartOffset =1
)

function DefaultTsGen

static inline EnsembleValueFunc DefaultTsGen()

function CreateEnsembleTs

static inline EnsemblePtrType CreateEnsembleTs(
    size_t ensSize,
    size_t length,
    const ptime & start,
    const TimeStep & timeStep,
    size_t fcastIndex =0,
    FullElementValueFunc ffun =&DecimalRamp
)

function CreateEnsembleTs

static inline EnsemblePtrType CreateEnsembleTs(
    size_t ensSize,
    size_t length,
    const ptime & start =ptime(date(2000, 1, 1)),
    const TimeStep & timeStep =TimeStep::GetDaily(),
    EnsembleValueFunc tsGen =DefaultTsGen()
)

function DefaultMtsGen

static inline TsEnsembleValueFunc DefaultMtsGen()

function CreateTsEnsembleTs

static inline TSeriesEnsemblePtrType CreateTsEnsembleTs(
    size_t length,
    const ptime & start =ptime(date(2000, 1, 1)),
    const TimeStep & timeStep =TimeStep::GetDaily(),
    TsEnsembleValueFunc mtsGen =DefaultMtsGen()
)

function CreateTsEnsembleTs

static inline TSeriesEnsemblePtrType CreateTsEnsembleTs(
    size_t length,
    size_t ensSize,
    size_t tsLength,
    const ptime & start =ptime(date(2000, 1, 1)),
    const TimeStep & timeStep =TimeStep::GetDaily(),
    const TimeStep & timeStepFcasts =TimeStep::GetHourly(),
    FullElementValueFunc ffun =&DecimalRamp,
    int forecastStartOffset =1
)

Public Attributes Documentation

variable kTimeSeriesLength

static const size_t kTimeSeriesLength = 48;

Updated on 2022-08-21 at 18:10:33 +1000