Re: Exception running EuropeanOption example (maybe boost problem?)

Posted by Giorgio Pazmandi on
URL: http://quantlib.414.s1.nabble.com/Exception-running-EuropeanOption-example-maybe-boost-problem-tp7357p7359.html

Hi Bojan, thank you for your tip, without calling std::transform everything
works correctly. I have also seen that the original code works fine with
boost 1.34, so I can either use your patch or the older boost installation.

Thank you again for your help

Giorgio Pazmandi


> -----Original Message-----
> From: Bojan Nikolic [mailto:[hidden email]]
> Sent: giovedì, 26. marzo 2009 16:57
> To: Giorgio Pazmandi
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] Exception running EuropeanOption example
> (maybe boost problem?)
>
>
>
> This does look like to be a bug in boost on your platform/compiler
> combination. The std::transform takes a copy of the function (i.e.,
> fourth) argument and boost seems to trip up when it is time to destroy
> it.
>
> I would try expanding out the transform code in the leastsquares
> code. Something as simple as below should do I think as a first check.
>
> Best,
> Bojan
>
> --- a/ql/math/linearleastsquaresregression.hpp
> +++ b/ql/math/linearleastsquaresregression.hpp
> @@ -106,7 +106,11 @@
>
>          Matrix A(n, m);
>          for (i=0; i<m; ++i)
> -            std::transform(x.begin(), x.end(), A.column_begin(i),
> v[i]);
> +            for(size_t j=0; j<x.size(); ++j)
> +            {
> +                A[j][i]=v[i](x[j]);
> +            }
> +
>
>          const SVD svd(A);
>          const Matrix& V = svd.V();
>
>
> --
> Bojan Nikolic          ||          http://www.bnikolic.co.uk
>
> -----------------------------------------------------------------------
> -------
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users


------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users