Database Reference
In-Depth Information
Fig. 12.14 The Levi-Civita
symbol
• Addition/subtraction
• Contraction
• Inner product
• Outer (tensor) product
• Contracted (multilinear) product
•
n
-Mode multiplication
• Matricization
We first give an example of the initialization of a sparse tensor Fig.
12.14
.
Example 12.12
In order to initialize the Levi-Civita symbol, which can be
interpreted as sparse tensor, the following steps are performed:
int[] dimension
¼
{3,3,3};
SparseTensor tensor
¼
new SparseTensor( dimension );
tensor.setEntry( 5, -1 );
tensor.setEntry( 7, 1 );
tensor.setEntry( 11, 1 );
tensor.setEntry( 15, -1 );
tensor.setEntry( 19, -1 );
tensor.setEntry( 21, 1 );
or, using a hash map,
HashMap
<
Integer, Double
>
entries
¼
new HashMap
<
Integer,
Double
>
;
entries.put( 5, -1 );
entries.put( 7, 1 );
entries.put( 11, 1 );
entries.put( 15, -1 );
entries.put( 19, -1 );
entries.put( 21, 1 );
int[] dimension
¼
{3,3,3};
SparseTensor tensor
¼
new SparseTensor( entries, dimension
);
■