Opened 9 years ago
Last modified 9 years ago
#1925 new defect
Error and enhancement in InvChEx function
Reported by: | César Pérez Álvarez | Owned by: | Víctor de Buen Remiro |
---|---|---|---|
Priority: | normal | Milestone: | Mantainance |
Component: | Packages | Version: | 3.3 |
Severity: | major | Keywords: | |
Cc: |
Description
When we use InvChEx with a time series which has a 0 MaxS, it generates a non-zero expansion where we had to be a zero value.
Example:
Serie anu = -SubSer(Pulse(y2000m01d01, Anual), y2000, y2002);
Serie mon = InvChEx(anu, Monthly);
I would like to enhance this function to expand the outcome time series which all dates "in last date" of input time series.
This correction I think solve all problems:
Serie InvChExNew(Serie ser, TimeSet dtn)
{
Date end = Succ(Succ(Last(ser), Dating(ser), 1), dtn, -1);
Date ini = First(ser);
Real num = MaxS(ser)+1;
Serie ind = CalInd(C, dtn)*num;
Expand(SubSer(InvCh(ser, ind)>>ind, ini, end),num)
};
Serie monNew = InvChExNew(anu, Monthly);
You can compare different outputs time series between mon and monNew to see it works.
Its important to explain in description that Dating(ser) and dtn in InvChEx must be harmonic between them.
An example of the new function to include in stdlib/general/grammars/_serie.tol in stdlib package
{
};
PutDescription(I2(