Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions .github/workflows/CI.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Documentation"

on:
push:
branches:
- main
tags: '*'
pull_request:
schedule:
- cron: '1 4 * * 4'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }}

jobs:
build-and-deploy-docs:
name: "Documentation"
uses: "ITensor/ITensorActions/.github/workflows/Documentation.yml@main"
with:
localregistry: https://github.com/ITensor/ITensorRegistry.git
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
36 changes: 7 additions & 29 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,13 @@
name: Format check
name: "Format Check"

on:
push:
branches: [main]
tags: [v*]
branches:
- 'main'
tags: '*'
pull_request:

jobs:
format:
format-check:
name: "Format Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- name: Install JuliaFormatter and format
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Check format
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "The following files have not been formatted:"
write(stdout, out)
out_diff = Cmd(`git diff`) |> read |> String
@error "Diff:"
write(stdout, out_diff)
exit(1)
@error ""
end'
uses: "ITensor/ITensorActions/.github/workflows/FormatCheck.yml@main"
40 changes: 8 additions & 32 deletions .github/workflows/LiterateCheck.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,15 @@
name: Literate check
name: "Literate Check"

on:
push:
branches: [main]
tags: [v*]
branches:
- 'main'
tags: '*'
pull_request:

jobs:
literate:
name: "Literate Check"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1
- name: Install Literate and generate docs
run: |
julia -e '
using Pkg
Pkg.develop(PackageSpec(path=pwd()))
Pkg.instantiate()
Pkg.add(PackageSpec(name="Literate"))'
julia -e 'include("docs/make_readme.jl")'
- name: Check if docs need to be updated
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "The docs are outdated, rerun Literate to regenerate them."
write(stdout, out)
out_diff = Cmd(`git diff`) |> read |> String
@error "Diff:"
write(stdout, out_diff)
exit(1)
@error ""
end'
uses: "ITensor/ITensorActions/.github/workflows/LiterateCheck.yml@main"
with:
localregistry: https://github.com/ITensor/ITensorRegistry.git
42 changes: 42 additions & 0 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests
on:
push:
branches:
- 'master'
- 'main'
- 'release-'
tags: '*'
paths-ignore:
- 'docs/**'
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel intermediate builds: only if it is a pull request build.
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

jobs:
tests:
name: "Tests"
strategy:
fail-fast: false
matrix:
version:
- 'lts' # minimal supported version
- '1' # latest released Julia version
# group:
# - 'core'
# - 'optional'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
uses: "ITensor/ITensorActions/.github/workflows/Tests.yml@main"
with:
group: "${{ matrix.group }}"
julia-version: "${{ matrix.version }}"
os: "${{ matrix.os }}"
localregistry: https://github.com/ITensor/ITensorRegistry.git
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
exclude_types: [markdown] # incompatible with Literate.jl
- repo: https://github.com/qiaojunfeng/pre-commit-julia-format
rev: v0.2.0

- repo: "https://github.com/domluna/JuliaFormatter.jl"
rev: v1.0.62
hooks:
- id: julia-format
- id: "julia-formatter"
16 changes: 0 additions & 16 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,11 @@ GradedUnitRanges = "e2de450a-8a67-46c7-b59c-01d5a3d041c5"
[extensions]
TensorAlgebraGradedUnitRangesExt = "GradedUnitRanges"

[sources]
GradedUnitRanges = {url = "https://github.com/ITensor/GradedUnitRanges.jl"}
LabelledNumbers = {url = "https://github.com/ITensor/LabelledNumbers.jl"}

[compat]
Aqua = "0.8.9"
ArrayLayouts = "1.10.4"
BlockArrays = "1.2.0"
EllipsisNotation = "1.8.0"
GradedUnitRanges = "0.1.0"
LabelledNumbers = "0.1.0"
LinearAlgebra = "1.10"
Test = "1.10"
TupleTools = "1.6.0"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
GradedUnitRanges = "e2de450a-8a67-46c7-b59c-01d5a3d041c5"
LabelledNumbers = "f856a3a6-4152-4ec4-b2a7-02c1a55d7993"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Test"]
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/TensorAlgebra.jl/stable/)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/TensorAlgebra.jl/dev/)
[![Build Status](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Build Status](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/Tests.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/ITensor/TensorAlgebra.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/TensorAlgebra.jl)
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

## Installation instructions

This package resides in the `ITensor/ITensorRegistry` local registry.
In order to install, simply add that registry through your package manager.
This step is only required once.
```julia
julia> using Pkg: Pkg

julia> Pkg.add(url="https://github.com/ITensor/TensorAlgebra.jl")
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
or:
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

Then, the package can be added as usual through the package manager:

```julia
julia> Pkg.add("TensorAlgebra")
```

## Examples
Expand Down
22 changes: 20 additions & 2 deletions examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,36 @@
#
# [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/TensorAlgebra.jl/stable/)
# [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/TensorAlgebra.jl/dev/)
# [![Build Status](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/CI.yml?query=branch%3Amain)
# [![Build Status](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/TensorAlgebra.jl/actions/workflows/Tests.yml?query=branch%3Amain)
# [![Coverage](https://codecov.io/gh/ITensor/TensorAlgebra.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/TensorAlgebra.jl)
# [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
# [![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

# ## Installation instructions

# This package resides in the `ITensor/ITensorRegistry` local registry.
# In order to install, simply add that registry through your package manager.
# This step is only required once.
#=
```julia
julia> using Pkg: Pkg

julia> Pkg.add(url="https://github.com/ITensor/TensorAlgebra.jl")
julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry")
```
=#
# or:
#=
```julia
julia> Pkg.Registry.add(url="[email protected]:ITensor/ITensorRegistry.git")
```
=#
# if you want to use SSH credentials, which can make it so you don't have to enter your Github ursername and password when registering packages.

# Then, the package can be added as usual through the package manager:

#=
```julia
julia> Pkg.add("TensorAlgebra")
```
=#

Expand Down
1 change: 1 addition & 0 deletions src/LinearAlgebraExtensions/qr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function LinearAlgebra.qr(a::LayoutMatrix, biperm::BlockedPermutation{2})
end

# TODO: Define in terms of an inner function `_qr` or `tensor_qr`.
# TODO: this is type piracy
function LinearAlgebra.qr(
a::AbstractArray, labels_a::Tuple, labels_q::Tuple, labels_r::Tuple
)
Expand Down
12 changes: 8 additions & 4 deletions src/fusedims.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@
⊗() = Base.OneTo(1)

# Overload this version for most arrays
function fusedims(a::AbstractArray, axes::AbstractUnitRange...)
return fusedims(FusionStyle(a), a, axes...)
function fusedims(a::AbstractArray, ax::AbstractUnitRange, axes::AbstractUnitRange...)
return fusedims(FusionStyle(a), a, ax, axes...)

Check warning on line 33 in src/fusedims.jl

View check run for this annotation

Codecov / codecov/patch

src/fusedims.jl#L32-L33

Added lines #L32 - L33 were not covered by tests
end

# Overload this version for fusion tensors, array maps, etc.
function fusedims(a::AbstractArray, axesblocks::Tuple{Vararg{AbstractUnitRange}}...)
return fusedims(a, flatten_tuples(axesblocks)...)
function fusedims(

Check warning on line 37 in src/fusedims.jl

View check run for this annotation

Codecov / codecov/patch

src/fusedims.jl#L37

Added line #L37 was not covered by tests
a::AbstractArray,
axb::Tuple{Vararg{AbstractUnitRange}},
axesblocks::Tuple{Vararg{AbstractUnitRange}}...,
)
return fusedims(a, flatten_tuples((axb, axesblocks...))...)

Check warning on line 42 in src/fusedims.jl

View check run for this annotation

Codecov / codecov/patch

src/fusedims.jl#L42

Added line #L42 was not covered by tests
end

# Fix ambiguity issue
Expand Down
Loading
Loading