### 3 releases

Uses old Rust 2015

0.1.2 | Jun 28, 2015 |
---|---|

0.1.1 | Jun 28, 2015 |

0.1.0 | Jun 21, 2015 |

#**18** in #tensor

**Unlicense**

12KB

285 lines

# Tensor

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.

#### Dependencies

~215KB