Login  Register

Re: 答复: Adjoint Greeks

Posted by Peter Caspers-4 on Apr 15, 2015; 3:00pm
URL: http://quantlib.414.s1.nabble.com/Adjoint-Greeks-tp16147p16489.html

Thanks Alex, great.
Peter

On 15 April 2015 at 15:07, Alexander Sokol <[hidden email]> wrote:

> Hi Peter:
>
> We were able to solve the errors such as the one you mentioned in your post
> by operator overloading in boost namespace. The code sample is below in this
> email.
>
> Best regards
> Alex
>
> Sample error message:
>
> 1>c:\projects\quantlib\dependencies\cpp\boost\numeric\ublas\detail\matrix_assign.hpp(34):
> error C2678: binary '<' : no operator found which takes a left-hand operand
> of type 'boost::numeric::ublas::matrix_scalar_unary<E,F>' (or there is no
> acceptable conversion)
>
> Code snippet which fixes this error:
>
> #include <cppad/cppad.hpp>
>
> namespace boost {
>        namespace numeric {
>               namespace ublas
>               {
>                      template<class M>
>                      class sparse_matrix_element;
>
>                      template<class T, class L, std::size_t IB, class IA,
> class TA>
>                      class compressed_matrix;
>
>                      template<class T, class ALLOC>
>                      class unbounded_array;
>
>                      namespace detail {
>
>                            template <typename Left, typename Right>
>                            inline bool operator < (Left const& left,
> CppAD::AD<Right> const& right)
>                            {
>
> #pragma message ("overload operator < : " __FUNCSIG__)
>                                   // This is only for demonstrate
>                                   // Ensure that adjoint logic will workable
>                                   return left < CppAD::Value(right);
>                            }
>                      }
>               }
>        }
> }
>
> #include <boost/numeric/ublas/lu.hpp>
> using namespace std;
>
>
> int main() {
>     typedef CppAD::AD<double> T;
>     boost::numeric::ublas::matrix<T> a(5, 5);
>     boost::numeric::ublas::permutation_matrix<std::size_t> pert(5);
>     // lu decomposition
>     const std::size_t s = lu_factorize(a, pert);
>
>     return 0;
> }
>
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Adjoint-Greeks-tp16147p16486.html
> Sent from the quantlib-dev mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-dev mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev