Extracting the data table from tensor object

60 views
Skip to first unread message

David Mainprice

unread,
Feb 5, 2013, 10:18:07 AM2/5/13
to mtex...@googlegroups.com
For the MTEX class tensor there are limited number of methods compared with MatLab's functions. Sometimes it would useful to extract the "matrix" data table structure and apply standard MatLab operations like ./ , unique(A), sum(A(:)) etc plus there are some MTEX functions like mrdivide,  rdivide, sum etc with no examples which may be useful.

There is a tensor d = get(T,'mineral')  does this allow you extract the tensor table values from the object below ?

all the best David Mainprice

C_tensor = tensor (show methods, plot)
  rank: 4 (3 x 3 x 3 x 3)
 
  tensor in Voigt matrix representation:
 207.24  56.78  64.31  -0.46   3.21  -4.86
  56.78 177.26  59.66   0.84  -1.24   0.62
  64.31  59.66 193.79   0.91   1.11  -0.52
  -0.46   0.84   0.91  55.59  -1.11  -0.55
   3.21  -1.24   1.11  -1.11  68.52  -0.41
  -4.86   0.62  -0.52  -0.55  -0.41  53.84

Ralf Hielscher

unread,
Feb 6, 2013, 5:07:19 AM2/6/13
to mtex...@googlegroups.com
Hi David,

extracting the entries of a tensor is possible in many way:

to extract all entries as a multidimensional array we have
double(C_tensor)

to extract e.g. a 4th rank tensor in Voigt matrix form we have
matrix(c_tensor,'Voigt')

to extract a specific entry if the tensor you can do
C_tensor{3,3}

I agree that there are many MATLAB typical functions not yet implemented for tensors. We should check carefully which functions make sense for tensors, e.g.
for 
sum(C_tensor(:))
we have to define what is
C_tensor(:)
which is not so clear. 

Functions I can imagine to implement are
sum(C_tensor,[dimensions])
norm
(C_tensor)

On the other hand it makes not so much sense to define every possible functions which acts entry wise on matrices for tensors.

Ralf.








Reply all
Reply to author
Forward
0 new messages