Transforming Vectors and Tensors; and SVD

David Gobbi dgobbi at irus.rri.on.ca
Mon May 8 21:18:42 EDT 2000


On Tue, 9 May 2000, Nigel Nunn wrote:

> Hi David [dgobbi at irus.rri.on.ca], 
> 
> > It would be very nice if most (or all) of CLAPACK was
> > available to VTK using vtkFloatArray and vtkDoubleArray
> > as the array data types.  I'm uncertain whether converting
> > CLAPACK to a C++ interface instead of a C interface would
> > have anything to offer here, though.  VTK would probably
> > use the C interface, since vtkDataArray doesn't use the STL
> > but instead stores the data in a simple C array.
> 
> Agreed.  Perhaps something as simple as a few wrapper classes 
> with methods that take vtkFloatArrays or vtkDoubleArrays and 
> return on request any LAPACK factorization or solution?
>   
> Specifically, one class might manage calls to the Eig-Svd
> branch of CLAPACK -- merely prepare parameters and call
> the simple/expert/etc. drivers as indicated by flags.
>  
>   class vtkCLAPACK_EigSVD { ... }; 
>   class vtkCLAPACK_LinSys { ... }; 
>  
> Member variables to store condition estimators, singular 
> values, eigenstuff, basis transformations, etc.

It wouldn't be necessary to have special member variables for
all this stuff, you could just pass a vtkDataArray for each
array or vector and single scalar values such as condition 
estimators can be returned.  

So a real SVD routine would look something like

int vtkLinearAlgebra::SingularValueDecomposition(vtkDoubleArray *M
                                                 vtkDoubleArray *U,
                                                 vtkDoubleArray *w,
                                                 vtkDoubleArray *VT);

where U or VT can be set to NULL if you don't desire that information,
and where the function will return a error flag if it didn't
converge.  The U, w, and VT arrays will automatically be set to
the correct size, etc.  My approach would be to keep it as simple
as possible and keep the interface as similar as possible to the 
underlying CLAPACK routines.  I don't think that using a Set/Get
approach would be a good idea.  I envision something more in line
with the way vtkMath is organized.

> LAPACK seems to divide into 4 parts:
>  
>   1. real Eig/Svd    (single/double) 
>   2. real LinSys     (single/double) 
>   3. complex Eig/Svd (single/double) 
>   4. complex LinSys  (single/double) 
>  
> How much would you like to see made available?

A small, basic set of single/double real Eigenvalue, SVD, and Linear
routines at first.  Nothing that works on sparse arrays, because VTK
doesn't have any suitable way of dealing with sparse arrays (at least,
I don't think it does).

 - David

--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------



More information about the vtkusers mailing list