Crates.io | tensor |
lib.rs | tensor |
version | 0.1.2 |
source | src |
created_at | 2015-06-21 07:18:18.658537 |
updated_at | 2015-12-11 23:59:11.698689 |
description | Currently, a sketch of a Tensor library |
homepage | |
repository | https://github.com/brittcagnina/tensor |
max_upload_size | |
id | 2432 |
size | 11,611 |
Currently, support is only for contravariant Tensors of equal dimension basis vectors.
Also, all Tensors are assumed to use an orthonormal basis (Ex: Euclidean standard basis).
We use the following rank Tensor definition:
T'α..'β = ( ∂x'α / ∂xγ )..( ∂x'β / ∂xμ ) Tγ..μ
After assuming an orthonormal basis, we know that ( ∂x'α / ∂xγ ) will be zero for all cases α != γ.
and one for α = γ
The same is true for other components such as ( ∂x'β / ∂xμ ) with regards to β != μ.
This allows a straight-forward calculation of the outer and inner products of Tensors.
The inner product between two Tensors is currently defined for all Tensor ranks, so long as the ranks are the same, and the indices of both Tensors are all of equal dimension. I will gradually ease up on these restrictions.
This code serves as a sketch.
// 3d Rank3 Tensor Example
let t3 = Tensor::build(3, 3, vec![
1, 2, 3,
4, 5, 6,
7, 8, 9,
10, 11, 12,
13, 14, 15,
16, 17, 18,
19, 20, 21,
22, 23, 24,
25, 26, 27
]);
let t = t3.inner_product(&t3.clone());
t.print();
The above code will perform the inner product between t3 and itself, and then print out each component of the final Tensor, t.
A more robust Tensor library is on the way.