Skip to content

Removes {h,v,hv}cat between arbitrary number of operators and matrices #112

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
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: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ julia:
- 1.0
- 1.1
- 1.2
- 1.3
- nightly

matrix:
allow_failures:
- julia: 1.3
- julia: nightly

notifications:
Expand Down
3 changes: 3 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ environment:
matrix:
- julia_version: 1.0
- julia_version: 1.1
- julia_version: 1.2
- julia_version: 1.3
- julia_version: nightly

platform:
Expand All @@ -10,6 +12,7 @@ platform:

matrix:
allow_failures:
- julia_version: 1.3
- julia_version: nightly

branches:
Expand Down
8 changes: 4 additions & 4 deletions src/LinearOperators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ function hcat(A :: AbstractLinearOperator, B :: AbstractLinearOperator)
LinearOperator{S}(nrow, ncol, false, false, prod, tprod, ctprod)
end

function hcat(ops :: OperatorOrMatrix...)
function hcat(ops :: AbstractLinearOperator...)
op = ops[1]
for i = 2:length(ops)
op = [op ops[i]]
Expand All @@ -585,7 +585,7 @@ function vcat(A :: AbstractLinearOperator, B :: AbstractLinearOperator)
return LinearOperator{S}(nrow, ncol, false, false, prod, tprod, ctprod)
end

function vcat(ops :: OperatorOrMatrix...)
function vcat(ops :: AbstractLinearOperator...)
op = ops[1]
for i = 2:length(ops)
op = [op; ops[i]]
Expand All @@ -594,9 +594,9 @@ function vcat(ops :: OperatorOrMatrix...)
end

# Removed by https://github.com/JuliaLang/julia/pull/24017
function hvcat(rows :: Tuple{Vararg{Int}}, ops :: OperatorOrMatrix...)
function hvcat(rows :: Tuple{Vararg{Int}}, ops :: AbstractLinearOperator...)
nbr = length(rows)
rs = Array{OperatorOrMatrix,1}(undef, nbr)
rs = Array{AbstractLinearOperator,1}(undef, nbr)
a = 1
for i = 1:nbr
rs[i] = hcat(ops[a:a-1+rows[i]]...)
Expand Down
2 changes: 1 addition & 1 deletion test/test_cat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function test_cat()
@test(norm(Do2 * rhs - D * rhs) <= rtol * norm(D * rhs))

@test_throws LinearOperatorException [LinearOperator(ones(5,5)) ; opEye(3)]
K = [Matrix(1.0I, 2, 2) opZeros(2,3) ; opZeros(3,2) opEye(3)]
K = [opEye(2) opZeros(2,3) ; opZeros(3,2) opEye(3)]
v = simple_vector(Float64, 5)
@test all(v .== K * v)

Expand Down