Skip to content
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

remove PTYQoLCircularArraysExt #22

Merged
merged 9 commits into from
Jun 26, 2024
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PTYQoL"
uuid = "551ad714-b11a-4605-8871-12721def4e72"
authors = ["Tianyi Pu <912396513@qq.com> and contributors"]
version = "0.2.7"
version = "0.2.8"

[weakdeps]
AlgebraicNumbers = "e86d093a-a386-599e-b7c7-df0420c8bcba"
Expand Down
2 changes: 0 additions & 2 deletions ext/PTYQoLBandedMatricesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ end
end
end

convert(::Type{AbstractArray{T}}, M::BandedMatrix{T}) where T = M

end
12 changes: 6 additions & 6 deletions ext/PTYQoLBlockArraysExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ function findblockindex(A::AbstractArray{T,N}, I::Tuple{Vararg{Integer,N}}) wher
end

# ambiguities
import BlockArrays: BlockArray, to_axes, colsupport, rowsupport, PseudoBlockArray, _pseudo_reshape
import BlockArrays: BlockArray, to_axes, colsupport, rowsupport, BlockedArray, _blocked_reshape
import Base: OneTo, similar, reshape

@inline similar(::BlockArray, ::Type{T}, axes::Tuple{Union{Integer, OneTo}, Vararg{Union{Integer, OneTo}}}) where T = BlockArray{T}(undef, map(to_axes,axes))
@inline similar(::BlockArray, ::Type{T}, axes::Tuple{Integer, Vararg{Integer}}) where T = BlockArray{T}(undef, map(to_axes,axes))

rowsupport(A::PseudoBlockArray, i::CartesianIndex{2}) = rowsupport(A, first(i))
colsupport(A::PseudoBlockArray, i::CartesianIndex{2}) = colsupport(A, last(i))
rowsupport(A::BlockedArray, i::CartesianIndex{2}) = rowsupport(A, first(i))
colsupport(A::BlockedArray, i::CartesianIndex{2}) = colsupport(A, last(i))

reshape(block_array::PseudoBlockArray, axes::Tuple{}) = _pseudo_reshape(block_array, axes)
reshape(block_array::BlockArray, dims::Tuple{Vararg{Int}}) = reshape(PseudoBlockArray(block_array), dims)
reshape(block_array::BlockArray, dims::Tuple{}) = reshape(PseudoBlockArray(block_array), dims)
reshape(block_array::BlockedArray, axes::Tuple{}) = _pseudo_reshape(block_array, axes)
reshape(block_array::BlockArray, dims::Tuple{Vararg{Int}}) = reshape(BlockedArray(block_array), dims)
reshape(block_array::BlockArray, dims::Tuple{}) = reshape(BlockedArray(block_array), dims)

end # module
16 changes: 0 additions & 16 deletions ext/PTYQoLCircularArraysExt.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
module PTYQoLCircularArraysExt

import CircularArrays: CircularArray
"""
CircularMatrix{T,A} <: AbstractVector{T}

Two-dimensional array backed by an `AbstractArray{T, 2}` of type `A` with fixed size and circular indexing.
Alias for [`CircularArray{T,2,A}`](@ref).
"""
const CircularMatrix{T} = CircularArray{T, 2}

# ambiguities
import Base: similar
import CircularArrays: CircularArray, _similar

# https://github.com/Vexatos/CircularArrays.jl/pull/31
@inline similar(arr::CircularArray, ::Type{T}, dims::Tuple{Integer, Vararg{Integer}}) where T = _similar(arr, T, dims)

end
8 changes: 6 additions & 2 deletions src/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ macro struct_map(TYP, ops...)
end)
end

export indent
indent(s::AbstractString, t::AbstractString) = t*replace(s, "\n" => "\n"*t)
indent(s::AbstractString, k::Integer) = indent(s, repeat(' ', k))

import Base: Fix1, show, string
export ln
"""
Expand Down Expand Up @@ -246,8 +250,8 @@ julia> fracpochhammer(1, 2, 0.5, 1, 3) # (1 * 1.5 * 2) / (2 * 3 * 4)
0.125
```
"""
fracpochhammer(a,b,n) = prod(x/y for (x,y) in zip(range(a,length=n),range(b,length=n)))
fracpochhammer(a,b,stepa,stepb,n) = prod(x/y for (x,y) in zip(range(a,step=stepa,length=n),range(b,step=stepb,length=n)))
fracpochhammer(a,b,n) = prod((x/y for (x,y) in zip(range(a,length=n),range(b,length=n))), init=1)
fracpochhammer(a,b,stepa,stepb,n) = prod((x/y for (x,y) in zip(range(a,step=stepa,length=n),range(b,step=stepb,length=n))), init=1)

const TupleN{T,N} = Tuple{Vararg{T,N}}
const Tuple1N{T,N} = Tuple{T, Vararg{T,N}}
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ using Aqua
for m in extension
display(m[1])
display(m[2])
Aqua.ambiguity_hint(m...)
Aqua.ambiguity_hint(stdout, m...)
print("\n\n\n")
end
println("There are $(length(extension)) ambiguities that can be solved by extension.")
Expand Down
Loading