# General Usage

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

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

**Page:** 45

---

## [Custom (NumPy style) broadcasting rule that avoids iterating over elements (for GPU-acceleration)](https://discourse.julialang.org/t/custom-numpy-style-broadcasting-rule-that-avoids-iterating-over-elements-for-gpu-acceleration/131515)

<div class="topic-metadata">

**Author:** [@TimHargreaves](https://discourse.julialang.org/u/TimHargreaves)\
**Replies:** 10\
**Last updated:** [August 24, 2025, 7:48pm UTC](https://discourse.julialang.org/t/custom-numpy-style-broadcasting-rule-that-avoids-iterating-over-elements-for-gpu-acceleration/131515 "2025-08-24T19:48:57Z")

</div>

Minimal Example As a minimal example, suppose that I have the following two structs defined, struct Foo{T, M\<:AbstractMatrix{T}} A::M B::M end struct Bar{T, M\<:AbstractMatrix{T}} C::M foo::Foo{T, M} end…

---

## [Does \`@label\`/\`@goto\` introduce scope like loop blocks?](https://discourse.julialang.org/t/does-label-goto-introduce-scope-like-loop-blocks/129607)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 5\
**Last updated:** [August 24, 2025, 4:17pm UTC](https://discourse.julialang.org/t/does-label-goto-introduce-scope-like-loop-blocks/129607 "2025-08-24T16:17:45Z")

</div>

Variables assigned in a loop block scope are different across iterations while if statements don’t introduce new local scope at all, but what’s the variable scoping behavior for @label-@goto jumps? Initially I’d assume t…

---

## [Close instead of wait if TCP socket is never drained](https://discourse.julialang.org/t/close-instead-of-wait-if-tcp-socket-is-never-drained/131727)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 1\
**Last updated:** [August 24, 2025, 3:23pm UTC](https://discourse.julialang.org/t/close-instead-of-wait-if-tcp-socket-is-never-drained/131727 "2025-08-24T15:23:50Z")

</div>

I was wondering how the triplet of OS, libuv and Julia handles the scenario where a TCP socket is constantly written to but never read from on the peer’s side, so I came up with this little test script. s = listen(1234)…

---

## [PresetTimeCallback with array in affect function](https://discourse.julialang.org/t/presettimecallback-with-array-in-affect-function/131806)

<div class="topic-metadata">

**Author:** [@Marco\_Masi](https://discourse.julialang.org/u/Marco_Masi)\
**Replies:** 1\
**Last updated:** [August 24, 2025, 11:57am UTC](https://discourse.julialang.org/t/presettimecallback-with-array-in-affect-function/131806 "2025-08-24T11:57:08Z")

</div>

I’m trying to understand how to use the PresetTimeCallback(tstops,affect!) where tstops is an array of time steps and the affect function should also affect the integration each time with different values. For example, …

---

## [Hidden version of searchsortedfirst](https://discourse.julialang.org/t/hidden-version-of-searchsortedfirst/131776)

<div class="topic-metadata">

**Author:** [@alan](https://discourse.julialang.org/u/alan)\
**Replies:** 4\
**Last updated:** [August 23, 2025, 9:05pm UTC](https://discourse.julialang.org/t/hidden-version-of-searchsortedfirst/131776 "2025-08-23T21:05:09Z")

</div>

In the Julia source code, there is an undocumented version of searchsortedfirst: function searchsortedfirst(v::AbstractVector, x, lo::T, hi::T, o::Ordering)::keytype(v) where T\<:Integer I need a function like this, in …

---

## [I want advice - Struggling to Connect Python with Julia](https://discourse.julialang.org/t/i-want-advice-struggling-to-connect-python-with-julia/131788)

<div class="topic-metadata">

**Author:** [@Olivia](https://discourse.julialang.org/u/Olivia)\
**Replies:** 1\
**Last updated:** [August 23, 2025, 3:44pm UTC](https://discourse.julialang.org/t/i-want-advice-struggling-to-connect-python-with-julia/131788 "2025-08-23T15:44:52Z")

</div>

Hi everyone I have been experimenting with Julia for a while now mainly because I such as its speed & how well it handles numerical tasks. I wanted to integrate some of my existing Python scripts into Julia but I am faci…

---

## [Discrepancies of Errors caused by \`collect(Base.OneTo(N))\`](https://discourse.julialang.org/t/discrepancies-of-errors-caused-by-collect-base-oneto-n/131787)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 1\
**Last updated:** [August 23, 2025, 11:17am UTC](https://discourse.julialang.org/t/discrepancies-of-errors-caused-by-collect-base-oneto-n/131787 "2025-08-23T11:17:29Z")

</div>

I discover this (using Version 1.11.5 (2025-04-14) ) julia\> collect(Base.OneTo(2^59)) ERROR: OutOfMemoryError() Stacktrace: \[1\] GenericMemory @ .\\boot.jl:516 \[inlined\] \[2\] Array @ .\\boot.jl:578 \[inlined\] \[3\] Ar…

---

## [Bring Intel x86 simd sort library to Julia](https://discourse.julialang.org/t/bring-intel-x86-simd-sort-library-to-julia/131719)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 35\
**Last updated:** [August 22, 2025, 2:23pm UTC](https://discourse.julialang.org/t/bring-intel-x86-simd-sort-library-to-julia/131719 "2025-08-22T14:23:13Z")

</div>

Hi, Intel x86 simd sort library can be used via C++ template. If I wanted to make this library available to the maximum of Julia users (a bit like numpy did) what would be the best steps to follow? Should I use Binary…

---

## [Aqua Compare Project.toml and test/Project.toml fails](https://discourse.julialang.org/t/aqua-compare-project-toml-and-test-project-toml-fails/131760)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 3\
**Last updated:** [August 22, 2025, 11:47am UTC](https://discourse.julialang.org/t/aqua-compare-project-toml-and-test-project-toml-fails/131760 "2025-08-22T11:47:16Z")

</div>

I am trying out Aqua on some packages and getting an error I cannot see to figure out. julia\> Aqua.test\_all(Winding;stale\_deps=true) Test Summary: | Pass Total Time Method ambiguity | 1 1 2.5s Test Summary…

---

## [Is there an "Algebra of basis-functions"](https://discourse.julialang.org/t/is-there-an-algebra-of-basis-functions/131750)

<div class="topic-metadata">

**Author:** [@JADekker](https://discourse.julialang.org/u/JADekker)\
**Replies:** 8\
**Last updated:** [August 22, 2025, 9:23am UTC](https://discourse.julialang.org/t/is-there-an-algebra-of-basis-functions/131750 "2025-08-22T09:23:50Z")

</div>

In my research, I often work with the following kind of problem that essentially reduces to approximating a conditional expectation, say \\mathbb{E}\[g(X)|X=x\], by a linear combination of basis-functions, \\mathbb{E}\[g(X)|X…

---

## [Parsing one line try catch](https://discourse.julialang.org/t/parsing-one-line-try-catch/131756)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 5\
**Last updated:** [August 22, 2025, 4:03am UTC](https://discourse.julialang.org/t/parsing-one-line-try-catch/131756 "2025-08-22T04:03:01Z")

</div>

I was surprised that the following line does not parse: \_ \_ \_ \_(\_)\_ | Documentation: https://docs.julialang.org (\_) | (\_) (\_) | \_ \_ \_| |\_ \_\_ \_ | Type "?" for help, "\]?" for…

---

## [Finding package that requires admin permission to install](https://discourse.julialang.org/t/finding-package-that-requires-admin-permission-to-install/131758)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 3\
**Last updated:** [August 21, 2025, 8:01pm UTC](https://discourse.julialang.org/t/finding-package-that-requires-admin-permission-to-install/131758 "2025-08-21T20:01:51Z")

</div>

I gave a short-course this last weekend and the participants reported a pop-up window asking for admin permission while installing GeoStats.jl on Windows machines in their lab. How can I identify the indirect dependenc…

---

## [Efficient representation of a sparse "pentadiagonal" matrix?](https://discourse.julialang.org/t/efficient-representation-of-a-sparse-pentadiagonal-matrix/131744)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 8\
**Last updated:** [August 21, 2025, 6:53pm UTC](https://discourse.julialang.org/t/efficient-representation-of-a-sparse-pentadiagonal-matrix/131744 "2025-08-21T18:53:13Z")

</div>

I am interested in the eigenspectrum of Hermitian matrices that have a “pentadiagonal” structure, with A\[m,n\]=0 if abs(m-n)\>2. I am most interested in eigenstates with values close to zero. At present I am using Arpack.j…

---

## [Pkg Manager Issues due to VPN/Windows 11?](https://discourse.julialang.org/t/pkg-manager-issues-due-to-vpn-windows-11/131633)

<div class="topic-metadata">

**Author:** [@co1emi11er](https://discourse.julialang.org/u/co1emi11er)\
**Replies:** 9\
**Last updated:** [August 21, 2025, 4:06pm UTC](https://discourse.julialang.org/t/pkg-manager-issues-due-to-vpn-windows-11/131633 "2025-08-21T16:06:10Z")

</div>

I use julia on a work computer and I don’t recall this being an issue in the past. Anytime I try to install or update packages, it pops up a message that looks something like this: (@v1.11) pkg\> registry up General …

---

## [Dagger not fully utilizing CPU cores](https://discourse.julialang.org/t/dagger-not-fully-utilizing-cpu-cores/131733)

<div class="topic-metadata">

**Author:** [@Miroboru](https://discourse.julialang.org/u/Miroboru)\
**Replies:** 5\
**Last updated:** [August 21, 2025, 1:05pm UTC](https://discourse.julialang.org/t/dagger-not-fully-utilizing-cpu-cores/131733 "2025-08-21T13:05:43Z")

</div>

I have a time consuming simulation that is run over a set of signal to noise ratios, and thus is trivial to parallelize. I am currently using Dagger.jl to start 24 processes (I am on a 24 core threadripper system with 25…

---

## [Reading input parameters from a text file](https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737)

<div class="topic-metadata">

**Author:** [@prconlin](https://discourse.julialang.org/u/prconlin)\
**Replies:** 19\
**Last updated:** [August 21, 2025, 12:04pm UTC](https://discourse.julialang.org/t/reading-input-parameters-from-a-text-file/131737 "2025-08-21T12:04:33Z")

</div>

Hello, I’m writing a simple simulation program, and I want the input parameters to be read from a text file at runtime. My strategy is to read all of the parameters into a dictionary, which works, but feels very clumsy…

---

## [When does it make sense to use \`Base.MultiplicativeInverses\`](https://discourse.julialang.org/t/when-does-it-make-sense-to-use-base-multiplicativeinverses/131711)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 6\
**Last updated:** [August 19, 2025, 4:18pm UTC](https://discourse.julialang.org/t/when-does-it-make-sense-to-use-base-multiplicativeinverses/131711 "2025-08-19T16:18:05Z")

</div>

When does it make sense to use the Base.MultiplicativeInverses? I am considering storing the MultiplicativeInverse in my AbstractArray subtype which uses some index calculations based on some fields and the parent array.…

---

## [Intermittent Segfault](https://discourse.julialang.org/t/intermittent-segfault/131694)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 2\
**Last updated:** [August 21, 2025, 12:57am UTC](https://discourse.julialang.org/t/intermittent-segfault/131694 "2025-08-21T00:57:42Z")

</div>

Hello, I have recently started experiencing an intermittent segfault when using Julia with the vscode extension. I’ve been developing with this setup for well over a year and never experienced this before. I don’t even …

---

## [Macros to fill keyword arguments](https://discourse.julialang.org/t/macros-to-fill-keyword-arguments/25454)

<div class="topic-metadata">

**Author:** [@dstarerstor](https://discourse.julialang.org/u/dstarerstor)\
**Replies:** 6\
**Last updated:** [August 20, 2025, 4:40pm UTC](https://discourse.julialang.org/t/macros-to-fill-keyword-arguments/25454 "2025-08-20T16:40:10Z")

</div>

Hi everyone, I’m having a difficult time understanding how to properly use macros. I’m trying to make a macro @passkwargs that will turn foo(; @passkwargs(x,y)) into foo(; x=x, y=y) I’m just starting to work with ma…

---

## [Resetting threads with \`:static\` scheduling](https://discourse.julialang.org/t/resetting-threads-with-static-scheduling/131738)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 0\
**Last updated:** [August 20, 2025, 3:15pm UTC](https://discourse.julialang.org/t/resetting-threads-with-static-scheduling/131738 "2025-08-20T15:15:56Z")

</div>

When I ctrl-c a threaded loop with :static scheduling, I cannot re-run that threaded loop until I restart the REPL. If I try to re-run a threaded loop after breaking, I get the error message ERROR: @threads :static can…

---

## [Hash collision with small vectors](https://discourse.julialang.org/t/hash-collision-with-small-vectors/131702)

<div class="topic-metadata">

**Author:** [@mxhbl](https://discourse.julialang.org/u/mxhbl)\
**Replies:** 16\
**Last updated:** [August 20, 2025, 2:33pm UTC](https://discourse.julialang.org/t/hash-collision-with-small-vectors/131702 "2025-08-20T14:33:00Z")

</div>

Hi everyone, I recently ran into a hash collision with very small vectors (I’m on Julia 11.2): julia\> a = \[0x0000000000000080, 0x0000000000100000, 0x0000000000000400, 0x0000000000000100\] 4-element Vector{UInt64}: 0x00…

---

## [Need perf help on paralel var](https://discourse.julialang.org/t/need-perf-help-on-paralel-var/131716)

<div class="topic-metadata">

**Author:** [@yolhan\_mannes](https://discourse.julialang.org/u/yolhan_mannes)\
**Replies:** 4\
**Last updated:** [August 19, 2025, 9:36pm UTC](https://discourse.julialang.org/t/need-perf-help-on-paralel-var/131716 "2025-08-19T21:36:39Z")

</div>

Hello, I’m trying to add Statistics to AcceleratedKernels.jl in Add Statistics in KA, (only mean and var implemented) by yolhan83 · Pull Request #64 · JuliaGPU/AcceleratedKernels.jl · GitHub, GPU results seems nice but b…

---

## [Version \`CXXABI\_1.3.15' not found when loading matplotlib through PythonCall](https://discourse.julialang.org/t/version-cxxabi-1-3-15-not-found-when-loading-matplotlib-through-pythoncall/131671)

<div class="topic-metadata">

**Author:** [@zhzhang](https://discourse.julialang.org/u/zhzhang)\
**Replies:** 23\
**Last updated:** [August 19, 2025, 9:26pm UTC](https://discourse.julialang.org/t/version-cxxabi-1-3-15-not-found-when-loading-matplotlib-through-pythoncall/131671 "2025-08-19T21:26:09Z")

</div>

Hi folks, I want to call some functions from the Python package matplotlib in Julia through PythonCall.jl. However, it prompts version 'CXXABI\_1.3.15' not found. Here is the error message: julia\> using PythonCall juli…

---

## [Abusing \`convert\` as an alternative to \`Union{Nothing, Int64}\`](https://discourse.julialang.org/t/abusing-convert-as-an-alternative-to-union-nothing-int64/131534)

<div class="topic-metadata">

**Author:** [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Replies:** 15\
**Last updated:** [August 19, 2025, 8:14pm UTC](https://discourse.julialang.org/t/abusing-convert-as-an-alternative-to-union-nothing-int64/131534 "2025-08-19T20:14:52Z")

</div>

In C it is common to have functions that return a positive integer result on success, or a negative integer if an error happens. When I use these functions, I tend to forget the possible error values and do integer arith…

---

## ["Circular dependency detected" preventing precompile](https://discourse.julialang.org/t/circular-dependency-detected-preventing-precompile/131715)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 3\
**Last updated:** [August 19, 2025, 6:22pm UTC](https://discourse.julialang.org/t/circular-dependency-detected-preventing-precompile/131715 "2025-08-19T18:22:42Z")

</div>

julia\> using GLMakie ┌ Warning: Circular dependency detected. │ Precompilation will be skipped for dependencies in this cycle: │ ┌ FilePathsBase → FilePathsBaseMmapExt │ └─ FilePathsBase → FilePathsBaseTestExt │ Precom…

---

## [Confused by "Type"](https://discourse.julialang.org/t/confused-by-type/131714)

<div class="topic-metadata">

**Author:** [@alan](https://discourse.julialang.org/u/alan)\
**Replies:** 4\
**Last updated:** [August 19, 2025, 5:34pm UTC](https://discourse.julialang.org/t/confused-by-type/131714 "2025-08-19T17:34:28Z")

</div>

I’m confused by this snippet from https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array: julia\> struct SquaresVector \<: AbstractArray{Int, 1} count::Int end julia\> Base.IndexStyle(::…

---

## [Regular println vs Core.stdout](https://discourse.julialang.org/t/regular-println-vs-core-stdout/131685)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 10\
**Last updated:** [August 19, 2025, 12:38pm UTC](https://discourse.julialang.org/t/regular-println-vs-core-stdout/131685 "2025-08-19T12:38:39Z")

</div>

@time println(Core.stdout, "Hello") Hello 0.000027 seconds julia\> @time println("Hello") Hello 0.000074 seconds julia\> @time print(Core.stdout, "Hello") Hello 0.000020 seconds Why is it 3 times faster \[see my fol…

---

## [DistributedNext FYI](https://discourse.julialang.org/t/distributednext-fyi/131706)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [August 19, 2025, 11:16am UTC](https://discourse.julialang.org/t/distributednext-fyi/131706 "2025-08-19T11:16:56Z")

</div>

Continuing the discussion from I want Best Practices for Working With Python & Julia Together: Yes, new to me, note “Bleeding-edge fork of Distributed.jl” and “This is a soft fork of Distributed.jl for the purposes of …

---

## [Using particle filter to estimate the state through the observations of another parameter that depends on state](https://discourse.julialang.org/t/using-particle-filter-to-estimate-the-state-through-the-observations-of-another-parameter-that-depends-on-state/131690)

<div class="topic-metadata">

**Author:** [@Tanya123](https://discourse.julialang.org/u/Tanya123)\
**Replies:** 1\
**Last updated:** [August 19, 2025, 11:42am UTC](https://discourse.julialang.org/t/using-particle-filter-to-estimate-the-state-through-the-observations-of-another-parameter-that-depends-on-state/131690 "2025-08-19T11:42:20Z")

</div>

My goal is to estimate the basal friction field (β) of a glacier using surface velocity observations. Direct observations of β are unavailable, but velocity measurements at the surface are accessible via sensors. The cu…

---

## [Time-Axis Linked Bar Plot with Gaps](https://discourse.julialang.org/t/time-axis-linked-bar-plot-with-gaps/131632)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 6\
**Last updated:** [August 18, 2025, 4:12pm UTC](https://discourse.julialang.org/t/time-axis-linked-bar-plot-with-gaps/131632 "2025-08-18T16:12:41Z")

</div>

I am trying to replicate a plot from timewarrior that looks something like this: Basically, you have date on the y-axis and blocks of time on the x-axis from 0 - 23 representing 24 hours in a day. I don’t care about …

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

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