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

[breaking] Remove shape function (duplicate of size) #297

Merged
merged 1 commit into from
Dec 5, 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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ Function | Description
`hermitian` | Determine whether the operator is Hermitian
`push!` | For L-BFGS or L-SR1 operators, push a new pair {s,y}
`reset!` | For L-BFGS or L-SR1 operators, reset the data
`shape` | Return the size of a linear operator
`show` | Display basic information about an operator
`size` | Return the size of a linear operator
`symmetric` | Determine whether the operator is symmetric
Expand Down
1 change: 0 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Function | Description
`hermitian` | Determine whether the operator is Hermitian
`push!` | For L-BFGS or L-SR1 operators, push a new pair {s,y}
`reset!` | For L-BFGS or L-SR1 operators, reset the data
`shape` | Return the size of a linear operator
`show` | Display basic information about an operator
`size` | Return the size of a linear operator
`symmetric` | Determine whether the operator is symmetric
Expand Down
10 changes: 1 addition & 9 deletions src/abstract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export AbstractLinearOperator,
nprod,
ntprod,
nctprod,
reset!,
shape
reset!

mutable struct LinearOperatorException <: Exception
msg::AbstractString
Expand Down Expand Up @@ -210,13 +209,6 @@ function size(op::AbstractLinearOperator, d::Integer)
throw(LinearOperatorException("Linear operators only have 2 dimensions for now"))
end

"""
m, n = shape(op)

An alias for size.
"""
shape(op::AbstractLinearOperator) = size(op)

"""
ishermitian(op)

Expand Down
3 changes: 1 addition & 2 deletions test/test_linop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function test_linop()

@testset "Size" begin
@test(size(op) == (nrow, ncol))
@test(shape(op) == (nrow, ncol))
@test(size(op, 1) == nrow)
@test(size(op, 2) == ncol)
@test_throws LinearOperatorException size(op, 3)
Expand Down Expand Up @@ -676,7 +675,7 @@ function test_linop()
for _ = 1:nctprods
op' * rand(3)
end
for fn ∈ (:size, :shape, :issymmetric, :ishermitian, :nprod, :ntprod, :nctprod)
for fn ∈ (:size, :issymmetric, :ishermitian, :nprod, :ntprod, :nctprod)
@eval begin
@test $fn($top) == $fn($top.op)
end
Expand Down
Loading