# General Usage

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

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

**Page:** 207

---

## [Cthulhu.jl showing unstable return type](https://discourse.julialang.org/t/cthulhu-jl-showing-unstable-return-type/109385)

<div class="topic-metadata">

**Author:** [@Gokhan\_Kof](https://discourse.julialang.org/u/Gokhan_Kof)\
**Replies:** 5\
**Last updated:** [January 29, 2024, 2:59pm UTC](https://discourse.julialang.org/t/cthulhu-jl-showing-unstable-return-type/109385 "2024-01-29T14:59:00Z")

</div>

Hi, I am trying to eliminate type unstable parts of my code and Cthulhu.jl is showing the return type of a dictionary access as red: x = my\_dict\[first(my\_set)\] x is detected as as Array{Float64} but shown in red. I su…

---

## [Distributed Arrays: Using multiprocessing increaes memory allocations by factor of 200 and slows down](https://discourse.julialang.org/t/distributed-arrays-using-multiprocessing-increaes-memory-allocations-by-factor-of-200-and-slows-down/109402)

<div class="topic-metadata">

**Author:** [@james](https://discourse.julialang.org/u/james)\
**Replies:** 0\
**Last updated:** [January 29, 2024, 2:45pm UTC](https://discourse.julialang.org/t/distributed-arrays-using-multiprocessing-increaes-memory-allocations-by-factor-of-200-and-slows-down/109402 "2024-01-29T14:45:49Z")

</div>

I have 4 processes, each working on a separate part of an array in parallel. Following a previous thread, I use the DistributedArrays package so that every process gets their own part of the array. In the MWE below, I r…

---

## [Stopping pmap when one of the node hit an error](https://discourse.julialang.org/t/stopping-pmap-when-one-of-the-node-hit-an-error/109389)

<div class="topic-metadata">

**Author:** [@muuusso](https://discourse.julialang.org/u/muuusso)\
**Replies:** 0\
**Last updated:** [January 29, 2024, 11:05am UTC](https://discourse.julialang.org/t/stopping-pmap-when-one-of-the-node-hit-an-error/109389 "2024-01-29T11:05:36Z")

</div>

I’m using pmap on my cluster university to distribute computation between different nodes. I’d like to be able to stop all the workers when one of them fails/throw an error. I’ve been looking for a while and I couldn’t f…

---

## [LoopVectorization: no method matching shufflevector](https://discourse.julialang.org/t/loopvectorization-no-method-matching-shufflevector/109369)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 2\
**Last updated:** [January 29, 2024, 10:13am UTC](https://discourse.julialang.org/t/loopvectorization-no-method-matching-shufflevector/109369 "2024-01-29T10:13:07Z")

</div>

Am I doing something wrong? julia\> vmapreduce(==(3), max, \[1,2,3\]) true julia\> vmapreduce(==(3), max, \[1,2,3,4\]) ERROR: MethodError: no method matching shufflevector(::VectorizationBase.Mask{4, UInt8}, ::Val{(2, 3)}) …

---

## [How to Sensibly Implement Generic Slice Indexing for Custom Array Type](https://discourse.julialang.org/t/how-to-sensibly-implement-generic-slice-indexing-for-custom-array-type/109289)

<div class="topic-metadata">

**Author:** [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)\
**Replies:** 3\
**Last updated:** [January 29, 2024, 8:38am UTC](https://discourse.julialang.org/t/how-to-sensibly-implement-generic-slice-indexing-for-custom-array-type/109289 "2024-01-29T08:38:01Z")

</div>

I have a custom array type that I want to implement custom Base.getindex for: struct MyReadOnlyArray{T, N} \<: AbstractArray{T, N} ... size::NTuple{N, Int} end Not it needs to be n-dimensional. For single entrie…

---

## [Multiple dispatch, but for structs?](https://discourse.julialang.org/t/multiple-dispatch-but-for-structs/109221)

<div class="topic-metadata">

**Author:** [@mkoculak](https://discourse.julialang.org/u/mkoculak)\
**Replies:** 6\
**Last updated:** [January 29, 2024, 12:29am UTC](https://discourse.julialang.org/t/multiple-dispatch-but-for-structs/109221 "2024-01-29T00:29:55Z")

</div>

I was thinking about having an option to specify a “fallback” usage for structs, something that seems to me like a reversed multiple dispatch? Let’s say I have a struct: struct Foo x::String y::Array end And I…

---

## [Which getindex expression threw BoundsError](https://discourse.julialang.org/t/which-getindex-expression-threw-boundserror/109329)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 4\
**Last updated:** [January 28, 2024, 6:27pm UTC](https://discourse.julialang.org/t/which-getindex-expression-threw-boundserror/109329 "2024-01-28T18:27:46Z")

</div>

I often make this kind of mistake. Would it be possible for the error to figure out which subexpression has the problem, to save me time debugging? julia\> let n = 2, m = 3 xs = randn(n) ys = randn(…

---

## [Can the location of the .julia directory be changed (on windows)?](https://discourse.julialang.org/t/can-the-location-of-the-julia-directory-be-changed-on-windows/109354)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 11\
**Last updated:** [January 28, 2024, 2:49pm UTC](https://discourse.julialang.org/t/can-the-location-of-the-julia-directory-be-changed-on-windows/109354 "2024-01-28T14:49:40Z")

</div>

I have a huge size of .julia directory (~10G) at the default location (C:\\Users\\xxx) but my space on C: is tight, so can I move the .julia directory to D:? Thanks.

---

## [Creating Circular Referencing Structs](https://discourse.julialang.org/t/creating-circular-referencing-structs/107933)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 3\
**Last updated:** [December 22, 2023, 12:24am UTC](https://discourse.julialang.org/t/creating-circular-referencing-structs/107933 "2023-12-22T00:24:48Z")

</div>

This works abstract type Abstract\_B end mutable struct A obj::Abstract\_B function A() x = new() x.obj = B(x) end end struct B\<:Abstract\_B obj::A end Can it be done without t…

---

## [Parsimonious way to unpack big structs](https://discourse.julialang.org/t/parsimonious-way-to-unpack-big-structs/66522)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 18\
**Last updated:** [January 28, 2024, 11:44am UTC](https://discourse.julialang.org/t/parsimonious-way-to-unpack-big-structs/66522 "2024-01-28T11:44:07Z")

</div>

I often work with large structs w/ many (over 20) parameters. I currently do something like: struct m; α; β; γ; end # store parameters in a struct m(; α=0.1,β=0.2,γ=0.3) = m(α,β,γ) # fcn that returns struct w/ default…

---

## [\`eval\` scope problem and \`println\` problem for multithreading](https://discourse.julialang.org/t/eval-scope-problem-and-println-problem-for-multithreading/109333)

<div class="topic-metadata">

**Author:** [@ccestbon](https://discourse.julialang.org/u/ccestbon)\
**Replies:** 13\
**Last updated:** [January 28, 2024, 9:17am UTC](https://discourse.julialang.org/t/eval-scope-problem-and-println-problem-for-multithreading/109333 "2024-01-28T09:17:55Z")

</div>

Update 1: Thanks for all the suggesions. I have modifed the code as follows: using Sockets # server server = listen(2000) errormonitor( @async begin sock = accept(server) ex = quote my() = println("aa") end …

---

## [How to actively develop a package I am working on?](https://discourse.julialang.org/t/how-to-actively-develop-a-package-i-am-working-on/109331)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [January 28, 2024, 8:55am UTC](https://discourse.julialang.org/t/how-to-actively-develop-a-package-i-am-working-on/109331 "2024-01-28T08:55:18Z")

</div>

Hello! I have a package I am working on and currently my workflow is a bit of a hassle. I want to develop my package a bit more interactively, but currently my workflow is: Do changes Commit changes to Github and push …

---

## [Computing binomial(n,k) without overflow](https://discourse.julialang.org/t/computing-binomial-n-k-without-overflow/109349)

<div class="topic-metadata">

**Author:** [@mike.ingold](https://discourse.julialang.org/u/mike.ingold)\
**Replies:** 14\
**Last updated:** [January 28, 2024, 3:52am UTC](https://discourse.julialang.org/t/computing-binomial-n-k-without-overflow/109349 "2024-01-28T03:52:11Z")

</div>

The function binomial(n,k) throws an OverflowError if the standard ::Int64 arguments are large enough that the result overflows an ::Int64. This can be modified to binomial(big(b),k) to promote the output to BigInt, e.g.…

---

## [Macro CheatSheet for Julia 2024.01](https://discourse.julialang.org/t/macro-cheatsheet-for-julia-2024-01/109291)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 2\
**Last updated:** [January 27, 2024, 8:51pm UTC](https://discourse.julialang.org/t/macro-cheatsheet-for-julia-2024-01/109291 "2024-01-27T20:51:56Z")

</div>

Hey Julianners, I created a not so hard to read and hopefully clean Julia Cheat Sheet for macros. This is I think a very good way to fill the gaps on the harder parts. JuliaMacroCheatSheet It is worth to check it her…

---

## [Matrix storage](https://discourse.julialang.org/t/matrix-storage/109343)

<div class="topic-metadata">

**Author:** [@Enlil50](https://discourse.julialang.org/u/Enlil50)\
**Replies:** 11\
**Last updated:** [January 27, 2024, 6:59pm UTC](https://discourse.julialang.org/t/matrix-storage/109343 "2024-01-27T18:59:18Z")

</div>

How are matrices stored? Let us make an example: I initialize a 10\*10 int32 matrix. I first fill the 5\*5 left-top block. I then extend the matrix to be a 10\*10, adding the new elements with the correct \[ , \] syntax. …

---

## [Cannot instantiate env in Julia 1.10: adwaita\_icon\_theme\_jll git tree hash error - anyone else?](https://discourse.julialang.org/t/cannot-instantiate-env-in-julia-1-10-adwaita-icon-theme-jll-git-tree-hash-error-anyone-else/108105)

<div class="topic-metadata">

**Author:** [@harvestdeparture729](https://discourse.julialang.org/u/harvestdeparture729)\
**Replies:** 11\
**Last updated:** [January 27, 2024, 6:58pm UTC](https://discourse.julialang.org/t/cannot-instantiate-env-in-julia-1-10-adwaita-icon-theme-jll-git-tree-hash-error-anyone-else/108105 "2024-01-27T18:58:02Z")

</div>

Hello all, long-time lurker, first time caller, etc. etc. When excitedly trying to instantiate an environment w/ shiny new Julia 1.10 today (Windows), I encountered an odd error, which I’ve submitted/summarized here: Ca…

---

## [Remove bounds checking for the entire program](https://discourse.julialang.org/t/remove-bounds-checking-for-the-entire-program/109339)

<div class="topic-metadata">

**Author:** [@Enlil50](https://discourse.julialang.org/u/Enlil50)\
**Replies:** 8\
**Last updated:** [January 27, 2024, 6:38pm UTC](https://discourse.julialang.org/t/remove-bounds-checking-for-the-entire-program/109339 "2024-01-27T18:38:53Z")

</div>

I don’t need bound checking. Instead of writing @inbounds everywhere, can I test my program without it and then, when it all works, enable a flag which disables all the bound checking and other automatic behaviours typi…

---

## [Removing undesirable allocations in some functions](https://discourse.julialang.org/t/removing-undesirable-allocations-in-some-functions/109337)

<div class="topic-metadata">

**Author:** [@aris](https://discourse.julialang.org/u/aris)\
**Replies:** 15\
**Last updated:** [January 27, 2024, 6:15pm UTC](https://discourse.julialang.org/t/removing-undesirable-allocations-in-some-functions/109337 "2024-01-27T18:15:41Z")

</div>

Greetings everyone, Here I would like to use a specific example from a code of mine, to help me (and hopefully others) better understand how allocations work. I’ve got a code which imports data (xyz coordinates of hydr…

---

## [A most harrowing collection of Julia WATs](https://discourse.julialang.org/t/a-most-harrowing-collection-of-julia-wats/77323)

<div class="topic-metadata">

**Author:** [@miguelraz](https://discourse.julialang.org/u/miguelraz)\
**Replies:** 106\
**Last updated:** [January 27, 2024, 4:05pm UTC](https://discourse.julialang.org/t/a-most-harrowing-collection-of-julia-wats/77323 "2024-01-27T16:05:08Z")

</div>

Hello all! :wave: I’ve been collecting a few of the most cursed corner cases of Julia WATs that I know of here (WIP), but I would appreciate if people could share their own rare specimens as well. Please ping me with y…

---

## [Compiler doesn't know the type of real.(vec) in compile time](https://discourse.julialang.org/t/compiler-doesnt-know-the-type-of-real-vec-in-compile-time/109336)

<div class="topic-metadata">

**Author:** [@Shayan](https://discourse.julialang.org/u/Shayan)\
**Replies:** 6\
**Last updated:** [January 27, 2024, 2:03pm UTC](https://discourse.julialang.org/t/compiler-doesnt-know-the-type-of-real-vec-in-compile-time/109336 "2024-01-27T14:03:04Z")

</div>

How to make the cc function type stable? function cc( model::Type{\<:CepstralCoeffModel}, tseries::AbstractVector, p::Integer, n::Integer; normalize::Bool=false ) series = tseries normalize && begin ser…

---

## [How does one programmatically examine the contents of a function?](https://discourse.julialang.org/t/how-does-one-programmatically-examine-the-contents-of-a-function/109320)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 1\
**Last updated:** [January 27, 2024, 4:09am UTC](https://discourse.julialang.org/t/how-does-one-programmatically-examine-the-contents-of-a-function/109320 "2024-01-27T04:09:41Z")

</div>

I would like to examine a user defined function to create a variable example function function foo(var) out = var.a.a1 .+ var.b.c3 return out end in this case I would like to examine the code to identify that var …

---

## [Integration of ~1/r and ~1/r^2 functions](https://discourse.julialang.org/t/integration-of-1-r-and-1-r-2-functions/109200)

<div class="topic-metadata">

**Author:** [@svretina](https://discourse.julialang.org/u/svretina)\
**Replies:** 7\
**Last updated:** [January 25, 2024, 12:49pm UTC](https://discourse.julialang.org/t/integration-of-1-r-and-1-r-2-functions/109200 "2024-01-25T12:49:12Z")

</div>

I would like to integrate some rational functions I have which scale as 1/r and 1/r^2 respectively. Gaussian quadratures are exact for polynomial functions. Do you know any julia implementation of a rational quadrature? …

---

## [4D Meshing in julia](https://discourse.julialang.org/t/4d-meshing-in-julia/109239)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 4\
**Last updated:** [January 26, 2024, 10:58pm UTC](https://discourse.julialang.org/t/4d-meshing-in-julia/109239 "2024-01-26T22:58:31Z")

</div>

Hi there, Is there a julia package with the ability to generate 4d meshes (the 4th dimension being time). There are no strict requirements for the quality of the mesh (the elements do not have to be convex). Thank you…

---

## [My Package cannot be installed using Pkg.add](https://discourse.julialang.org/t/my-package-cannot-be-installed-using-pkg-add/109294)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [January 26, 2024, 9:53pm UTC](https://discourse.julialang.org/t/my-package-cannot-be-installed-using-pkg-add/109294 "2024-01-26T21:53:12Z")

</div>

Hello! I think the issue is to due with my specific package and not any bug in Pkg. The package is: GitHub - AhmedSalih3d/SPHExample: Simple SPH dam-break simulation in Julia When I do Pkg.add(url="https://github.com/…

---

## [How to run ptx code on CUDA from julia?](https://discourse.julialang.org/t/how-to-run-ptx-code-on-cuda-from-julia/109306)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 11\
**Last updated:** [January 26, 2024, 8:42pm UTC](https://discourse.julialang.org/t/how-to-run-ptx-code-on-cuda-from-julia/109306 "2024-01-26T20:42:17Z")

</div>

Hi I am trying to create a NN library that directly output a very optimized version of ptx code, also would be open to output even lower level code if possible. But of course I see I have to go step by step as it is get…

---

## [Krylov based lanczos etc for sparse matrices](https://discourse.julialang.org/t/krylov-based-lanczos-etc-for-sparse-matrices/109310)

<div class="topic-metadata">

**Author:** [@Enlil50](https://discourse.julialang.org/u/Enlil50)\
**Replies:** 2\
**Last updated:** [January 26, 2024, 8:31pm UTC](https://discourse.julialang.org/t/krylov-based-lanczos-etc-for-sparse-matrices/109310 "2024-01-26T20:31:34Z")

</div>

I found Home · KrylovKit.jl and it points to KrylovMethods.jl/README.md at master · JuliaInv/KrylovMethods.jl · GitHub for sparse matrices. However I don’t find any documentation. How can i use it? Does it support comp…

---

## [What is Julia used for?](https://discourse.julialang.org/t/what-is-julia-used-for/109199)

<div class="topic-metadata">

**Author:** [@Rajaram\_Venkataraman](https://discourse.julialang.org/u/Rajaram_Venkataraman)\
**Replies:** 15\
**Last updated:** [January 26, 2024, 7:29pm UTC](https://discourse.julialang.org/t/what-is-julia-used-for/109199 "2024-01-26T19:29:56Z")

</div>

For classic ML and DNN, scikitlearn, tensorflow and pytorch are popular - will be so in the foreseeablefuture. For genetic algorithms, GNNs and LLMs also, Python - C/C++ ecosyem is at the forefront. I would like to under…

---

## [How to preview a Luxor drawing](https://discourse.julialang.org/t/how-to-preview-a-luxor-drawing/109298)

<div class="topic-metadata">

**Author:** [@aleppersico](https://discourse.julialang.org/u/aleppersico)\
**Replies:** 8\
**Last updated:** [January 26, 2024, 5:15pm UTC](https://discourse.julialang.org/t/how-to-preview-a-luxor-drawing/109298 "2024-01-26T17:15:27Z")

</div>

Hello all, I am using Julia to run simulations on a given system and in my post-processing module I plot and save the results. Also, I have implemented a Luxor drawing function named drawSystem() that shows my data in a…

---

## [Parallelization seems to increase the necessary amount of allocations for single threads](https://discourse.julialang.org/t/parallelization-seems-to-increase-the-necessary-amount-of-allocations-for-single-threads/109259)

<div class="topic-metadata">

**Author:** [@jabru](https://discourse.julialang.org/u/jabru)\
**Replies:** 8\
**Last updated:** [January 26, 2024, 3:10pm UTC](https://discourse.julialang.org/t/parallelization-seems-to-increase-the-necessary-amount-of-allocations-for-single-threads/109259 "2024-01-26T15:10:00Z")

</div>

Hi there, so I am currently working on a small piece of code that is meant to demonstrate the usefulness of parallelization. Therefore I wrote a small Euler like differential equation solver that solves the Euler equatio…

---

## [Fit a dynamical system to a 2 variables time series](https://discourse.julialang.org/t/fit-a-dynamical-system-to-a-2-variables-time-series/109003)

<div class="topic-metadata">

**Author:** [@ManuelFossa](https://discourse.julialang.org/u/ManuelFossa)\
**Replies:** 4\
**Last updated:** [January 26, 2024, 2:57pm UTC](https://discourse.julialang.org/t/fit-a-dynamical-system-to-a-2-variables-time-series/109003 "2024-01-26T14:57:16Z")

</div>

Hello, I have data that consists of an N=1000 observations \* 3 columns matrix. the first two columns are 2 variables that condition the third one. I used DynamicalSystems.jl to estimate the phase space portrait via de…

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

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