Skip to content

Conversation

@jClugstor
Copy link
Member

Checklist

  • [ x] Appropriate tests were added
  • [ x] Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • [ x] The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • [ x] Any new documentation only uses public API

The idea here is to automatically generate the struct plus the constructors in such a way that the constructors end up being type stable, with the added benefit that it makes adding toggles and presets much easier than when you have to make the constructors manually.

Currently, you need a tuple of symbols representing toggles, a named tuple where keys are presets, and values are named tuples where the keys are toggles and values are the AbstractMessageLevel that is associated with that toggle in that preset. This also allows for a more flexible constructor, where users will be able to set the verbosity specifier to a preset while changing individual settings at the time of construction. So for example if you want a Minimal LinearVerbosity except for :default_lu_fallback you can do LinearVerbosity(preset = Minimal(), default_lu_fallback = WarnLevel()).

Example

toggles = (:toggle1, :toggle2, :toggle3, :toggle4, :toggle5,
    :toggle6, :toggle7, :toggle8, :toggle9, :toggle10)

preset_map = (
    None = (
        toggle1 = Silent(),
        toggle2 = Silent(),
        toggle3 = Silent(),
        toggle4 = Silent(),
        toggle5 = Silent(),
        toggle6 = Silent(),
        toggle7 = Silent(),
        toggle8 = Silent(),
        toggle9 = Silent(),
        toggle10 = Silent()
    ),
    Minimal = (
        toggle1 = WarnLevel(),
        toggle2 = Silent(),
        toggle3 = ErrorLevel(),
        toggle4 = DebugLevel(),
        toggle5 = InfoLevel(),
        toggle6 = WarnLevel(),
        toggle7 = Silent(),
        toggle8 = InfoLevel(),
        toggle9 = DebugLevel(),
        toggle10 = ErrorLevel()
    ),
    Standard = (
        toggle1 = InfoLevel(),
        toggle2 = WarnLevel(),
        toggle3 = DebugLevel(),
        toggle4 = ErrorLevel(),
        toggle5 = Silent(),
        toggle6 = InfoLevel(),
        toggle7 = DebugLevel(),
        toggle8 = WarnLevel(),
        toggle9 = Silent(),
        toggle10 = ErrorLevel()
    ),
    Detailed = (
        toggle1 = DebugLevel(),
        toggle2 = InfoLevel(),
        toggle3 = Silent(),
        toggle4 = WarnLevel(),
        toggle5 = ErrorLevel(),
        toggle6 = DebugLevel(),
        toggle7 = ErrorLevel(),
        toggle8 = Silent(),
        toggle9 = WarnLevel(),
        toggle10 = InfoLevel()
    ),
    All = (
        toggle1 = ErrorLevel(),
        toggle2 = DebugLevel(),
        toggle3 = InfoLevel(),
        toggle4 = Silent(),
        toggle5 = WarnLevel(),
        toggle6 = ErrorLevel(),
        toggle7 = InfoLevel(),
        toggle8 = DebugLevel(),
        toggle9 = WarnLevel(),
        toggle10 = Silent()
    )
)

groups = (
    numerical = (:toggle1, :toggle2, :toggle3),
    performance = (:toggle4, :toggle5, :toggle6, :toggle7),
    error_control = (:toggle8, :toggle9, :toggle10)
)

when put through the generator gives

 struct VerbSpec{T1, T2, T3, T4, T5, T6, T7, T8, T9, T10} <: AbstractVerbositySpecifier
        toggle1::T1
        toggle2::T2
        toggle3::T3
        toggle4::T4
        toggle5::T5
        toggle6::T6
        toggle7::T7
        toggle8::T8
        toggle9::T9
        toggle10::T10
end

 function VerbSpec(toggle1, toggle2, toggle3, toggle4, toggle5, toggle6, toggle7, toggle8, toggle9, toggle10)
        return VerbSpec{typeof(toggle1), typeof(toggle2), typeof(toggle3), typeof(toggle4), typeof(toggle5), typeof(toggle6), typeof(toggle7), typeof(toggle8), typeof(toggle9), typeof(toggle10)}(toggle1, toggle2, toggle3, toggle4, toggle5, toggle6, toggle7, toggle8, toggle9, toggle10)
    end


function VerbSpec(::None)
    return VerbSpec(Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent())
end


function VerbSpec(::Minimal)
    return VerbSpec(WarnLevel(), Silent(), ErrorLevel(), DebugLevel(), InfoLevel(), WarnLevel(), Silent(), InfoLevel(), DebugLevel(), ErrorLevel())
end

function VerbSpec(::Standard)
    return VerbSpec(InfoLevel(), WarnLevel(), DebugLevel(), ErrorLevel(), Silent(), InfoLevel(), DebugLevel(), WarnLevel(), Silent(), ErrorLevel())
end


function VerbSpec(::Detailed)
    return VerbSpec(DebugLevel(), InfoLevel(), Silent(), WarnLevel(), ErrorLevel(), DebugLevel(), ErrorLevel(), Silent(), WarnLevel(), InfoLevel())
end

 function _build_VerbSpec_runtime(numerical, performance, error_control, preset, kwargs)
        begin
            if numerical !== nothing && !(numerical isa AbstractMessageLevel)
                throw(ArgumentError("$(:numerical) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(numerical))"))
            end
        end
        begin
            if performance !== nothing && !(performance isa AbstractMessageLevel)
                throw(ArgumentError("$(:performance) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(performance))"))
            end
        end
        begin
            if error_control !== nothing && !(error_control isa AbstractMessageLevel)
                throw(ArgumentError("$(:error_control) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(error_control))"))
            end
        end
        if preset !== nothing && !(preset isa AbstractVerbosityPreset)
            throw(ArgumentError("preset must be a SciMLLogging.AbstractVerbosityPreset, got \$(typeof(preset))"))
        end
        begin
            for (key, value) = pairs(kwargs)
                if !(key in [:toggle1, :toggle2, :toggle3, :toggle4, :toggle5, :toggle6, :toggle7, :toggle8, :toggle9, :toggle10])
                    throw(ArgumentError("Unknown verbosity option: \$key. Valid options are: $([:toggle1, :toggle2, :toggle3, :toggle4, :toggle5, :toggle6, :toggle7, :toggle8, :toggle9, :toggle10])"))
                end
                if !(value isa AbstractMessageLevel)
                    throw(ArgumentError("\$key must be a SciMLLogging.AbstractMessageLevel, got \$(typeof(value))"))
                end
            end
        end
        preset_to_use = if preset === nothing
                Standard()
            else
                preset
            end
        preset_config = ((None = (toggle1 = Silent(), toggle2 = Silent(), toggle3 = Silent(), toggle4 = Silent(), toggle5 = Silent(), toggle6 = Silent(), toggle7 = Silent(), toggle8 = Silent(), toggle9 = Silent(), toggle10 = Silent()), Minimal = (toggle1 = WarnLevel(), toggle2 = Silent(), toggle3 = ErrorLevel(), toggle4 = DebugLevel(), toggle5 = InfoLevel(), toggle6 = WarnLevel(), toggle7 = Silent(), toggle8 = InfoLevel(), toggle9 = DebugLevel(), toggle10 = ErrorLevel()), Standard = (toggle1 = InfoLevel(), toggle2 = WarnLevel(), toggle3 = DebugLevel(), toggle4 = ErrorLevel(), toggle5 = Silent(), toggle6 = InfoLevel(), toggle7 = DebugLevel(), toggle8 = WarnLevel(), toggle9 = Silent(), toggle10 = ErrorLevel()), Detailed = (toggle1 = DebugLevel(), toggle2 = InfoLevel(), toggle3 = Silent(), toggle4 = WarnLevel(), toggle5 = ErrorLevel(), toggle6 = DebugLevel(), toggle7 = ErrorLevel(), toggle8 = Silent(), toggle9 = WarnLevel(), toggle10 = InfoLevel()), All = (toggle1 = ErrorLevel(), toggle2 = DebugLevel(), toggle3 = InfoLevel(), toggle4 = Silent(), toggle5 = WarnLevel(), toggle6 = ErrorLevel(), toggle7 = InfoLevel(), toggle8 = DebugLevel(), toggle9 = WarnLevel(), toggle10 = Silent())))[(typeof(preset_to_use)).name.name]
        begin
            toggle1 = if haskey(kwargs, :toggle1)
                    kwargs[:toggle1]
                elseif numerical !== nothing
                    numerical
                else
                    preset_config[:toggle1]
                end
        end
        begin
            toggle2 = if haskey(kwargs, :toggle2)
                    kwargs[:toggle2]
                elseif numerical !== nothing
                    numerical
                else
                    preset_config[:toggle2]
                end
        end
        begin
            toggle3 = if haskey(kwargs, :toggle3)
                    kwargs[:toggle3]
                elseif numerical !== nothing
                    numerical
                else
                    preset_config[:toggle3]
                end
        end
        begin
            toggle4 = if haskey(kwargs, :toggle4)
                    kwargs[:toggle4]
                elseif performance !== nothing
                    performance
                else
                    preset_config[:toggle4]
                end
        end
        begin
            toggle5 = if haskey(kwargs, :toggle5)
                    kwargs[:toggle5]
                elseif performance !== nothing
                    performance
                else
                    preset_config[:toggle5]
                end
        end
        begin
            toggle6 = if haskey(kwargs, :toggle6)
                    kwargs[:toggle6]
                elseif performance !== nothing
                    performance
                else
                    preset_config[:toggle6]
                end
        end
        begin
            toggle7 = if haskey(kwargs, :toggle7)
                    kwargs[:toggle7]
                elseif performance !== nothing
                    performance
                else
                    preset_config[:toggle7]
                end
        end
        begin
            toggle8 = if haskey(kwargs, :toggle8)
                    kwargs[:toggle8]
                elseif error_control !== nothing
                    error_control
                else
                    preset_config[:toggle8]
                end
        end
        begin
            toggle9 = if haskey(kwargs, :toggle9)
                    kwargs[:toggle9]
                elseif error_control !== nothing
                    error_control
                else
                    preset_config[:toggle9]
                end
        end
        begin
            toggle10 = if haskey(kwargs, :toggle10)
                    kwargs[:toggle10]
                elseif error_control !== nothing
                    error_control
                else
                    preset_config[:toggle10]
                end
        end
        return VerbSpec(toggle1, toggle2, toggle3, toggle4, toggle5, toggle6, toggle7, toggle8, toggle9, toggle10)
    end

@ChrisRackauckas
Copy link
Member

It needs to be a macro...

@jClugstor
Copy link
Member Author

I've simplified it and turned it in to a macro.

Using LinearVerbosity as an example, you can do

@verbosity_specifier LinearVerbosity begin
    toggles = (
        :default_lu_fallback,
        :no_right_preconditioning,
        :using_IterativeSolvers,
        :IterativeSolvers_iterations,
        :KrylovKit_verbosity,
        :KrylovJL_verbosity,
        :HYPRE_verbosity,
        :pardiso_verbosity,
        :blas_errors,
        :blas_invalid_args,
        :blas_info,
        :blas_success,
        :condition_number,
        :convergence_failure,
        :solver_failure,
        :max_iters
    )

    presets = (
        None = (
            default_lu_fallback = Silent(),
            no_right_preconditioning = Silent(),
            using_IterativeSolvers = Silent(),
            IterativeSolvers_iterations = Silent(),
            KrylovKit_verbosity = Silent(),
            KrylovJL_verbosity = Silent(),
            HYPRE_verbosity = Silent(),
            pardiso_verbosity = Silent(),
            blas_errors = Silent(),
            blas_invalid_args = Silent(),
            blas_info = Silent(),
            blas_success = Silent(),
            condition_number = Silent(),
            convergence_failure = Silent(),
            solver_failure = Silent(),
            max_iters = Silent()
        ),
        Minimal = (
            default_lu_fallback = Silent(),
            no_right_preconditioning = Silent(),
            using_IterativeSolvers = Silent(),
            IterativeSolvers_iterations = Silent(),
            KrylovKit_verbosity = Silent(),
            KrylovJL_verbosity = Silent(),
            HYPRE_verbosity = Silent(),
            pardiso_verbosity = Silent(),
            blas_errors = WarnLevel(),
            blas_invalid_args = WarnLevel(),
            blas_info = Silent(),
            blas_success = Silent(),
            condition_number = Silent(),
            convergence_failure = Silent(),
            solver_failure = Silent(),
            max_iters = Silent()
        ),
        Standard = (
            default_lu_fallback = Silent(),
            no_right_preconditioning = Silent(),
            using_IterativeSolvers = Silent(),
            IterativeSolvers_iterations = Silent(),
            KrylovKit_verbosity = CustomLevel(1),
            KrylovJL_verbosity = Silent(),
            HYPRE_verbosity = InfoLevel(),
            pardiso_verbosity = Silent(),
            blas_errors = WarnLevel(),
            blas_invalid_args = WarnLevel(),
            blas_info = Silent(),
            blas_success = Silent(),
            condition_number = Silent(),
            convergence_failure = WarnLevel(),
            solver_failure = WarnLevel(),
            max_iters = WarnLevel()
        ),
        Detailed = (
            default_lu_fallback = WarnLevel(),
            no_right_preconditioning = InfoLevel(),
            using_IterativeSolvers = InfoLevel(),
            IterativeSolvers_iterations = Silent(),
            KrylovKit_verbosity = CustomLevel(2),
            KrylovJL_verbosity = CustomLevel(1),
            HYPRE_verbosity = InfoLevel(),
            pardiso_verbosity = CustomLevel(1),
            blas_errors = WarnLevel(),
            blas_invalid_args = WarnLevel(),
            blas_info = InfoLevel(),
            blas_success = InfoLevel(),
            condition_number = Silent(),
            convergence_failure = WarnLevel(),
            solver_failure = WarnLevel(),
            max_iters = WarnLevel()
        ),
        All = (
            default_lu_fallback = WarnLevel(),
            no_right_preconditioning = InfoLevel(),
            using_IterativeSolvers = InfoLevel(),
            IterativeSolvers_iterations = InfoLevel(),
            KrylovKit_verbosity = CustomLevel(3),
            KrylovJL_verbosity = CustomLevel(1),
            HYPRE_verbosity = InfoLevel(),
            pardiso_verbosity = CustomLevel(1),
            blas_errors = WarnLevel(),
            blas_invalid_args = WarnLevel(),
            blas_info = InfoLevel(),
            blas_success = InfoLevel(),
            condition_number = InfoLevel(),
            convergence_failure = WarnLevel(),
            solver_failure = WarnLevel(),
            max_iters = WarnLevel()
        )
    )

    groups = (
        error_control = (:default_lu_fallback, :blas_errors, :blas_invalid_args),
        performance = (:no_right_preconditioning,),
        numerical = (:using_IterativeSolvers, :IterativeSolvers_iterations,
                     :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity,
                     :pardiso_verbosity, :blas_info, :blas_success, :condition_number,
                     :convergence_failure, :solver_failure, :max_iters)
    )
end

and get

    const _preset_map_LinearVerbosity = NamedTuple{(:None, :Minimal, :All, :Standard, :Detailed)}((NamedTuple{(:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters)}((Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent())), NamedTuple{(:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters)}((Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), WarnLevel(), WarnLevel(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent())), NamedTuple{(:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters)}((WarnLevel(), InfoLevel(), InfoLevel(), InfoLevel(), CustomLevel(3), CustomLevel(1), InfoLevel(), CustomLevel(1), WarnLevel(), WarnLevel(), InfoLevel(), InfoLevel(), InfoLevel(), WarnLevel(), WarnLevel(), WarnLevel())), NamedTuple{(:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters)}((Silent(), Silent(), Silent(), Silent(), CustomLevel(1), Silent(), InfoLevel(), Silent(), WarnLevel(), WarnLevel(), Silent(), Silent(), Silent(), WarnLevel(), WarnLevel(), WarnLevel())), NamedTuple{(:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters)}((WarnLevel(), InfoLevel(), InfoLevel(), Silent(), CustomLevel(2), CustomLevel(1), InfoLevel(), CustomLevel(1), WarnLevel(), WarnLevel(), InfoLevel(), InfoLevel(), Silent(), WarnLevel(), WarnLevel(), WarnLevel()))))
    struct LinearVerbosity{T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16} <: AbstractVerbositySpecifier
        default_lu_fallback::T1
        no_right_preconditioning::T2
        using_IterativeSolvers::T3
        IterativeSolvers_iterations::T4
        KrylovKit_verbosity::T5
        KrylovJL_verbosity::T6
        HYPRE_verbosity::T7
        pardiso_verbosity::T8
        blas_errors::T9
        blas_invalid_args::T10
        blas_info::T11
        blas_success::T12
        condition_number::T13
        convergence_failure::T14
        solver_failure::T15
        max_iters::T16
    end
    function LinearVerbosity(::None)
        return LinearVerbosity(Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent())
    end
    function LinearVerbosity(::Minimal)
        return LinearVerbosity(Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent(), WarnLevel(), WarnLevel(), Silent(), Silent(), Silent(), Silent(), Silent(), Silent())
    end
    function LinearVerbosity(::All)
        return LinearVerbosity(WarnLevel(), InfoLevel(), InfoLevel(), InfoLevel(), CustomLevel(3), CustomLevel(1), InfoLevel(), CustomLevel(1), WarnLevel(), WarnLevel(), InfoLevel(), InfoLevel(), InfoLevel(), WarnLevel(), WarnLevel(), WarnLevel())
    end
    function LinearVerbosity(::Standard)
        return LinearVerbosity(Silent(), Silent(), Silent(), Silent(), CustomLevel(1), Silent(), InfoLevel(), Silent(), WarnLevel(), WarnLevel(), Silent(), Silent(), Silent(), WarnLevel(), WarnLevel(), WarnLevel())
    end
    function LinearVerbosity(::Detailed)
        return LinearVerbosity(WarnLevel(), InfoLevel(), InfoLevel(), Silent(), CustomLevel(2), CustomLevel(1), InfoLevel(), CustomLevel(1), WarnLevel(), WarnLevel(), InfoLevel(), InfoLevel(), Silent(), WarnLevel(), WarnLevel(), WarnLevel())
    end
    begin
        function LinearVerbosity(; preset = nothing, numerical = nothing, performance = nothing, error_control = nothing, kwargs...)
            kwargs = NamedTuple(kwargs)
            if numerical === nothing && (performance === nothing && (error_control === nothing && (preset === nothing && isempty(kwargs))))
                return LinearVerbosity(Silent(), Silent(), Silent(), Silent(), CustomLevel(1), Silent(), InfoLevel(), Silent(), WarnLevel(), WarnLevel(), Silent(), Silent(), Silent(), WarnLevel(), WarnLevel(), WarnLevel())
            end
            begin
                if numerical !== nothing && !(numerical isa AbstractMessageLevel)
                    throw(ArgumentError("$(:numerical) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(numerical))"))
                end
            end
            begin
                if performance !== nothing && !(performance isa AbstractMessageLevel)
                    throw(ArgumentError("$(:performance) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(performance))"))
                end
            end
            begin
                if error_control !== nothing && !(error_control isa AbstractMessageLevel)
                    throw(ArgumentError("$(:error_control) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(error_control))"))
                end
            end
            if preset !== nothing && !(preset isa AbstractVerbosityPreset)
                throw(ArgumentError("preset must be a SciMLLogging.AbstractVerbosityPreset, got $(typeof(preset))"))
            end
            for (key, value) = pairs(kwargs)
                if !(key in (:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters))
                    throw(ArgumentError("Unknown verbosity option: $(key). Valid options are: $((:default_lu_fallback, :no_right_preconditioning, :using_IterativeSolvers, :IterativeSolvers_iterations, :KrylovKit_verbosity, :KrylovJL_verbosity, :HYPRE_verbosity, :pardiso_verbosity, :blas_errors, :blas_invalid_args, :blas_info, :blas_success, :condition_number, :convergence_failure, :solver_failure, :max_iters))"))
                end
                if !(value isa AbstractMessageLevel)
                    throw(ArgumentError("$(key) must be a SciMLLogging.AbstractMessageLevel, got $(typeof(value))"))
                end
            end
            preset_to_use = if preset === nothing
                    Standard()
                else
                    preset
                end
            preset_config = _preset_map_LinearVerbosity[(typeof(preset_to_use)).name.name]
            default_lu_fallback = if haskey(kwargs, :default_lu_fallback)
                    kwargs[:default_lu_fallback]
                else
                    if error_control !== nothing
                        error_control
                    else
                        preset_config[:default_lu_fallback]
                    end
                end
            no_right_preconditioning = if haskey(kwargs, :no_right_preconditioning)
                    kwargs[:no_right_preconditioning]
                else
                    if performance !== nothing
                        performance
                    else
                        preset_config[:no_right_preconditioning]
                    end
                end
            using_IterativeSolvers = if haskey(kwargs, :using_IterativeSolvers)
                    kwargs[:using_IterativeSolvers]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:using_IterativeSolvers]
                    end
                end
            IterativeSolvers_iterations = if haskey(kwargs, :IterativeSolvers_iterations)
                    kwargs[:IterativeSolvers_iterations]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:IterativeSolvers_iterations]
                    end
                end
            KrylovKit_verbosity = if haskey(kwargs, :KrylovKit_verbosity)
                    kwargs[:KrylovKit_verbosity]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:KrylovKit_verbosity]
                    end
                end
            KrylovJL_verbosity = if haskey(kwargs, :KrylovJL_verbosity)
                    kwargs[:KrylovJL_verbosity]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:KrylovJL_verbosity]
                    end
                end
            HYPRE_verbosity = if haskey(kwargs, :HYPRE_verbosity)
                    kwargs[:HYPRE_verbosity]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:HYPRE_verbosity]
                    end
                end
            pardiso_verbosity = if haskey(kwargs, :pardiso_verbosity)
                    kwargs[:pardiso_verbosity]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:pardiso_verbosity]
                    end
                end
            blas_errors = if haskey(kwargs, :blas_errors)
                    kwargs[:blas_errors]
                else
                    if error_control !== nothing
                        error_control
                    else
                        preset_config[:blas_errors]
                    end
                end
            blas_invalid_args = if haskey(kwargs, :blas_invalid_args)
                    kwargs[:blas_invalid_args]
                else
                    if error_control !== nothing
                        error_control
                    else
                        preset_config[:blas_invalid_args]
                    end
                end
            blas_info = if haskey(kwargs, :blas_info)
                    kwargs[:blas_info]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:blas_info]
                    end
                end
            blas_success = if haskey(kwargs, :blas_success)
                    kwargs[:blas_success]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:blas_success]
                    end
                end
            condition_number = if haskey(kwargs, :condition_number)
                    kwargs[:condition_number]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:condition_number]
                    end
                end
            convergence_failure = if haskey(kwargs, :convergence_failure)
                    kwargs[:convergence_failure]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:convergence_failure]
                    end
                end
            solver_failure = if haskey(kwargs, :solver_failure)
                    kwargs[:solver_failure]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:solver_failure]
                    end
                end
            max_iters = if haskey(kwargs, :max_iters)
                    kwargs[:max_iters]
                else
                    if numerical !== nothing
                        numerical
                    else
                        preset_config[:max_iters]
                    end
                end
            return LinearVerbosity(default_lu_fallback, no_right_preconditioning, using_IterativeSolvers, IterativeSolvers_iterations, KrylovKit_verbosity, KrylovJL_verbosity, HYPRE_verbosity, pardiso_verbosity, blas_errors, blas_invalid_args, blas_info, blas_success, condition_number, convergence_failure, solver_failure, max_iters)
        end
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants