fd operators update

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

fd operators update

Peter Caspers-4
Hi,

when updating to the current trunk I notice that my operators do not
compile any more due to an extended interface of FdmLinearOpComposite.
Seems I have to implement

virtual Disposable<std::vector<SparseMatrix> > toMatrixDecomp() const=0;

and looking at other operators I think I should return a vector of
SparseMatrix'es corresponding to

apply_direction(0,...)
apply_direction(1,...)
...
apply_direction(n,...)
apply_mixed(...)

, yes ? What is the improvement when using UBLAS ? Sorry in case I
overlooked any documentation on this.

thank you
Peter





------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: fd operators update

Ralph Schreyer
Hi Peter,

yes, either you define QL_NO_UBLAS_SUPPORT or you implement toMatrixDecomp() as you described it. Providing toMatrixDecomp() has the advantage that it delivers the components for toMatrix() of FdmLinearOp and in this way you get a matrix representation of the P(I)DE as a SparseMatrix, such that you can e. g. directly invert it in order to solve it.

This was e.g. used by Klaus Spanderen in his GPU example


where the QuantLib fdm framework was brought on the GPU via the toMatrix() interface and the CUDA cuSPARSE library.

Furthermore, you can use the matrix representation to precondition the finite difference solution.


Best regards
Ralph

Am 20.04.2013 um 20:25 schrieb Peter Caspers:

Hi,

when updating to the current trunk I notice that my operators do not
compile any more due to an extended interface of FdmLinearOpComposite.
Seems I have to implement

virtual Disposable<std::vector<SparseMatrix> > toMatrixDecomp() const=0;

and looking at other operators I think I should return a vector of
SparseMatrix'es corresponding to

apply_direction(0,...)
apply_direction(1,...)
...
apply_direction(n,...)
apply_mixed(...)

, yes ? What is the improvement when using UBLAS ? Sorry in case I
overlooked any documentation on this.

thank you
Peter





------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: fd operators update

Klaus Spanderen-2
In reply to this post by Peter Caspers-4

Hi Peter

 

the rational behind this method was to get an easy way to create sparse matrices out of a FdmLinearOpComposite or more precise to get an

boost::numeric::ublas::compressed_matrix<Real> object. This class can then be used as an interface to highly efficient sparse matrix library like MKL or cusip. I have seen significant performance improvements while moving to a "tailor-made" sparse matrix library.

 

But looking at your posting I now realize that I've broken backwards compatibility and we should define

 

virtual Disposable<std::vector<SparseMatrix> > toMatrixDecomp() const {

QL_FAIL("method not implemented");

}

 

Then you don't have implement a method to provide functionality you are not interest in. What do you think?

 

regards

Klaus

 

 

On Saturday, April 20, 2013 08:25:24 PM Peter Caspers wrote:

> Hi,

>

> when updating to the current trunk I notice that my operators do not

> compile any more due to an extended interface of FdmLinearOpComposite.

> Seems I have to implement

>

> virtual Disposable<std::vector<SparseMatrix> > toMatrixDecomp() const=0;

>

> and looking at other operators I think I should return a vector of

> SparseMatrix'es corresponding to

>

> apply_direction(0,...)

> apply_direction(1,...)

> ...

> apply_direction(n,...)

> apply_mixed(...)

>

> , yes ? What is the improvement when using UBLAS ? Sorry in case I

> overlooked any documentation on this.

>

> thank you

> Peter

>

>

>

>

>

> ----------------------------------------------------------------------------

> -- Precog is a next-generation analytics platform capable of advanced

> analytics on semi-structured data. The platform includes APIs for building

> apps and a phenomenal toolset for data science. Developers can use our

> toolset for easy data analysis & visualization. Get a free account!

> http://www2.precog.com/precogplatform/slashdotnewsletter

> _______________________________________________

> QuantLib-dev mailing list

> [hidden email]

> https://lists.sourceforge.net/lists/listinfo/quantlib-dev


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: fd operators update

Peter Caspers-4
Thank you Klaus, Ralph, this is very interesting. Very nice blog too. The default implementation surely looks like a good idea (though for me backward compatibility is not highest priority and in this case it is really easy to stay compliant).
kind regards
Peter

Am 21.04.2013 13:39, schrieb Klaus Spanderen:

Hi Peter

 

the rational behind this method was to get an easy way to create sparse matrices out of a FdmLinearOpComposite or more precise to get an

boost::numeric::ublas::compressed_matrix<Real> object. This class can then be used as an interface to highly efficient sparse matrix library like MKL or cusip. I have seen significant performance improvements while moving to a "tailor-made" sparse matrix library.

 

But looking at your posting I now realize that I've broken backwards compatibility and we should define

 

virtual Disposable<std::vector<SparseMatrix> > toMatrixDecomp() const {

QL_FAIL("method not implemented");

}

 

Then you don't have implement a method to provide functionality you are not interest in. What do you think?

 

regards

Klaus

 

 

On Saturday, April 20, 2013 08:25:24 PM Peter Caspers wrote:

> Hi,

>

> when updating to the current trunk I notice that my operators do not

> compile any more due to an extended interface of FdmLinearOpComposite.

> Seems I have to implement

>

> virtual Disposable<std::vector<SparseMatrix> > toMatrixDecomp() const=0;

>

> and looking at other operators I think I should return a vector of

> SparseMatrix'es corresponding to

>

> apply_direction(0,...)

> apply_direction(1,...)

> ...

> apply_direction(n,...)

> apply_mixed(...)

>

> , yes ? What is the improvement when using UBLAS ? Sorry in case I

> overlooked any documentation on this.

>

> thank you

> Peter

>

>

>

>

>

> ----------------------------------------------------------------------------

> -- Precog is a next-generation analytics platform capable of advanced

> analytics on semi-structured data. The platform includes APIs for building

> apps and a phenomenal toolset for data science. Developers can use our

> toolset for easy data analysis & visualization. Get a free account!

> http://www2.precog.com/precogplatform/slashdotnewsletter

> _______________________________________________

> QuantLib-dev mailing list

> [hidden email]

> https://lists.sourceforge.net/lists/listinfo/quantlib-dev



------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev