# General Usage

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

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

**Page:** 239

---

## [De-serialisation conflicts when multiple definitions in the Union](https://discourse.julialang.org/t/de-serialisation-conflicts-when-multiple-definitions-in-the-union/104991)

<div class="topic-metadata">

**Author:** [@ravitimm](https://discourse.julialang.org/u/ravitimm)\
**Replies:** 0\
**Last updated:** [October 16, 2023, 12:33am UTC](https://discourse.julialang.org/t/de-serialisation-conflicts-when-multiple-definitions-in-the-union/104991 "2023-10-16T00:33:48Z")

</div>

I wonder why the following de-serialisation code does not work. In the Geometry struct, if I remove one of the types (Vector{Float64} or Vector{Vector{Float64}), it works. They appear to be conflicting somehow. If I c…

---

## [Why does \`./=\` allocate?](https://discourse.julialang.org/t/why-does-allocate/104987)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [October 15, 2023, 10:30pm UTC](https://discourse.julialang.org/t/why-does-allocate/104987 "2023-10-15T22:30:58Z")

</div>

I have this bit of code. I managed to avoid all allocations. function compute!(csmatout, XYZ, tangents, feid, qpid) center = (0.0, 0.0, 0.0) xyz = (XYZ\[1\], XYZ\[2\], XYZ\[3\]) csmatout\[:, 1\] .= xyz .…

---

## [Tasks booted to efficiency cores when not in foreground or rendered on the screen](https://discourse.julialang.org/t/tasks-booted-to-efficiency-cores-when-not-in-foreground-or-rendered-on-the-screen/104980)

<div class="topic-metadata">

**Author:** [@Di11on](https://discourse.julialang.org/u/Di11on)\
**Replies:** 2\
**Last updated:** [October 15, 2023, 7:14pm UTC](https://discourse.julialang.org/t/tasks-booted-to-efficiency-cores-when-not-in-foreground-or-rendered-on-the-screen/104980 "2023-10-15T19:14:04Z")

</div>

Hi folks, I have discovered an issue with my 13900k based machine (I now very much regret the poor choice of a 13900k). Processes run on performance cores when the app/task is in the foreground on the screen - but whene…

---

## [Julia & Mojo Mandelbrot Benchmark](https://discourse.julialang.org/t/julia-mojo-mandelbrot-benchmark/103638)

<div class="topic-metadata">

**Author:** [@Dreycen\_Foiles](https://discourse.julialang.org/u/Dreycen_Foiles)\
**Replies:** 56\
**Last updated:** [October 13, 2023, 3:24am UTC](https://discourse.julialang.org/t/julia-mojo-mandelbrot-benchmark/103638 "2023-10-13T03:24:39Z")

</div>

For those of you who aren’t aware, the Mojo SDK was recently released, so I thought I would take the opportunity to start benchmarking some Julia code against Mojo. As a first test, I am calculating the Mandelbrot set us…

---

## [Github workflow - ignore errors on nightly](https://discourse.julialang.org/t/github-workflow-ignore-errors-on-nightly/104968)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [October 15, 2023, 7:48am UTC](https://discourse.julialang.org/t/github-workflow-ignore-errors-on-nightly/104968 "2023-10-15T07:48:05Z")

</div>

Sometimes the tests of a package fail, not because there is a bug in the package, but because Julia nightly is broken, e.g Fixed link in developer.md · JuliaGraphics/QML.jl@5614e6a · GitHub Can I declare these failures …

---

## [Computing the preimage of count\_ones](https://discourse.julialang.org/t/computing-the-preimage-of-count-ones/104838)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 17\
**Last updated:** [October 15, 2023, 2:23am UTC](https://discourse.julialang.org/t/computing-the-preimage-of-count-ones/104838 "2023-10-15T02:23:28Z")

</div>

count\_ones(x) counts how many 1s are in the binary representation of the integer x I am looking for a function that computes the preimage of that. Or informally the inverse (but it’s not actually invertable). That is …

---

## [New stdlib compat requirements - CompatHelper.jl to the rescue?!](https://discourse.julialang.org/t/new-stdlib-compat-requirements-compathelper-jl-to-the-rescue/104966)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 2\
**Last updated:** [October 14, 2023, 9:31pm UTC](https://discourse.julialang.org/t/new-stdlib-compat-requirements-compathelper-jl-to-the-rescue/104966 "2023-10-14T21:31:09Z")

</div>

In response to Will GitHub - JuliaRegistries/CompatHelper.jl: Automatically update the \[compat\] entries for your Julia package's dependencies do The Right Thing and add new compat bounds for stdlibs automatically? If n…

---

## [Visualization problem of the back side of a surface mesh](https://discourse.julialang.org/t/visualization-problem-of-the-back-side-of-a-surface-mesh/104923)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 4\
**Last updated:** [October 14, 2023, 8:54pm UTC](https://discourse.julialang.org/t/visualization-problem-of-the-back-side-of-a-surface-mesh/104923 "2023-10-14T20:54:36Z")

</div>

Hello, I have a problem with a 3D animation. This is a torus which reverses itself. The problem is that when it is reversed, it is ugly because the normals are not oriented as they should. How to solve this problem? u…

---

## [Why does this Python code performs three times faster than Julia?](https://discourse.julialang.org/t/why-does-this-python-code-performs-three-times-faster-than-julia/104919)

<div class="topic-metadata">

**Author:** [@SantiagoOrtiz](https://discourse.julialang.org/u/SantiagoOrtiz)\
**Replies:** 22\
**Last updated:** [October 13, 2023, 11:59pm UTC](https://discourse.julialang.org/t/why-does-this-python-code-performs-three-times-faster-than-julia/104919 "2023-10-13T23:59:17Z")

</div>

I tried to follow basic Performance Tips, but surprisingly, my Python code does it faster than Julia. # Julia code ʋ₀::Float64 = 1.0 r₀::Float64 = 1.0 n::Int64 = 5000000 const σ::Float64 = 1.0 const ϵ::Float64 = 1.0 c…

---

## [Interpolations, between Lux Dense layers, supported?](https://discourse.julialang.org/t/interpolations-between-lux-dense-layers-supported/104938)

<div class="topic-metadata">

**Author:** [@Rohan\_Rajagopal](https://discourse.julialang.org/u/Rohan_Rajagopal)\
**Replies:** 2\
**Last updated:** [October 14, 2023, 12:37am UTC](https://discourse.julialang.org/t/interpolations-between-lux-dense-layers-supported/104938 "2023-10-14T00:37:31Z")

</div>

Greetings, one of the custom Lux models I am trying to develop requires interpolation in between, something like the following(?) which errs using DataInterpolations, Lux, Random, Zygote, Enzyme function convert\_interp…

---

## [Macro to Extend Function with Additional Arguements (MacroTools.jl)?](https://discourse.julialang.org/t/macro-to-extend-function-with-additional-arguements-macrotools-jl/104916)

<div class="topic-metadata">

**Author:** [@matthew3245](https://discourse.julialang.org/u/matthew3245)\
**Replies:** 3\
**Last updated:** [October 13, 2023, 7:19pm UTC](https://discourse.julialang.org/t/macro-to-extend-function-with-additional-arguements-macrotools-jl/104916 "2023-10-13T19:19:28Z")

</div>

My goal is to create a macro that takes an arbitrary function and adds additional arguments and changes the docstring. For example, say I define the following function: "This is my function" function f(a, b; x=1.0, y=1…

---

## [Julia CPU Target](https://discourse.julialang.org/t/julia-cpu-target/101291)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 2\
**Last updated:** [October 13, 2023, 6:27pm UTC](https://discourse.julialang.org/t/julia-cpu-target/101291 "2023-10-13T18:27:36Z")

</div>

Damn stupid question - is there a methodology for choosing the -C CPU Target fields for a given CPU type? I can see that you can use CPUID.jl but for more in depth choices such as th many avx related flags is there a sc…

---

## [Tune Metropolis-Hastings (normal distribution) scale parameters (and algorithms parameters in general)](https://discourse.julialang.org/t/tune-metropolis-hastings-normal-distribution-scale-parameters-and-algorithms-parameters-in-general/104925)

<div class="topic-metadata">

**Author:** [@caesoma](https://discourse.julialang.org/u/caesoma)\
**Replies:** 10\
**Last updated:** [October 13, 2023, 5:32pm UTC](https://discourse.julialang.org/t/tune-metropolis-hastings-normal-distribution-scale-parameters-and-algorithms-parameters-in-general/104925 "2023-10-13T17:32:38Z")

</div>

I am doing Bayesian inference of a few parameters (~3), albeit of a highly nonlinear model, and I am interested in the performance of random-walk Metropolis-Hastings versus Hamiltonian Monte Carlo methods. I don’t expect…

---

## [Training a LSTM model for time series, lack of performance](https://discourse.julialang.org/t/training-a-lstm-model-for-time-series-lack-of-performance/104868)

<div class="topic-metadata">

**Author:** [@Maria\_Adelaide\_Loffa](https://discourse.julialang.org/u/Maria_Adelaide_Loffa)\
**Replies:** 9\
**Last updated:** [October 13, 2023, 4:16pm UTC](https://discourse.julialang.org/t/training-a-lstm-model-for-time-series-lack-of-performance/104868 "2023-10-13T16:16:58Z")

</div>

Hi everyone, I’m trying to train a LSTM model for forecasting a time series. At this stage training happens, but with a really bad performance: loss function values exhibit really minimal changes. I added a picture tha…

---

## [Order of methods docstrings inside function block when using Documenter](https://discourse.julialang.org/t/order-of-methods-docstrings-inside-function-block-when-using-documenter/104922)

<div class="topic-metadata">

**Author:** [@Alexey\_Bogdanov](https://discourse.julialang.org/u/Alexey_Bogdanov)\
**Replies:** 0\
**Last updated:** [October 13, 2023, 9:16am UTC](https://discourse.julialang.org/t/order-of-methods-docstrings-inside-function-block-when-using-documenter/104922 "2023-10-13T09:16:46Z")

</div>

Hi everyone! I’m having trouble with order of appearance of methods docstrings inside a function block using Documenter.jl macro @docs. This order seems to be random. That is everytime I build the docs the order of meth…

---

## [Static HMC mass matrix/metric parameter](https://discourse.julialang.org/t/static-hmc-mass-matrix-metric-parameter/104926)

<div class="topic-metadata">

**Author:** [@caesoma](https://discourse.julialang.org/u/caesoma)\
**Replies:** 0\
**Last updated:** [October 13, 2023, 10:13am UTC](https://discourse.julialang.org/t/static-hmc-mass-matrix-metric-parameter/104926 "2023-10-13T10:13:46Z")

</div>

I am running inference of a nonlinear model as described here it will run (albeit poorly) even with Metropolis-Hastings, and with acceptable results with NUTS and HMC with Dual averaging tuning of path length: With va…

---

## [Function in module is not visible even though it's listed in the module and exported](https://discourse.julialang.org/t/function-in-module-is-not-visible-even-though-its-listed-in-the-module-and-exported/104915)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 1\
**Last updated:** [October 13, 2023, 4:23am UTC](https://discourse.julialang.org/t/function-in-module-is-not-visible-even-though-its-listed-in-the-module-and-exported/104915 "2023-10-13T04:23:42Z")

</div>

I made a package, which is in the julia registry, called Spacey.jl. I added a function to the module and exported it. When I try to using the package/module, the new function pointGroup is not found, but names shows that…

---

## [Single folder shared by different machines](https://discourse.julialang.org/t/single-folder-shared-by-different-machines/104910)

<div class="topic-metadata">

**Author:** [@Farcitoast](https://discourse.julialang.org/u/Farcitoast)\
**Replies:** 3\
**Last updated:** [October 13, 2023, 4:29am UTC](https://discourse.julialang.org/t/single-folder-shared-by-different-machines/104910 "2023-10-13T04:29:37Z")

</div>

Hi everyone, I’m quite new to Julia, and I’m having trouble finding the best way to have a shared folder between several machines that might run some Julia scripts in parallel. My typical workflow is the following: I …

---

## [Eachslice(ones(3),dims=2)](https://discourse.julialang.org/t/eachslice-ones-3-dims-2/104907)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 1\
**Last updated:** [October 12, 2023, 8:30pm UTC](https://discourse.julialang.org/t/eachslice-ones-3-dims-2/104907 "2023-10-12T20:30:17Z")

</div>

fails, while eachslice(ones(3,1),dims=2) works well. (Similar for other dimensions and higher order dims). This is somewhat inconsistent with the fact that ones(3)\[:,1\] does its job, and it is also inconvenient. EDIT: …

---

## [How to use BigFloats with ccall?](https://discourse.julialang.org/t/how-to-use-bigfloats-with-ccall/104895)

<div class="topic-metadata">

**Author:** [@Alseidon](https://discourse.julialang.org/u/Alseidon)\
**Replies:** 5\
**Last updated:** [October 12, 2023, 7:35pm UTC](https://discourse.julialang.org/t/how-to-use-bigfloats-with-ccall/104895 "2023-10-12T19:35:05Z")

</div>

I want to call a C library that uses MPFR in my Julia code. The issue is, I can’t make it work: if I manipulate a BigFloat declared in Julia within the C code, it becomes NaN. Here is an example: #include \<gmp.h\> #inclu…

---

## [Meshes.Vec is ambiguous](https://discourse.julialang.org/t/meshes-vec-is-ambiguous/104836)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 22\
**Last updated:** [October 12, 2023, 5:55pm UTC](https://discourse.julialang.org/t/meshes-vec-is-ambiguous/104836 "2023-10-12T17:55:11Z")

</div>

Hello, When I run the code above, I get: ERROR: LoadError: MethodError: Meshes.Vec(::Vector{Float64}) is ambiguous. However I only import (not using) Meshes, and there’s no Meshes.Vec in my code. What should I do? us…

---

## [From PyCall to PythonCall](https://discourse.julialang.org/t/from-pycall-to-pythoncall/104874)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 12\
**Last updated:** [October 12, 2023, 3:42pm UTC](https://discourse.julialang.org/t/from-pycall-to-pythoncall/104874 "2023-10-12T15:42:27Z")

</div>

I am trying to convert SymbolicControlSystems.jl from using PyCall to PythonCall. How can I translate the following line: const sp = SymPy.PyCall.PyNULL() I tried, but this does not work: const sp = SymPyPythonCall.P…

---

## [How to use a quaternion in Makie.rotate?](https://discourse.julialang.org/t/how-to-use-a-quaternion-in-makie-rotate/104899)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 1\
**Last updated:** [October 12, 2023, 3:28pm UTC](https://discourse.julialang.org/t/how-to-use-a-quaternion-in-makie-rotate/104899 "2023-10-12T15:28:16Z")

</div>

Hello, Extracted from the doc of Makie: rotate!(t::Transformable, axis\_rot::Quaternion) rotate!(t::Transformable, axis\_rot::AbstractFloat) rotate!(t::Transformable, axis\_rot...) Not very clear to me. How do we specif…

---

## [What is the most idiomatic way to allocate a (reusable) buffer for a function?](https://discourse.julialang.org/t/what-is-the-most-idiomatic-way-to-allocate-a-reusable-buffer-for-a-function/104892)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 10\
**Last updated:** [October 12, 2023, 2:42pm UTC](https://discourse.julialang.org/t/what-is-the-most-idiomatic-way-to-allocate-a-reusable-buffer-for-a-function/104892 "2023-10-12T14:42:55Z")

</div>

Suppose I have a function f that allocates, for instance the following function sum\_of\_fractions(a) v = map(x -\> 1/(x+a), 1:10) return sum(v) end Assume for the sake of this discussion that I cannot get rid of …

---

## [Stray Julia processes in the background on VSCode](https://discourse.julialang.org/t/stray-julia-processes-in-the-background-on-vscode/104770)

<div class="topic-metadata">

**Author:** [@Undercover](https://discourse.julialang.org/u/Undercover)\
**Replies:** 9\
**Last updated:** [October 12, 2023, 12:43pm UTC](https://discourse.julialang.org/t/stray-julia-processes-in-the-background-on-vscode/104770 "2023-10-12T12:43:30Z")

</div>

Hi there, I am facing some issues when using Julia in VSCode, using Jupyter notebooks, where stray processes are left running in the background consuming a lot of CPU and RAM. I’ve tried to work out a MWE Jupyter notebo…

---

## [Save animation with Luxor.jl](https://discourse.julialang.org/t/save-animation-with-luxor-jl/104861)

<div class="topic-metadata">

**Author:** [@aleppersico](https://discourse.julialang.org/u/aleppersico)\
**Replies:** 12\
**Last updated:** [October 12, 2023, 10:22am UTC](https://discourse.julialang.org/t/save-animation-with-luxor-jl/104861 "2023-10-12T10:22:03Z")

</div>

Hello :blush:, I have just learned how to produce drawings and animation with Luxor.jl (Introduction to Luxor · Luxor) using Luxor.animate, Movie and frame function. However, I cannot find a way to save my animation in …

---

## [Call function on vectors of mixed type (using \`FunctionWrapper\` and \`Union\`s)](https://discourse.julialang.org/t/call-function-on-vectors-of-mixed-type-using-functionwrapper-and-union-s/92750)

<div class="topic-metadata">

**Author:** [@GoodDayToYouAll](https://discourse.julialang.org/u/GoodDayToYouAll)\
**Replies:** 2\
**Last updated:** [October 12, 2023, 9:52am UTC](https://discourse.julialang.org/t/call-function-on-vectors-of-mixed-type-using-functionwrapper-and-union-s/92750 "2023-10-12T09:52:30Z")

</div>

Hi everyone and a happy new year! In one part of my code I have a vector v whose elements have different types. Additionally, I have a function f with different methods for all the involved types and want to call this …

---

## [Training a NeuralODE with an ODE depending on exogenous time-dependent input](https://discourse.julialang.org/t/training-a-neuralode-with-an-ode-depending-on-exogenous-time-dependent-input/101304)

<div class="topic-metadata">

**Author:** [@Maria\_Adelaide\_Loffa](https://discourse.julialang.org/u/Maria_Adelaide_Loffa)\
**Replies:** 5\
**Last updated:** [October 12, 2023, 8:08am UTC](https://discourse.julialang.org/t/training-a-neuralode-with-an-ode-depending-on-exogenous-time-dependent-input/101304 "2023-10-12T08:08:23Z")

</div>

Hi everyone. I’m working on developing a NeuralODE trained on ad ODE which describes a building’s thermal behaviour through an RC equation. I tried both with the definition of a NeuralODE from a multilayer NN and by tr…

---

## [Failure of Zygote.jl on function with integration by HCubature.jl](https://discourse.julialang.org/t/failure-of-zygote-jl-on-function-with-integration-by-hcubature-jl/104856)

<div class="topic-metadata">

**Author:** [@swish47](https://discourse.julialang.org/u/swish47)\
**Replies:** 5\
**Last updated:** [October 11, 2023, 8:58pm UTC](https://discourse.julialang.org/t/failure-of-zygote-jl-on-function-with-integration-by-hcubature-jl/104856 "2023-10-11T20:58:11Z")

</div>

I need to perform automatic differentiation on a function constructed by numerical integration. I choose HCubature.jl on integral and Zygote.jl on AD. However, there is an error as following: using HCubature,Zygote con…

---

## [Plotting only the contents of a plot/heatmap and hiding everything else using Plots.jl](https://discourse.julialang.org/t/plotting-only-the-contents-of-a-plot-heatmap-and-hiding-everything-else-using-plots-jl/104469)

<div class="topic-metadata">

**Author:** [@ferrolho](https://discourse.julialang.org/u/ferrolho)\
**Replies:** 1\
**Last updated:** [October 11, 2023, 6:17pm UTC](https://discourse.julialang.org/t/plotting-only-the-contents-of-a-plot-heatmap-and-hiding-everything-else-using-plots-jl/104469 "2023-10-11T18:17:48Z")

</div>

Hi! I would like to plot only the very contents of a plot (a heatmap in this case) using Plots.jl. I’ve set the aspect ratio to 1:1, hidden the axes, hidden the color bar, set the margins to zero, and set the image size…

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

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