Skip to content

disallow infinite operators in Zeros matrix constructors #406

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 1 commit into from
Mar 20, 2023
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 src/ApproxFunBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import BandedMatrices: bandrange, inbands_setindex!, bandwidth,
colstart, colstop, colrange, rowstart, rowstop, rowrange,
bandwidths, _BandedMatrix, BandedMatrix, isbanded

import BlockArrays: blocksize, block, blockaxes, blockindex
import BlockArrays: blocksize, block, blockaxes, blockindex, blocklengths
import BlockBandedMatrices: blockbandwidth, blockbandwidths, blockcolstop,
blockcolrange, blockcolstart, blockrowstop, blockrowstart,
subblockbandwidth, subblockbandwidths, _BlockBandedMatrix,
Expand Down
22 changes: 17 additions & 5 deletions src/Operators/Operator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -733,20 +733,32 @@ copyto!(dest::AbstractMatrix, src::Operator) = copyto!(dest, AbstractMatrix(src)

# this is for operators that implement copy via axpy!

BandedMatrix(::Type{Zeros}, V::Operator) = BandedMatrix(Zeros{eltype(V)}(size(V)), bandwidths(V))
Matrix(::Type{Zeros}, V::Operator) = Matrix(Zeros{eltype(V)}(size(V)))
BandedBlockBandedMatrix(::Type{Zeros}, V::Operator) =
function BandedMatrix(::Type{Zeros}, V::Operator)
all(isfinite, size(V)) || throw(ArgumentError("operator must be finite"))
BandedMatrix(Zeros{eltype(V)}(size(V)), bandwidths(V))
end
function Matrix(::Type{Zeros}, V::Operator)
all(isfinite, size(V)) || throw(ArgumentError("operator must be finite"))
Matrix(Zeros{eltype(V)}(size(V)))
end
function BandedBlockBandedMatrix(::Type{Zeros}, V::Operator)
all(isfinite, size(V)) || throw(ArgumentError("operator must be finite"))
BandedBlockBandedMatrix(Zeros{eltype(V)}(size(V)),
blocklengths(rangespace(V)), blocklengths(domainspace(V)),
blockbandwidths(V), subblockbandwidths(V))
BlockBandedMatrix(::Type{Zeros}, V::Operator) =
end
function BlockBandedMatrix(::Type{Zeros}, V::Operator)
all(isfinite, size(V)) || throw(ArgumentError("operator must be finite"))
BlockBandedMatrix(Zeros{eltype(V)}(size(V)),
AbstractVector{Int}(blocklengths(rangespace(V))),
AbstractVector{Int}(blocklengths(domainspace(V))),
blockbandwidths(V))
RaggedMatrix(::Type{Zeros}, V::Operator) =
end
function RaggedMatrix(::Type{Zeros}, V::Operator)
all(isfinite, size(V)) || throw(ArgumentError("operator must be finite"))
RaggedMatrix(Zeros{eltype(V)}(size(V)),
Int[max(0,colstop(V,j)) for j=1:size(V,2)])
end


convert_axpy!(::Type{MT}, S::Operator) where {MT <: AbstractMatrix} =
Expand Down