# General Usage

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

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

**Page:** 413

---

## [Mutually-circular type declarations for Clang.jl](https://discourse.julialang.org/t/mutually-circular-type-declarations-for-clang-jl/29411)

<div class="topic-metadata">

**Author:** [@steveaccount](https://discourse.julialang.org/u/steveaccount)\
**Replies:** 0\
**Last updated:** [October 2, 2019, 2:37pm UTC](https://discourse.julialang.org/t/mutually-circular-type-declarations-for-clang-jl/29411 "2019-10-02T14:37:53Z")

</div>

Where is the latest info about mutually-circular type declarations (also called ‘mutually recursive type declarations’, also for structs). Open issue in Julia since 2011. Latest info? Maybe “recursive field types, the e…

---

## [Is Pyplot backend able to draw vectors in 3D?](https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [August 7, 2022, 10:04am UTC](https://discourse.julialang.org/t/is-pyplot-backend-able-to-draw-vectors-in-3d/85389 "2022-08-07T10:04:27Z")

</div>

I am open to any backend besides PyPlot. But I am currently use Pyplot to plot vectors, but unable to, here are the codes: using Plots pyplot() xc = \[0,0,1\] yc = \[0,1,0\] zc = \[1,0,0\] plot(xc,yc,zc,st=:line,arrows=:tr…

---

## [Lux.jl Chain of Dense layers don't see speed up going from 32 bits -\> 16 bits](https://discourse.julialang.org/t/lux-jl-chain-of-dense-layers-dont-see-speed-up-going-from-32-bits-16-bits/85419)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 5\
**Last updated:** [August 7, 2022, 8:49am UTC](https://discourse.julialang.org/t/lux-jl-chain-of-dense-layers-dont-see-speed-up-going-from-32-bits-16-bits/85419 "2022-08-07T08:49:54Z")

</div>

using Lux, BenchmarkTools, Random const rng = Random.default\_rng() julia\> let model = Chain( Dense(23, 30, Lux.relu), Dense(30, 25, Lux.relu), Dense(25, 20, Lux.relu…

---

## [Check values on adding to Dict](https://discourse.julialang.org/t/check-values-on-adding-to-dict/85410)

<div class="topic-metadata">

**Author:** [@braamvandyk](https://discourse.julialang.org/u/braamvandyk)\
**Replies:** 4\
**Last updated:** [August 7, 2022, 8:36am UTC](https://discourse.julialang.org/t/check-values-on-adding-to-dict/85410 "2022-08-07T08:36:15Z")

</div>

Apologies if this should have been obvious, but I could not find a discussion or documentation on the topic. Admittedly, its late, I’m tired, and I may just be overlooking things… The question I’m struggling with is ess…

---

## [Clang.jl doesn't work for netmap (problem #ifdefs)](https://discourse.julialang.org/t/clang-jl-doesnt-work-for-netmap-problem-ifdefs/28596)

<div class="topic-metadata">

**Author:** [@steveaccount](https://discourse.julialang.org/u/steveaccount)\
**Replies:** 2\
**Last updated:** [August 7, 2022, 8:12am UTC](https://discourse.julialang.org/t/clang-jl-doesnt-work-for-netmap-problem-ifdefs/28596 "2022-08-07T08:12:04Z")

</div>

There is a possible bug/problem with Clang.jl. I am an assistant prof working on an implementation of netmap in Julia (fast networks by bypassing the kernel for IO). Here is the example: This works only if I remove an…

---

## [Inverting default \`collect\` behavior when iterator returns an array](https://discourse.julialang.org/t/inverting-default-collect-behavior-when-iterator-returns-an-array/85409)

<div class="topic-metadata">

**Author:** [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Replies:** 3\
**Last updated:** [August 7, 2022, 3:56am UTC](https://discourse.julialang.org/t/inverting-default-collect-behavior-when-iterator-returns-an-array/85409 "2022-08-07T03:56:54Z")

</div>

A MWE: struct MyIter n limit end function Base.iterate(m::MyIter) state = ones(m.n) return (state,state .+ 1) end function Base.iterate(m::MyIter,state) if first(state) \> m.limit return no…

---

## [Grouped Data Frame -- Two different types](https://discourse.julialang.org/t/grouped-data-frame-two-different-types/85404)

<div class="topic-metadata">

**Author:** [@Snowy](https://discourse.julialang.org/u/Snowy)\
**Replies:** 3\
**Last updated:** [August 6, 2022, 8:47pm UTC](https://discourse.julialang.org/t/grouped-data-frame-two-different-types/85404 "2022-08-06T20:47:21Z")

</div>

Hi! I have two different implementations of grouping dataframes, but I’m trying to determine why they are different types. Here is my code: using CSV using DataFrames timeseries = CSV.read("link to data file (see bel…

---

## [Puzzled by (abstract) NTuple conversion](https://discourse.julialang.org/t/puzzled-by-abstract-ntuple-conversion/8286)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 0\
**Last updated:** [January 11, 2018, 10:25am UTC](https://discourse.julialang.org/t/puzzled-by-abstract-ntuple-conversion/8286 "2018-01-11T10:25:50Z")

</div>

Is this expected? julia\> convert(NTuple{2,T} where T\<:AbstractFloat, (1, Float16(2.0))) (1.0, Float16(2.0)) julia\> ans isa NTuple{2,T} where T\<:AbstractFloat false I was under the impression that convert offered a gua…

---

## [Why is there an allocation?](https://discourse.julialang.org/t/why-is-there-an-allocation/85405)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 12\
**Last updated:** [August 6, 2022, 7:00pm UTC](https://discourse.julialang.org/t/why-is-there-an-allocation/85405 "2022-08-06T19:00:30Z")

</div>

module mbas001 elxs = fill(Matrix{Float64}(undef, 3, 3), 7) for \_i in eachindex(elxs) elxs\[\_i\] = rand(3, 3) end ex = fill(zero(Float64), 3, 3) copy2ex!(ex, elxs, j, k) = let elxsc = elxs\[c\] for \_i in axes(ex…

---

## [Slower with threads](https://discourse.julialang.org/t/slower-with-threads/84600)

<div class="topic-metadata">

**Author:** [@marllos](https://discourse.julialang.org/u/marllos)\
**Replies:** 26\
**Last updated:** [August 6, 2022, 5:46pm UTC](https://discourse.julialang.org/t/slower-with-threads/84600 "2022-08-06T17:46:22Z")

</div>

Hello everybody! My actual code takes 16 hours. So I went to learn Parallelism. I started with @task and the execution time went down to 10 hours. Very good! As I have a server with 64 cores, I thought about using @threa…

---

## [Numerical Maximum Entropy... suggested method / Optimization & Integration packages?](https://discourse.julialang.org/t/numerical-maximum-entropy-suggested-method-optimization-integration-packages/85367)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 4\
**Last updated:** [August 6, 2022, 5:26pm UTC](https://discourse.julialang.org/t/numerical-maximum-entropy-suggested-method-optimization-integration-packages/85367 "2022-08-06T17:26:22Z")

</div>

So I’m interested in finding an approximate maximum entropy distribution for a positive quantity with a given mean and a given mean absolute difference between two randomly chosen values (it’s related to the Gini coeffic…

---

## [How to see where a symbol is defined](https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 2\
**Last updated:** [August 6, 2022, 5:03pm UTC](https://discourse.julialang.org/t/how-to-see-where-a-symbol-is-defined/85406 "2022-08-06T17:03:37Z")

</div>

If I have the file function f end f(x) = x f() = 5 I can use methods to find the method definitions on lines 3 and 4, but how can I find the function declaration on line 1?

---

## [One-line if-else statement with short-circuit evaluation](https://discourse.julialang.org/t/one-line-if-else-statement-with-short-circuit-evaluation/85399)

<div class="topic-metadata">

**Author:** [@tapyu](https://discourse.julialang.org/u/tapyu)\
**Replies:** 1\
**Last updated:** [August 6, 2022, 2:28pm UTC](https://discourse.julialang.org/t/one-line-if-else-statement-with-short-circuit-evaluation/85399 "2022-08-06T14:28:34Z")

</div>

In Unix shell scripts, we can do the following ❯ \[\[ -n $HOME \]\] && echo "true statement" || echo "else statement" true statement ❯ \[\[ -n $NOT\_A\_ENV \]\] && echo "true statement" || echo "else statement" else statement Ho…

---

## [What is 0.14\*300?](https://discourse.julialang.org/t/what-is-0-14-300/85397)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 7\
**Last updated:** [August 6, 2022, 2:14pm UTC](https://discourse.julialang.org/t/what-is-0-14-300/85397 "2022-08-06T14:14:10Z")

</div>

julia\> 0.14\*300 42.00000000000001 julia\> Int32(0.14\*300) ERROR: InexactError: Int32(42.00000000000001) Stacktrace: \[1\] Int32(x::Float64) @ Base .\\float.jl:791 \[2\] top-level scope @ REPL\[12\]:1 Or for that matter…

---

## [Julia vs Python almost the same performance but Python with taichi is 100x faster. Why?And can be improved?](https://discourse.julialang.org/t/julia-vs-python-almost-the-same-performance-but-python-with-taichi-is-100x-faster-why-and-can-be-improved/85239)

<div class="topic-metadata">

**Author:** [@ajsagit](https://discourse.julialang.org/u/ajsagit)\
**Replies:** 13\
**Last updated:** [August 6, 2022, 1:07pm UTC](https://discourse.julialang.org/t/julia-vs-python-almost-the-same-performance-but-python-with-taichi-is-100x-faster-why-and-can-be-improved/85239 "2022-08-06T13:07:33Z")

</div>

Dudes,recently I reviewed Python and the Taichi package. As lots of users mentioned, the performance enchanced almost 100x by Taichi. And, when I compare with the counting primes code between Julia and Python, it seems t…

---

## [Doctest, terminal size, and show's limit interact poorly](https://discourse.julialang.org/t/doctest-terminal-size-and-shows-limit-interact-poorly/85372)

<div class="topic-metadata">

**Author:** [@dsweber2](https://discourse.julialang.org/u/dsweber2)\
**Replies:** 2\
**Last updated:** [August 6, 2022, 9:13am UTC](https://discourse.julialang.org/t/doctest-terminal-size-and-shows-limit-interact-poorly/85372 "2022-08-06T09:13:50Z")

</div>

For jldoctests, is there a way to deal with the variation in size caused by show’s limit property? This is causing local doctests to execute fine, but when I push to github, they break. Simple working example: if I gene…

---

## [\[Markdown Pkg\] Issues with parsing of nested list](https://discourse.julialang.org/t/markdown-pkg-issues-with-parsing-of-nested-list/85211)

<div class="topic-metadata">

**Author:** [@o314](https://discourse.julialang.org/u/o314)\
**Replies:** 2\
**Last updated:** [August 3, 2022, 5:12am UTC](https://discourse.julialang.org/t/markdown-pkg-issues-with-parsing-of-nested-list/85211 "2022-08-03T05:12:03Z")

</div>

I need to parse a very simple nested list with julia markdown, but can’t get it correctly. The doc states to insert some newline. It works upto level 2, but it does not seem to work at depth 3 and more. LIST THAT BUGS …

---

## [Bucket sorting in Julia](https://discourse.julialang.org/t/bucket-sorting-in-julia/85275)

<div class="topic-metadata">

**Author:** [@Alejandro\_Quiaro\_San](https://discourse.julialang.org/u/Alejandro_Quiaro_San)\
**Replies:** 9\
**Last updated:** [August 6, 2022, 2:41am UTC](https://discourse.julialang.org/t/bucket-sorting-in-julia/85275 "2022-08-06T02:41:56Z")

</div>

Hello guys, I wrote a bucket sorting algorithm in Julia, which apparently is not available in the built-in modules, or in any other library. I will be using this bucket sorting for ray tracing, and I need the code to be …

---

## [In a set of related packages, where is pre-compilation best done?](https://discourse.julialang.org/t/in-a-set-of-related-packages-where-is-pre-compilation-best-done/85375)

<div class="topic-metadata">

**Author:** [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Replies:** 0\
**Last updated:** [August 6, 2022, 1:49am UTC](https://discourse.julialang.org/t/in-a-set-of-related-packages-where-is-pre-compilation-best-done/85375 "2022-08-06T01:49:02Z")

</div>

I am in the process of abstracting out some core functionality and methods from packages in the JuliaActuary ecosystem into a “Core” package. Is it always good to precompile code where it’s defined? E.g. in the “Core” p…

---

## [How do I customize the derivative of a matrix using Zygote: @adjoint](https://discourse.julialang.org/t/how-do-i-customize-the-derivative-of-a-matrix-using-zygote-adjoint/85176)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 2\
**Last updated:** [August 5, 2022, 10:26pm UTC](https://discourse.julialang.org/t/how-do-i-customize-the-derivative-of-a-matrix-using-zygote-adjoint/85176 "2022-08-05T22:26:58Z")

</div>

Let’s say I have a matrix A, and each of the entries of this matrix A is the function of x. And then we have matrix B, and the entries in matrix B are the derivatives of the entries in matrix A with respect to x. When I …

---

## [Is there a way to create a comprehensive set of conditional combinations](https://discourse.julialang.org/t/is-there-a-way-to-create-a-comprehensive-set-of-conditional-combinations/85368)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 11\
**Last updated:** [August 5, 2022, 9:11pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-create-a-comprehensive-set-of-conditional-combinations/85368 "2022-08-05T21:11:09Z")

</div>

Hi I was just wondering if there was a way to generate a combinatorial collection subject to some condition. For example using the Combinatorics package If I can generate all combinations of some vector collect(combina…

---

## [Run a command in a new terminal window](https://discourse.julialang.org/t/run-a-command-in-a-new-terminal-window/37739)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 19\
**Last updated:** [August 5, 2022, 9:09pm UTC](https://discourse.julialang.org/t/run-a-command-in-a-new-terminal-window/37739 "2022-08-05T21:09:32Z")

</div>

Hi all, I’m trying to run a Command asynchronously and direct the output to a new terminal window. I understand that I can do this: run(pipeline(\`echo hello\`, stdout="out.txt")) which works to re-direct the output to …

---

## [Package installation problem](https://discourse.julialang.org/t/package-installation-problem/85038)

<div class="topic-metadata">

**Author:** [@mwsohn](https://discourse.julialang.org/u/mwsohn)\
**Replies:** 3\
**Last updated:** [August 5, 2022, 7:15pm UTC](https://discourse.julialang.org/t/package-installation-problem/85038 "2022-08-05T19:15:48Z")

</div>

I am using Julia v1.7.3 and am trying to update StaticArrays.jl to 1.5.2. No matter what I do, I have this issue with unsatisfiable requirments. My ultimate goal is to install Survey.jl. I would appreciate any help on th…

---

## [What is the fastest method to shift matrix?](https://discourse.julialang.org/t/what-is-the-fastest-method-to-shift-matrix/85261)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 43\
**Last updated:** [August 5, 2022, 6:20pm UTC](https://discourse.julialang.org/t/what-is-the-fastest-method-to-shift-matrix/85261 "2022-08-05T18:20:23Z")

</div>

I want to shift a sparse matrix (A) one digit to left with adding zeros in the first column at the right. For that I am multiplying the matrix with Rotate. However, when the matrix is big in size and diversity of values,…

---

## [Docker Build w/ Sockets connection refused (ECONNREFUSED)](https://discourse.julialang.org/t/docker-build-w-sockets-connection-refused-econnrefused/85362)

<div class="topic-metadata">

**Author:** [@DrPapa](https://discourse.julialang.org/u/DrPapa)\
**Replies:** 0\
**Last updated:** [August 5, 2022, 5:59pm UTC](https://discourse.julialang.org/t/docker-build-w-sockets-connection-refused-econnrefused/85362 "2022-08-05T17:59:11Z")

</div>

I have been building sysimages with PackageCompiler in docker without issue until recently. I recently add some functions that require Sockets networking. To exercise the function in the PackageCompiler.jl tracing scrip…

---

## [Thinning MCMC posteriors to reduce autocorrelation?](https://discourse.julialang.org/t/thinning-mcmc-posteriors-to-reduce-autocorrelation/85254)

<div class="topic-metadata">

**Author:** [@99dB](https://discourse.julialang.org/u/99dB)\
**Replies:** 12\
**Last updated:** [August 5, 2022, 4:22pm UTC](https://discourse.julialang.org/t/thinning-mcmc-posteriors-to-reduce-autocorrelation/85254 "2022-08-05T16:22:07Z")

</div>

Hi all, I have some autocorrelation issues in my chains and tried different things that didn’t help much. My issue is certainly internal to the model I used, where I have some parameter correlations. I read some piece …

---

## [Select colums by the value of rows](https://discourse.julialang.org/t/select-colums-by-the-value-of-rows/84793)

<div class="topic-metadata">

**Author:** [@chenr86](https://discourse.julialang.org/u/chenr86)\
**Replies:** 4\
**Last updated:** [August 5, 2022, 2:32pm UTC](https://discourse.julialang.org/t/select-colums-by-the-value-of-rows/84793 "2022-08-05T14:32:55Z")

</div>

Hello, I want to select target colums with row values between an interval. For example, with df like below, I want to select colums with row values between \[3, 5\], which means that it should return :x1 :x2 :y1. How can …

---

## [How to define string \`" foo\\n bar\\n "\` in one \`""" ... """\` block?](https://discourse.julialang.org/t/how-to-define-string-foo-n-bar-n-in-one-block/85347)

<div class="topic-metadata">

**Author:** [@hyrodium](https://discourse.julialang.org/u/hyrodium)\
**Replies:** 2\
**Last updated:** [August 5, 2022, 2:02pm UTC](https://discourse.julialang.org/t/how-to-define-string-foo-n-bar-n-in-one-block/85347 "2022-08-05T14:02:41Z")

</div>

I really love the Julia’s syntax for """ with indents (See doc): julia\> function check\_string\_indent() s = """ foo bar """ return s end check\_string\_indent (…

---

## [Precompile a script?](https://discourse.julialang.org/t/precompile-a-script/5364)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 17\
**Last updated:** [August 5, 2022, 11:52am UTC](https://discourse.julialang.org/t/precompile-a-script/5364 "2022-08-05T11:52:29Z")

</div>

Is there a way to precompile a script, so that I can execute it in batch fast?

---

## [Create gif from saved images](https://discourse.julialang.org/t/create-gif-from-saved-images/85146)

<div class="topic-metadata">

**Author:** [@Sergey\_Novak](https://discourse.julialang.org/u/Sergey_Novak)\
**Replies:** 19\
**Last updated:** [August 5, 2022, 9:33am UTC](https://discourse.julialang.org/t/create-gif-from-saved-images/85146 "2022-08-05T09:33:56Z")

</div>

I have 3000 images.They are the result of calculations on Julia. This images is a graphic of probablity density function (PDF), time series and lyapunov spectrum. How can i create gif from images PDF, time series and lya…

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

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