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

Fix the LinearAliasSpecifier constructor #893

Merged
merged 1 commit into from
Dec 19, 2024
Merged
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
13 changes: 5 additions & 8 deletions src/problems/linear_problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ end
@doc doc"""
Holds information on what variables to alias
when solving a LinearProblem. Conforms to the AbstractAliasSpecifier interface.
`LinearAliasSpecifier(;alias_p = nothing, alias_f = nothing, alias_A = nothing, alias_b = nothing, alias = nothing)`
`LinearAliasSpecifier(; alias_A = nothing, alias_b = nothing, alias = nothing)`

When a keyword argument is `nothing`, the default behaviour of the solver is used.

### Keywords

* `alias_p::Union{Bool, Nothing}`
* `alias_f::Union{Bool, Nothing}`
* `alias_A::Union{Bool, Nothing}`: alias the `A` array.
* `alias_b::Union{Bool, Nothing}`: alias the `b` array.
* `alias::Union{Bool, Nothing}`: sets all fields of the `LinearAliasSpecifier` to `alias`.
Expand All @@ -99,14 +97,13 @@ struct LinearAliasSpecifier <: AbstractAliasSpecifier
alias_A::Union{Bool,Nothing}
alias_b::Union{Bool,Nothing}

function LinearAliasSpecifier(; alias_A = nothing, alias_b = nothing,
alias_p = nothing, alias_f = nothing, alias = nothing)
function LinearAliasSpecifier(; alias_A = nothing, alias_b = nothing, alias = nothing)
if alias == true
new(true, true, true, true)
new(true, true)
elseif alias == false
new(false, false, false, false)
new(false, false)
elseif isnothing(alias)
new(alias_p, alias_f, alias_A, alias_b)
new(alias_A, alias_b)
end
end
end
Expand Down
Loading