# General Usage

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

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

**Page:** 374

---

## [Parallel execution of a number of lines](https://discourse.julialang.org/t/parallel-execution-of-a-number-of-lines/89765)

<div class="topic-metadata">

**Author:** [@CeterisPartybus](https://discourse.julialang.org/u/CeterisPartybus)\
**Replies:** 2\
**Last updated:** [November 4, 2022, 9:52am UTC](https://discourse.julialang.org/t/parallel-execution-of-a-number-of-lines/89765 "2022-11-04T09:52:15Z")

</div>

Is there a way to run multiple lines of code in parallel on multiple threads? I am familiar with the @threads for loop. But I would like to tell Julia that some lines can be run in parallel instead of sequentially. To …

---

## [MLJ: how to read/interpret \`measure\` from evaluate](https://discourse.julialang.org/t/mlj-how-to-read-interpret-measure-from-evaluate/89689)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 9\
**Last updated:** [November 4, 2022, 9:21am UTC](https://discourse.julialang.org/t/mlj-how-to-read-interpret-measure-from-evaluate/89689 "2022-11-04T09:21:57Z")

</div>

In this toy example I know one config is overtraining: tree1 = EvoTreeClassifier(; nrounds = 10, eta = 0.1, max\_depth=5) tree2 = EvoTreeClassifier(; nrounds = 10, eta = 0.1, max\_depth=10) because I checked it via manu…

---

## [ArgumentError: unable to check bounds for indices of type Index](https://discourse.julialang.org/t/argumenterror-unable-to-check-bounds-for-indices-of-type-index/89759)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 1\
**Last updated:** [November 4, 2022, 8:14am UTC](https://discourse.julialang.org/t/argumenterror-unable-to-check-bounds-for-indices-of-type-index/89759 "2022-11-04T08:14:18Z")

</div>

This is going to be an easy one, because it’s probably about pointing me to the right place in the docs: My MWE struct Index i::Int64 end Base.getindex(A::AbstractArray,i::Index) = A\[i.i\] index = \[Index(1),Index(3…

---

## [How to make it be a memory leak program(without lower function such as GC.xxx used)](https://discourse.julialang.org/t/how-to-make-it-be-a-memory-leak-program-without-lower-function-such-as-gc-xxx-used/89347)

<div class="topic-metadata">

**Author:** [@HANHAOHAN](https://discourse.julialang.org/u/HANHAOHAN)\
**Replies:** 10\
**Last updated:** [November 4, 2022, 7:53am UTC](https://discourse.julialang.org/t/how-to-make-it-be-a-memory-leak-program-without-lower-function-such-as-gc-xxx-used/89347 "2022-11-04T07:53:07Z")

</div>

Again and again, the memory occupation grows to 80%(about 12G) slowly as my program running. My program is simple, as follows: using Images using HTTP using libwebp\_jll using ImageView using CSV using ProgressMeter f…

---

## [Use javascript library pseudocode.js with Documenter.jl](https://discourse.julialang.org/t/use-javascript-library-pseudocode-js-with-documenter-jl/87684)

<div class="topic-metadata">

**Author:** [@amontoison](https://discourse.julialang.org/u/amontoison)\
**Replies:** 0\
**Last updated:** [September 23, 2022, 4:57am UTC](https://discourse.julialang.org/t/use-javascript-library-pseudocode-js-with-documenter-jl/87684 "2022-09-23T04:57:43Z")

</div>

Does anyone know if it is possible to use the external javascript library pseudocode.js with Documenter.jl ? I am trying to replace my algorithms stored in .png files in my documentation of Krylov.jl. I modified the kw…

---

## [Help with erro MethodError](https://discourse.julialang.org/t/help-with-erro-methoderror/89747)

<div class="topic-metadata">

**Author:** [@Ricardo\_Lima](https://discourse.julialang.org/u/Ricardo_Lima)\
**Replies:** 0\
**Last updated:** [November 4, 2022, 12:25am UTC](https://discourse.julialang.org/t/help-with-erro-methoderror/89747 "2022-11-04T00:25:48Z")

</div>

I have method to calculate the inverse of laplace. I’m making a websocket to do the calculation and return the value. This is the calculation that works perfectly. using InverseLaplace import InverseLaplace: talbot t…

---

## [How to assign a particular method for a function with the exact type signature to an lvalue?](https://discourse.julialang.org/t/how-to-assign-a-particular-method-for-a-function-with-the-exact-type-signature-to-an-lvalue/89707)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 5\
**Last updated:** [November 3, 2022, 4:01pm UTC](https://discourse.julialang.org/t/how-to-assign-a-particular-method-for-a-function-with-the-exact-type-signature-to-an-lvalue/89707 "2022-11-03T16:01:01Z")

</div>

I’d like to be able to set an lvalue to a particular method. Essentially use it as a function pointer so that it can be called later in some other code. I’d like to set the method rather than the function because I’m wor…

---

## [Update progress name along with percentage in ProgressMeter.jl](https://discourse.julialang.org/t/update-progress-name-along-with-percentage-in-progressmeter-jl/89716)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 2\
**Last updated:** [November 3, 2022, 3:06pm UTC](https://discourse.julialang.org/t/update-progress-name-along-with-percentage-in-progressmeter-jl/89716 "2022-11-03T15:06:33Z")

</div>

I’m using ProgressMeter.jl and I have a Progress to measure time a task takes. The task has n::Int total steps, but for each n/10th or so step a different parameter is used in my process. I would like to be able to displ…

---

## [How to preallocate a static array for use with \`lu!\`](https://discourse.julialang.org/t/how-to-preallocate-a-static-array-for-use-with-lu/89712)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 3\
**Last updated:** [November 3, 2022, 2:02pm UTC](https://discourse.julialang.org/t/how-to-preallocate-a-static-array-for-use-with-lu/89712 "2022-11-03T14:02:01Z")

</div>

If you call lu on an SMatrix, you get a static LU factorization—cool: using StaticArrays using LinearAlgebra A = SMatrix{3, 3}(rand(3, 3)) lu(A) # StaticArrays.LU # L factor: # 3×3 LowerTriangular{Float64, SMatrix{3, 3…

---

## [Address of object](https://discourse.julialang.org/t/address-of-object/89695)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 4\
**Last updated:** [November 3, 2022, 1:49pm UTC](https://discourse.julialang.org/t/address-of-object/89695 "2022-11-03T13:49:34Z")

</div>

passing a variable to a c library by reference, that takes a void\* and size, using Ref(x), Base.summarysize(x) does not work as expected for Arrays: a=\[1,2,3\] b=\[1,2,3\] f(a) f(b) the C function f should return the sam…

---

## [Heat problem in polar coordinates? Method of Lines?](https://discourse.julialang.org/t/heat-problem-in-polar-coordinates-method-of-lines/89713)

<div class="topic-metadata">

**Author:** [@David\_F](https://discourse.julialang.org/u/David_F)\
**Replies:** 0\
**Last updated:** [November 3, 2022, 1:38pm UTC](https://discourse.julialang.org/t/heat-problem-in-polar-coordinates-method-of-lines/89713 "2022-11-03T13:38:46Z")

</div>

Can I solve the heat equation using polar coordinates (a hollow sphere) with Method of Lines? I haven’t found an example with polar or spherical coordinates, although the documentation mentions that a spherical Laplacia…

---

## [What happens to overwritten Modules?](https://discourse.julialang.org/t/what-happens-to-overwritten-modules/89711)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 1\
**Last updated:** [November 3, 2022, 12:23pm UTC](https://discourse.julialang.org/t/what-happens-to-overwritten-modules/89711 "2022-11-03T12:23:01Z")

</div>

Some packages create a new sandbox module for each run of let’s say a document generator, or a code cell in a documenter project. Do these modules take up more and more space because they’re never removed? Or what are th…

---

## [REPL history interfering with RadioMenu navigation](https://discourse.julialang.org/t/repl-history-interfering-with-radiomenu-navigation/89703)

<div class="topic-metadata">

**Author:** [@AngusRussell](https://discourse.julialang.org/u/AngusRussell)\
**Replies:** 0\
**Last updated:** [November 3, 2022, 9:01am UTC](https://discourse.julialang.org/t/repl-history-interfering-with-radiomenu-navigation/89703 "2022-11-03T09:01:48Z")

</div>

I have a function that uses the REPL.TerminalMenus: RadioMenu to navigate through the local directory in order to select a file to load. The function works great when run directly in the REPL, however when I run it from …

---

## [How to structure a Gtk app](https://discourse.julialang.org/t/how-to-structure-a-gtk-app/89647)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 3\
**Last updated:** [November 3, 2022, 7:30am UTC](https://discourse.julialang.org/t/how-to-structure-a-gtk-app/89647 "2022-11-03T07:30:46Z")

</div>

When looking at Gyk examples a lot of the apps use global variables. How can this be avoided while keeping access to the model values(like data, a figure object,…) What I saw using Gtk win = GtkWindow() f = Figure() …

---

## [Performance comparison - Flux.jl's Adam vs Jax's Adam](https://discourse.julialang.org/t/performance-comparison-flux-jls-adam-vs-jaxs-adam/89553)

<div class="topic-metadata">

**Author:** [@richinex](https://discourse.julialang.org/u/richinex)\
**Replies:** 33\
**Last updated:** [November 3, 2022, 5:27am UTC](https://discourse.julialang.org/t/performance-comparison-flux-jls-adam-vs-jaxs-adam/89553 "2022-11-03T05:27:34Z")

</div>

Hello guys, I have been wondering about Julia’s performance and would like to know if it is really true that Julia is really faster than python as is always stated because I have not yet seen any performance gain since I…

---

## [Total memory size of collections](https://discourse.julialang.org/t/total-memory-size-of-collections/89682)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 1\
**Last updated:** [November 3, 2022, 2:36am UTC](https://discourse.julialang.org/t/total-memory-size-of-collections/89682 "2022-11-03T02:36:53Z")

</div>

how can I get the total memory size of arrays. using sizeof does not give the total memory footprint. for example, sizeof(\[1\])==sizeof(\["a"\])==sizeof(\["abcdef"\]) and sizeof(\[\[1,2\],\[3,4\]\])==sizeof(\[\[1,2,0\],\[3,4,0\]\]) …

---

## [How do I evaluate a probability mass function from Distributions?](https://discourse.julialang.org/t/how-do-i-evaluate-a-probability-mass-function-from-distributions/89673)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 2\
**Last updated:** [November 2, 2022, 8:26pm UTC](https://discourse.julialang.org/t/how-do-i-evaluate-a-probability-mass-function-from-distributions/89673 "2022-11-02T20:26:17Z")

</div>

I get 0 p=Distributions.Hypergeometric(100, 100, 200) Hypergeometric(ns=100, nf=100, n=200) pdf(p,4) 0.0

---

## [Convert string in text file into int](https://discourse.julialang.org/t/convert-string-in-text-file-into-int/89663)

<div class="topic-metadata">

**Author:** [@ahmad88](https://discourse.julialang.org/u/ahmad88)\
**Replies:** 3\
**Last updated:** [November 2, 2022, 7:14pm UTC](https://discourse.julialang.org/t/convert-string-in-text-file-into-int/89663 "2022-11-02T19:14:49Z")

</div>

I have the following textfile: initial=0 n=39 E=\[( 0 , 8 ), ( 0 , 13 ), ( 0 , 20 ), ( 0 , 22 ), ( 0 , 26 ), ( 0 , 36 ), ( 0 , 5 ), ( 0 , 10 ), ( 0 , 17 ), ( 0 , 27 ), ( 1 , 18 ), ( 2 , 5 ), ( 2 , 8 ), ( 3 …

---

## [Concatenation of NamedArrays while maintaining column names](https://discourse.julialang.org/t/concatenation-of-namedarrays-while-maintaining-column-names/89666)

<div class="topic-metadata">

**Author:** [@Filippati](https://discourse.julialang.org/u/Filippati)\
**Replies:** 2\
**Last updated:** [November 2, 2022, 7:16pm UTC](https://discourse.julialang.org/t/concatenation-of-namedarrays-while-maintaining-column-names/89666 "2022-11-02T19:16:47Z")

</div>

Hello everyone, I am trying to figure out how to concatenate NamedArrays while maintaining column names. using NamedArrays countriesq = \["USq", "CNq", "JPq", "FRq", "BDq", "ITq", "UKq"\] countriesr = \["USr", "CNr", "JPr…

---

## [Parameterize all types excluding a certain type](https://discourse.julialang.org/t/parameterize-all-types-excluding-a-certain-type/89639)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 6\
**Last updated:** [November 2, 2022, 6:32pm UTC](https://discourse.julialang.org/t/parameterize-all-types-excluding-a-certain-type/89639 "2022-11-02T18:32:22Z")

</div>

Suppose I have a parameterized type Foo{T} with a field val::T, and an abstract type Bar. I would like to: # Library Code struct Foo{T} val::T end abstract type Bar end baz(bar::Bar, a::Foo, b::Foo) = baz(bar, a.v…

---

## [Caching of recompilation in CI](https://discourse.julialang.org/t/caching-of-recompilation-in-ci/89652)

<div class="topic-metadata">

**Author:** [@mmiller](https://discourse.julialang.org/u/mmiller)\
**Replies:** 1\
**Last updated:** [November 2, 2022, 6:06pm UTC](https://discourse.julialang.org/t/caching-of-recompilation-in-ci/89652 "2022-11-02T18:06:11Z")

</div>

Hey everyone, has anyone got caching of package precompilation working in CircleCI, or a similar CI tool? Ideally I’d instantiate and precompile according to a Project.toml, and then save the ~/.julia folder so that futu…

---

## [Parse String to Function](https://discourse.julialang.org/t/parse-string-to-function/89668)

<div class="topic-metadata">

**Author:** [@Ricardo\_Lima](https://discourse.julialang.org/u/Ricardo_Lima)\
**Replies:** 1\
**Last updated:** [November 2, 2022, 5:30pm UTC](https://discourse.julialang.org/t/parse-string-to-function/89668 "2022-11-02T17:30:19Z")

</div>

How to make this code work? #pkg\> add InverseLaplace using InverseLaplace import InverseLaplace: talbot f2(s) = s / (s^2 + 1); ft2 = Talbot(f2, 80); ft2(pi / 2) #corret f1(s) = Symbol("s / (s^2 + 1)") ft1 = Talbot(f1…

---

## [Reduce allocations for 3D Arrays](https://discourse.julialang.org/t/reduce-allocations-for-3d-arrays/89667)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 10\
**Last updated:** [November 2, 2022, 5:26pm UTC](https://discourse.julialang.org/t/reduce-allocations-for-3d-arrays/89667 "2022-11-02T17:26:31Z")

</div>

When I solve large scale ODEs (136 equations), I try to extract some common factor and calculate them before using them in the equations, however that will take me a 3D array, which will take me quite a lot of allocation…

---

## [Strange characters in windows terminal](https://discourse.julialang.org/t/strange-characters-in-windows-terminal/89355)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 15\
**Last updated:** [November 2, 2022, 2:46pm UTC](https://discourse.julialang.org/t/strange-characters-in-windows-terminal/89355 "2022-11-02T14:46:33Z")

</div>

I have the following code: function git\_pull() result = 0 try msg = readlines(\`$git pull --rebase\`) println(msg) catch e result = 1 end result end If I call this function fro…

---

## [Convert DataFrames 1.3 DataFrame to DataFrames 1.4](https://discourse.julialang.org/t/convert-dataframes-1-3-dataframe-to-dataframes-1-4/88267)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 14\
**Last updated:** [November 2, 2022, 2:10pm UTC](https://discourse.julialang.org/t/convert-dataframes-1-3-dataframe-to-dataframes-1-4/88267 "2022-11-02T14:10:59Z")

</div>

I serialized a DataFrame from DataFrames.jl@1.3. Can I convert it to be compatible with DataFrames.jl@1.4 so I can load it in an environment with the new version?

---

## [FFTW Performance](https://discourse.julialang.org/t/fftw-performance/77175)

<div class="topic-metadata">

**Author:** [@jonas-kr](https://discourse.julialang.org/u/jonas-kr)\
**Replies:** 25\
**Last updated:** [November 2, 2022, 1:05pm UTC](https://discourse.julialang.org/t/fftw-performance/77175 "2022-11-02T13:05:36Z")

</div>

I noticed pretty weird runtimes of FFTs using the FFTW-backend, especially on Windows. If I switch to the MKL-backend, the execution time is back to normal (on AMD and Intel systems). To figure out, whether FFTW is the …

---

## [Get multiple elements from named tuples](https://discourse.julialang.org/t/get-multiple-elements-from-named-tuples/89614)

<div class="topic-metadata">

**Author:** [@johnbb](https://discourse.julialang.org/u/johnbb)\
**Replies:** 4\
**Last updated:** [November 2, 2022, 11:26am UTC](https://discourse.julialang.org/t/get-multiple-elements-from-named-tuples/89614 "2022-11-02T11:26:37Z")

</div>

Why does the following not work for named tuples? x = (a=1, b=2, c=3) x\[1:2\] x\[\[1,2\]\] With unnamed tuples like x = (1, 2, 3) it works fine. Tested with Julia 1.8.2.

---

## [Diagonal elements of matrix product](https://discourse.julialang.org/t/diagonal-elements-of-matrix-product/31418)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 12\
**Last updated:** [November 2, 2022, 11:26am UTC](https://discourse.julialang.org/t/diagonal-elements-of-matrix-product/31418 "2022-11-02T11:26:16Z")

</div>

I have two matrices A and B, and I need to compute the diagonal elements of the product A\*B as fast as possible, and store them in a pre-allocated vector. What’s the fastest way to do this? I mean faster than writing my…

---

## [Between Matrix{Matrix{Any}} and Matrix{Any}](https://discourse.julialang.org/t/between-matrix-matrix-any-and-matrix-any/74534)

<div class="topic-metadata">

**Author:** [@frydaydeep](https://discourse.julialang.org/u/frydaydeep)\
**Replies:** 4\
**Last updated:** [November 2, 2022, 9:28am UTC](https://discourse.julialang.org/t/between-matrix-matrix-any-and-matrix-any/74534 "2022-11-02T09:28:22Z")

</div>

function ⊗(A::T,B::T) where T\<:Array \[i\*B for i in A\] end a = ⊗(rand(2,2),rand(3,3)) typeof(a) Matrix{Matrix{Float64}} (alias for Array{Array{Float64, 2}, 2}) I know: a = kron(rand(2,2),rand(3,3)) But I’m trying …

---

## [Help building MWE for 1.8 latency regression](https://discourse.julialang.org/t/help-building-mwe-for-1-8-latency-regression/84796)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 11\
**Last updated:** [November 2, 2022, 8:02am UTC](https://discourse.julialang.org/t/help-building-mwe-for-1-8-latency-regression/84796 "2022-11-02T08:02:29Z")

</div>

Motivated by the SnoopPrecompile announcement, I checked out my package’s TTFX on 1.8rc3. Using a sample script like: # test\_startup.jl @time using CMBLensing @time LenseFlow(FlatMap(randn(10,10))/1e6) \* FlatMap(randn(1…

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

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