diff --git a/.github/workflows/Documenter.yml b/.github/workflows/Documenter.yml index b91b123..b2ad773 100644 --- a/.github/workflows/Documenter.yml +++ b/.github/workflows/Documenter.yml @@ -5,14 +5,41 @@ on: tags: [v*] pull_request: +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + jobs: - Documenter: + docs: name: Documentation runs-on: ubuntu-latest + permissions: + # needed to allow julia-actions/cache to proactively delete old caches that it has created + actions: write + contents: write + statuses: write steps: - uses: actions/checkout@v4 - - uses: julia-actions/julia-buildpkg@latest - - uses: julia-actions/julia-docdeploy@latest + - uses: julia-actions/setup-julia@v1 + with: + version: '1' + - uses: julia-actions/cache@v1 + - name: Configure doc environment + shell: julia --project=docs --color=yes {0} + run: | + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate() + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + - name: Run doctests + shell: julia --project=docs --color=yes {0} + run: | + using Documenter: DocMeta, doctest + using TensorCore + DocMeta.setdocmeta!(TensorCore, :DocTestSetup, :(using TensorCore); recursive=true) + doctest(TensorCore) diff --git a/src/TensorCore.jl b/src/TensorCore.jl index e5ac156..ea354f6 100644 --- a/src/TensorCore.jl +++ b/src/TensorCore.jl @@ -20,12 +20,12 @@ For arrays `a` and `b`, perform elementwise multiplication. julia> a = [2, 3]; b = [5, 7]; julia> a ⊙ b -2-element Array{$Int,1}: +2-element Vector{$Int}: 10 21 julia> a ⊙ [5] -ERROR: DimensionMismatch("Axes of `A` and `B` must match, got (Base.OneTo(2),) and (Base.OneTo(1),)") +ERROR: DimensionMismatch: Axes of `A` and `B` must match, got (Base.OneTo(2),) and (Base.OneTo(1),) [...] ``` @@ -74,7 +74,7 @@ For vectors `v` and `w`, the Kronecker product is related to the tensor product julia> a = [2, 3]; b = [5, 7, 11]; julia> a ⊗ b -2×3 Array{$Int,2}: +2×3 Matrix{$Int}: 10 14 22 15 21 33 ``` @@ -164,13 +164,13 @@ and hence may sometimes return another `Adjoint` vector. (And similarly for `Tra julia> M = rand(5,5); v = rand(5); julia> typeof(v ⊡ M') -Array{Float64,1} +Vector{Float64} (alias for Array{Float64, 1}) julia> typeof(M ⊡ v') # adjoint of the previous line -Adjoint{Float64,Array{Float64,1}} +LinearAlgebra.Adjoint{Float64, Vector{Float64}} julia> typeof(v' ⊡ M') # same as *, and equal to adjoint(M ⊡ v) -Adjoint{Float64,Array{Float64,1}} +LinearAlgebra.Adjoint{Float64, Vector{Float64}} julia> typeof(v' ⊡ v) Float64