From: Ian Scott <ian.m.scott@st...>  20050719 12:43:37

Kris Thielemans wrote: > Hi > > I'm new to vxl, but am wondering if it would be possible to use some of the > VNL routines with my own vector and matrix classes. I know, I'm asking too > much... > > I realise that this will involve some work but would like to ask for some > suggestions. > > I suppose the easiest way to go would be to make sure that my classes > provide the same interface as vnl_vector and vnl_matrix, and then typedef > vnl_vector etc. Somewhat cleaner would be to derive vnl_vector from my > classes from my own classes. Or some wrapper classes as suggested in > Numerical Recipes for C++ > (see http://www.numericalrecipes.com/cpppages/chap1sel.pdf p.29 et al) You can use vnl_vector_ref and vnl_matrix_ref to wrap an existing array of numbers in the types vnl expects. Alternatively, you could wrap the data of a vnl_vector in your own classes. > A longer route (but in the end more satisfying) would be to template the vnl > routines in terms of vector and matrix classes (which still need to have the > correct interface). A lot of trouble with instanstations then of course. Sounds horrendous. 