Posted by
Ballabio Gerardo-4 on
URL: http://quantlib.414.s1.nabble.com/Behavior-of-ql-TimeSeries-tp7536p7538.html
Da: Luigi Ballabio [mailto:
[hidden email]]
> > Then came the real surprise. I discovered that, when I call
> > qlTimeSeriesValue on a nonexistent date, that date together with the
> > value of 3.40282E+38 _get added to the time series_!!!
>
> That's because of the behavior of the std::map<Date, double>
underneath.
> If you look at the implementation of TimeSeries in C++, you'll see
> that the const version of operator[] returns Null without adding it,
> but the non-const has to return a reference and therefore needs an
> entry in the map to refer to. If you didn't add it, you couldn't
> write "series[d] = v;" to add a new value.
>
> The real question (but I'm not overly familiar with that part, so
> we'll have to rely on someone else) might be: why qlTimeSeriesValue,
> which should only read from the time series, uses the non-const
> version of operator[] instead of the const version?
You're saying that wasn't intentional, aren't you?
Gerardo
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div style="font-family:Calibri;font-size:10px">
Banca Profilo S.p.A.
Corso Italia, 49 - 20122 Milano - Tel. 02 58408.1, Fax 02 5831 6057
Capitale Sociale Euro 136.794.106,00 i.v.
Iscrizione al Registro Imprese di Milano, C.F. e P.IVA 09108700155 -
[hidden email]
Iscritta all’Albo delle Banche e dei Gruppi bancari
Aderente al Fondo Interbancario di Tutela dei depositi
Aderente al Conciliatore Bancario Finanziario e all’Arbitro Bancario Finanziario
Appartenente al Gruppo bancario Banca Profilo e soggetta all’attività di direzione e coordinamento di Arepo BP S.p.A.
DISCLAIMER:
The information transmitted may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon,
this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any computer.
</div>
</body>
</html>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users