[ quantlib-Patches-3000492 ] Enhancements to TimeSeries class

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ quantlib-Patches-3000492 ] Enhancements to TimeSeries class

SourceForge.net
Patches item #3000492, was opened at 2010-05-12 17:02
Message generated for change (Settings changed) made by lballabio
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3000492&group_id=12740

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Slava Mazur (shlagbaum)
>Assigned to: Luigi Ballabio (lballabio)
Summary: Enhancements to TimeSeries class

Initial Comment:
I propose the following changes to TimeSeries class:
-- to add an extra template parameter Time with default to Date - this will allow for use of alternative data/time types (e.g. time_t);
-- to add time and value projection iterators so that one would be able to iterate through time and values independently - this feature would allow for treatment of a TimeSeries object as a simple sequence of time and/or value elemnets;
-- to add time and value iterator generating members: begin_time(), end_time(), begin_values(), end_values()

The diff of proposed changes is attached

----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2010-10-21 17:34

Message:
The patch was applied to the code repository.
It will be included in next release.
Thank you.


----------------------------------------------------------------------

Comment By: Slava Mazur (shlagbaum)
Date: 2010-10-18 19:24

Message:
The following changes are made to ql/timeseries.hpp:
-- projection iterators are implemented via boost::transform_iterator;
-- reverse iterators are defined only for containers that support
bidirectional iteration, for those that does not an instance of TimeSeries
class can be created, but methods that require a reverse iterator will not
compile;
-- c++0x compliant method added, cbegin(), cend() etc.

In TimeSeriesTest class a new testIterators method added.

----------------------------------------------------------------------

Comment By: Luigi Ballabio (lballabio)
Date: 2010-09-29 17:00

Message:
Slava,
    unfortunately, redefining TimeSeries as

template <class T, class Time = Date, class Container = std::map<Time, T>
>

is not backward-compatible with the existing declaration; existing client
code instantiating TimeSeries<T, MyContainer> would break. As Time needs to
come before Container in the template parameters, I don't think we'll be
able to apply this change until we start breaking things for a 2.0
release.

However, the iterators you defined would be a welcome addition.  May you
attach a new diff that adds them, but without the Time template parameter?

Thanks,
    Luigi



----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=312740&aid=3000492&group_id=12740

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev