@@ -1352,12 +1352,12 @@ As well as::
1352
1352
Here A and B are not tensors, they are arrays, but the tensor representation
1353
1353
works just as well for them.
1354
1354
1355
- List of tensor operations::
1355
+ List of fundamental tensor operations::
1356
1356
1357
1357
Product
1358
1358
Add
1359
1359
Transpose
1360
- Contraction
1360
+ Contract / Contraction
1361
1361
Assign
1362
1362
Rank
1363
1363
@@ -1396,6 +1396,25 @@ Dot proudct :code:`dot_product(A, B)` is represented by
1396
1396
:code: `Contraction(Product([A, B]), [Rank(A), Rank(A)+1]) `, typically
1397
1397
:code: `Rank(A) == 1 `.
1398
1398
1399
+ Rank 0 tensors are scalars. Their value can be used instead of their symbol,
1400
+ e.g., 1, 2, -1, $i$, etc. A subtraction of two tensors $A - B$ can thus be
1401
+ defined as :code: `Add(A, Product([-1, B])) `, where $-1$ is a scalar tensor of
1402
+ rank 0, or to be completely explicit::
1403
+
1404
+ MinusOne = Tensor("-1", 0)
1405
+ Add(A, Product([MinusOne, B]))
1406
+
1407
+ Using the fundamental tensor operations above we can then build/define many
1408
+ other tensor operations::
1409
+
1410
+ dot_product(A, B) = Contraction(Product([A, B]), [Rank(A), Rank(A)+1])
1411
+ matmul(A, B) = Contraction(Product([A, B]), [Rank(A), Rank(A)+1])
1412
+ Tr A = Contract(A, [1, 2]) # assuming Rank(A) = 2
1413
+ |A| = sqrt(Contract(Product([A,A]), [1, Rank(A)+1], [2, Rank(A)+2], ...
1414
+ [Rank(A), 2*Rank(A)]))
1415
+ A^n = Product([A, A, ..., A]) # n-times
1416
+ Exp(A) = sum_n^oo A^n/n!
1417
+
1399
1418
Examples
1400
1419
========
1401
1420
0 commit comments