Skip to content

Commit

Permalink
Use Type not DataType (#30)
Browse files Browse the repository at this point in the history
* Julia 1.10

* Use Type not DataType
  • Loading branch information
JeffFessler authored Apr 9, 2024
1 parent ca274f5 commit 44fce6a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ within each iteration.

### Compatibility

Tested with Julia ≥ 1.9.
Tested with Julia ≥ 1.10.


### Related packages
Expand Down
2 changes: 1 addition & 1 deletion src/b0init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function b0init(
threshold::Real = 0.1,
df::AbstractVector{<:RealU} = Float32[],
relamp::AbstractVector{<:RealU} = ones(Float32, size(df)) / max(1, length(df)),
T::DataType = eltype(1 / oneunit(Te)),
T::Type{<:Number} = eltype(1 / oneunit(Te)),
kwargs...
)::Array{T,D-2} where {D, Te <: RealU}

Expand Down
2 changes: 1 addition & 1 deletion src/b0model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function b0model(
smap::AbstractArray{<:Complex} = ones(ComplexF32, size(fmap)..., 1),
xf::AbstractArray{<:Number,D} = zeros(Tx, size(fmap)),
relax::AbstractArray{<:RealU} = zeros(Tf, size(fmap)),
T::DataType = promote_type(Tx, ComplexF32, eltype(oneunit(Tf)*oneunit(Te))),
T::Type{<:Number} = promote_type(Tx, ComplexF32, eltype(oneunit(Tf)*oneunit(Te))),
)::Array{T,D+2} where {D, Te <: RealU, Tf <: RealU, Tx <: Number}

Base.require_one_based_indexing(df, echotime, fmap, relamp, smap, xf, xw)
Expand Down
4 changes: 2 additions & 2 deletions src/spdiff1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using LinearAlgebra: I


"""
spdiff1(n::Int; ending::Symbol = :remove, T::DataType = Int32)
spdiff1(n::Int; ending::Symbol = :remove, T::Type = Int32)
Sparse `n × n` matrix
for 1st-order finite differences.
Expand All @@ -19,7 +19,7 @@ for 1st-order finite differences.
- `:remove` (default) remove first difference
- `:zero` keep first row, akin to zero boundary conditions
"""
function spdiff1(n::Int; ending::Symbol = :remove, T::DataType = Int32)
function spdiff1(n::Int; ending::Symbol = :remove, T::Type{<:Number} = Int32)
sp = spdiagm(-1 => -ones(T,n-1), 0 => fill(one(T), n))
if ending === :remove
sp[1,1:2] .= zero(T)
Expand Down
4 changes: 2 additions & 2 deletions src/spdiff2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using LinearAlgebra: I


"""
spdiff2(n::Int; ending::Symbol = :remove, T::DataType = Int32)
spdiff2(n::Int; ending::Symbol = :remove, T::Type = Int32)
Sparse `n × n` matrix
for 2nd-order finite differences.
Expand All @@ -20,7 +20,7 @@ for 2nd-order finite differences.
- `:zero` keep first and last rows, akin to zero boundary conditions
- `:first` use 1st-order finite differences for first and last rows
"""
function spdiff2(n::Int; ending::Symbol = :remove, T::DataType = Int32)
function spdiff2(n::Int; ending::Symbol = :remove, T::Type{<:Number} = Int32)
sp = spdiagm(-1 => -ones(T,n-1), +1 => -ones(T,n-1), 0 => fill(T(2), n))
if ending === :remove
sp[1,1:3] .= zero(T)
Expand Down

0 comments on commit 44fce6a

Please sign in to comment.