-
Notifications
You must be signed in to change notification settings - Fork 2
Start handling abstract block types #150
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
11 commits
Select commit
Hold shift + click to select a range
e6fdb68
[WIP] Start handling abstract block types
mtfishman 3a199fb
Fix printing, start adding tests
mtfishman 3318622
Make blockwise map friendlier to abstract block types
mtfishman 9ddf0f5
Mark broken noncontiguous slicing test
mtfishman 635cc18
Fix tests
mtfishman 3a9aa2d
Comment out broken tests
mtfishman e42a5ed
Fix 0-dim isstored
mtfishman 02c2d69
Fix for Julia v1.10
mtfishman d9d532f
Delete extraneous _convert definition
mtfishman 033e9fa
Remove stale test dep
mtfishman 4bbdb8f
Add back test dep
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 = "BlockSparseArrays" | ||
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4" | ||
authors = ["ITensor developers <[email protected]> and contributors"] | ||
version = "0.7.14" | ||
version = "0.7.15" | ||
|
||
[deps] | ||
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" | ||
|
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
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
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,44 @@ | ||
using Adapt: adapt | ||
using BlockArrays: Block | ||
using BlockSparseArrays: BlockSparseMatrix, blockstoredlength | ||
using JLArrays: JLArray | ||
using SparseArraysBase: storedlength | ||
using Test: @test, @test_broken, @testset | ||
|
||
elts = (Float32, Float64, ComplexF32) | ||
arrayts = (Array, JLArray) | ||
@testset "Abstract block type (arraytype=$arrayt, eltype=$elt)" for arrayt in arrayts, | ||
elt in elts | ||
|
||
dev = adapt(arrayt) | ||
a = BlockSparseMatrix{elt,AbstractMatrix{elt}}(undef, [2, 3], [2, 3]) | ||
@test sprint(show, MIME"text/plain"(), a) isa String | ||
@test iszero(storedlength(a)) | ||
@test iszero(blockstoredlength(a)) | ||
a[Block(1, 1)] = dev(randn(elt, 2, 2)) | ||
a[Block(2, 2)] = dev(randn(elt, 3, 3)) | ||
@test !iszero(a[Block(1, 1)]) | ||
@test a[Block(1, 1)] isa arrayt{elt,2} | ||
@test !iszero(a[Block(2, 2)]) | ||
@test a[Block(2, 2)] isa arrayt{elt,2} | ||
@test iszero(a[Block(2, 1)]) | ||
@test a[Block(2, 1)] isa Matrix{elt} | ||
@test iszero(a[Block(1, 2)]) | ||
@test a[Block(1, 2)] isa Matrix{elt} | ||
|
||
b = copy(a) | ||
@test Array(b) ≈ Array(a) | ||
|
||
b = a + a | ||
@test Array(b) ≈ Array(a) + Array(a) | ||
|
||
b = 3a | ||
@test Array(b) ≈ 3Array(a) | ||
|
||
if arrayt === Array | ||
b = a * a | ||
@test Array(b) ≈ Array(a) * Array(a) | ||
else | ||
@test_broken a * a | ||
end | ||
end |
Oops, something went wrong.
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.