# Latest

**URL:** https://discourse.julialang.org/latest.md?page=1297

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

**Page:** 1298

---

## [Why does julia use thousands of cpu-hours to compute 1+2?](https://discourse.julialang.org/t/why-does-julia-use-thousands-of-cpu-hours-to-compute-1-2/66041)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 10\
**Last updated:** [August 16, 2021, 9:03pm UTC](https://discourse.julialang.org/t/why-does-julia-use-thousands-of-cpu-hours-to-compute-1-2/66041 "2021-08-16T21:03:15Z")

</div>

I’m fairly new to julia, and not overly experienced with scaling to huge numbers of processes, so forgive me if I’m missing something obvious. Alright, to be honest, I actually used a couple thousand cpu-hours to run us…

---

## [Sorting strings containing numbers, so that "A2" \< "A10"?](https://discourse.julialang.org/t/sorting-strings-containing-numbers-so-that-a2-a10/5372)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 28\
**Last updated:** [August 16, 2021, 7:50pm UTC](https://discourse.julialang.org/t/sorting-strings-containing-numbers-so-that-a2-a10/5372 "2021-08-16T19:50:08Z")

</div>

I need to sort strings containing numbers. Is there a simple way to sort them, such that, for example, "A2" \< "A10"? That is, I want a lexicographic compare, such that numbers in the string are compared by value. I gues…

---

## [GLMakie: how to plot two images with transparency?](https://discourse.julialang.org/t/glmakie-how-to-plot-two-images-with-transparency/66492)

<div class="topic-metadata">

**Author:** [@mariusd](https://discourse.julialang.org/u/mariusd)\
**Replies:** 3\
**Last updated:** [August 16, 2021, 8:47pm UTC](https://discourse.julialang.org/t/glmakie-how-to-plot-two-images-with-transparency/66492 "2021-08-16T20:47:15Z")

</div>

I’m using GLMakie to display 2 images. GLMakie.image(GLMakie.rotr90(image\_data)) GLMakie.image!(GLMakie.rotr90(some\_extra\_data), colormap=“viridis”) This code will display “some\_extra\_data” and the “image\_data” is no …

---

## [Flux question: best way to write a function that reuses some terms](https://discourse.julialang.org/t/flux-question-best-way-to-write-a-function-that-reuses-some-terms/66510)

<div class="topic-metadata">

**Author:** [@IRM](https://discourse.julialang.org/u/IRM)\
**Replies:** 1\
**Last updated:** [August 16, 2021, 8:43pm UTC](https://discourse.julialang.org/t/flux-question-best-way-to-write-a-function-that-reuses-some-terms/66510 "2021-08-16T20:43:45Z")

</div>

I have a question about the best (most computationally efficient) way to write functions for automatic differentiation in Flux in which some terms are reused. The particular example I give is motivated by the paper Jauc…

---

## [Avoid slowness in the first execution of a function](https://discourse.julialang.org/t/avoid-slowness-in-the-first-execution-of-a-function/66509)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 3\
**Last updated:** [August 16, 2021, 8:14pm UTC](https://discourse.julialang.org/t/avoid-slowness-in-the-first-execution-of-a-function/66509 "2021-08-16T20:14:00Z")

</div>

Hello everyone. I noticed that the first time I run a function with julia, the execution time (as well as the allocated memory) is significantly higher than subsequent executions, at least in my code. Since I have to r…

---

## [How to pre-allocate an Array of UnitRange (specifically a SharedArray of Tuple of UnitRange)?](https://discourse.julialang.org/t/how-to-pre-allocate-an-array-of-unitrange-specifically-a-sharedarray-of-tuple-of-unitrange/66506)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 1\
**Last updated:** [August 16, 2021, 7:33pm UTC](https://discourse.julialang.org/t/how-to-pre-allocate-an-array-of-unitrange-specifically-a-sharedarray-of-tuple-of-unitrange/66506 "2021-08-16T19:33:39Z")

</div>

Question Is there a shorter or better way to pre-allocate indsTup and inds as shown below? : indsTup = \[(1:2,1:2)\] for i in 1:10 push!(indsTup,(1:2,1:2)) end indsTup = SharedArray(indsTup) inds = \[1:2\] for i in 1:10 …

---

## [Unstack using row numbers](https://discourse.julialang.org/t/unstack-using-row-numbers/66432)

<div class="topic-metadata">

**Author:** [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Replies:** 5\
**Last updated:** [August 16, 2021, 7:08pm UTC](https://discourse.julialang.org/t/unstack-using-row-numbers/66432 "2021-08-16T19:08:28Z")

</div>

I have a table with multiple column pairs I dictating x and y values. If I stack them I can add columns bases on the column names for each pair, but do unstack them I need the original row numbers again. What is the bes…

---

## [Memory allocation while using @views](https://discourse.julialang.org/t/memory-allocation-while-using-views/66482)

<div class="topic-metadata">

**Author:** [@aramgharibyan](https://discourse.julialang.org/u/aramgharibyan)\
**Replies:** 5\
**Last updated:** [August 16, 2021, 3:11pm UTC](https://discourse.julialang.org/t/memory-allocation-while-using-views/66482 "2021-08-16T15:11:39Z")

</div>

I found an issue while using @views, which may help others speed up their code. Let us consider this example of code. len = 5000 const arr1 = Array{Float64, 2}(undef, 10, len) const arr2 = Array{Float64, 2}(undef, 10, l…

---

## [Strange deadlock in 1.7.0-beta3 didn't happen in 1.5.x](https://discourse.julialang.org/t/strange-deadlock-in-1-7-0-beta3-didnt-happen-in-1-5-x/66462)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 10\
**Last updated:** [August 16, 2021, 6:38pm UTC](https://discourse.julialang.org/t/strange-deadlock-in-1-7-0-beta3-didnt-happen-in-1-5-x/66462 "2021-08-16T18:38:02Z")

</div>

I have an Agents.jl simulation that worked fine last summer… I’m back to looking at the code, and it’s deadlocking and sitting there using 0% of cpu. It’s a script that uses Threads.@spawn to run some threads each of wh…

---

## [Significant allocations with Callbacks (Tsit5)](https://discourse.julialang.org/t/significant-allocations-with-callbacks-tsit5/66467)

<div class="topic-metadata">

**Author:** [@Amarantine](https://discourse.julialang.org/u/Amarantine)\
**Replies:** 4\
**Last updated:** [August 16, 2021, 5:58pm UTC](https://discourse.julialang.org/t/significant-allocations-with-callbacks-tsit5/66467 "2021-08-16T17:58:40Z")

</div>

I have a reasonably optimized ODE problem where I used callback for terminating the integrator when some values get too large. Without callback I have (43 allocations: 16.23 KiB), and with callback I have (42,065,928 all…

---

## [@time and @benchmark give different results](https://discourse.julialang.org/t/time-and-benchmark-give-different-results/66374)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 6\
**Last updated:** [August 16, 2021, 5:18pm UTC](https://discourse.julialang.org/t/time-and-benchmark-give-different-results/66374 "2021-08-16T17:18:37Z")

</div>

\[Corrected: ms is 10^{-3} seconds and μs is 10^{-6}.\] I’m evaluating 2 algorithms for doing roughly the same thing, using @time and @benchmark. The ratio of times between the 2 timing methods differs by a factor of rou…

---

## [Flux assumes only trainable parameters should be moved to GPU](https://discourse.julialang.org/t/flux-assumes-only-trainable-parameters-should-be-moved-to-gpu/66429)

<div class="topic-metadata">

**Author:** [@SebastianCallh](https://discourse.julialang.org/u/SebastianCallh)\
**Replies:** 3\
**Last updated:** [August 16, 2021, 4:38pm UTC](https://discourse.julialang.org/t/flux-assumes-only-trainable-parameters-should-be-moved-to-gpu/66429 "2021-08-16T16:38:13Z")

</div>

And that’s not always a good assumption! I am working on a masked dense layer, which looks something like this struct MaskedDense{F, M \<: AbstractMatrix, B \<: AbstractVector} W::M b::B M::AbstractMatrix{Bool} σ:…

---

## [Multiple Conda Environments + PyCall.jl?](https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754)

<div class="topic-metadata">

**Author:** [@LodewijkBrand](https://discourse.julialang.org/u/LodewijkBrand)\
**Replies:** 2\
**Last updated:** [August 16, 2021, 4:36pm UTC](https://discourse.julialang.org/t/multiple-conda-environments-pycall-jl/61754 "2021-08-16T16:36:06Z")

</div>

I have been using PyCall.jl to wrap some algorithms written in Python to compare against a series of algorithms I’ve written in Julia. I’ve started adding additional algorithms one of which is implemented ~4 years ago a…

---

## [Dispatch on type only](https://discourse.julialang.org/t/dispatch-on-type-only/66498)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 4\
**Last updated:** [August 16, 2021, 4:17pm UTC](https://discourse.julialang.org/t/dispatch-on-type-only/66498 "2021-08-16T16:17:27Z")

</div>

Is it possible to dispatch on a type only, not having an instance with a type? This works: function choose(t::Float64) println("choosing t::Float64") end function choose(t::Tuple) println("choosing t::Tuple") e…

---

## [Help modeling attitude propagation using ModelingToolkit.jl](https://discourse.julialang.org/t/help-modeling-attitude-propagation-using-modelingtoolkit-jl/66398)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 2\
**Last updated:** [August 16, 2021, 2:03pm UTC](https://discourse.julialang.org/t/help-modeling-attitude-propagation-using-modelingtoolkit-jl/66398 "2021-08-16T14:03:57Z")

</div>

Hi! I am trying to model the attitude propagation with quaternions using ModelingToolkit.jl. I could make a very simple example as shown below: using ModelingToolkit using OrdinaryDiffEq using ReferenceFrameRotations u…

---

## [Slow performance while solving 1-d poisson equation using GeneralMIRK4() from BoundaryValueDiffEq](https://discourse.julialang.org/t/slow-performance-while-solving-1-d-poisson-equation-using-generalmirk4-from-boundaryvaluediffeq/66444)

<div class="topic-metadata">

**Author:** [@usman0311](https://discourse.julialang.org/u/usman0311)\
**Replies:** 4\
**Last updated:** [August 16, 2021, 1:03pm UTC](https://discourse.julialang.org/t/slow-performance-while-solving-1-d-poisson-equation-using-generalmirk4-from-boundaryvaluediffeq/66444 "2021-08-16T13:03:15Z")

</div>

I solved 1-d poisson equation using julia 1.6.2 with BoundaryValueDiffEq package, it is taking very long time to solve. Same problem is taking less than a minute in python’s scipy.integrate.solve\_bvp. Could anyone help m…

---

## [Data Collection Issue With Julia Agents](https://discourse.julialang.org/t/data-collection-issue-with-julia-agents/66458)

<div class="topic-metadata">

**Author:** [@bfried1](https://discourse.julialang.org/u/bfried1)\
**Replies:** 8\
**Last updated:** [August 16, 2021, 12:04pm UTC](https://discourse.julialang.org/t/data-collection-issue-with-julia-agents/66458 "2021-08-16T12:04:54Z")

</div>

mdata = \[:Social\] returns the same graph over and over without updating, I can’t seem to find the reason, any ideas?

---

## [Reshape into named tuple](https://discourse.julialang.org/t/reshape-into-named-tuple/66474)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 4\
**Last updated:** [August 16, 2021, 10:52am UTC](https://discourse.julialang.org/t/reshape-into-named-tuple/66474 "2021-08-16T10:52:18Z")

</div>

I have a vector with elements of possibly different types (but homogeneous) and the same length (\>1e8). Example: julia\> data 3-element Vector{Any}: \[0.7947257509914385, 0.938439282086563, 0.7825664679861779, 0.9622100…

---

## [Function inside Macro](https://discourse.julialang.org/t/function-inside-macro/66476)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 0\
**Last updated:** [August 16, 2021, 10:49am UTC](https://discourse.julialang.org/t/function-inside-macro/66476 "2021-08-16T10:49:36Z")

</div>

Hi there, I am struggling to find a way to combine a macro und a function. Lets start with an MWE of what I want to do: using QuickTypes abstract type AbstractModel end param = (a = 1., b = 2.) # Create a new Parametr…

---

## [Build struct from arrays and names](https://discourse.julialang.org/t/build-struct-from-arrays-and-names/66350)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 3\
**Last updated:** [August 16, 2021, 10:35am UTC](https://discourse.julialang.org/t/build-struct-from-arrays-and-names/66350 "2021-08-16T10:35:59Z")

</div>

From a stream, I receive a number of arrays and strings as their field names. How can I dynamically build a structure from it? Of course, trying to define a struct within the code generates ERROR: LoadError: syntax: …

---

## [Issue with Plots](https://discourse.julialang.org/t/issue-with-plots/66460)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 1\
**Last updated:** [August 16, 2021, 9:58am UTC](https://discourse.julialang.org/t/issue-with-plots/66460 "2021-08-16T09:58:43Z")

</div>

Unexpectedly, Plots stopped working. I use gr() and get this message: could not load library “libGR.so” dlopen(libGR.so.dylib, 1): image not found using ENV\[“GRDIR”\]=“” Pkg.build(“GR”) has not helped. When I try w…

---

## [OutOfMemoryError with sparse A'\*A](https://discourse.julialang.org/t/outofmemoryerror-with-sparse-a-a/65911)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 9\
**Last updated:** [August 16, 2021, 9:55am UTC](https://discourse.julialang.org/t/outofmemoryerror-with-sparse-a-a/65911 "2021-08-16T09:55:38Z")

</div>

I have to multiply large sparse matrices in the following orthogonal projection orthProject(A::SparseMatricCSC, v::SparseVector) = A \* ((A' \* A) \\ Vector(A' \* v)) but due I got this error ERROR: OutOfMemoryError() Sta…

---

## [Help! Plots not loading](https://discourse.julialang.org/t/help-plots-not-loading/49941)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 47\
**Last updated:** [August 16, 2021, 9:50am UTC](https://discourse.julialang.org/t/help-plots-not-loading/49941 "2021-08-16T09:50:59Z")

</div>

I’m having trouble with the GR backend for Plots using Plots \[ Info: Precompiling Plots \[91a5bcdd-55d7-5caf-9e0b-520d859cae80\] Your GR installation is incomplete. Rerun build step for GR package. ERROR: LoadError: Load…

---

## [Nbabel nbody integrator speed up](https://discourse.julialang.org/t/nbabel-nbody-integrator-speed-up/51712)

<div class="topic-metadata">

**Author:** [@darleybarreto](https://discourse.julialang.org/u/darleybarreto)\
**Replies:** 64\
**Last updated:** [August 16, 2021, 5:17am UTC](https://discourse.julialang.org/t/nbabel-nbody-integrator-speed-up/51712 "2021-08-16T05:17:29Z")

</div>

Hi folks, I found this implementation of a Nbabel integrator in Julia, which I believe it’s a very simple one. The author report a runtime of 2.57s against 0.48s of Pythran. Would any of you help me improve this? I belie…

---

## [How to use \`bfs\_tree\` and \`dfs\_tree\` from \`LightGraphs.jl\`](https://discourse.julialang.org/t/how-to-use-bfs-tree-and-dfs-tree-from-lightgraphs-jl/66331)

<div class="topic-metadata">

**Author:** [@mroavi](https://discourse.julialang.org/u/mroavi)\
**Replies:** 8\
**Last updated:** [August 16, 2021, 8:55am UTC](https://discourse.julialang.org/t/how-to-use-bfs-tree-and-dfs-tree-from-lightgraphs-jl/66331 "2021-08-16T08:55:19Z")

</div>

I’m trying to understand how to use bfs\_tree and dfs\_tree from LightGraphs.jl . They both return the same graph so I don’t know how to extract the actual order in which the nodes were visited. using LightGraphs g = dou…

---

## [How to display on screen using Cairo.jl?](https://discourse.julialang.org/t/how-to-display-on-screen-using-cairo-jl/66427)

<div class="topic-metadata">

**Author:** [@Rratic](https://discourse.julialang.org/u/Rratic)\
**Replies:** 17\
**Last updated:** [August 16, 2021, 8:14am UTC](https://discourse.julialang.org/t/how-to-display-on-screen-using-cairo-jl/66427 "2021-08-16T08:14:25Z")

</div>

I want to show the graph on the screen (maybe a window) I wonder which surface function I should choose and how to fill the arguments,since there’s an error every time I try. I hope there’s an example :grinning:

---

## [Significant allocations with Callbacks with lazy interpolation (Vern methods)](https://discourse.julialang.org/t/significant-allocations-with-callbacks-with-lazy-interpolation-vern-methods/51080)

<div class="topic-metadata">

**Author:** [@Lachlan-Bn](https://discourse.julialang.org/u/Lachlan-Bn)\
**Replies:** 9\
**Last updated:** [August 16, 2021, 8:00am UTC](https://discourse.julialang.org/t/significant-allocations-with-callbacks-with-lazy-interpolation-vern-methods/51080 "2021-08-16T08:00:12Z")

</div>

I have a question that probably has a simple answer and is more conceptual, so I haven’t yet written a MWE. I have a small system with low error tolerance that, ignoring any callbacks, is reasonably efficient in terms o…

---

## [Change colors of Pkg.test()](https://discourse.julialang.org/t/change-colors-of-pkg-test/66369)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 6\
**Last updated:** [August 16, 2021, 7:48am UTC](https://discourse.julialang.org/t/change-colors-of-pkg-test/66369 "2021-08-16T07:48:27Z")

</div>

How do I change the colors for all the different elements in the output of Pkg.test()? I’ve tried setting the environment variables in Environment Variables · The Julia Language, but they don’t seem to have the desire…

---

## [Surface command in Julia](https://discourse.julialang.org/t/surface-command-in-julia/66378)

<div class="topic-metadata">

**Author:** [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Replies:** 7\
**Last updated:** [August 16, 2021, 5:55am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378 "2021-08-16T05:55:05Z")

</div>

MethodError: no method matching optimize\_ticks(::Float64, ::Float64; k\_min=4, k\_max=8, scale=:identity) Closest candidates are: optimize\_ticks(::T, ::T; extend\_ticks, Q, k\_min, k\_max, k\_ideal, granularity\_weight, simpl…

---

## [PyData Global 2021: Call for proposal due August 15th](https://discourse.julialang.org/t/pydata-global-2021-call-for-proposal-due-august-15th/66137)

<div class="topic-metadata">

**Author:** [@logankilpatrick](https://discourse.julialang.org/u/logankilpatrick)\
**Replies:** 3\
**Last updated:** [August 16, 2021, 12:07am UTC](https://discourse.julialang.org/t/pydata-global-2021-call-for-proposal-due-august-15th/66137 "2021-08-16T00:07:40Z")

</div>

Hey all, PyData Global is fast approaching and it would be awesome to have Julia well represented there: https://pydata.org/global2021/present/. Specifically, we are looking for folks interesting in conducting workshops…

[Previous page](https://discourse.julialang.org/latest.md?page=1296)

[Next page](https://discourse.julialang.org/latest.md?page=1298)
