Re: 答复: ql/experimental/math/latentmodel.hpp failed at Line 750 on visual studio

Posted by japari on
URL: http://quantlib.414.s1.nabble.com/ql-experimental-math-latentmodel-hpp-failed-at-Line-750-on-visual-studio-tp15940p15947.html

1.-) For what is worth, I expected those problems on MS compilers. I dont see the problem and forces to open the interface which breaks the CRTP design.

2.-) Yes, thats actually what I have done in the multithread branch (the one I actually use). see

https://github.com/japari/quantlib/blob/MultithreadLatentQLXL/QuantLib/ql/experimental/credit/randomdefaultlatentmodel.hpp

I usually make cherry picks afterwards but I make an exception on this file because is the one that uses the multithreading. Again is the same macro/solution, gcc is happy.

3.-) Luigi, I'll try your solution on VC9; that makes sense.

Best
Pepe




----- Original Message -----

> About the make_pair problem: what if, instead of std::make_pair<Real,
> Probability>(...), you use just std::make_pair(...)? (That is, you
> don't provide the template args explicitly and let the compiler
> deduce
> them?)
>
> Luigi
>
> On Tue, Oct 7, 2014 at 11:17 AM, cheng li
> <[hidden email]> wrote:
> > Hi Luigi,
> >
> > I have found more issues when I build the examples on windows with
> > visual studio 2012
> >
> > 1. ql\experimental\credit\randomlosslatentmodel.hpp Line 103
> >
> >   #if !defined(QL_PATCH_MSVC90)
> >         friend class RandomLM<RandomLossLM, copulaPolicy, USNG>;
> >     protected:
> >   #else
> >     public:
> >   #endif
> >
> >   Error 34      error C3200:
> >   'QuantLib::RandomLossLM<copulaPolicy,USNG>' : invalid template
> >   argument for template parameter 'derivedRandomLM', expected a
> >   class template
> >
> > This issue can be resolved by replacing QL_PATCH_MSVC90 with
> > _MSC_VER as the comment says...
> >
> > 2. ql\experimental\credit\randomdefaultlatentmodel.hpp at Line 831
> >
> > RandomLM<RandomDefaultLM, copulaPolicy, USNG>(copula->numFactors(),
> > copula->size(), copula->copula(),
> >
> > Error   1       error C3200:
> > 'QuantLib::RandomDefaultLM<copulaPolicy>' : invalid template
> > argument for template parameter 'derivedRandomLM', expected a
> > class template
> >
> > This issue also goes for the same file at line 814 and
> >
> > This can be solved by replacing the original line with
> > RandomLM(copula->numFactors(), copula->size(), copula->copula(),
> >
> > 3. ql\experimental\credit\binomiallossmodel.hpp at Line 394
> >
> > distrib.insert(std::make_pair<Real, Probability>(lossPts[i],
> >                 //capped, some situations giving a very small
> >                 probability over 1
> >                 std::min(sum+values[i],1.)
> >                 ));
> >
> > Error   9       error C2664: 'std::make_pair' : cannot convert
> > parameter 1 from 'double' to 'QuantLib::Real &&'
> >
> > This error is rather strange and the error message seems
> > ridiculous...
> >
> > The same issue goes for
> > ql\experimental\credit\randomdefaultlatentmodel.hpp at Line 394
> > and 398.
> >
> > This issue can be resolved by replacing make_pair with pair.
> >
> > I am not sure all these above fix will work properly with gcc...
> >
> > Regards,
> > Cheng
> >
> > -----邮件原件-----
> > 发件人: Luigi Ballabio [mailto:[hidden email]]
> > 发送时间: 2014年10月7日 15:51
> > 收件人: cheng li
> > 抄送: QuantLib users
> > 主题: Re: [Quantlib-users] ql/experimental/math/latentmodel.hpp
> > failed at Line 750 on visual studio
> >
> > It's fixed now, thanks. Strange that gcc didn't catch this...
> >
> > Luigi
> >
> >
> > On Tue, Oct 7, 2014 at 6:49 AM, cheng li
> > <[hidden email]> wrote:
> >> Hi Team,
> >>
> >>
> >>
> >> I find this line can’t be compiled:
> >>
> >>
> >>
> >> explicit FactorSampler(const LatentModel<TC>::copulaType& copula,
> >>
> >>                                BigNatural seed = 0)
> >>
> >>
> >>
> >> Without typename
> >>
> >>
> >>
> >> Regards,
> >>
> >> Cheng
> >>
> >>
> >> ----------------------------------------------------------------------
> >> -------- Meet PCI DSS 3.0 Compliance Requirements with EventLog
> >> Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box
> >> PCI
> >> DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance?
> >> Download
> >> White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with
> >> EventLog Analyzer
> >> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.
> >> clktrk _______________________________________________
> >> QuantLib-users mailing list
> >> [hidden email]
> >> https://lists.sourceforge.net/lists/listinfo/quantlib-users
> >>
> >
> >
> >
> > --
> > <https://implementingquantlib.blogspot.com>
> > <https://twitter.com/lballabio>
> >
>
>
>
> --
> <https://implementingquantlib.blogspot.com>
> <https://twitter.com/lballabio>
>

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users