Jutho / TensorOperations.jl

Julia package for tensor contractions and related operations
https://jutho.github.io/TensorOperations.jl/stable/
Other
453 stars 56 forks source link

A more helpful error message when splatting into @ncon. #80

Closed mhauru closed 4 years ago

mhauru commented 4 years ago

Resolves https://github.com/Jutho/TensorOperations.jl/issues/79

I considered, instead of just checking that there aren't splats in tensorlist, enforcing that all elements should be symbols or calls to conj. I didn't dare do that for fear of excluding some use case I hadn't thought of.

Jutho commented 4 years ago

Looks good.

Indeed, the individual tensors don't need to simple symbols or calls to conj. E.g., if you have 4 tensors in a list tensors, its perfectly fine to do things like. As long as @ncon just knowns the number of objects, and which need to be conjugated, that's fine. But I agree my implementation is not very fail-proof!

@ncon([tensors[1], conj(tensors[2]), tensors[3][:,1,:], view(tensors[4], :, 1:2:end)], ...)

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.8%) to 70.393% when pulling 0ff4365945540b6654901f9e727918531b184340 on mhauru:master into 4cc4a066cc623ab5342f2076fe09de4bea2324b1 on Jutho:master.

codecov[bot] commented 4 years ago

Codecov Report

Merging #80 into master will increase coverage by 1.1%. The diff coverage is 50%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #80     +/-   ##
=========================================
+ Coverage   71.91%   73.01%   +1.1%     
=========================================
  Files          22       22             
  Lines        1766     1827     +61     
=========================================
+ Hits         1270     1334     +64     
+ Misses        496      493      -3
Impacted Files Coverage Δ
src/indexnotation/tensormacros.jl 58.33% <50%> (-0.29%) :arrow_down:
src/indexnotation/preprocessors.jl 57.37% <0%> (-0.96%) :arrow_down:
src/implementation/diagonal.jl 69.29% <0%> (-0.9%) :arrow_down:
src/functions/ncon.jl 100% <0%> (ø) :arrow_up:
src/functions/simple.jl 100% <0%> (ø) :arrow_up:
src/indexnotation/verifiers.jl 82.79% <0%> (+0.37%) :arrow_up:
src/indexnotation/instantiators.jl 86.92% <0%> (+0.76%) :arrow_up:
src/indexnotation/parser.jl 86.25% <0%> (+1.25%) :arrow_up:
src/implementation/stridedarray.jl 83.84% <0%> (+2.11%) :arrow_up:
src/indexnotation/optimaltree.jl 93.65% <0%> (+3.04%) :arrow_up:
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4cc4a06...0ff4365. Read the comment docs.