Skip to content

Commit

Permalink
Accessors for input and output eltypes
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Nov 5, 2023
1 parent d31880e commit 77a0a45
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,11 @@ function cache_self(L::ComposedOperator, u::AbstractVecOrMat)
M = size(op, 1)
sz = u isa AbstractMatrix ? (M, K) : (M,)

T = if op isa FunctionOperator #
T = if op isa FunctionOperator #

Check warning on line 636 in src/basic.jl

View check run for this annotation

Codecov / codecov/patch

src/basic.jl#L636

Added line #L636 was not covered by tests
# FunctionOperator isn't guaranteed to play by the rules of
# `promote_type`. For example, an irFFT is a complex operation
# that accepts complex vector and returns ones.
op.traits.eltypes[2]
output_eltype(op)

Check warning on line 640 in src/basic.jl

View check run for this annotation

Codecov / codecov/patch

src/basic.jl#L640

Added line #L640 was not covered by tests
else
promote_type(eltype.((op, cache[1]))...)
end
Expand Down
15 changes: 12 additions & 3 deletions src/func.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ function set_cache(f::FunctionOperator{iip, oop, mul5, T, F, Fa, Fi, Fai, Tr, P,
f.p, f.t, cache)
end

function input_eltype(::FunctionOperator{iip, oop, mul5, T, F, Fa, Fi, Fai, Tr, P, Tt, C,

Check warning on line 103 in src/func.jl

View check run for this annotation

Codecov / codecov/patch

src/func.jl#L103

Added line #L103 was not covered by tests
iType, oType,
}) where {iip, oop, mul5, T, F, Fa, Fi, Fai, Tr, P, Tt, C, iType, oType}
return iType

Check warning on line 106 in src/func.jl

View check run for this annotation

Codecov / codecov/patch

src/func.jl#L106

Added line #L106 was not covered by tests
end

function output_eltype(::FunctionOperator{iip, oop, mul5, T, F, Fa, Fi, Fai, Tr, P, Tt, C,

Check warning on line 109 in src/func.jl

View check run for this annotation

Codecov / codecov/patch

src/func.jl#L109

Added line #L109 was not covered by tests
iType, oType,
}) where {iip, oop, mul5, T, F, Fa, Fi, Fai, Tr, P, Tt, C, iType, oType}
return oType

Check warning on line 112 in src/func.jl

View check run for this annotation

Codecov / codecov/patch

src/func.jl#L112

Added line #L112 was not covered by tests
end

"""
$(SIGNATURES)
Expand Down Expand Up @@ -301,9 +313,6 @@ function FunctionOperator(op,
eltype(input), eltype(output)}(op,
_op_adjoint, op_inverse, _op_adjoint_inverse, traits, p, _t, cache)

# L = FunctionOperator(op, _op_adjoint, op_inverse, _op_adjoint_inverse, traits, p, _t,
# cache, eltype(input), eltype(output))

# create cache

if _unwrap_val(ifcache) & (L.cache === nothing)
Expand Down

0 comments on commit 77a0a45

Please sign in to comment.