# General Usage

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

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

**Page:** 114

---

## [Wrong rank of this simple matrix](https://discourse.julialang.org/t/wrong-rank-of-this-simple-matrix/122477)

<div class="topic-metadata">

**Author:** [@singularity](https://discourse.julialang.org/u/singularity)\
**Replies:** 2\
**Last updated:** [November 11, 2024, 9:16am UTC](https://discourse.julialang.org/t/wrong-rank-of-this-simple-matrix/122477 "2024-11-11T09:16:11Z")

</div>

Hi. I am using Julia 1.10.4. I am using the LinearAlgebra package to compute rank, nullspace, et cetera for matrices. My code is unexpectedly throwing some errors and it turns out it seems to be calculating matrix rank i…

---

## [Domains whitelist for package manager](https://discourse.julialang.org/t/domains-whitelist-for-package-manager/122478)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 1\
**Last updated:** [November 11, 2024, 2:49am UTC](https://discourse.julialang.org/t/domains-whitelist-for-package-manager/122478 "2024-11-11T02:49:09Z")

</div>

I have to run an app on the cloud with a firewall that has a domain whitelist. In other words: I have to know all the domains necessary for installing packages like Plots.jl or ModelingToolkit.jl. I’m not sure how the pa…

---

## [Question about MPICH (presumably from MPI\_jll)](https://discourse.julialang.org/t/question-about-mpich-presumably-from-mpi-jll/122458)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [November 10, 2024, 4:53pm UTC](https://discourse.julialang.org/t/question-about-mpich-presumably-from-mpi-jll/122458 "2024-11-10T16:53:07Z")

</div>

My running MPI program reports MPICH 4.2.3. ┌ Info: MPICH Version: 4.2.3 │ MPICH Release date: Wed Oct 2 09:35:21 AM CDT 2024 │ MPICH ABI: 16:3:4 │ MPICH Device: ch3:nemesis │ MPICH configure: --…

---

## [Efficiency of Multiple Dispatch](https://discourse.julialang.org/t/efficiency-of-multiple-dispatch/122466)

<div class="topic-metadata">

**Author:** [@hssn15](https://discourse.julialang.org/u/hssn15)\
**Replies:** 3\
**Last updated:** [November 10, 2024, 3:40pm UTC](https://discourse.julialang.org/t/efficiency-of-multiple-dispatch/122466 "2024-11-10T15:40:18Z")

</div>

Hi, I have been curious about the working principle of Multiple Dispatch since I started to Julia. So, I would like to know that, is there some kind of conditional statements in lower level of Multiple Dispatch. For exa…

---

## [Maintainability: Best way to have two versions of the same function with minor differences](https://discourse.julialang.org/t/maintainability-best-way-to-have-two-versions-of-the-same-function-with-minor-differences/122453)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 5\
**Last updated:** [November 10, 2024, 3:36pm UTC](https://discourse.julialang.org/t/maintainability-best-way-to-have-two-versions-of-the-same-function-with-minor-differences/122453 "2024-11-10T15:36:44Z")

</div>

Say I have two usecases for a function. One logs the result of each iteration and is parallelized using Polyester.@batch, the other only needs to return the final result and uses Threads.@threads. Performance is top prio…

---

## [Slicing array on julia 4000ms vs c++ 400ms](https://discourse.julialang.org/t/slicing-array-on-julia-4000ms-vs-c-400ms/122389)

<div class="topic-metadata">

**Author:** [@tradingtsm](https://discourse.julialang.org/u/tradingtsm)\
**Replies:** 24\
**Last updated:** [November 10, 2024, 2:17am UTC](https://discourse.julialang.org/t/slicing-array-on-julia-4000ms-vs-c-400ms/122389 "2024-11-10T02:17:04Z")

</div>

Hi everyone, I’ve trying to compare a function, on slicing an array on cpp vs julia, I get different results as I wrote on the title and I don’t understand why, would appreaciate your help. I’m using custom data for th…

---

## [HDF5 error: MPIExt cannot find libmpi\_usempif08.40.dylib](https://discourse.julialang.org/t/hdf5-error-mpiext-cannot-find-libmpi-usempif08-40-dylib/115900)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 8\
**Last updated:** [November 9, 2024, 8:27pm UTC](https://discourse.julialang.org/t/hdf5-error-mpiext-cannot-find-libmpi-usempif08-40-dylib/115900 "2024-11-09T20:27:26Z")

</div>

Missing /.julia/artifacts/69e85a392db842d919cf5759941f8f3e8a0e569e/lib/libhdf5\_fortran.so" libmpi\_usempif08.so.40: cannot open shared object file: No such file or directory ? Any idea what that is about?

---

## [Is there a way to statically ensure an if-block covers all enum cases?](https://discourse.julialang.org/t/is-there-a-way-to-statically-ensure-an-if-block-covers-all-enum-cases/122426)

<div class="topic-metadata">

**Author:** [@NHDaly](https://discourse.julialang.org/u/NHDaly)\
**Replies:** 8\
**Last updated:** [November 9, 2024, 8:00pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-statically-ensure-an-if-block-covers-all-enum-cases/122426 "2024-11-09T20:00:56Z")

</div>

Consider: @enum Level LOW MEDIUM HIGH function do\_stuff(level::Level, args...) if level == HIGH println("High level") elseif level == MEDIUM println("Medium level") elseif level == LOW …

---

## [Issue with PDEBase or PDEsystems!](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174)

<div class="topic-metadata">

**Author:** [@Naceur\_Bouziani](https://discourse.julialang.org/u/Naceur_Bouziani)\
**Replies:** 13\
**Last updated:** [November 9, 2024, 2:16pm UTC](https://discourse.julialang.org/t/issue-with-pdebase-or-pdesystems/122174 "2024-11-09T14:16:40Z")

</div>

Hello everyone ! I’m trying to solve a 3 coupled and non linear PDE equations as a first work later Iwill see how to use Catalyst to add sources and sinks processes. for now its just the transport of coupled PDE of gase…

---

## [An issue with dispatching imported types](https://discourse.julialang.org/t/an-issue-with-dispatching-imported-types/122004)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 41\
**Last updated:** [November 9, 2024, 1:25pm UTC](https://discourse.julialang.org/t/an-issue-with-dispatching-imported-types/122004 "2024-11-09T13:25:54Z")

</div>

I have a problem with which I am struggling without success. I have two functions, ps1 and ps2, which are essentially the same: function ps1(A::T) where {T \<: PeriodicSymbolicMatrix} return T end function ps2(A::T) w…

---

## [Draw from density in DynamicHMC ecosystem](https://discourse.julialang.org/t/draw-from-density-in-dynamichmc-ecosystem/122398)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 6\
**Last updated:** [November 9, 2024, 10:13am UTC](https://discourse.julialang.org/t/draw-from-density-in-dynamichmc-ecosystem/122398 "2024-11-09T10:13:25Z")

</div>

DynamicHMC.jl (from @Tamas\_Papp) and related packages take a log-density callable and sample parameter values with it. One feature I’ve seen in some other programs (Stan, Turing) is the ability to simulate data given a p…

---

## [PlotlyJS error](https://discourse.julialang.org/t/plotlyjs-error/122104)

<div class="topic-metadata">

**Author:** [@elm9742](https://discourse.julialang.org/u/elm9742)\
**Replies:** 4\
**Last updated:** [November 9, 2024, 3:20am UTC](https://discourse.julialang.org/t/plotlyjs-error/122104 "2024-11-09T03:20:09Z")

</div>

I’m trying to do analysis using a package called scLENS. I followed the guide code as shown on the scLENS GitHub, and when I run Pkg.instantiate(), I get the following error related to the PlotlyJS package. ✗ PlotlyJ…

---

## [Array construction of composite types failed to provide a consistent bound for its corresponding element type](https://discourse.julialang.org/t/array-construction-of-composite-types-failed-to-provide-a-consistent-bound-for-its-corresponding-element-type/122356)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 7\
**Last updated:** [November 9, 2024, 1:37am UTC](https://discourse.julialang.org/t/array-construction-of-composite-types-failed-to-provide-a-consistent-bound-for-its-corresponding-element-type/122356 "2024-11-09T01:37:18Z")

</div>

MWV: julia\> struct myT{T1, T2\<:Tuple{Number, Any}} a::T1 b::T2 end julia\> m1 = myT(1.0, (1, :a)) myT{Float64, Tuple{Int64, Symbol}}(1.0, (1, :a)) julia\> m2 = myT(1.1, (1.1, :b)) myT{Float64, Tuple…

---

## [Inconsistent CondaPkg environments](https://discourse.julialang.org/t/inconsistent-condapkg-environments/118767)

<div class="topic-metadata">

**Author:** [@JordiBolibar](https://discourse.julialang.org/u/JordiBolibar)\
**Replies:** 23\
**Last updated:** [November 8, 2024, 10:29pm UTC](https://discourse.julialang.org/t/inconsistent-condapkg-environments/118767 "2024-11-08T22:29:58Z")

</div>

I’m having some issues with CondaPkg.jl in order to get a conda environment configured and running for one of my packages. I basically have a list of dependencies, which if I add to an environment.yml file and and create…

---

## [LinearAlgebra.mul! for complex vectors very slow on Apple Silicon](https://discourse.julialang.org/t/linearalgebra-mul-for-complex-vectors-very-slow-on-apple-silicon/122404)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 5\
**Last updated:** [November 8, 2024, 4:00pm UTC](https://discourse.julialang.org/t/linearalgebra-mul-for-complex-vectors-very-slow-on-apple-silicon/122404 "2024-11-08T16:00:06Z")

</div>

I usually run my computations on a Linux workstation via SSH from my MacBook. However, the specs of the recent M4 Macbook Pro would seem to promise rather extreme performance. But, just testing out basic matrix-vector m…

---

## [What does it mean to define a function inside a function? Will this result in additional performance overhead?](https://discourse.julialang.org/t/what-does-it-mean-to-define-a-function-inside-a-function-will-this-result-in-additional-performance-overhead/122409)

<div class="topic-metadata">

**Author:** [@Blumenkranz](https://discourse.julialang.org/u/Blumenkranz)\
**Replies:** 6\
**Last updated:** [November 8, 2024, 11:49am UTC](https://discourse.julialang.org/t/what-does-it-mean-to-define-a-function-inside-a-function-will-this-result-in-additional-performance-overhead/122409 "2024-11-08T11:49:04Z")

</div>

function test\_inner(x,y) x+y end function test\_outer(x,y) return test\_inner(x,y) end function test\_outer2(x,y) function test\_inner2(x,y) x+y end test\_inner2(x,y) end x = 1.;y = 2. @btime test\_…

---

## [Is it possible to avoid these excess allocations when using @batch or @threads?](https://discourse.julialang.org/t/is-it-possible-to-avoid-these-excess-allocations-when-using-batch-or-threads/122208)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 4\
**Last updated:** [November 8, 2024, 10:37am UTC](https://discourse.julialang.org/t/is-it-possible-to-avoid-these-excess-allocations-when-using-batch-or-threads/122208 "2024-11-08T10:37:37Z")

</div>

It took some effort to come up with a short MWE for this issue. The goal is to avoid a few small allocations when mutating (an argument of an inner function) in parallel: MWEusing BenchmarkTools, Parameters, Polyester, …

---

## [Copy image from VSCODE](https://discourse.julialang.org/t/copy-image-from-vscode/64204)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 9\
**Last updated:** [November 8, 2024, 9:24am UTC](https://discourse.julialang.org/t/copy-image-from-vscode/64204 "2024-11-08T09:24:46Z")

</div>

What is the correct way to copy an image from the edit area, in VSCode? When using the copy command (right click on the image) the image is not copied, to be able to copy it in Word, Paint, …, etc.

---

## [How to know when objects are stack or heap allocated](https://discourse.julialang.org/t/how-to-know-when-objects-are-stack-or-heap-allocated/103056)

<div class="topic-metadata">

**Author:** [@opiateblush](https://discourse.julialang.org/u/opiateblush)\
**Replies:** 7\
**Last updated:** [November 8, 2024, 1:12am UTC](https://discourse.julialang.org/t/how-to-know-when-objects-are-stack-or-heap-allocated/103056 "2024-11-08T01:12:20Z")

</div>

I’m currently writing some performance critical code and got a bit confused about stack and heap allocation in Julia. I thought that immutables are usually stack allocated but apparently that is not the case. I’ve made a…

---

## [Using OrdinaryDiffEQ Integrator interface for split step](https://discourse.julialang.org/t/using-ordinarydiffeq-integrator-interface-for-split-step/122313)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 12\
**Last updated:** [November 7, 2024, 11:06pm UTC](https://discourse.julialang.org/t/using-ordinarydiffeq-integrator-interface-for-split-step/122313 "2024-11-07T23:06:20Z")

</div>

hi all, Looking to see if someone can help me out. Currently working with Trixi.jl and it’s great. However, because it’s fairly new, there are some things that have not been implemented. For example, handling nonlinear…

---

## [Need help using ForwardDiff gradient with numerical loop](https://discourse.julialang.org/t/need-help-using-forwarddiff-gradient-with-numerical-loop/122352)

<div class="topic-metadata">

**Author:** [@dameka](https://discourse.julialang.org/u/dameka)\
**Replies:** 11\
**Last updated:** [November 7, 2024, 10:55pm UTC](https://discourse.julialang.org/t/need-help-using-forwarddiff-gradient-with-numerical-loop/122352 "2024-11-07T22:55:28Z")

</div>

I’m testing ways to get the gradient of a function which at its core is a numerical loop. I’m trying to use ForwardDiff currently to see if it’s any faster than Zygote reverse diff. I can’t get ForwardDiff to perform AD …

---

## [GLMakie saving Axis](https://discourse.julialang.org/t/glmakie-saving-axis/122358)

<div class="topic-metadata">

**Author:** [@sransome](https://discourse.julialang.org/u/sransome)\
**Replies:** 9\
**Last updated:** [November 7, 2024, 9:56pm UTC](https://discourse.julialang.org/t/glmakie-saving-axis/122358 "2024-11-07T21:56:09Z")

</div>

I have a complex figure with several Axis and I want to save an image of just one Axis. One of the Axis is named SpreadGrid\_ax and I have tried… FileIO.save("SpreadGrid\_ax.png", SpreadGrid\_ax.scene; size = size(SpreadG…

---

## [Best practice code generation](https://discourse.julialang.org/t/best-practice-code-generation/122384)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 12\
**Last updated:** [November 7, 2024, 8:16pm UTC](https://discourse.julialang.org/t/best-practice-code-generation/122384 "2024-11-07T20:16:21Z")

</div>

I want to auto-generate some structs and functions of my package KiteUtils.jl. As input I have a .yaml file. I have a file build.jl that creates a few files that are then included in the package. How can I achieve that …

---

## [Creating the instance of a function type](https://discourse.julialang.org/t/creating-the-instance-of-a-function-type/122355)

<div class="topic-metadata">

**Author:** [@brainandforce](https://discourse.julialang.org/u/brainandforce)\
**Replies:** 13\
**Last updated:** [November 7, 2024, 3:53pm UTC](https://discourse.julialang.org/t/creating-the-instance-of-a-function-type/122355 "2024-11-07T15:53:41Z")

</div>

The type of a standard Julia function f is typeof(f), which is a singleton. julia\> function f end f (generic function with 0 methods) julia\> typeof(f) typeof(f) (singleton type of function f, subtype of Function) But …

---

## [Spooky allocations - linked to Varargs?](https://discourse.julialang.org/t/spooky-allocations-linked-to-varargs/122373)

<div class="topic-metadata">

**Author:** [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Replies:** 8\
**Last updated:** [November 7, 2024, 4:31pm UTC](https://discourse.julialang.org/t/spooky-allocations-linked-to-varargs/122373 "2024-11-07T16:31:24Z")

</div>

Hi folks, today I found a strange behavior that eludes my understanding. Would someone please tell me where the allocations are coming from in this example? I am probably overlooking something but I have been staring at…

---

## [Better way to have "filled" ranges?](https://discourse.julialang.org/t/better-way-to-have-filled-ranges/122383)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [November 7, 2024, 4:11pm UTC](https://discourse.julialang.org/t/better-way-to-have-filled-ranges/122383 "2024-11-07T16:11:26Z")

</div>

Is there a better (more elegant) way of the one below in order to obtain a vector representing ranges filled with the first element of the range ? years = collect(2000:2019) step = 5 desired\_res = \[2000,2000,2000,2000,…

---

## [I want to read files with mingw64 in pluto notebooks](https://discourse.julialang.org/t/i-want-to-read-files-with-mingw64-in-pluto-notebooks/122343)

<div class="topic-metadata">

**Author:** [@selinguler94](https://discourse.julialang.org/u/selinguler94)\
**Replies:** 2\
**Last updated:** [November 7, 2024, 3:46pm UTC](https://discourse.julialang.org/t/i-want-to-read-files-with-mingw64-in-pluto-notebooks/122343 "2024-11-07T15:46:45Z")

</div>

output = read(mingw64 $FORTRANexe, String) I tried this but it doesn’t work. I am a windows user and I am trying to execute some fortran files in pluto, so I need mingw64. I failed to do it with wsl too, I’m starting to…

---

## [Random numbers, with MersenneTwister, not stable across major releases](https://discourse.julialang.org/t/random-numbers-with-mersennetwister-not-stable-across-major-releases/122284)

<div class="topic-metadata">

**Author:** [@leolo](https://discourse.julialang.org/u/leolo)\
**Replies:** 8\
**Last updated:** [November 7, 2024, 3:24pm UTC](https://discourse.julialang.org/t/random-numbers-with-mersennetwister-not-stable-across-major-releases/122284 "2024-11-07T15:24:13Z")

</div>

Hi, after updating to Julia 1.11, I have an issue with a random number sequence that changed. using Random rng = Random.MersenneTwister(42) v = rng.rand(10) println(v) This gives different results under 1.10.2 and 1.11…

---

## [Is there a way to get a UnionAll base type from a concrete type?](https://discourse.julialang.org/t/is-there-a-way-to-get-a-unionall-base-type-from-a-concrete-type/122328)

<div class="topic-metadata">

**Author:** [@HanD](https://discourse.julialang.org/u/HanD)\
**Replies:** 15\
**Last updated:** [November 7, 2024, 2:02pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-get-a-unionall-base-type-from-a-concrete-type/122328 "2024-11-07T14:02:19Z")

</div>

I ran into a minor obstacle where I needed the UnionAll base type of a value, but I couldn’t figure out how to do it (without explicit isa checks). I.e., julia\> p = :a =\> 1 :a =\> 1 julia\> typeof(p) Pair{Symbol, Int64} …

---

## [Implementation of Periodic Boundary Conditions](https://discourse.julialang.org/t/implementation-of-periodic-boundary-conditions/122318)

<div class="topic-metadata">

**Author:** [@priyanshuFSI](https://discourse.julialang.org/u/priyanshuFSI)\
**Replies:** 10\
**Last updated:** [November 7, 2024, 1:51pm UTC](https://discourse.julialang.org/t/implementation-of-periodic-boundary-conditions/122318 "2024-11-07T13:51:39Z")

</div>

Hi, I am writing my Finite Element Solver for CFD simulations. I encounter a what should be like an easy problem but I cant figure out how to do it. In my code, I want to account for periodic boundary conditions. For th…

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

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