Skip to content

Commit

Permalink
some progress
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Sep 1, 2023
1 parent 4199fc9 commit 8bb99de
Show file tree
Hide file tree
Showing 18 changed files with 1,963 additions and 5 deletions.
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style = "yas"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/Manifest.toml
.vscode/
16 changes: 15 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@ uuid = "5f87ffc2-9cf1-4a46-8172-465d160bd8cd"
authors = ["lkdvos <[email protected]> and contributors"]
version = "1.0.0-DEV"

[deps]
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
SparseArrayKit = "a9a3c162-d163-4c15-8926-b8794fbefed2"
Strided = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
TestEnv = "1e6cf692-eddd-4d53-88a5-2d735e33781b"
TupleTools = "9d95972d-f1c8-5527-a6e0-b4b365fa01f6"
VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"

[compat]
julia = "1"

[extras]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"

[targets]
test = ["Test"]
test = ["Test", "TestExtras", "Random", "Combinatorics"]
27 changes: 26 additions & 1 deletion src/BlockTensorKit.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
module BlockTensorKit

# Write your package code here.
using TensorKit
using SparseArrayKit
using VectorInterface
using TensorOperations
using LinearAlgebra
using Strided
using TupleTools: getindices, isperm
using BlockArrays
using TupleTools

import VectorInterface

# Spaces
include("sumspace.jl")
export SumSpace

# TensorMaps
include("blockarray.jl")
include("blocktensor.jl")
include("sparseblocktensor.jl")
export BlockTensorMap

# implementations
include("linalg.jl")
include("vectorinterface.jl")
include("tensorinterface.jl")

end
23 changes: 23 additions & 0 deletions src/blockarray.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const BlockSparseArray{T, N, A} = BlockArray{T, N, SparseArray{A,N}} where {T, N, A<:AbstractArray{T,N}}

Base.@propagate_inbounds function BlockArrays.viewblock(block_arr::BlockSparseArray{T,N,A},
block::Block{N}) where {T,N,A}
blks = block.n
@boundscheck blockcheckbounds(block_arr, blks...)
return get(block_arr.blocks.data, CartesianIndex(blks...)) do
return fill!(similar(A, map(getindex, blocksizes(block_arr), blks)), zero(T))
end
end

Base.:(\)(b1::BlockSparseArray{T,N,A}, b2::BlockSparseArray{T,N,A}) where {T,N,A} = PseudoBlockArray(b1) \ PseudoBlockArray(b2)

function Base.:(/)(b1::BlockSparseArray{T,N,A}, b2::BlockSparseArray{T,N,A}) where {T,N,A}
return PseudoBlockArray(b1) / PseudoBlockArray(b2)
end

# Base.adjoint(A::PseudoBlockArray) = PseudoBlockArray(adjoint(A.blocks), A.axes)

# function LinearAlgebra.ldiv!(A::Adjoint{<:Any,<:Union{LinearAlgebra.QR,LinearAlgebra.QRCompactWY,LinearAlgebra.QRPivoted}},
# B::PseudoBlockMatrix)
# return ldiv!(A, B.blocks)
# end
Loading

0 comments on commit 8bb99de

Please sign in to comment.