[vtkusers] Rows versus columns bug in vtkTensorGlyph?

Jose Paulo Moitinho de Almeida moitinho at civil.ist.utl.pt
Mon May 12 06:04:06 EDT 2003


On Friday 09 May 2003 21:29, Ashok Kumar wrote:
> As given in the the VTK File Formats section of the User guide, 3x3 tensors
> are entered as:
>
> T00 T01 T02
> T10 T11 T12
> T20 T21 T22
>
> But in the piece of code quoted below from vtkTensorGlyph.cxx, the rows of
> above matrix are being called columns.  The "m" matrix below is actually
> the transpose of the tensor being read.  Also the code following "//use
> tensor columns as eigenvectors" is actually using the "rows" of the tensor
> data.
>
> This doesn't cause problems if one is inputing symmetric tensors (as most
> physical 3x3 tensors of interest are symmetrical).  But with the option
> ExtractEigenvaluesOff, I started getting sheared looking cuboids when I
> actually gave the eigenvectors scaled by eigenvalues as the "columns" of
> the tensor.  But when I gave them as "rows" the problem vanished.
>

I "played a bit" with that code, to add the orientation stuff and I remember 
that had some doubts regarding your question, but as I was working with 
stresses I always had symmetry, so I never investigated it in depth.

The code is there for a long time, but perhaps it is time to set things 
consistent. It is possible that some programs have been "adapted" to make it 
work (i.e. the rows/columns have been changed until the right result was 
obtained), so my suggestion is that is is better to change the man page and 
the comments (when it is 100% sure that what is written is not consistent).

> Another point:  When ExtractEigenvalues is set On, then it makes sense to
> call the input data as the "tensor".  But when "ExtractEigenvalues" is
> turned "off", then the input matrix consisting of eigenvectors scaled by
> their eigenvalues arranged in columns, is not a tensor anymore.  It is
> actually the Determinant of the tensor multiplied by the similarity
> transformation (det(T)*S) required for diagonalization (I=STS^).  So may be
> a different term than "tensor" will be more appropriate in that respect.
> May be the input should just be called a "matrix", which could be the
> actual tensor in one case and the matrix of eigenvectors multiplied by
> their eigenvalues in the second case (with ExtractEigenvaluesOff).
>

You are right, but what we are doing anyway is to represent something that 
comes (or may come) from a tensor, so rather than changing everything I would 
suggest a more rigorous spelling in the man page and eventually a 
clarification comment in the code. Instead of 

"...If this boolean is false, then eigenvalues/eigenvectors are not extracted, 
and the columns of the tensor are taken as the eigenvectors (the norm of 
column, always positive, is the eigenvalue). " 

something like  

"...If this boolean is false, then eigenvalues/eigenvectors are not extracted, 
and the columns of the input matrix are taken as the eigenvectors of the 
tensor (the norm of column, always positive, is the eigenvalue). " 


Regards

Ze Paulo



More information about the vtkusers mailing list