# General Usage

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

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

**Page:** 120

---

## [Shortest Path from contour plot?](https://discourse.julialang.org/t/shortest-path-from-contour-plot/121719)

<div class="topic-metadata">

**Author:** [@sophibug](https://discourse.julialang.org/u/sophibug)\
**Replies:** 3\
**Last updated:** [October 24, 2024, 9:33pm UTC](https://discourse.julialang.org/t/shortest-path-from-contour-plot/121719 "2024-10-24T21:33:21Z")

</div>

Putting this in general usage, because I’m applying it to chemistry, but shortest path is a frequent problem. I have a 2D potential energy surface of a molecule as two of its axes rotate, formatted for a contour plot. I…

---

## [Replicating scipy.ndimate.gaussian\_filter keyword "order" to filter image with derivatives of Gaussian](https://discourse.julialang.org/t/replicating-scipy-ndimate-gaussian-filter-keyword-order-to-filter-image-with-derivatives-of-gaussian/121715)

<div class="topic-metadata">

**Author:** [@fsyhantis](https://discourse.julialang.org/u/fsyhantis)\
**Replies:** 0\
**Last updated:** [October 24, 2024, 6:22pm UTC](https://discourse.julialang.org/t/replicating-scipy-ndimate-gaussian-filter-keyword-order-to-filter-image-with-derivatives-of-gaussian/121715 "2024-10-24T18:22:29Z")

</div>

I am trying to convert a Python script to Julia, using the package Images. To compute the Gaussian filtered gradient of images, the python scipy use scipy.ndimage.gaussian\_filter(img, σ, order=(1,0)) and scipy.ndimage.ga…

---

## [@profile slows down MPI?](https://discourse.julialang.org/t/profile-slows-down-mpi/121700)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 0\
**Last updated:** [October 24, 2024, 2:10pm UTC](https://discourse.julialang.org/t/profile-slows-down-mpi/121700 "2024-10-24T14:10:33Z")

</div>

Is anybody else having problems when trying to @profile an MPI program? I seem to find that when I add @profile my code slows down a lot, with a load of time being spent in MPI calls (a lot more than I would expect). I t…

---

## [CUDA Error : ArgumentError: Objects are on devices with different types: CPUDevice and CUDADevice](https://discourse.julialang.org/t/cuda-error-argumenterror-objects-are-on-devices-with-different-types-cpudevice-and-cudadevice/121651)

<div class="topic-metadata">

**Author:** [@agme2014](https://discourse.julialang.org/u/agme2014)\
**Replies:** 4\
**Last updated:** [October 23, 2024, 6:11pm UTC](https://discourse.julialang.org/t/cuda-error-argumenterror-objects-are-on-devices-with-different-types-cpudevice-and-cudadevice/121651 "2024-10-23T18:11:49Z")

</div>

Hi, I am trying to use CUDA to speed up my code. I am running into an error at the last step, where optimization is used for the iterations This is the message I am getting : ERROR: ArgumentError: Objects are on device…

---

## [Type inference difference in \`mapreduce(f, op, t)\` vs \`reduce(op, map(f, t))\`](https://discourse.julialang.org/t/type-inference-difference-in-mapreduce-f-op-t-vs-reduce-op-map-f-t/93265)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [October 24, 2024, 8:42am UTC](https://discourse.julialang.org/t/type-inference-difference-in-mapreduce-f-op-t-vs-reduce-op-map-f-t/93265 "2024-10-24T08:42:21Z")

</div>

For tuples, it seems mapreduce has poorer type inference than map + reduce. julia\> using FillArrays, Infinities, InfiniteArrays, Test julia\> ax = Ones{Int}(InfiniteCardinal{0}()); julia\> y = (ax,ax); julia\> @inferred…

---

## [What is the Proper Way To Do Interactive Inline Plots? (Workaround Found)](https://discourse.julialang.org/t/what-is-the-proper-way-to-do-interactive-inline-plots-workaround-found/121679)

<div class="topic-metadata">

**Author:** [@tillfalko](https://discourse.julialang.org/u/tillfalko)\
**Replies:** 0\
**Last updated:** [October 24, 2024, 7:00am UTC](https://discourse.julialang.org/t/what-is-the-proper-way-to-do-interactive-inline-plots-workaround-found/121679 "2024-10-24T07:00:25Z")

</div>

What I’m looking for I’m looking for a non-janky way to create interactive inline plots in a VSCode Notebook using either Plots.jl or any Makie version. Workaround I have found a way to do it in Plots.jl, but it’s clear…

---

## [Who should own a package extension? Does it matter?](https://discourse.julialang.org/t/who-should-own-a-package-extension-does-it-matter/121668)

<div class="topic-metadata">

**Author:** [@brainandforce](https://discourse.julialang.org/u/brainandforce)\
**Replies:** 5\
**Last updated:** [October 24, 2024, 5:57am UTC](https://discourse.julialang.org/t/who-should-own-a-package-extension-does-it-matter/121668 "2024-10-24T05:57:00Z")

</div>

I want to ensure that my package, CliffordNumbers.jl, interoperates with Unitful.jl, and that parametric types dependent on both packages (like Quantity{\<:AbstractCliffordNumber}) have operations defined on them consiste…

---

## [Performance comparison of a custom gcd() function in Julia, C, and Rust](https://discourse.julialang.org/t/performance-comparison-of-a-custom-gcd-function-in-julia-c-and-rust/121665)

<div class="topic-metadata">

**Author:** [@jbytecode](https://discourse.julialang.org/u/jbytecode)\
**Replies:** 7\
**Last updated:** [October 23, 2024, 10:58pm UTC](https://discourse.julialang.org/t/performance-comparison-of-a-custom-gcd-function-in-julia-c-and-rust/121665 "2024-10-23T22:58:53Z")

</div>

Here is the naive implementation of the gcd (Greatest Common Divisor) in Julia: function mygcd(a::Int64, b::Int64)::Int64 if a == b return a elseif a \> b return mygcd(a-b, b) else return m…

---

## [Tuple{Vararg{T, N}} where N \>= 1](https://discourse.julialang.org/t/tuple-vararg-t-n-where-n-1/121644)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 9\
**Last updated:** [October 23, 2024, 7:35pm UTC](https://discourse.julialang.org/t/tuple-vararg-t-n-where-n-1/121644 "2024-10-23T19:35:39Z")

</div>

It can be extremely convenient to dispatch on the types of arguments in a tuple, creating an alias for tuples of a type. However, a zero-length tuple will match a Vararg Tuple of any type, which can create issues with d…

---

## [Cassette performance overhead](https://discourse.julialang.org/t/cassette-performance-overhead/121659)

<div class="topic-metadata">

**Author:** [@jgarvin](https://discourse.julialang.org/u/jgarvin)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 5:44pm UTC](https://discourse.julialang.org/t/cassette-performance-overhead/121659 "2024-10-23T17:44:04Z")

</div>

I’ve been getting frustrated by some of the limitations around metaprogramming in Python and recently heard about Cassette. One thing that’s confusing to me without having a strong understanding of Julia yet is why Casse…

---

## [Creating Parameters.jl struct samples using variable keywords](https://discourse.julialang.org/t/creating-parameters-jl-struct-samples-using-variable-keywords/121639)

<div class="topic-metadata">

**Author:** [@JPool](https://discourse.julialang.org/u/JPool)\
**Replies:** 4\
**Last updated:** [October 23, 2024, 5:06pm UTC](https://discourse.julialang.org/t/creating-parameters-jl-struct-samples-using-variable-keywords/121639 "2024-10-23T17:06:13Z")

</div>

Hi, I’m trying to make a function that takes in a default struct which holds parameters for my model. I want to be able to make a sample list where some properties are kept constant, and some are sampled using a sampling…

---

## [Empty period problem - an exceptional case](https://discourse.julialang.org/t/empty-period-problem-an-exceptional-case/121655)

<div class="topic-metadata">

**Author:** [@anon91151494](https://discourse.julialang.org/u/anon91151494)\
**Replies:** 2\
**Last updated:** [October 23, 2024, 4:58pm UTC](https://discourse.julialang.org/t/empty-period-problem-an-exceptional-case/121655 "2024-10-23T16:58:10Z")

</div>

I have discovered a problem with the implementation of the Dates CompoundPeriod type. Here’s a simple REPL demo. julia\> using Dates julia\> ms0 = Millisecond(0) 0 milliseconds julia\> canonicalize(ms0) empty period As…

---

## [Fast ways to check if an element is in a vector of vector of elements](https://discourse.julialang.org/t/fast-ways-to-check-if-an-element-is-in-a-vector-of-vector-of-elements/121598)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 20\
**Last updated:** [October 23, 2024, 3:42pm UTC](https://discourse.julialang.org/t/fast-ways-to-check-if-an-element-is-in-a-vector-of-vector-of-elements/121598 "2024-10-23T15:42:36Z")

</div>

Hello , What would be the most efficient way to look for a number in a vector of vector of numbers? i.e. Data: t = \[ \[1,2,3\] , \[4,5,6\] , \[1,10,12\], \[1,4,5\] \] Input: 1 Output: 1,3,4 I could do something like findall…

---

## [Status of Julia database libraries](https://discourse.julialang.org/t/status-of-julia-database-libraries/11877)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 143\
**Last updated:** [October 23, 2024, 3:12pm UTC](https://discourse.julialang.org/t/status-of-julia-database-libraries/11877 "2024-10-23T15:12:27Z")

</div>

TLDR; My experience with the DB access libraries has been overwhelmingly negative - I’m concerned that the Julia ecosystem is missing a huge foundational piece for success. Things don’t look any better as we’re moving to…

---

## [How to Update Non-Time-Dependent States in Mixed ODE Problems?](https://discourse.julialang.org/t/how-to-update-non-time-dependent-states-in-mixed-ode-problems/121594)

<div class="topic-metadata">

**Author:** [@chooron](https://discourse.julialang.org/u/chooron)\
**Replies:** 11\
**Last updated:** [October 23, 2024, 3:07pm UTC](https://discourse.julialang.org/t/how-to-update-non-time-dependent-states-in-mixed-ode-problems/121594 "2024-10-23T15:07:58Z")

</div>

Hello, I’d like to ask for your help. In an ODE problem, after I complete the calculations for a given time step ( t ), I need to update a certain state. This state is not time-dependent but is recalculated based on anot…

---

## [Get base10 mantissa and exponent of real (eg Float64)](https://discourse.julialang.org/t/get-base10-mantissa-and-exponent-of-real-eg-float64/121529)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 11\
**Last updated:** [October 22, 2024, 8:54am UTC](https://discourse.julialang.org/t/get-base10-mantissa-and-exponent-of-real-eg-float64/121529 "2024-10-22T08:54:36Z")

</div>

What would be the recommended way of getting the base 10 mantissa and exponent of a floating point number? Is there a package that does this? Or should I just reparse from printed representation, as in using Printf fu…

---

## [Turning a stochastic simulator into a set of deterministic simulators by fixing the seed](https://discourse.julialang.org/t/turning-a-stochastic-simulator-into-a-set-of-deterministic-simulators-by-fixing-the-seed/121642)

<div class="topic-metadata">

**Author:** [@weltenbummler](https://discourse.julialang.org/u/weltenbummler)\
**Replies:** 0\
**Last updated:** [October 23, 2024, 1:43pm UTC](https://discourse.julialang.org/t/turning-a-stochastic-simulator-into-a-set-of-deterministic-simulators-by-fixing-the-seed/121642 "2024-10-23T13:43:31Z")

</div>

Hello all, I am given a stochastic simulator and would like to turn it into n deterministic simulators where each operates with a fixed seed. The simulators depend on some parameters that the user can specify. My quest…

---

## [Elegant handling of possibly-state-dependent parameters in physical simulation](https://discourse.julialang.org/t/elegant-handling-of-possibly-state-dependent-parameters-in-physical-simulation/121640)

<div class="topic-metadata">

**Author:** [@Ickaser](https://discourse.julialang.org/u/Ickaser)\
**Replies:** 1\
**Last updated:** [October 23, 2024, 1:34pm UTC](https://discourse.julialang.org/t/elegant-handling-of-possibly-state-dependent-parameters-in-physical-simulation/121640 "2024-10-23T13:34:44Z")

</div>

For a couple years now, I have been using OrdinaryDiffEq for developing a handful of models for describing the process of pharmaceutical lyophilization. The more time I spend, the more I learn about more aspects of Julia…

---

## [Julia on RISC-V / Mango Pi board](https://discourse.julialang.org/t/julia-on-risc-v-mango-pi-board/91584)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 3\
**Last updated:** [October 23, 2024, 1:04pm UTC](https://discourse.julialang.org/t/julia-on-risc-v-mango-pi-board/91584 "2024-10-23T13:04:12Z")

</div>

Hey all. I just found out about the Mango Pi Mango Pi official website | Tiny and Elegant SBC | mqpro which is a RISC-V dev board similar to the RasPi zero. I’d love to run Julia on one of these, but obviously it’s RISC…

---

## [Reshaped views might alias](https://discourse.julialang.org/t/reshaped-views-might-alias/121495)

<div class="topic-metadata">

**Author:** [@lxvm](https://discourse.julialang.org/u/lxvm)\
**Replies:** 5\
**Last updated:** [October 23, 2024, 12:54pm UTC](https://discourse.julialang.org/t/reshaped-views-might-alias/121495 "2024-10-23T12:54:41Z")

</div>

Hi, I have implemented a linear operator as a method of LinearAlgebra.mul!(x, A, b) to use with IterativeSolvers.jl, but when profiling my code I noticed a huge performance difference due to unaliasing arrays when testi…

---

## [Speed up loop for logpdf](https://discourse.julialang.org/t/speed-up-loop-for-logpdf/121620)

<div class="topic-metadata">

**Author:** [@Ian\_L](https://discourse.julialang.org/u/Ian_L)\
**Replies:** 13\
**Last updated:** [October 23, 2024, 7:00am UTC](https://discourse.julialang.org/t/speed-up-loop-for-logpdf/121620 "2024-10-23T07:00:20Z")

</div>

I have the following code which tries to evaluate the logpdf of multiple categorical variables. It is ok, but apparently it is one of the bottlenecks in my code. Really, all the code is doing is for each datapoint xs\[i\],…

---

## [An idea to use algebra in to variable definition](https://discourse.julialang.org/t/an-idea-to-use-algebra-in-to-variable-definition/121616)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 4\
**Last updated:** [October 23, 2024, 12:55am UTC](https://discourse.julialang.org/t/an-idea-to-use-algebra-in-to-variable-definition/121616 "2024-10-23T00:55:34Z")

</div>

If I know that c^2=a^2+b^2 and I know the values of a and c but want to find b then I have to manually rearrange the equation and do b = sqrt(c^2 - a^2) For complicated cases, it may be hard to decipher what was the in…

---

## [Get the list of members for LDAP group](https://discourse.julialang.org/t/get-the-list-of-members-for-ldap-group/109798)

<div class="topic-metadata">

**Author:** [@aww-r](https://discourse.julialang.org/u/aww-r)\
**Replies:** 1\
**Last updated:** [October 22, 2024, 7:36pm UTC](https://discourse.julialang.org/t/get-the-list-of-members-for-ldap-group/109798 "2024-10-22T19:36:08Z")

</div>

I have a question in regards to LDAP, or specifically LDAP.Client package. I’d like to list all the members of specific LDAP group but I cannot make it working with the package. If I enter into bash below code I’m gettin…

---

## [User-defined binary functions used infix](https://discourse.julialang.org/t/user-defined-binary-functions-used-infix/121601)

<div class="topic-metadata">

**Author:** [@pao](https://discourse.julialang.org/u/pao)\
**Replies:** 1\
**Last updated:** [October 22, 2024, 4:58pm UTC](https://discourse.julialang.org/t/user-defined-binary-functions-used-infix/121601 "2024-10-22T16:58:34Z")

</div>

Hi guys, is there any method for using a binary user-defined function infix between actual argument values? I see a lot of discussion about infix operators, representable with a single character, but nothing about re…

---

## [How to get current Julia process memory usage?](https://discourse.julialang.org/t/how-to-get-current-julia-process-memory-usage/41734)

<div class="topic-metadata">

**Author:** [@yiyuezhuo](https://discourse.julialang.org/u/yiyuezhuo)\
**Replies:** 10\
**Last updated:** [October 22, 2024, 4:25pm UTC](https://discourse.julialang.org/t/how-to-get-current-julia-process-memory-usage/41734 "2024-10-22T16:25:08Z")

</div>

I was debugging a ccall memory leak problem and found the memory usage value in top useful: Is there a direct method to access this value from Julia? I used Sys.free\_memory as a proxy but it suffers from noise introd…

---

## [What is the best way to re-use a temporary vector](https://discourse.julialang.org/t/what-is-the-best-way-to-re-use-a-temporary-vector/121519)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 16\
**Last updated:** [October 22, 2024, 4:24pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-re-use-a-temporary-vector/121519 "2024-10-22T16:24:11Z")

</div>

Hi, I have the following situation: I have a function f(x::Float64) which creates a temporary array A::Vector{Float64}, then finally it returns a Float64. I typically call this function millions of times, so I am wonder…

---

## [Citation of Julia Packages](https://discourse.julialang.org/t/citation-of-julia-packages/121600)

<div class="topic-metadata">

**Author:** [@runjaj](https://discourse.julialang.org/u/runjaj)\
**Replies:** 1\
**Last updated:** [October 22, 2024, 4:11pm UTC](https://discourse.julialang.org/t/citation-of-julia-packages/121600 "2024-10-22T16:11:54Z")

</div>

I want to start adding the bibliographic references of the packages I use in my teaching. Some packages include in their websites the references the authors want us to cite. However, it’s time consuming to look for this …

---

## [Defining folder structures templates](https://discourse.julialang.org/t/defining-folder-structures-templates/121597)

<div class="topic-metadata">

**Author:** [@cshen](https://discourse.julialang.org/u/cshen)\
**Replies:** 0\
**Last updated:** [October 22, 2024, 3:15pm UTC](https://discourse.julialang.org/t/defining-folder-structures-templates/121597 "2024-10-22T15:15:08Z")

</div>

Hello, I am looking toward automating some project initialization with julia. There are different kind of projects and each project has a slightly different folder structure. I know I can just use a previously existing…

---

## [Luxor and Unicode](https://discourse.julialang.org/t/luxor-and-unicode/121587)

<div class="topic-metadata">

**Author:** [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Replies:** 3\
**Last updated:** [October 22, 2024, 3:09pm UTC](https://discourse.julialang.org/t/luxor-and-unicode/121587 "2024-10-22T15:09:47Z")

</div>

Is there a way to represent the unicode ⇐ (\\u21D0) etc in a Luxor plot? I guess I need to specifiy an adequate typeface, but is is annoying that the repl and jupyter show what I want for the Array A, but not Luxor, not e…

---

## [JuliaFormatter, JuliaHub docs, and the public keyword](https://discourse.julialang.org/t/juliaformatter-juliahub-docs-and-the-public-keyword/121531)

<div class="topic-metadata">

**Author:** [@scheinerman](https://discourse.julialang.org/u/scheinerman)\
**Replies:** 5\
**Last updated:** [October 22, 2024, 3:09pm UTC](https://discourse.julialang.org/t/juliaformatter-juliahub-docs-and-the-public-keyword/121531 "2024-10-22T15:09:24Z")

</div>

I have found that tagging some of my functions as public causes two problems. First, JuliaFormatter fails. Second, the documentation I built with Documenter doesn’t migrate to docs.juliahub.com.

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

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