# General Usage

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

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

**Page:** 582

---

## [Unexpected spacing in LaTeX plot label](https://discourse.julialang.org/t/unexpected-spacing-in-latex-plot-label/63740)

<div class="topic-metadata">

**Author:** [@psanan](https://discourse.julialang.org/u/psanan)\
**Replies:** 6\
**Last updated:** [June 29, 2021, 7:38pm UTC](https://discourse.julialang.org/t/unexpected-spacing-in-latex-plot-label/63740 "2021-06-29T19:38:21Z")

</div>

I’d like to label a line on a plot using LaTeX to write a norm, e.g. using Plots using LaTeXStrings plot(\[1,2,3\], label=L"||x-y||^2") I see but the text inside the norm appears shifted to the right and the spacing b…

---

## [Using Accessors to mutate an incomplete initialized struct](https://discourse.julialang.org/t/using-accessors-to-mutate-an-incomplete-initialized-struct/61917)

<div class="topic-metadata">

**Author:** [@t-bltg](https://discourse.julialang.org/u/t-bltg)\
**Replies:** 3\
**Last updated:** [June 29, 2021, 1:47pm UTC](https://discourse.julialang.org/t/using-accessors-to-mutate-an-incomplete-initialized-struct/61917 "2021-06-29T13:47:39Z")

</div>

Hi, I am trying to write a method for finalizing incomplete initialization of a struct. I want to avoid using a mutable struct. I found Setfield.jl or Accessors.jl which seem to fulfill my requirements, but it fails so…

---

## [Performance issue with this bootstrapp](https://discourse.julialang.org/t/performance-issue-with-this-bootstrapp/63551)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 11\
**Last updated:** [June 29, 2021, 1:34pm UTC](https://discourse.julialang.org/t/performance-issue-with-this-bootstrapp/63551 "2021-06-29T13:34:16Z")

</div>

Hi, I have the following piece of code that performs a simple bootstrap, but which is taking a very long time. I was wondering If I made obvious mistakes in the implmentation, although @code\_warntype seems to tell me ev…

---

## [Is there a way to capture an upper bound via dispatch?](https://discourse.julialang.org/t/is-there-a-way-to-capture-an-upper-bound-via-dispatch/63718)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 6\
**Last updated:** [June 29, 2021, 8:10am UTC](https://discourse.julialang.org/t/is-there-a-way-to-capture-an-upper-bound-via-dispatch/63718 "2021-06-29T08:10:35Z")

</div>

As part of the logic of writing some function, I’d like to use the upper bound of some passed-in type’s argument. Is there any way to capture this upper bound cleanly via dispatch? Basically, I’d like the following: str…

---

## [Interpolate variables in markdown in Documenter.jl](https://discourse.julialang.org/t/interpolate-variables-in-markdown-in-documenter-jl/60726)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [June 29, 2021, 8:04am UTC](https://discourse.julialang.org/t/interpolate-variables-in-markdown-in-documenter-jl/60726 "2021-06-29T08:04:08Z")

</div>

Is it possible to interpolate a variable (such as a url name) in the doc pages? For example, I want to set: my\_page = "http://url.to.my.page.org" and then, in the Documenter Markdown files, do: \[MyPage\]($my\_page) or…

---

## [Lorenz attractor with makie](https://discourse.julialang.org/t/lorenz-attractor-with-makie/63712)

<div class="topic-metadata">

**Author:** [@lazarusA](https://discourse.julialang.org/u/lazarusA)\
**Replies:** 4\
**Last updated:** [June 29, 2021, 4:56am UTC](https://discourse.julialang.org/t/lorenz-attractor-with-makie/63712 "2021-06-29T04:56:27Z")

</div>

I’m trying to reproduce the Lorenz attractor simulation from here: https://lazarusa.github.io/gnuplot-examples/menu3/#animations (scroll to the third example) and I feel like this should be easier or at least there sho…

---

## [Optimal approach to simulating large system of time-dependent ODEs?](https://discourse.julialang.org/t/optimal-approach-to-simulating-large-system-of-time-dependent-odes/63709)

<div class="topic-metadata">

**Author:** [@kharing](https://discourse.julialang.org/u/kharing)\
**Replies:** 1\
**Last updated:** [June 28, 2021, 10:39pm UTC](https://discourse.julialang.org/t/optimal-approach-to-simulating-large-system-of-time-dependent-odes/63709 "2021-06-28T22:39:00Z")

</div>

I’m looking to solve a large (N ~ 1000) system of 1st order, linear ODEs with time-dependent coefficients, \\frac{d u}{d t} = A(t) \\cdot u(t). Because both the numerical constants involved in the coefficients and the nu…

---

## [Exporting a \`RuntimeGeneratedFunction\`](https://discourse.julialang.org/t/exporting-a-runtimegeneratedfunction/63628)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 4\
**Last updated:** [June 28, 2021, 10:34pm UTC](https://discourse.julialang.org/t/exporting-a-runtimegeneratedfunction/63628 "2021-06-28T22:34:11Z")

</div>

I have a ModelingToolkit.ODESystem in a package called AstrodynamicalModels. I want to export an ODEFunction, which uses RuntimeGeneratedFunctions to avoid world-age issues. When I import AstrodynamicalModels, and try t…

---

## [Fixed point decimals for accounting](https://discourse.julialang.org/t/fixed-point-decimals-for-accounting/63400)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 44\
**Last updated:** [June 28, 2021, 9:39pm UTC](https://discourse.julialang.org/t/fixed-point-decimals-for-accounting/63400 "2021-06-28T21:39:36Z")

</div>

What are some efficient ways to implement fixed point decimals, for tasks like accounting?

---

## [Precompiling Plots fails in jupyter notebook](https://discourse.julialang.org/t/precompiling-plots-fails-in-jupyter-notebook/63707)

<div class="topic-metadata">

**Author:** [@murrayE](https://discourse.julialang.org/u/murrayE)\
**Replies:** 0\
**Last updated:** [June 28, 2021, 4:51pm UTC](https://discourse.julialang.org/t/precompiling-plots-fails-in-jupyter-notebook/63707 "2021-06-28T16:51:42Z")

</div>

After using the REPL to add the Plots package in julia 1.6.1 under macOS Big sur 11.4, I opened the jupyter notebook ott\_chaos.ipynb from the JuliaDynamics tutorials and evaluated the first cell: using Plots, Dynamical…

---

## [Overwrite function in a submodule](https://discourse.julialang.org/t/overwrite-function-in-a-submodule/63706)

<div class="topic-metadata">

**Author:** [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Replies:** 11\
**Last updated:** [June 28, 2021, 4:58pm UTC](https://discourse.julialang.org/t/overwrite-function-in-a-submodule/63706 "2021-06-28T16:58:07Z")

</div>

Hi everyone, I have a Base module that contains some functionality, which I would like to (optionally) extend upon. Ideally, the extension simply overrides some functions in the base module, while leaving the others as…

---

## [How to prevent Inf or NaN at low floating number precision](https://discourse.julialang.org/t/how-to-prevent-inf-or-nan-at-low-floating-number-precision/63705)

<div class="topic-metadata">

**Author:** [@yingqiuz](https://discourse.julialang.org/u/yingqiuz)\
**Replies:** 4\
**Last updated:** [June 28, 2021, 4:44pm UTC](https://discourse.julialang.org/t/how-to-prevent-inf-or-nan-at-low-floating-number-precision/63705 "2021-06-28T16:44:08Z")

</div>

Hi I am programming at Float32 to improve the speed. In my calculations, however, Inf or NaNs occur occasionally due to the use of exp.(x). For example x=90.30891f0; exp(x) will yield Inf32, even if x is fine. I was wo…

---

## [Periods / shifts argument for the diff function](https://discourse.julialang.org/t/periods-shifts-argument-for-the-diff-function/63701)

<div class="topic-metadata">

**Author:** [@scimas](https://discourse.julialang.org/u/scimas)\
**Replies:** 7\
**Last updated:** [June 28, 2021, 4:33pm UTC](https://discourse.julialang.org/t/periods-shifts-argument-for-the-diff-function/63701 "2021-06-28T16:33:52Z")

</div>

The diff function doesn’t have a periods / shifts argument, similar to the equivalent pandas function. But looking at the julia source code, it seems it would be easy to add it without breaking any existing code. So bef…

---

## [Avoid \`expected Int32, got Int64 value\` error on CI](https://discourse.julialang.org/t/avoid-expected-int32-got-int64-value-error-on-ci/63695)

<div class="topic-metadata">

**Author:** [@floswald](https://discourse.julialang.org/u/floswald)\
**Replies:** 6\
**Last updated:** [June 28, 2021, 3:06pm UTC](https://discourse.julialang.org/t/avoid-expected-int32-got-int64-value-error-on-ci/63695 "2021-06-28T15:06:12Z")

</div>

I have an odd error on github actions where my tests fail on x86 machines but pass on x64. Basically this: Single Baseline Region: Error During Test at /home/runner/work/LandUse.jl/LandUse.jl/test/model\_test.jl:1 385 …

---

## [ProgressMeter generates lots of allocations and overhead when multi-threaded (even if disabled)](https://discourse.julialang.org/t/progressmeter-generates-lots-of-allocations-and-overhead-when-multi-threaded-even-if-disabled/63696)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 10\
**Last updated:** [June 28, 2021, 2:49pm UTC](https://discourse.julialang.org/t/progressmeter-generates-lots-of-allocations-and-overhead-when-multi-threaded-even-if-disabled/63696 "2021-06-28T14:49:10Z")

</div>

Maybe I should post an issue on the package site, but lets go. Given this simple threaded loop: julia\> using ProgressMeter, BenchmarkTools julia\> function loop(n) s = zeros(Threads.nthreads()) Threads…

---

## [Drawing a median line in a histogram in Plots](https://discourse.julialang.org/t/drawing-a-median-line-in-a-histogram-in-plots/63682)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 4\
**Last updated:** [June 28, 2021, 2:46pm UTC](https://discourse.julialang.org/t/drawing-a-median-line-in-a-histogram-in-plots/63682 "2021-06-28T14:46:57Z")

</div>

Following the idea of the link, I reproduced the graph using the Plots package, and I got the following questions: It is possible to replace the following lines of code with a command: subplot = plot!()\[1\] h = extrema(…

---

## [Documenter can't find docs](https://discourse.julialang.org/t/documenter-cant-find-docs/63200)

<div class="topic-metadata">

**Author:** [@Joinijo](https://discourse.julialang.org/u/Joinijo)\
**Replies:** 3\
**Last updated:** [June 28, 2021, 2:20pm UTC](https://discourse.julialang.org/t/documenter-cant-find-docs/63200 "2021-06-28T14:20:38Z")

</div>

Hi, I’m trying to build a documentation using documenter and run into a weird error. In one of the .md files, I have a few @docs blocks. It looks as follows: ##Functions \`\`\`@docs f \`\`\` ##Some more functions \`\`\`@docs …

---

## [Can you filter a Dict with pairs?](https://discourse.julialang.org/t/can-you-filter-a-dict-with-pairs/63685)

<div class="topic-metadata">

**Author:** [@gleyland](https://discourse.julialang.org/u/gleyland)\
**Replies:** 8\
**Last updated:** [June 28, 2021, 1:59pm UTC](https://discourse.julialang.org/t/can-you-filter-a-dict-with-pairs/63685 "2021-06-28T13:59:36Z")

</div>

Hi, I can filter a Dict with first and last: d = Dict("a" =\> 1, "b" =\> 2, "c" =\> 3) filter(e -\> first(e) == "a" || last(e) == 3, d) But it would be really nice if I could destructure e into a key and a value: filter(…

---

## [Import package from python](https://discourse.julialang.org/t/import-package-from-python/47144)

<div class="topic-metadata">

**Author:** [@nadaa](https://discourse.julialang.org/u/nadaa)\
**Replies:** 18\
**Last updated:** [June 28, 2021, 1:34pm UTC](https://discourse.julialang.org/t/import-package-from-python/47144 "2021-06-28T13:34:31Z")

</div>

Hi, I have a package installed in anaconda, and I want to use in Julia. I did the following: set python environment in Julia to be anaconda python and rebuilt pycall restart Julia I still have an importerror! Any s…

---

## [SuiteSparse.CHOLMOD.lowrankupdate! does not speed up calculations](https://discourse.julialang.org/t/suitesparse-cholmod-lowrankupdate-does-not-speed-up-calculations/63690)

<div class="topic-metadata">

**Author:** [@sidelkin](https://discourse.julialang.org/u/sidelkin)\
**Replies:** 0\
**Last updated:** [June 28, 2021, 11:17am UTC](https://discourse.julialang.org/t/suitesparse-cholmod-lowrankupdate-does-not-speed-up-calculations/63690 "2021-06-28T11:17:48Z")

</div>

Hello. Can someone explain why using SuiteSparse.CHOLMOD.lowrankupdate! does not give acceleration in this example? using BenchmarkTools, LinearAlgebra, SparseArrays, Test, SuiteSparse N = 100; M = 20 b = rand(N) spA =…

---

## [Hyperbolic tangents (of matrix) numerically inaccurate?](https://discourse.julialang.org/t/hyperbolic-tangents-of-matrix-numerically-inaccurate/63558)

<div class="topic-metadata">

**Author:** [@judober](https://discourse.julialang.org/u/judober)\
**Replies:** 3\
**Last updated:** [June 28, 2021, 10:56am UTC](https://discourse.julialang.org/t/hyperbolic-tangents-of-matrix-numerically-inaccurate/63558 "2021-06-28T10:56:37Z")

</div>

Hello everyone, I need to calculate the tanh of a complex square matrix. The function needs to work for different matrixes and the numbers can get relative big (well, values around 20 don’t seem big but apparently they …

---

## [Confusion about matrix multiplication order (\>2 matrices)](https://discourse.julialang.org/t/confusion-about-matrix-multiplication-order-2-matrices/63681)

<div class="topic-metadata">

**Author:** [@MartaVanin](https://discourse.julialang.org/u/MartaVanin)\
**Replies:** 1\
**Last updated:** [June 28, 2021, 8:33am UTC](https://discourse.julialang.org/t/confusion-about-matrix-multiplication-order-2-matrices/63681 "2021-06-28T08:33:07Z")

</div>

Hello, I am performing some matrix multiplication and I am a bit confused about the results. Specifically, I have a sparse matrix H 390x331 and a diagonal matrix R 390x390. I want to calculate G = transpose(H)\*inv(R)\*…

---

## [Basic stochastic model](https://discourse.julialang.org/t/basic-stochastic-model/63680)

<div class="topic-metadata">

**Author:** [@Cyber](https://discourse.julialang.org/u/Cyber)\
**Replies:** 0\
**Last updated:** [June 28, 2021, 8:19am UTC](https://discourse.julialang.org/t/basic-stochastic-model/63680 "2021-06-28T08:19:26Z")

</div>

Hello all. I am trying to simulate stochasitc motions for some particles in a specific domain. It is fine for just 2 particles. But if I would like to simulate more than 2 particles, my code becomes too slow.(I only know…

---

## [MLJ TunedModel with imbalanced classes](https://discourse.julialang.org/t/mlj-tunedmodel-with-imbalanced-classes/63667)

<div class="topic-metadata">

**Author:** [@Vishal\_Sharma1](https://discourse.julialang.org/u/Vishal_Sharma1)\
**Replies:** 1\
**Last updated:** [June 28, 2021, 3:51am UTC](https://discourse.julialang.org/t/mlj-tunedmodel-with-imbalanced-classes/63667 "2021-06-28T03:51:26Z")

</div>

The TunedModel interface supports parameter - weights but not class\_weights. For classification problems with highly imbalanced classes, we need tuned model measures working with class weights. Is it currently possible…

---

## [Is it possible to use SIMD in multithreading?](https://discourse.julialang.org/t/is-it-possible-to-use-simd-in-multithreading/63662)

<div class="topic-metadata">

**Author:** [@ignis](https://discourse.julialang.org/u/ignis)\
**Replies:** 5\
**Last updated:** [June 28, 2021, 2:30am UTC](https://discourse.julialang.org/t/is-it-possible-to-use-simd-in-multithreading/63662 "2021-06-28T02:30:15Z")

</div>

I was wondering how I could combine multithreading with SIMD operations and I’m not sure if it is even possible. I’m writing a few toy codes just to check that the code is actually being vectorized but as I don’t have mu…

---

## [Vscode tab completion suddenly broken](https://discourse.julialang.org/t/vscode-tab-completion-suddenly-broken/63646)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 3\
**Last updated:** [June 28, 2021, 1:48am UTC](https://discourse.julialang.org/t/vscode-tab-completion-suddenly-broken/63646 "2021-06-28T01:48:07Z")

</div>

I’ve been using vscode with Julia for a while now. All of a sudden, tab completion for symbols like \\approx stopped working, but it still works for function names and such. Similar posts on this forum have not solved t…

---

## [Google Sheets](https://discourse.julialang.org/t/google-sheets/3602)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 6\
**Last updated:** [June 27, 2021, 9:10pm UTC](https://discourse.julialang.org/t/google-sheets/3602 "2021-06-27T21:10:11Z")

</div>

I would like to modify Google spreadsheets using Julia. The API is well documented but, sadly, without examples using Julia. I don’t have much experience with web-based API’s and would appreciate pointers on where to s…

---

## [Why matrix multiplication is much slower than PyTorch](https://discourse.julialang.org/t/why-matrix-multiplication-is-much-slower-than-pytorch/63661)

<div class="topic-metadata">

**Author:** [@yingqiuz](https://discourse.julialang.org/u/yingqiuz)\
**Replies:** 4\
**Last updated:** [June 27, 2021, 8:49pm UTC](https://discourse.julialang.org/t/why-matrix-multiplication-is-much-slower-than-pytorch/63661 "2021-06-27T20:49:27Z")

</div>

For example, matrix multiplication of 10,000 x 10,100 matrices, single threaded In julia: BLAS.set\_num\_threads(1) A = randn(10000, 10000) B = randn(10000, 10000) C = Matrix{Float64}(undef, 10000, 10000) @benchmark mul…

---

## [Modifying view index results in silent out-of-bound access](https://discourse.julialang.org/t/modifying-view-index-results-in-silent-out-of-bound-access/63663)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [June 27, 2021, 8:27pm UTC](https://discourse.julialang.org/t/modifying-view-index-results-in-silent-out-of-bound-access/63663 "2021-06-27T20:27:25Z")

</div>

The view doc says The behavior is undefined if the shape of the parent array is changed after view is called because there is no bound check for the parent array; e.g., it may cause a segmentation fault. but it do…

---

## [A simple SIMD.jl loop that is slower than a vanilla \`@inbounds @simd\`](https://discourse.julialang.org/t/a-simple-simd-jl-loop-that-is-slower-than-a-vanilla-inbounds-simd/63655)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 8\
**Last updated:** [June 27, 2021, 8:21pm UTC](https://discourse.julialang.org/t/a-simple-simd-jl-loop-that-is-slower-than-a-vanilla-inbounds-simd/63655 "2021-06-27T20:21:43Z")

</div>

I have a loop that performs some bit-fiddling operations. Because of the way some out-of-loop constants are used, @simd (and occasionally even LoopVectorization.jl) does not always give the fastest possible machine code.…

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

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