# Latest

**URL:** https://discourse.julialang.org/latest.md?page=402

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 403

---

## [Merge Dictionaries with values of type Vector](https://discourse.julialang.org/t/merge-dictionaries-with-values-of-type-vector/114703)

<div class="topic-metadata">

**Author:** [@sardinecan](https://discourse.julialang.org/u/sardinecan)\
**Replies:** 3\
**Last updated:** [May 25, 2024, 6:42am UTC](https://discourse.julialang.org/t/merge-dictionaries-with-values-of-type-vector/114703 "2024-05-25T06:42:10Z")

</div>

Hi everyone, I try to merge two dictionaries and one of them contains a vector value. Unfortunately, all the merging methods used return the same error: body = Dict( :scope =\> "deposited" ) # an optional paramete…

---

## [Fastest way of resetting a vector](https://discourse.julialang.org/t/fastest-way-of-resetting-a-vector/114709)

<div class="topic-metadata">

**Author:** [@xiaoming](https://discourse.julialang.org/u/xiaoming)\
**Replies:** 2\
**Last updated:** [May 25, 2024, 5:23am UTC](https://discourse.julialang.org/t/fastest-way-of-resetting-a-vector/114709 "2024-05-25T05:23:47Z")

</div>

For a vector a=collect(1:1000), what is the fastest way to reset it? Currently, I only have one solution: a=collect(1:1000) deleteat!(a, 1:length(a))

---

## [Understanding the behaviour of @. macro](https://discourse.julialang.org/t/understanding-the-behaviour-of-macro/114680)

<div class="topic-metadata">

**Author:** [@Janik](https://discourse.julialang.org/u/Janik)\
**Replies:** 5\
**Last updated:** [May 25, 2024, 12:47am UTC](https://discourse.julialang.org/t/understanding-the-behaviour-of-macro/114680 "2024-05-25T00:47:49Z")

</div>

Hi, I am very new to Julia and was playing around with @. (using Julia 1.10.3) and noticed that I can compute the expression 5 .\* rand(10) .+ 2 as expected, however when I use @. 5\*rand(10) + 2 it does not work and …

---

## [Computing variance of variables is very slow in JuMP](https://discourse.julialang.org/t/computing-variance-of-variables-is-very-slow-in-jump/114660)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 3\
**Last updated:** [May 25, 2024, 12:19am UTC](https://discourse.julialang.org/t/computing-variance-of-variables-is-very-slow-in-jump/114660 "2024-05-25T00:19:28Z")

</div>

Consider the small code snippet below using JuMP using Statistics model = Model() n = 1000 @variable(model, x\[1:n\], Bin) @time @objective(model, Min, var(x .\* rand(n))) The timing is 162.785950 seconds (93.08 k alloc…

---

## [Idiom for related types?](https://discourse.julialang.org/t/idiom-for-related-types/114706)

<div class="topic-metadata">

**Author:** [@slawrence](https://discourse.julialang.org/u/slawrence)\
**Replies:** 5\
**Last updated:** [May 24, 2024, 10:40pm UTC](https://discourse.julialang.org/t/idiom-for-related-types/114706 "2024-05-24T22:40:22Z")

</div>

Short version: I want something that serves the role of “methods for structs”, where the content of the struct depends nontrivially on the parameter (just as the content of a method can depend on the type of an argument…

---

## [Is there a way to make a Set of Types that all inherit from a supertype?](https://discourse.julialang.org/t/is-there-a-way-to-make-a-set-of-types-that-all-inherit-from-a-supertype/114705)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 10:04pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-make-a-set-of-types-that-all-inherit-from-a-supertype/114705 "2024-05-24T22:04:59Z")

</div>

For instance a Set that contains Integer types like UInt8, Int64, and so on. Or a Set that contains Exception types. First instinct would be Set{Type{Exception}}() But that can only store the type Exception You can u…

---

## [Allocations in sparse matrices](https://discourse.julialang.org/t/allocations-in-sparse-matrices/114540)

<div class="topic-metadata">

**Author:** [@clopen](https://discourse.julialang.org/u/clopen)\
**Replies:** 6\
**Last updated:** [May 24, 2024, 8:45pm UTC](https://discourse.julialang.org/t/allocations-in-sparse-matrices/114540 "2024-05-24T20:45:38Z")

</div>

Hello, I have a code where I use ‘normal’ (Array{Float64,2 } type) matrices and SparseMatrixCSC{Float64} matrices. Lets say A::SparseMatrixCSC{Float64} = sparse(1.0I, 100, 100) a::Float64 = 2.0 If I create other matric…

---

## [Time-series analysis - Probabilistic inference on RQA ( SymbolicInference.jl)](https://discourse.julialang.org/t/time-series-analysis-probabilistic-inference-on-rqa-symbolicinference-jl/114701)

<div class="topic-metadata">

**Author:** [@fargolo](https://discourse.julialang.org/u/fargolo)\
**Replies:** 0\
**Last updated:** [May 24, 2024, 8:15pm UTC](https://discourse.julialang.org/t/time-series-analysis-probabilistic-inference-on-rqa-symbolicinference-jl/114701 "2024-05-24T20:15:40Z")

</div>

How it started The SymbolicInference.jl package uses Analytic Combinatorics to perform probabilistic inference over certain combinatorial classes. The first application is explained in this white paper Probabilistic in…

---

## [Towards Rust-level feedback on type stability](https://discourse.julialang.org/t/towards-rust-level-feedback-on-type-stability/113497)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 17\
**Last updated:** [May 24, 2024, 6:48pm UTC](https://discourse.julialang.org/t/towards-rust-level-feedback-on-type-stability/113497 "2024-05-24T18:48:06Z")

</div>

I am thinking about the best way to get continual feedback with more detailed type hints in VSCode. Similar to how it is done with rust-analyzer. Background For those who haven’t used Rust, here’s what the feedback loop…

---

## [Iterator yielding tuples vs arrays](https://discourse.julialang.org/t/iterator-yielding-tuples-vs-arrays/114686)

<div class="topic-metadata">

**Author:** [@Marco-Congedo](https://discourse.julialang.org/u/Marco-Congedo)\
**Replies:** 11\
**Last updated:** [May 24, 2024, 6:17pm UTC](https://discourse.julialang.org/t/iterator-yielding-tuples-vs-arrays/114686 "2024-05-24T18:17:07Z")

</div>

This iterator yields n=3 P=Iterators.product(((1, -1) for i=1:n)...) foreach(println, P) (1, 1, 1) (-1, 1, 1) (1, -1, 1) (-1, -1, 1) (1, 1, -1) (-1, 1, -1) (1, -1, -1) (-1, -1, -1) which is what i need for…

---

## [How do I use 'pchip' interpolation of Matlab in Julia code?](https://discourse.julialang.org/t/how-do-i-use-pchip-interpolation-of-matlab-in-julia-code/114688)

<div class="topic-metadata">

**Author:** [@hyde](https://discourse.julialang.org/u/hyde)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 5:29pm UTC](https://discourse.julialang.org/t/how-do-i-use-pchip-interpolation-of-matlab-in-julia-code/114688 "2024-05-24T17:29:34Z")

</div>

In Matlab, there is ‘pchip’ interpolation method. How do I can use ‘pchip’ interpolation by Julia code. I tried some guide such as ‘‘GitHub - gerlero/PCHIPInterpolation.jl: Monotonic cubic interpolation in Julia’’ foun…

---

## [Distributed Computing addprocs onto password enabled ssh connection](https://discourse.julialang.org/t/distributed-computing-addprocs-onto-password-enabled-ssh-connection/114543)

<div class="topic-metadata">

**Author:** [@Teodor\_Tchalakov](https://discourse.julialang.org/u/Teodor_Tchalakov)\
**Replies:** 3\
**Last updated:** [May 24, 2024, 5:15pm UTC](https://discourse.julialang.org/t/distributed-computing-addprocs-onto-password-enabled-ssh-connection/114543 "2024-05-24T17:15:58Z")

</div>

I am attempting to use Distributed.jl to add processes using the SSHManager to a Windows device with an administrative user account that has a password. I am able to run addprocs(\[user@hostname\], :auto), which connects t…

---

## [Macro for implicitly defined NamedTuples](https://discourse.julialang.org/t/macro-for-implicitly-defined-namedtuples/114685)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 4\
**Last updated:** [May 24, 2024, 5:10pm UTC](https://discourse.julialang.org/t/macro-for-implicitly-defined-namedtuples/114685 "2024-05-24T17:10:32Z")

</div>

I want to write a macro imp that does this julia\> @imp(; a = 2, b = a^2, c = 3) (; a = 2, b = 4, c = 3) Not being any good with metaprogramming I turn to the Julia community: Is there any package that already achiev…

---

## [Ignore Manifest.toml when testing a package](https://discourse.julialang.org/t/ignore-manifest-toml-when-testing-a-package/111003)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 3\
**Last updated:** [May 24, 2024, 4:04pm UTC](https://discourse.julialang.org/t/ignore-manifest-toml-when-testing-a-package/111003 "2024-05-24T16:04:30Z")

</div>

Hi, I am testing a local package with different version of Julia. And I always get the message: “The active manifest file has dependencies that were resolved with a different julia version. Unexpected behaviour may oc…

---

## [Using MH() with a custom proposal and acceptance rate of 1 to emulate traditional Gibbs?](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653)

<div class="topic-metadata">

**Author:** [@aws](https://discourse.julialang.org/u/aws)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 4:01pm UTC](https://discourse.julialang.org/t/using-mh-with-a-custom-proposal-and-acceptance-rate-of-1-to-emulate-traditional-gibbs/114653 "2024-05-24T16:01:46Z")

</div>

Hello, Thank you in advance for reading. I am a researcher considering whether to use Turing for a project. As background, I will be implementing and extending a sparse infinite Bayesian factor model as described in Spa…

---

## [I'm failing at "deploy"ing my first web-app with Dash.jl on JuliaHub](https://discourse.julialang.org/t/im-failing-at-deploy-ing-my-first-web-app-with-dash-jl-on-juliahub/114683)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 5\
**Last updated:** [May 24, 2024, 3:55pm UTC](https://discourse.julialang.org/t/im-failing-at-deploy-ing-my-first-web-app-with-dash-jl-on-juliahub/114683 "2024-05-24T15:55:13Z")

</div>

I have made a local package that takes data and sonifies it (sonification is when you map data to sound as opposed to visualization where you map it to visuals/graphs.) I now want to make some of its functionality access…

---

## [Passing large julia struct to c](https://discourse.julialang.org/t/passing-large-julia-struct-to-c/114662)

<div class="topic-metadata">

**Author:** [@vincentliu](https://discourse.julialang.org/u/vincentliu)\
**Replies:** 20\
**Last updated:** [May 24, 2024, 3:05pm UTC](https://discourse.julialang.org/t/passing-large-julia-struct-to-c/114662 "2024-05-24T15:05:25Z")

</div>

Hello, I want to pass an extremely large struct to c interface. For example mutable struct LargeStruct size::UInt32 data::NTuple{1024\*1024\*4,UInt32} end And when I try to create such a large struct, stack overf…

---

## [Turing.jl slow inference](https://discourse.julialang.org/t/turing-jl-slow-inference/114525)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 8\
**Last updated:** [May 24, 2024, 3:01pm UTC](https://discourse.julialang.org/t/turing-jl-slow-inference/114525 "2024-05-24T15:01:25Z")

</div>

Hi, I have specified the following model in Turing.jl: \\begin{align} e^{\\mathcal{L}C\_\\mathrm{i}}\\dot{T}\_\\mathrm{i} =& e^{{\\mathcal{L}A\_\\mathrm{w}}}\\Phi\_{\\mathrm{s}}(t) + e^{-\\mathcal{L}R\_{\\mathrm{ih}}} \\left\[T\_{\\mat…

---

## [Compilation latency with constant propagation and unreachable branches](https://discourse.julialang.org/t/compilation-latency-with-constant-propagation-and-unreachable-branches/114667)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 7\
**Last updated:** [May 24, 2024, 2:44pm UTC](https://discourse.julialang.org/t/compilation-latency-with-constant-propagation-and-unreachable-branches/114667 "2024-05-24T14:44:46Z")

</div>

With julia\> function f(a, b) if a == 1 return b \* b elseif a == 2 return b \* b' elseif a == 3 return b' \* b else re…

---

## [Stiff VS Non-stiff methods: Differing solutions](https://discourse.julialang.org/t/stiff-vs-non-stiff-methods-differing-solutions/114664)

<div class="topic-metadata">

**Author:** [@Sh\_166](https://discourse.julialang.org/u/Sh_166)\
**Replies:** 9\
**Last updated:** [May 24, 2024, 2:44pm UTC](https://discourse.julialang.org/t/stiff-vs-non-stiff-methods-differing-solutions/114664 "2024-05-24T14:44:25Z")

</div>

Apologies if there has been a trivial mistake or otherwise in what follows. MWE: using Symbolics, Plots, DifferentialEquations, ModelingToolkit, LaTeXStrings, Measures, DynamicalSystems function forced\_osc!(du, u, p,…

---

## [How to stop a long-running optimization process in JuMP?](https://discourse.julialang.org/t/how-to-stop-a-long-running-optimization-process-in-jump/114656)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 6\
**Last updated:** [May 24, 2024, 2:31pm UTC](https://discourse.julialang.org/t/how-to-stop-a-long-running-optimization-process-in-jump/114656 "2024-05-24T14:31:46Z")

</div>

Some optimization problem can be quite time-consuming. I used JuMP in Jupyter notebook (VS Code) and Julia REPL. After optimize! is called, the optimization starts, and sometimes I want to interrupt it. However The sto…

---

## [Matrix inversion in ModellingToolkit](https://discourse.julialang.org/t/matrix-inversion-in-modellingtoolkit/114515)

<div class="topic-metadata">

**Author:** [@rveynde](https://discourse.julialang.org/u/rveynde)\
**Replies:** 3\
**Last updated:** [May 24, 2024, 2:29pm UTC](https://discourse.julialang.org/t/matrix-inversion-in-modellingtoolkit/114515 "2024-05-24T14:29:16Z")

</div>

Hi all, I am trying to perform matrix inversion on a 2-dimensional variable in ModellingToolkit, but I get a MethodError that there is no matching method. Is there some implementation of matrix inversion that I could use…

---

## [Pirate Hunter](https://discourse.julialang.org/t/pirate-hunter/20402)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 9\
**Last updated:** [May 24, 2024, 1:57pm UTC](https://discourse.julialang.org/t/pirate-hunter/20402 "2024-05-24T13:57:26Z")

</div>

I made a script to hunt out type piracy. It isn’t perfect, but its not bad. invoke it by calling hunt on a module, function or list of methods. Or if you just call hunt() from the REPL it will search all modules curre…

---

## [Unitful.jl: type matching dimensions](https://discourse.julialang.org/t/unitful-jl-type-matching-dimensions/114676)

<div class="topic-metadata">

**Author:** [@Joh11](https://discourse.julialang.org/u/Joh11)\
**Replies:** 2\
**Last updated:** [May 24, 2024, 1:51pm UTC](https://discourse.julialang.org/t/unitful-jl-type-matching-dimensions/114676 "2024-05-24T13:51:59Z")

</div>

Hi, Up until now, I have only used Unitful for basic conversion, however I would like now to use it for type checking. However, I cannot make it work. I want ensure (with type safety) that a given variable is an array …

---

## [Order of parameters in ODEProblem](https://discourse.julialang.org/t/order-of-parameters-in-odeproblem/114672)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 1\
**Last updated:** [May 24, 2024, 12:56pm UTC](https://discourse.julialang.org/t/order-of-parameters-in-odeproblem/114672 "2024-05-24T12:56:48Z")

</div>

Hi, I defined an ODE problem in ModelingToolkit.jl, as such: using ModelingToolkit using ModelingToolkit: t\_nounits as t, D\_nounits as D using ModelingToolkitStandardLibrary.Blocks using DataInterpolations using Ordina…

---

## [Nbval-like tool to validate pluto notebooks?](https://discourse.julialang.org/t/nbval-like-tool-to-validate-pluto-notebooks/114379)

<div class="topic-metadata">

**Author:** [@mmesiti](https://discourse.julialang.org/u/mmesiti)\
**Replies:** 3\
**Last updated:** [May 24, 2024, 12:49pm UTC](https://discourse.julialang.org/t/nbval-like-tool-to-validate-pluto-notebooks/114379 "2024-05-24T12:49:02Z")

</div>

Hi all, for Jupyter notebooks there is a tool called “nbval”, that can re-run the notebook and check that the new output is the one that is saved in the notebook itself. Thanks to this, notebooks become useful as an in…

---

## [Is it possible to use environmental variables in YAML.jl?](https://discourse.julialang.org/t/is-it-possible-to-use-environmental-variables-in-yaml-jl/114565)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [May 24, 2024, 10:29am UTC](https://discourse.julialang.org/t/is-it-possible-to-use-environmental-variables-in-yaml-jl/114565 "2024-05-24T10:29:25Z")

</div>

I would like to store relative paths in my YAML file. Googling, I saw that the way to do it in other languages is to use environmental variables. So I did try with: scenario\_path = "/some/path/" settings\_path = joinpa…

---

## [Current best practices for Julia dependencies in Python packages](https://discourse.julialang.org/t/current-best-practices-for-julia-dependencies-in-python-packages/109433)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 12\
**Last updated:** [May 24, 2024, 10:09am UTC](https://discourse.julialang.org/t/current-best-practices-for-julia-dependencies-in-python-packages/109433 "2024-05-24T10:09:46Z")

</div>

I have a python package that a lot of colleagues use, and I have a julia package that does some of the same things vastly better, so I’d like to use it from the python package, as an optional install. I’m not too worrie…

---

## [Save best model in FluxTraining.jl](https://discourse.julialang.org/t/save-best-model-in-fluxtraining-jl/114591)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 4\
**Last updated:** [May 24, 2024, 8:54am UTC](https://discourse.julialang.org/t/save-best-model-in-fluxtraining-jl/114591 "2024-05-24T08:54:12Z")

</div>

Cheers, is there a built-in way with fit! to save the model parameters (or model state) after each epoch? What about saving the best model only? Thanks in advance.

---

## [What is the best way to modify existing or add new optimizer in Optim?](https://discourse.julialang.org/t/what-is-the-best-way-to-modify-existing-or-add-new-optimizer-in-optim/114553)

<div class="topic-metadata">

**Author:** [@PetrosStefanou](https://discourse.julialang.org/u/PetrosStefanou)\
**Replies:** 4\
**Last updated:** [May 24, 2024, 7:59am UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-modify-existing-or-add-new-optimizer-in-optim/114553 "2024-05-24T07:59:24Z")

</div>

Hi everyone, I am wondering what would be the best way to modify an existing optimizer or add a totally new on in Optim. My interest is modify the update formula of the inverse Hessian approximation in BFGS algorithm. …

[Previous page](https://discourse.julialang.org/latest.md?page=401)

[Next page](https://discourse.julialang.org/latest.md?page=403)
