shmensor

module
v0.0.0-...-277eea6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2022 License: Apache-2.0

README

shmensor

Tiny tensor library in Go.

Most tensor operations are just combinations of a) tensor products and b) contractions (sums) over the tensors where 2 of the n indices are fixed and range 0 to their dimension. So I implement those two functions, and then provide multiple annotated examples this happening. For example, matrix multiplication (a rows b columns times b rows c columns) is actually a tensor product, creating 4 indices, and then an inner index contraction. Matrix times vector is the same, but it contracts from a 3 tensor back to a column vector.

I picked a canonical format that makes tensors easier to see. I pretend each tensor is the Kronecker product of a bunch of smaller tensors. They are represented as two dimensional matrices. I take the global row column indices, and trade them in for a list of coordinates with the contravariance (up and downness) going up to down, and the covariance (left to rightness) going left to right.

TODO:

  1. Index juggling. Going to designate metric tensors with an additional Boolean.
  2. Allow transpose by representing indices out of alphabetical order.

References:

Directories

Path Synopsis
applications

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL