# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=162

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

**Page:** 163

---

## [How to allow users to safely change package "constants"?](https://discourse.julialang.org/t/how-to-allow-users-to-safely-change-package-constants/115173)

<div class="topic-metadata">

**Author:** [@sadish-d](https://discourse.julialang.org/u/sadish-d)\
**Replies:** 19\
**Last updated:** [June 5, 2024, 12:44pm UTC](https://discourse.julialang.org/t/how-to-allow-users-to-safely-change-package-constants/115173 "2024-06-05T12:44:13Z")

</div>

I have a package MyPkg with some numbers that act as settings which for the most part are “constants”. But I would like users to be able to specify some variations of these so I can not define them as const. I’m thinking…

---

## [DrWatson Common Code as Module Issue](https://discourse.julialang.org/t/drwatson-common-code-as-module-issue/115203)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 11\
**Last updated:** [June 5, 2024, 12:15pm UTC](https://discourse.julialang.org/t/drwatson-common-code-as-module-issue/115203 "2024-06-05T12:15:02Z")

</div>

Hello, I am trying to use the functionality of DrWatson described here. But I can’t get it to work. Here is what I have. I’ve got a very basic project that looks like this. ./ ../ .git/ .gitignore Manifest.toml Projec…

---

## [Eigenvectors for a selected subset of eigenvalues](https://discourse.julialang.org/t/eigenvectors-for-a-selected-subset-of-eigenvalues/115213)

<div class="topic-metadata">

**Author:** [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Replies:** 0\
**Last updated:** [June 5, 2024, 6:23am UTC](https://discourse.julialang.org/t/eigenvectors-for-a-selected-subset-of-eigenvalues/115213 "2024-06-05T06:23:11Z")

</div>

I would like to accelerate some calculations based on dense eigen spectra (non-Hermitian Matrix of dimension O(10^4)), where I’m only interested in some subset of eigenvalues (unfortunately in the middle of the spectrum,…

---

## [Getting rid of allocations when copying data from one row to another](https://discourse.julialang.org/t/getting-rid-of-allocations-when-copying-data-from-one-row-to-another/115211)

<div class="topic-metadata">

**Author:** [@GreyAerin](https://discourse.julialang.org/u/GreyAerin)\
**Replies:** 3\
**Last updated:** [June 5, 2024, 6:07am UTC](https://discourse.julialang.org/t/getting-rid-of-allocations-when-copying-data-from-one-row-to-another/115211 "2024-06-05T06:07:58Z")

</div>

I’m writing model code that requires me to replace the border values with the opposite domain values (our domain is everything but the border of the matrix) and since we have to run this value swap every iteration, I was…

---

## [Wrapping make-generated artifacts in Julia package](https://discourse.julialang.org/t/wrapping-make-generated-artifacts-in-julia-package/115195)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 1\
**Last updated:** [June 4, 2024, 8:56pm UTC](https://discourse.julialang.org/t/wrapping-make-generated-artifacts-in-julia-package/115195 "2024-06-04T20:56:42Z")

</div>

I’m looking for some advice on approaches to this: I have an existing repo containing a Python package. The fact that it’s Python is maybe incidental - the package basically creates some artifacts (which happen to be JSO…

---

## [Unsure why a function isn't assigning a new value to a view](https://discourse.julialang.org/t/unsure-why-a-function-isnt-assigning-a-new-value-to-a-view/115182)

<div class="topic-metadata">

**Author:** [@GreyAerin](https://discourse.julialang.org/u/GreyAerin)\
**Replies:** 5\
**Last updated:** [June 4, 2024, 4:44pm UTC](https://discourse.julialang.org/t/unsure-why-a-function-isnt-assigning-a-new-value-to-a-view/115182 "2024-06-04T16:44:16Z")

</div>

I am writing code that goes through an array and does a calculation on each element, with the results previous calculations being used for future ones. I have a function that did this one index at a time, step!, and it …

---

## [How to decrease number of allocations when using NLSolve.jl?](https://discourse.julialang.org/t/how-to-decrease-number-of-allocations-when-using-nlsolve-jl/115164)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 8\
**Last updated:** [June 4, 2024, 1:07pm UTC](https://discourse.julialang.org/t/how-to-decrease-number-of-allocations-when-using-nlsolve-jl/115164 "2024-06-04T13:07:10Z")

</div>

With reference to my last post , I am trying to solve a set of non-linear equations known as the Coupled Cluster Equations in Quantum Chemistry using the NLSolve.jl package. As per the reply of @alfaromartino , in the sa…

---

## [How to employ nlsolve() to a function which has parameters which are difficult to calculate](https://discourse.julialang.org/t/how-to-employ-nlsolve-to-a-function-which-has-parameters-which-are-difficult-to-calculate/115126)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 3\
**Last updated:** [June 4, 2024, 11:31am UTC](https://discourse.julialang.org/t/how-to-employ-nlsolve-to-a-function-which-has-parameters-which-are-difficult-to-calculate/115126 "2024-06-04T11:31:58Z")

</div>

Basically, I am trying to solve the Coupled Cluster Equations using Julia and the package NLsolve which can be used to solve such nonlinear equations. My initial strategy was to define a function as follows that accepts …

---

## [YAML.jl have many bugs](https://discourse.julialang.org/t/yaml-jl-have-many-bugs/115158)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 1\
**Last updated:** [June 4, 2024, 9:39am UTC](https://discourse.julialang.org/t/yaml-jl-have-many-bugs/115158 "2024-06-04T09:39:36Z")

</div>

I’m not a mainter of YAML.jl but I’m concerned with the current status of YAML.jl. I have found many bugs in several days but also know YAML has more complex specification than JSON or TOML so it’s generally difficult to…

---

## [Quantum trajectories](https://discourse.julialang.org/t/quantum-trajectories/115038)

<div class="topic-metadata">

**Author:** [@paolo-mgi](https://discourse.julialang.org/u/paolo-mgi)\
**Replies:** 22\
**Last updated:** [June 4, 2024, 9:08am UTC](https://discourse.julialang.org/t/quantum-trajectories/115038 "2024-06-04T09:08:37Z")

</div>

Is there a way to implement the quantum trajectory algorithm described in https://qutip.readthedocs.io/en/latest/guide/dynamics/dynamics-monte.html for a specific model using existing tools of differentialequations.jl w…

---

## [Help debug python interface](https://discourse.julialang.org/t/help-debug-python-interface/115154)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [June 4, 2024, 8:21am UTC](https://discourse.julialang.org/t/help-debug-python-interface/115154 "2024-06-04T08:21:47Z")

</div>

Hi, I am trying to provide a python wrapper for BifurcationKit.jl. The wrapper is located here GitHub - bifurcationkit/bifurcationkitpy: Computation of bifurcation diagrams in python. However, I cannot debug the error …

---

## [Slicing arrays with a Colon via PythonCall](https://discourse.julialang.org/t/slicing-arrays-with-a-colon-via-pythoncall/115133)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 3\
**Last updated:** [June 4, 2024, 7:48am UTC](https://discourse.julialang.org/t/slicing-arrays-with-a-colon-via-pythoncall/115133 "2024-06-04T07:48:34Z")

</div>

This works in Julia julia\> rand(3,5)\[:, 1\] and this works in Python \>\>\> import numpy as np \>\>\> np.random.rand(3,5)\[:, 1\] but this doesn’t work with PythonCall julia\> using PythonCall julia\> np = pyimport("numpy") ju…

---

## [Difference between generating function forms](https://discourse.julialang.org/t/difference-between-generating-function-forms/115092)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 8\
**Last updated:** [June 4, 2024, 5:34am UTC](https://discourse.julialang.org/t/difference-between-generating-function-forms/115092 "2024-06-04T05:34:21Z")

</div>

If I have a vector vals = \[1, 2, 3, 4, 5\] and want to check if all values are e.g. \< 7 I could either do all(val -\> val \< 7, vals) or all(val \< 7 for val in vals) Is there a difference between these approaches? I h…

---

## [Sensitivity Analysis for Stochastic Differential Equations (SDEs) in Julia](https://discourse.julialang.org/t/sensitivity-analysis-for-stochastic-differential-equations-sdes-in-julia/115144)

<div class="topic-metadata">

**Author:** [@Houda\_Yaq](https://discourse.julialang.org/u/Houda_Yaq)\
**Replies:** 1\
**Last updated:** [June 4, 2024, 4:07am UTC](https://discourse.julialang.org/t/sensitivity-analysis-for-stochastic-differential-equations-sdes-in-julia/115144 "2024-06-04T04:07:05Z")

</div>

Hi everyone, I’m working on a project that requires sensitivity analysis for Stochastic Differential Equations (SDEs). I’ve been exploring the Julia ecosystem, and while there are excellent tools for ODEs (DifferentialE…

---

## [Choice of type parameters](https://discourse.julialang.org/t/choice-of-type-parameters/115147)

<div class="topic-metadata">

**Author:** [@freedomjin](https://discourse.julialang.org/u/freedomjin)\
**Replies:** 0\
**Last updated:** [June 4, 2024, 2:57am UTC](https://discourse.julialang.org/t/choice-of-type-parameters/115147 "2024-06-04T02:57:04Z")

</div>

Hi, I am a little confused about choice of type parameters either as data types or as literals, and would like to know their differences? More specifically, when defining a parametric type, which takes, say, some intege…

---

## [Type instabilities when dealing with structs and Ref](https://discourse.julialang.org/t/type-instabilities-when-dealing-with-structs-and-ref/115122)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 4\
**Last updated:** [June 3, 2024, 9:35pm UTC](https://discourse.julialang.org/t/type-instabilities-when-dealing-with-structs-and-ref/115122 "2024-06-03T21:35:07Z")

</div>

Hello, I’m facing type instabilities with a struct containing a Ref value. Here I show a minimal example struct Prova{T1\<:Integer} a::Ref{T1} function Prova(a::T1) where {T1} new{T1}(Ref(a)) end end…

---

## [Freeze model parameters with FluxTraining.jl](https://discourse.julialang.org/t/freeze-model-parameters-with-fluxtraining-jl/115119)

<div class="topic-metadata">

**Author:** [@cirobr](https://discourse.julialang.org/u/cirobr)\
**Replies:** 0\
**Last updated:** [June 3, 2024, 1:18pm UTC](https://discourse.julialang.org/t/freeze-model-parameters-with-fluxtraining-jl/115119 "2024-06-03T13:18:00Z")

</div>

Cheers, Training a model with FluxTraining.jl requires building up a learner where the optimizer is declared. For instance: opt = Flux.Adam(eta) learner = Learner(model, lossfn, optimizer=opt) epoch!(learner, TrainingP…

---

## [Strange things trying to add \`Downloads\`](https://discourse.julialang.org/t/strange-things-trying-to-add-downloads/115112)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [June 3, 2024, 10:31am UTC](https://discourse.julialang.org/t/strange-things-trying-to-add-downloads/115112 "2024-06-03T10:31:20Z")

</div>

I am having some “strange” behaviours, that I can’t reproduce in a consistent matter, while trying to install the Download module in a package, so I am asking if this is the suggested way to add download functionality in…

---

## [Read then write to same file for code (text file) formatting](https://discourse.julialang.org/t/read-then-write-to-same-file-for-code-text-file-formatting/115095)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 5\
**Last updated:** [June 3, 2024, 8:42am UTC](https://discourse.julialang.org/t/read-then-write-to-same-file-for-code-text-file-formatting/115095 "2024-06-03T08:42:23Z")

</div>

I want to sort a TOML file content (I know TOML does not ensure its ordering but let’s put it aside). So, I write the following script try to read a TOML file then sort by keys and then replace it by sorted TOML file. Bu…

---

## [Julia LSP on parametric structs](https://discourse.julialang.org/t/julia-lsp-on-parametric-structs/115069)

<div class="topic-metadata">

**Author:** [@co1emi11er](https://discourse.julialang.org/u/co1emi11er)\
**Replies:** 2\
**Last updated:** [June 3, 2024, 8:06am UTC](https://discourse.julialang.org/t/julia-lsp-on-parametric-structs/115069 "2024-06-03T08:06:38Z")

</div>

Hi, I had a question about getting IntelliSense working for a defined object. abstract type Shape end struct Square \<: Shape s::Float64 end struct Rectangle \<: Shape b::Float64 w::Float64 end struct Box…

---

## [Julia crashes when saving PyPlot figure](https://discourse.julialang.org/t/julia-crashes-when-saving-pyplot-figure/115056)

<div class="topic-metadata">

**Author:** [@u645532](https://discourse.julialang.org/u/u645532)\
**Replies:** 5\
**Last updated:** [June 3, 2024, 3:15am UTC](https://discourse.julialang.org/t/julia-crashes-when-saving-pyplot-figure/115056 "2024-06-03T03:15:37Z")

</div>

I’m using Julia 1.10.3 with PyPlot (matplotlib 3.8.4)… using PyPlot loglog(\[0.001,0.1,1,10\],\[1e4,3e3,2e2,1e1\],“o-”) … I save this figure using the Save button in the figure window, this works. Then I close the windo…

---

## [Type inference when just making a tuple](https://discourse.julialang.org/t/type-inference-when-just-making-a-tuple/115071)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 6\
**Last updated:** [June 2, 2024, 9:16pm UTC](https://discourse.julialang.org/t/type-inference-when-just-making-a-tuple/115071 "2024-06-02T21:16:42Z")

</div>

Hello, I’m seeing some type instabilities in my code. I saw that converting a vector into a tuple generates instabilities. Here a very simple example using Test function prova(vec) return Tuple(vec) end T = Floa…

---

## [Best library for particle filtering from a generative model?](https://discourse.julialang.org/t/best-library-for-particle-filtering-from-a-generative-model/115070)

<div class="topic-metadata">

**Author:** [@JasonPekos](https://discourse.julialang.org/u/JasonPekos)\
**Replies:** 2\
**Last updated:** [June 2, 2024, 6:06pm UTC](https://discourse.julialang.org/t/best-library-for-particle-filtering-from-a-generative-model/115070 "2024-06-02T18:06:03Z")

</div>

Hi! I’m looking for a library that will let me perform particle filtering for a generative model of a markov process, similar to the incredible pomp in R: or particles in Python. Basically, I want to specify some sor…

---

## [Align NumberField labels in Pluto](https://discourse.julialang.org/t/align-numberfield-labels-in-pluto/115081)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 0\
**Last updated:** [June 2, 2024, 4:56pm UTC](https://discourse.julialang.org/t/align-numberfield-labels-in-pluto/115081 "2024-06-02T16:56:37Z")

</div>

Hi all, I am using PlutoExtras to define groups of NumberFields. I would like to modify the layout and functionality in two ways. First, I would like to left align the labels, and possibly align the labels to the left o…

---

## [Help optimise an advice implementation](https://discourse.julialang.org/t/help-optimise-an-advice-implementation/97218)

<div class="topic-metadata">

**Author:** [@tecosaur](https://discourse.julialang.org/u/tecosaur)\
**Replies:** 12\
**Last updated:** [June 2, 2024, 3:30am UTC](https://discourse.julialang.org/t/help-optimise-an-advice-implementation/97218 "2024-06-02T03:30:14Z")

</div>

Hello, in my DataToolkitBase.jl I make extensive use of advised functions, e.g. instead of identity(x) I’ll have @advise identity(x) As such, I’m very interested in minimising the performance impact of advised calls.…

---

## [Julia 1.9 on qemu-aarch64 docker segfaults whille importing Unitful](https://discourse.julialang.org/t/julia-1-9-on-qemu-aarch64-docker-segfaults-whille-importing-unitful/98711)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 1\
**Last updated:** [June 2, 2024, 12:08am UTC](https://discourse.julialang.org/t/julia-1-9-on-qemu-aarch64-docker-segfaults-whille-importing-unitful/98711 "2024-06-02T00:08:42Z")

</div>

I don’t know on which repo to report (Julia? Unitful.jl?) or what information is helpful, so I’ve put it here I’ve started a aarch64 ubuntu docker container on x86 PC podman run -ti --net=host --arch=arm64 --volume=./j…

---

## [Could not load symbol "jl\_system\_image\_data", fail to precompile](https://discourse.julialang.org/t/could-not-load-symbol-jl-system-image-data-fail-to-precompile/114752)

<div class="topic-metadata">

**Author:** [@sfranchel](https://discourse.julialang.org/u/sfranchel)\
**Replies:** 3\
**Last updated:** [June 1, 2024, 7:23pm UTC](https://discourse.julialang.org/t/could-not-load-symbol-jl-system-image-data-fail-to-precompile/114752 "2024-06-01T19:23:35Z")

</div>

Precompilation of a project on a shared server breaks, due to the following error: Error: Error during loading of extension IntervalSetsRandomExt of IntervalSets, use \`Base.retry\_load\_extensions()\` to retry. │ except…

---

## [ForwardDiff.jl return NaN values in Hessian matrix](https://discourse.julialang.org/t/forwarddiff-jl-return-nan-values-in-hessian-matrix/115040)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 3\
**Last updated:** [June 1, 2024, 1:30pm UTC](https://discourse.julialang.org/t/forwarddiff-jl-return-nan-values-in-hessian-matrix/115040 "2024-06-01T13:30:12Z")

</div>

Hi guys, here are a demo of maximum likelihood estimation. Below, sample is used to sample the data, and neg\_loglikehood is used to calculated the negative log likelihood function. I wonder why ForwardDiff.jl returns he…

---

## [Type Inference Inferring Any for function that returns Float64](https://discourse.julialang.org/t/type-inference-inferring-any-for-function-that-returns-float64/115007)

<div class="topic-metadata">

**Author:** [@BenCichos](https://discourse.julialang.org/u/BenCichos)\
**Replies:** 11\
**Last updated:** [June 1, 2024, 6:21am UTC](https://discourse.julialang.org/t/type-inference-inferring-any-for-function-that-returns-float64/115007 "2024-06-01T06:21:45Z")

</div>

Hello everyone, I am currently trying to code an Optical Ray Tracing package in Julia, and while trying to optimise the code for performance I ran into some issues that the function trace that performs the tracing does a…

---

## [Failure to vectorize 8 Int64 multiplies when 8 Float64 multiplies vectorize](https://discourse.julialang.org/t/failure-to-vectorize-8-int64-multiplies-when-8-float64-multiplies-vectorize/114939)

<div class="topic-metadata">

**Author:** [@brainandforce](https://discourse.julialang.org/u/brainandforce)\
**Replies:** 8\
**Last updated:** [May 31, 2024, 11:52pm UTC](https://discourse.julialang.org/t/failure-to-vectorize-8-int64-multiplies-when-8-float64-multiplies-vectorize/114939 "2024-05-31T23:52:39Z")

</div>

I’ve come across this interesting observation in my package, CliffordNumbers.jl. For context, the multiplication done here is a geometric product (relevant code here) implemented as a grid multiply between blade coeffici…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=161)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=163)
