## Re: [Vxl-users] complex matrices, multiprecision data types

 Re: [Vxl-users] complex matrices, multiprecision data types From: Riccardo Lattanzi - 2005-03-17 22:30:56 ```Hi, I had to stop working on this for a while, but now I'm back on it. As you suggested I first wrote my own routine for matrix inversion (based on LU decomposition) for vnl_matrix >. It works correctly, but I haven't wrote it as a class (I wrote the functions and I call them from my main application which read MATLAB matrices, perform the inversion and wrote the inverted matrix on a MATLAB file). On the otherside I build the Multiprecision Library ARPREC and I test it on some sample applications. Now I need to integrate the two and I'm not sure to know how to do it. What I would do is: 1- write the decomposition as a class; 2- turn such class in a templated class so it would work for both vnl_matrix > and vnl_matrix > ARPREC provide the standard operators for mpreal. What should I do to make everything work? Do I need to edit the Vnl files? (edit vnl_matrix and define new operators overloading for the new case?) Could you please help me on this? Could you point to some code in Vnl I could get some ideas? Thanks a lot. Riccardo > > Having had a quick look at ARPREC, it appears to provide the standard > operator+, operator*, etc for the main numeric classes mpreal and > mpcomplex. So vnl would should be able to create matrices of mpcomplex > fairly easily. You might need to add some simple definitions of > vnl_numeric_traits, vnl_complex_traits, etc. > > The basic matrix operations - addition, multiplication - should work > fine on vnl_matrix. You would still need to write a > decomposition class in order to invert your matrix (as I mentioned > above, vnl_algo's decomposition and inversion classes only work on a > strictly limited set of types) but I guess Numerical Recipes would help > there. > > If you have to use mpcomplex to do the numbers, and write your own > decomposition, then it is hard to say if the advantage of using vnl's > matrix handling, is worth your effort in setting up vnl. On the plus > side, VXL is pretty easy to setup, especially if you switch off > everything but the numerics in the build options. On the plus side for > us, we would be interested in your experience of using ARPREC+vnl, and > we would be happy to put your decomposition code in the library. > > If you do want to write a LU decomposition class for > vnl_matrix I suggest you write it for > vnl_matrix > first and then turn it into a templated > class. > > Ian. > > > > -- Riccardo Lattanzi Harvard-MIT Division of Health Science and Technology Laboratory for Biomedical Imaging Research Beth Israel Deaconess Medical Center Tel: (+1) 617 667 0281 Fax: (+1) 617 667 7917 ```