@@ -1312,7 +1312,7 @@ arrays.
1312
1312
1313
1313
One can represent tensor equations as follows::
1314
1314
1315
- Contraction (Product([Transpose(A), B]), [2, 3])
1315
+ Contract (Product([Transpose(A), B]), [2, 3])
1316
1316
1317
1317
Which represents the following tensor equations:
1318
1318
@@ -1334,7 +1334,7 @@ always have to be one up one down, and they can be swapped via the metric
1334
1334
tensor.
1335
1335
1336
1336
It turns out the exact same representation can also be applied to arrays, so
1337
- :code: `Contraction (Product([Transpose(A), B]), [2, 3]) ` represents::
1337
+ :code: `Contract (Product([Transpose(A), B]), [2, 3]) ` represents::
1338
1338
1339
1339
matmul(tranpose(A), B)
1340
1340
@@ -1357,7 +1357,7 @@ List of fundamental tensor operations::
1357
1357
Product
1358
1358
Add
1359
1359
Transpose
1360
- Contract / Contraction
1360
+ Contract
1361
1361
Assign
1362
1362
Rank
1363
1363
@@ -1366,7 +1366,7 @@ We just need to know the rank, not the actual dimensions, so::
1366
1366
A = Tensor("A", 2)
1367
1367
B = Tensor("A", 2)
1368
1368
C = Tensor("A", 2)
1369
- Assign(C, Contraction (Product([Transpose(A), B]), [2, 3]))
1369
+ Assign(C, Contract (Product([Transpose(A), B]), [2, 3]))
1370
1370
1371
1371
represents::
1372
1372
@@ -1389,11 +1389,11 @@ or::
1389
1389
end do
1390
1390
1391
1391
Matrix multiplication :code: `matmul(A, B) ` is represented by
1392
- :code: `Contraction (Product([A, B]), [Rank(A), Rank(A)+1]) `, typically
1392
+ :code: `Contract (Product([A, B]), [Rank(A), Rank(A)+1]) `, typically
1393
1393
:code: `Rank(A) == 2 `.
1394
1394
1395
1395
Dot proudct :code: `dot_product(A, B) ` is represented by
1396
- :code: `Contraction (Product([A, B]), [Rank(A), Rank(A)+1]) `, typically
1396
+ :code: `Contract (Product([A, B]), [Rank(A), Rank(A)+1]) `, typically
1397
1397
:code: `Rank(A) == 1 `.
1398
1398
1399
1399
Rank 0 tensors are scalars. Their value can be used instead of their symbol,
@@ -1407,12 +1407,12 @@ rank 0, or to be completely explicit::
1407
1407
Using the fundamental tensor operations above we can then build/define many
1408
1408
other tensor operations::
1409
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])
1410
+ dot_product(A, B) = Contract (Product([A, B]), [Rank(A), Rank(A)+1])
1411
+ matmul(A, B) = Contract (Product([A, B]), [Rank(A), Rank(A)+1])
1412
1412
Tr A = Contract(A, [1, 2]) # assuming Rank(A) = 2
1413
1413
|A| = sqrt(Contract(Product([A,A]), [1, Rank(A)+1], [2, Rank(A)+2], ...
1414
1414
[Rank(A), 2*Rank(A)]))
1415
- A^n = Product([ A, A, ..., A] ) # n-times
1415
+ A^n = matmul(matmul(matmul( A, A), A), ...) # n-times
1416
1416
Exp(A) = sum_n^oo A^n/n!
1417
1417
1418
1418
Examples
0 commit comments