@@ -2420,3 +2420,32 @@ for $i=1, 2, 3$ we get:
2420
2420
2 \partial _z u^z \partial _z v^z\right )
2421
2421
\rho \,\d \rho \, \d \phi \, \d z
2422
2422
= \int f^z v^z \rho \,\d \rho \, \d \phi \, \d z
2423
+
2424
+ Difference Between Tensors and Arrays
2425
+ -------------------------------------
2426
+
2427
+ Every array can be interpreted as coefficients against some tensor basis in
2428
+ some curvilinear space. Then n-n-n arrays are 3D tensors in that space. n-m
2429
+ array would be a tensor from one space to another (different dimension), that's
2430
+ a more generalized case, but I think it can be done.
2431
+
2432
+ Now, if one applies a tensor operation and you feed it a tensor, the result is
2433
+ a tensor. Here are the most common operations: TensorContract, TensorProduct,
2434
+ TensorAdd, TensorTranspose. If you feed an array to it, it will still work, but
2435
+ you'll get an array out of course, not a tensor. But the operations can be done
2436
+ on arrays. So we can call these operations tensor operations. In fact the
2437
+ "tensor product" is a well known operations and called like that, and it is
2438
+ applied to all kinds of things which are not tensors.
2439
+
2440
+ Now, ArrayItem (or ArrayIndex/ArrayElement) which indexes into an array is not
2441
+ a tensor operation, because an element of a tensor is not a scalar. So that
2442
+ must be called ArrayElement. Things like ArrayMaxVal are array operations, or
2443
+ ArraySection, since a section of a tensor is not a tensor.
2444
+
2445
+ So operations with Tensor in front are "fundamental", and they accept tensors
2446
+ and return tensors. Operations with Array in front are just array operations,
2447
+ not as fundamental.
2448
+
2449
+ Many operations in fortran, such as dot_product, matmul, transpose, +, -, *
2450
+ happen to be tensor operations. But other operations such as maxval, sum, etc.
2451
+ are not tensor operations.
0 commit comments