-
Notifications
You must be signed in to change notification settings - Fork 0
More customization points in Concatenate
#32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
671d9b9
More customization points in Concatenate
mtfishman c36090f
Avoid calling private Base functions
mtfishman 4bf6ff4
Address comments from Lukas
mtfishman 66b9fc9
Don't store axes, reorganize code
mtfishman 9453585
Format
mtfishman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "DerivableInterfaces" | ||
uuid = "6c5e35bf-e59e-4898-b73c-732dcc4ba65f" | ||
authors = ["ITensor developers <[email protected]> and contributors"] | ||
version = "0.4.0" | ||
version = "0.4.1" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
|
@@ -13,9 +13,16 @@ MLStyle = "d8e11817-5142-5d16-987a-aa16d5891078" | |
MapBroadcast = "ebd9b9da-f48d-417c-9660-449667d60261" | ||
TypeParameterAccessors = "7e5a90cf-f82e-492e-a09b-e3e26432c138" | ||
|
||
[weakdeps] | ||
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" | ||
|
||
[extensions] | ||
DerivableInterfacesBlockArraysExt = "BlockArrays" | ||
|
||
[compat] | ||
Adapt = "4.1.1" | ||
ArrayLayouts = "1.11.0" | ||
ArrayLayouts = "1.11" | ||
BlockArrays = "1.4" | ||
Compat = "3.47,4.10" | ||
ExproniconLite = "0.10.13" | ||
LinearAlgebra = "1.10" | ||
|
10 changes: 10 additions & 0 deletions
10
ext/DerivableInterfacesBlockArraysExt/DerivableInterfacesBlockArraysExt.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module DerivableInterfacesBlockArraysExt | ||
|
||
using BlockArrays: BlockedOneTo, blockedrange, blocklengths | ||
using DerivableInterfaces.Concatenate: Concatenate | ||
|
||
function Concatenate.cat_axis(a1::BlockedOneTo, a2::BlockedOneTo) | ||
return blockedrange([blocklengths(a1); blocklengths(a2)]) | ||
end | ||
|
||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using DerivableInterfaces.Concatenate: concatenated | ||
using Test: @test, @testset | ||
|
||
@testset "Concatenated" begin | ||
a = randn(Float32, 2, 2) | ||
b = randn(Float64, 2, 2) | ||
|
||
concat = concatenated((1, 2), a, b) | ||
@test axes(concat) == Base.OneTo.((4, 4)) | ||
@test size(concat) == (4, 4) | ||
@test eltype(concat) === Float64 | ||
@test copy(concat) == cat(a, b; dims=(1, 2)) | ||
|
||
concat = concatenated(1, a, b) | ||
@test axes(concat) == Base.OneTo.((4, 2)) | ||
@test size(concat) == (4, 2) | ||
@test eltype(concat) === Float64 | ||
@test copy(concat) == cat(a, b; dims=1) | ||
|
||
concat = concatenated(3, a, b) | ||
@test axes(concat) == Base.OneTo.((2, 2, 2)) | ||
@test size(concat) == (2, 2, 2) | ||
@test eltype(concat) === Float64 | ||
@test copy(concat) == cat(a, b; dims=3) | ||
|
||
concat = concatenated(4, a, b) | ||
@test axes(concat) == Base.OneTo.((2, 2, 1, 2)) | ||
@test size(concat) == (2, 2, 1, 2) | ||
@test eltype(concat) === Float64 | ||
@test copy(concat) == cat(a, b; dims=4) | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.