Giter Site home page Giter Site logo

stjordanis / tensoroperations.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jutho/tensoroperations.jl

0.0 0.0 0.0 978 KB

Julia package for tensor contractions and related operations

Home Page: https://jutho.github.io/TensorOperations.jl/stable/

License: Other

Julia 100.00%

tensoroperations.jl's Introduction

TensorOperations.jl

Fast tensor operations using a convenient Einstein index notation.

Documentation Build Status Digital Object Identifier
CI CI (Julia nightly) DOI

What's new in v3

  • Switched to CUDA.jl instead of CuArrays.jl, which effectively restricts support to Julia 1.4 and higher.

  • The default cache size for intermediate results is now the minimum of either 4GB or one quarter of your total memory (obtained via Sys.total_memory()). Furthermore, the structure (i.e. size) and eltype of the temporaries is now also used as lookup key in the LRU cache, such that you can run the same code on different objects with different sizes or element types, without constantly having to reallocate the temporaries. Finally, the task rather than threadid is used to make the cache compatible with concurrency at any level.

    As a consequence, different objects for the same temporary location can now be cached, such that the cache can grow out of size quickly. Once the cache is not able to hold all the temporary objects needed for your simulation, it might actually deteriorate perfomance, and you might be better off disabling the cache alltogether with TensorOperations.disable_cache().

WARNING: TensorOperations 3.0 contains breaking changes if you did implement support for custom array / tensor types by overloading checked_similar_from_indices etc.

Code example

TensorOperations.jl is mostly used through the @tensor macro which allows one to express a given operation in terms of index notation format, a.k.a. Einstein notation (using Einstein's summation convention).

using TensorOperations
α=randn()
A=randn(5,5,5,5,5,5)
B=randn(5,5,5)
C=randn(5,5,5)
D=zeros(5,5,5)
@tensor begin
    D[a,b,c] = A[a,e,f,c,f,g]*B[g,b,e] + α*C[c,a,b]
    E[a,b,c] := A[a,e,f,c,f,g]*B[g,b,e] + α*C[c,a,b]
end

In the second to last line, the result of the operation will be stored in the preallocated array D, whereas the last line uses a different assignment operator := in order to define and allocate a new array E of the correct size. The contents of D and E will be equal.

For more information, please see the documentation.

tensoroperations.jl's People

Contributors

0 avatar alexmorley avatar austinprivett avatar dilumaluthge avatar femtocleaner[bot] avatar garrison avatar getzdan avatar giggleliu avatar ho-oto avatar jfeist avatar juliatagbot avatar jutho avatar kshyatt avatar maartenvd avatar marcusps avatar masonprotter avatar mhauru avatar sglyon avatar staticfloat avatar traktofon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.