Skip to content

Commit 31f075f

Browse files
Add aqua workflow, fix related issues (#251)
* add aqua workflow, fix related issues * Apply suggestions from code review Co-authored-by: Alexis <[email protected]>
1 parent c3cee66 commit 31f075f

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

.github/workflows/Aqua.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Aqua
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: julia-actions/setup-julia@latest
14+
with:
15+
version: '1'
16+
- name: Aqua.jl
17+
run: julia --color=yes -e 'using Pkg; Pkg.add("Aqua"); Pkg.develop(path="."); using Aqua, LinearOperators; Aqua.test_all(LinearOperators)'

src/special-operators.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ struct opEye <: AbstractLinearOperator{Any} end
1717
*(x::AbstractArray{T, 1} where {T}, ::opEye) = x
1818
*(::opEye, A::AbstractArray{T, 2} where {T}) = A
1919
*(A::AbstractArray{T, 2} where {T}, ::opEye) = A
20+
*(
21+
v::Union{LinearAlgebra.Adjoint{S, V}, LinearAlgebra.Transpose{S, V}},
22+
::LinearOperators.opEye,
23+
) where {S, V <: AbstractVector{S}} = v
2024
*(::opEye, T::AbstractLinearOperator) = T
2125
*(T::AbstractLinearOperator, ::opEye) = T
2226
*(::opEye, T::opEye) = T
@@ -212,9 +216,9 @@ opExtension(k::I, ncol::I) where {I <: Integer} = opExtension([k], ncol)
212216
import Base.getindex
213217
function getindex(
214218
op::AbstractLinearOperator,
215-
rows::Union{LinearOperatorIndexType{I}, I, Colon},
216-
cols::Union{LinearOperatorIndexType{I}, I, Colon},
217-
) where {I <: Integer}
219+
rows::Union{LinearOperatorIndexType{<:Integer}, <:Integer, Colon},
220+
cols::Union{LinearOperatorIndexType{<:Integer}, <:Integer, Colon},
221+
)
218222
R = opRestriction(rows, size(op, 1))
219223
E = opExtension(cols, size(op, 2))
220224
return R * op * E

test/test_linop.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ function test_linop()
223223
@test(abs(norm(opI2 * v - v)) <= ϵ * norm(v))
224224
@test(abs(norm(transpose(opI) * v - v)) <= ϵ * norm(v))
225225
@test(abs(norm(opI' * v - v)) <= ϵ * norm(v))
226+
@test(abs(norm(v' * opI - v')) <= ϵ * norm(v))
226227
@test(norm(Matrix(opI) - Matrix(1.0I, nrow, nrow)) <= ϵ * norm(Matrix(1.0I, nrow, nrow)))
227228

228229
w = opI * v

0 commit comments

Comments
 (0)