# General Usage

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

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

**Page:** 236

---

## [The \`sort\` only change order of the first column in matrix?](https://discourse.julialang.org/t/the-sort-only-change-order-of-the-first-column-in-matrix/105364)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 8\
**Last updated:** [October 25, 2023, 2:58pm UTC](https://discourse.julialang.org/t/the-sort-only-change-order-of-the-first-column-in-matrix/105364 "2023-10-25T14:58:52Z")

</div>

Hi friends, I just found a strange behave of the method of sort a1 = \[ 669.57 52.3 657.52 56.18 638.38 65.09 634.17 72.41 632.08 80.61\] sort(a1,dims=1) will give me below result 5×2 Matrix{F…

---

## [Saving GLMakie interactive window?](https://discourse.julialang.org/t/saving-glmakie-interactive-window/105376)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 1\
**Last updated:** [October 25, 2023, 1:59pm UTC](https://discourse.julialang.org/t/saving-glmakie-interactive-window/105376 "2023-10-25T13:59:42Z")

</div>

Hi Everyone, I am making some plots with GLMakie that allow me to check the data. I would like to share this with my colleagues (not just the static PNG). I know that PlotlyJS allows to save to HTML. Any way to do somet…

---

## [Julia optimization levels; and the case for \*less\* optimization, slower; faster compilation](https://discourse.julialang.org/t/julia-optimization-levels-and-the-case-for-less-optimization-slower-faster-compilation/105375)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [October 25, 2023, 1:16pm UTC](https://discourse.julialang.org/t/julia-optimization-levels-and-the-case-for-less-optimization-slower-faster-compilation/105375 "2023-10-25T13:16:51Z")

</div>

Julia has 4 optimization levels “-O, --optimize={0,1,2\*,3}”, but I’ve never seen what they do exactly e.g. -O1, nor until today what -O3 does, or if it’s recommended. Despite what you might think -O0 doesn’t mean no opt…

---

## [Compilation options for Downfall mitigation](https://discourse.julialang.org/t/compilation-options-for-downfall-mitigation/104844)

<div class="topic-metadata">

**Author:** [@mmesiti](https://discourse.julialang.org/u/mmesiti)\
**Replies:** 4\
**Last updated:** [October 25, 2023, 9:21am UTC](https://discourse.julialang.org/t/compilation-options-for-downfall-mitigation/104844 "2023-10-25T09:21:04Z")

</div>

Hello everybody, the code I am working on has suffered from a huge performance hit (up to 50%) because of the microcode update to mitigate the Downfall vulnerability. The generated code was using a lot of gather instruc…

---

## [Error during Optimization using Neural ODEs](https://discourse.julialang.org/t/error-during-optimization-using-neural-odes/105082)

<div class="topic-metadata">

**Author:** [@Marco\_Nesta](https://discourse.julialang.org/u/Marco_Nesta)\
**Replies:** 38\
**Last updated:** [October 22, 2023, 5:08pm UTC](https://discourse.julialang.org/t/error-during-optimization-using-neural-odes/105082 "2023-10-22T17:08:08Z")

</div>

using DifferentialEquations, Plots, Flux,Optim, DiffEqFlux, DataInterpolations,Random, ComponentArrays, Lux using Optimization, OptimizationOptimisers, OptimizationOptimJL,OptimizationNLopt rng = Random.default\_rng() usi…

---

## [Attach additional information to exception](https://discourse.julialang.org/t/attach-additional-information-to-exception/105337)

<div class="topic-metadata">

**Author:** [@ohmsweetohm1](https://discourse.julialang.org/u/ohmsweetohm1)\
**Replies:** 4\
**Last updated:** [October 25, 2023, 6:34am UTC](https://discourse.julialang.org/t/attach-additional-information-to-exception/105337 "2023-10-25T06:34:39Z")

</div>

If I want to attach additional information to an exception, e.g. I have a vector of some structs and do something with each. For one, there is an exception, and it would be helpful if I know from which. Maybe like this: …

---

## [Doubly linked objects preventing garbage collection](https://discourse.julialang.org/t/doubly-linked-objects-preventing-garbage-collection/105326)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 5\
**Last updated:** [October 24, 2023, 10:52pm UTC](https://discourse.julialang.org/t/doubly-linked-objects-preventing-garbage-collection/105326 "2023-10-24T22:52:29Z")

</div>

I’m trying to manage some async tasks (usually timers) that correspond to structs I create. Sometimes I want to delete all my data and start over, which is when I want the timers to close. I thought it would be a good id…

---

## [Generating a macro call from a macro with the macro name as a symbol](https://discourse.julialang.org/t/generating-a-macro-call-from-a-macro-with-the-macro-name-as-a-symbol/105335)

<div class="topic-metadata">

**Author:** [@awiersdorf](https://discourse.julialang.org/u/awiersdorf)\
**Replies:** 2\
**Last updated:** [October 24, 2023, 5:49pm UTC](https://discourse.julialang.org/t/generating-a-macro-call-from-a-macro-with-the-macro-name-as-a-symbol/105335 "2023-10-24T17:49:25Z")

</div>

I am trying to write a macro that expands into a call to another macro. Moreover, that other macro isn’t known statically—it’s determined at macro expansion time. I’m having difficulty constructing an AST with the macro …

---

## [MethodError in loss function when using Flux with GPU support](https://discourse.julialang.org/t/methoderror-in-loss-function-when-using-flux-with-gpu-support/105343)

<div class="topic-metadata">

**Author:** [@hungpham3112](https://discourse.julialang.org/u/hungpham3112)\
**Replies:** 2\
**Last updated:** [October 24, 2023, 1:16pm UTC](https://discourse.julialang.org/t/methoderror-in-loss-function-when-using-flux-with-gpu-support/105343 "2023-10-24T13:16:55Z")

</div>

I’m building simple neural network in regression problem then I receive an error: MethodError: no method matching loss(::Chain{Tuple{Dense{typeof(relu), CuArray{Float32, 2, CUDA.Mem.DeviceBuffer}, CuArray{Float32, 1, C…

---

## [About In-line-fft](https://discourse.julialang.org/t/about-in-line-fft/105340)

<div class="topic-metadata">

**Author:** [@Take1234](https://discourse.julialang.org/u/Take1234)\
**Replies:** 6\
**Last updated:** [October 24, 2023, 12:32pm UTC](https://discourse.julialang.org/t/about-in-line-fft/105340 "2023-10-24T12:32:07Z")

</div>

Hi Experts ,I’m just studing Julia But I’m in truble. Berrow 2D turblence simulation code is that I translated from Matlab is use too much memory. At my Simulation environment it use approx. 32 GB. I found some info abou…

---

## [Expanding \`@repl\` blocks in REPL and Jupyter](https://discourse.julialang.org/t/expanding-repl-blocks-in-repl-and-jupyter/105288)

<div class="topic-metadata">

**Author:** [@gdmsl](https://discourse.julialang.org/u/gdmsl)\
**Replies:** 3\
**Last updated:** [October 24, 2023, 9:26am UTC](https://discourse.julialang.org/t/expanding-repl-blocks-in-repl-and-jupyter/105288 "2023-10-24T09:26:48Z")

</div>

While writing documentation, I am making large use of the @repl blocks with Documenter.jl. However, it seems that these blocks are not expanded automatically in the REPL or in Jupyter. Is there a way to expand the @repl …

---

## [How to update the documentation of a package hosted on Github?](https://discourse.julialang.org/t/how-to-update-the-documentation-of-a-package-hosted-on-github/105324)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 8\
**Last updated:** [October 24, 2023, 1:06am UTC](https://discourse.julialang.org/t/how-to-update-the-documentation-of-a-package-hosted-on-github/105324 "2023-10-24T01:06:22Z")

</div>

Hello, I am the maintainer of EllipticFunctions.jl (that I will soon register). I have a Github action for the documentation but it has not updated the documentation for one year. Would you know what should I do?

---

## [Plot histogram with edge color in Plots.jl](https://discourse.julialang.org/t/plot-histogram-with-edge-color-in-plots-jl/83119)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 3\
**Last updated:** [October 23, 2023, 9:53pm UTC](https://discourse.julialang.org/t/plot-histogram-with-edge-color-in-plots-jl/83119 "2023-10-23T21:53:45Z")

</div>

Can one plot a histogram in Plots.jl where only the outer line is plotted, like in this picture? In PyPlot this is set be edgecolor but I did not find a way to do this in Plots with gr.

---

## [How to sum the result of mapslices on the GPU while tracking gradients?](https://discourse.julialang.org/t/how-to-sum-the-result-of-mapslices-on-the-gpu-while-tracking-gradients/105310)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 0\
**Last updated:** [October 23, 2023, 11:52am UTC](https://discourse.julialang.org/t/how-to-sum-the-result-of-mapslices-on-the-gpu-while-tracking-gradients/105310 "2023-10-23T11:52:49Z")

</div>

I need to do mapslices but need it to support gradient tracking for Zygote. So, I’m trying to use SliceMap.slicemap. I can’t use SliceMap.mapcols because I have parameters inside the function. SliceMap.slicemap returns a…

---

## [Why trying to remove .arrow file fails with IOError on Windows?](https://discourse.julialang.org/t/why-trying-to-remove-arrow-file-fails-with-ioerror-on-windows/105273)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 2\
**Last updated:** [October 23, 2023, 4:56pm UTC](https://discourse.julialang.org/t/why-trying-to-remove-arrow-file-fails-with-ioerror-on-windows/105273 "2023-10-23T16:56:31Z")

</div>

This is (hopefully) an MWE of my actual problem: using Arrow, DataFrames if true data = DataFrame(a=1:4, b=\["M", "F", "F", "M"\]) Arrow.write("MWE.arrow", data; file = false) Arrow.Stream("MWE.arrow") GC.…

---

## [Makie and observables](https://discourse.julialang.org/t/makie-and-observables/105261)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 5\
**Last updated:** [October 23, 2023, 2:47pm UTC](https://discourse.julialang.org/t/makie-and-observables/105261 "2023-10-23T14:47:12Z")

</div>

Disclaimer : I’m totally unsure if this question is sound or not. In the Makie - Problems with synchronous updates documentation, it is clearly stated that multiple updates of the plots can occur when only one really is…

---

## [Accessing Different Indexes in Arrays](https://discourse.julialang.org/t/accessing-different-indexes-in-arrays/105284)

<div class="topic-metadata">

**Author:** [@ivanricardo](https://discourse.julialang.org/u/ivanricardo)\
**Replies:** 7\
**Last updated:** [October 23, 2023, 2:35pm UTC](https://discourse.julialang.org/t/accessing-different-indexes-in-arrays/105284 "2023-10-23T14:35:46Z")

</div>

Hello, I have the current function in Julia but I realize it is quite repetitive and bad. Is there any way of generalizing this function? I want to create a function that takes in an array and range and returns the arra…

---

## [How to use multithreading appropriately?](https://discourse.julialang.org/t/how-to-use-multithreading-appropriately/105154)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 6\
**Last updated:** [October 23, 2023, 1:26pm UTC](https://discourse.julialang.org/t/how-to-use-multithreading-appropriately/105154 "2023-10-23T13:26:18Z")

</div>

Functions having same output but different multithreading setting have very different performances. Why would this happen? Are there any rules to conform when using multithreading? Below shows the code snippets of data …

---

## [Error message related to the GMT.jl package](https://discourse.julialang.org/t/error-message-related-to-the-gmt-jl-package/105272)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 2\
**Last updated:** [October 23, 2023, 1:14pm UTC](https://discourse.julialang.org/t/error-message-related-to-the-gmt-jl-package/105272 "2023-10-23T13:14:06Z")

</div>

My code was running perfectly fine on my Intel-based MacBook Pro, but it gave me the error below while running on Apple Silicon chips. Does anyone know what is going on? Many thanks. \[6464\] signal (11.2): Segmentation …

---

## [How to use Zygote.gradient where mapslices uses a function that includes a parameter?](https://discourse.julialang.org/t/how-to-use-zygote-gradient-where-mapslices-uses-a-function-that-includes-a-parameter/105307)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 1\
**Last updated:** [October 23, 2023, 11:07am UTC](https://discourse.julialang.org/t/how-to-use-zygote-gradient-where-mapslices-uses-a-function-that-includes-a-parameter/105307 "2023-10-23T11:07:40Z")

</div>

Original post below. I found the documentation for SliceMap.mapcols which explicitly states this isn’t supported: Note that if f itself contains parameters, their gradients are also not tracked.. So… if I need to do maps…

---

## [The Optimization Problem with Nested Loops in Julia](https://discourse.julialang.org/t/the-optimization-problem-with-nested-loops-in-julia/104833)

<div class="topic-metadata">

**Author:** [@Umut\_Can\_Turhan](https://discourse.julialang.org/u/Umut_Can_Turhan)\
**Replies:** 8\
**Last updated:** [October 23, 2023, 8:02am UTC](https://discourse.julialang.org/t/the-optimization-problem-with-nested-loops-in-julia/104833 "2023-10-23T08:02:55Z")

</div>

Hi everyone, I have a problem related to the optimization problem with nested loops. I use QuantumOptics.jl (qojulia.org) module to calculate for some physical situation. First of all, let me share my code and explain it…

---

## [Why would Franklin fail because "\`@sprintf\` not defined"?](https://discourse.julialang.org/t/why-would-franklin-fail-because-sprintf-not-defined/104912)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 3\
**Last updated:** [October 23, 2023, 7:30am UTC](https://discourse.julialang.org/t/why-would-franklin-fail-because-sprintf-not-defined/104912 "2023-10-23T07:30:47Z")

</div>

This is while building GMT docs, but both GMT and the GMT docs repo have Printf as a dependency. And locally the build works fine. This error in particular raised when running this case but there are several other ex…

---

## [Non-Deterministic Memory Allocation?](https://discourse.julialang.org/t/non-deterministic-memory-allocation/104941)

<div class="topic-metadata">

**Author:** [@mcmuffin6o](https://discourse.julialang.org/u/mcmuffin6o)\
**Replies:** 17\
**Last updated:** [October 22, 2023, 7:25pm UTC](https://discourse.julialang.org/t/non-deterministic-memory-allocation/104941 "2023-10-22T19:25:10Z")

</div>

After running a short script several times without making changes (using include("script.jl"); from the REPL), I noticed that the number and total size of memory allocations was not constant. How (and why?) can this happ…

---

## [Get fontsize in Luxor](https://discourse.julialang.org/t/get-fontsize-in-luxor/105084)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 3\
**Last updated:** [October 22, 2023, 3:08pm UTC](https://discourse.julialang.org/t/get-fontsize-in-luxor/105084 "2023-10-22T15:08:20Z")

</div>

How do I get the font size that has been set with the setfont function? The function get\_fontsize gives me the size that has been set with the fontsize function.

---

## [PyPlot vmin and vmax equivalent in Makie?](https://discourse.julialang.org/t/pyplot-vmin-and-vmax-equivalent-in-makie/105276)

<div class="topic-metadata">

**Author:** [@jddorellanao](https://discourse.julialang.org/u/jddorellanao)\
**Replies:** 1\
**Last updated:** [October 22, 2023, 11:54am UTC](https://discourse.julialang.org/t/pyplot-vmin-and-vmax-equivalent-in-makie/105276 "2023-10-22T11:54:02Z")

</div>

In PyPlot.jl when plotting a 2D matrix using imshow() you can set vmin and vmax wich acording to the official documentation: " vmin and vmax define the data range that the colormap covers." Using this package I create t…

---

## [Best way to count element pairs (x,y) satisfying a condition?](https://discourse.julialang.org/t/best-way-to-count-element-pairs-x-y-satisfying-a-condition/105264)

<div class="topic-metadata">

**Author:** [@Alergy](https://discourse.julialang.org/u/Alergy)\
**Replies:** 19\
**Last updated:** [October 22, 2023, 10:42am UTC](https://discourse.julialang.org/t/best-way-to-count-element-pairs-x-y-satisfying-a-condition/105264 "2023-10-22T10:42:00Z")

</div>

Hello everyone! I was trying to optimize the following MWE: using BenchmarkTools N = 2^20 a = rand(N); b = rand(N); @btime count(a+b .\< 1) 2.492 ms (9 allocations: 8.13 MiB) This seems to be allocating memory for a …

---

## [\[diffeqpy\] with sparse mass-matrix / jacobian](https://discourse.julialang.org/t/diffeqpy-with-sparse-mass-matrix-jacobian/91984)

<div class="topic-metadata">

**Author:** [@ChrisProv](https://discourse.julialang.org/u/ChrisProv)\
**Replies:** 2\
**Last updated:** [October 21, 2023, 1:44pm UTC](https://discourse.julialang.org/t/diffeqpy-with-sparse-mass-matrix-jacobian/91984 "2023-10-21T13:44:59Z")

</div>

Hello, I have a moderately-complex Python script which involves a DAE system solve at its core: M(u) dudt = F(u) The matrices M and J (the Jacobian of F(x)) are both sparse, and I need to exploit for this large system…

---

## [How can I add Latex directly into Weave.jl .jmd file?](https://discourse.julialang.org/t/how-can-i-add-latex-directly-into-weave-jl-jmd-file/105266)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 0\
**Last updated:** [October 21, 2023, 12:03pm UTC](https://discourse.julialang.org/t/how-can-i-add-latex-directly-into-weave-jl-jmd-file/105266 "2023-10-21T12:03:57Z")

</div>

Hi! I am trying to reference a figure I made using \\cref{fig:myfig} but it keeps on formatting my string no matter what I do… Anyone knows how? Kind regards

---

## [Drop rows of an array containing missing values](https://discourse.julialang.org/t/drop-rows-of-an-array-containing-missing-values/105258)

<div class="topic-metadata">

**Author:** [@ultratrader](https://discourse.julialang.org/u/ultratrader)\
**Replies:** 2\
**Last updated:** [October 21, 2023, 7:39am UTC](https://discourse.julialang.org/t/drop-rows-of-an-array-containing-missing-values/105258 "2023-10-21T07:39:36Z")

</div>

Hi guys, I want to drop rows containing missing values in an array. I can do this by converting the array to a df, and then using the skipmissing function from DataFrames.jl but I prefer to operate on an array rather th…

---

## [MLJ NuSVM predict function not found](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148)

<div class="topic-metadata">

**Author:** [@bryaan](https://discourse.julialang.org/u/bryaan)\
**Replies:** 3\
**Last updated:** [October 21, 2023, 3:01am UTC](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148 "2023-10-21T03:01:02Z")

</div>

I’m having an issue using MLJ NuSVR model. From the docs this should be working. NuSVR = @load NuSVR pkg=LIBSVM model = NuSVR(kernel=LIBSVM.Kernel.RadialBasis) # SVMRegressor = @load SVMRegressor…

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

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