Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Tensor operations with AbstractArrays

$
0
0

I’m looking after a way of doing the following operation. Here is an attempt using TensorCast.jl:

using TensorCast

# dummy data to simplify the example
n = 7
D = rand(n, n)
G = rand(7, 7, 7, 7)

@cast P[μ, ν] := D[λ, σ] * (G[μ, ν, σ, λ] - G[μ, λ, σ, ν] / 2)
# => ERROR: LoadError: can't find index λ on the left

I might be doing something wrong, but how could I make it work (possibly using another package)? I would like to have support of:

  • arbitrary AbstractArrays (the G in my code is actually a custom type that wraps a matrix to deal with symmetries, so it is not contiguous in memory)
  • matrices of type LinearAlgebra.Hermitian (TensorOperations.jl appearently does not)

4 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles