# General Usage

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

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

**Page:** 80

---

## [Access violation when using package JLD.jl](https://discourse.julialang.org/t/access-violation-when-using-package-jld-jl/126985)

<div class="topic-metadata">

**Author:** [@zyhsjtu](https://discourse.julialang.org/u/zyhsjtu)\
**Replies:** 5\
**Last updated:** [March 15, 2025, 2:56pm UTC](https://discourse.julialang.org/t/access-violation-when-using-package-jld-jl/126985 "2025-03-15T14:56:49Z")

</div>

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks. Exception: EXCEPTION\_ACCESS\_VIOLATION at 0x2c1fc3ce3bf – unsafe\_load at .\\pointer.jl:153 \[in…

---

## [What packages for images, image pyramids and interpolation do you recommend?](https://discourse.julialang.org/t/what-packages-for-images-image-pyramids-and-interpolation-do-you-recommend/126950)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 5\
**Last updated:** [March 15, 2025, 12:50pm UTC](https://discourse.julialang.org/t/what-packages-for-images-image-pyramids-and-interpolation-do-you-recommend/126950 "2025-03-15T12:50:39Z")

</div>

I’m planning to add photometric optimization (think Lucas-Kanade style model to image alignment, direct methods for visual odometry & SLAM, etc.) to my VisualGeometryOptimization package. I’d like to not re-invent the wh…

---

## [Updating a row in sparse cholesky factorisation using CHOLMOD](https://discourse.julialang.org/t/updating-a-row-in-sparse-cholesky-factorisation-using-cholmod/126683)

<div class="topic-metadata">

**Author:** [@wvanroos](https://discourse.julialang.org/u/wvanroos)\
**Replies:** 2\
**Last updated:** [March 15, 2025, 9:34am UTC](https://discourse.julialang.org/t/updating-a-row-in-sparse-cholesky-factorisation-using-cholmod/126683 "2025-03-15T09:34:52Z")

</div>

CHOLMOD allows the modification of a row of a sparse matrix and updates the factorisation, accordingly. There is a function ldlrowmod in Matlab that interfaces to rowadd and rowdel from CHOLMOD (SuiteSparse/CHOLMOD/MA…

---

## [Generic Functions Are Slow Here?](https://discourse.julialang.org/t/generic-functions-are-slow-here/126974)

<div class="topic-metadata">

**Author:** [@co1emi11er](https://discourse.julialang.org/u/co1emi11er)\
**Replies:** 3\
**Last updated:** [March 15, 2025, 5:26am UTC](https://discourse.julialang.org/t/generic-functions-are-slow-here/126974 "2025-03-15T05:26:18Z")

</div>

I write two functions that do the same thing, but one has allocations. All I change is the type from an abstract class to a concrete class. julia\> function baz((;h, t\_w, E, F\_y)::T) where T \<: AISCSteel.Shapes.IShapes.A…

---

## [VSCode Makie - Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state](https://discourse.julialang.org/t/vscode-makie-error-loading-webview-error-could-not-register-service-worker-invalidstateerror-failed-to-register-a-serviceworker-the-document-is-in-an-invalid-state/126972)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 1\
**Last updated:** [March 15, 2025, 4:50am UTC](https://discourse.julialang.org/t/vscode-makie-error-loading-webview-error-could-not-register-service-worker-invalidstateerror-failed-to-register-a-serviceworker-the-document-is-in-an-invalid-state/126972 "2025-03-15T04:50:02Z")

</div>

In VSCode-Julia 1.127.2, when I try to view a Makie plot it says Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid sta…

---

## [Symbolics.symplify must be invoked twice 2cos(x) - sin(2x)/sin(x)](https://discourse.julialang.org/t/symbolics-symplify-must-be-invoked-twice-2cos-x-sin-2x-sin-x/126944)

<div class="topic-metadata">

**Author:** [@fp4code](https://discourse.julialang.org/u/fp4code)\
**Replies:** 2\
**Last updated:** [March 15, 2025, 12:22am UTC](https://discourse.julialang.org/t/symbolics-symplify-must-be-invoked-twice-2cos-x-sin-2x-sin-x/126944 "2025-03-15T00:22:20Z")

</div>

Dear all, why do I have to invoke symplify twice? using Symbolics # v6.29.2, julia 1.11.4 @variables x v = 2cos(x) - sin(2x)/sin(x) va = simplify(v) # not simplified vb = simplify(va) # 0

---

## [Matrix (linear map function) exponential multiplied with vector in ExponentialUtilities.jl](https://discourse.julialang.org/t/matrix-linear-map-function-exponential-multiplied-with-vector-in-exponentialutilities-jl/126957)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 10\
**Last updated:** [March 15, 2025, 12:04am UTC](https://discourse.julialang.org/t/matrix-linear-map-function-exponential-multiplied-with-vector-in-exponentialutilities-jl/126957 "2025-03-15T00:04:07Z")

</div>

I am trying to multiply the exponential of a matrix (available as a function which linearly maps the input vector to an output vector), to a given vector, using expv from ExponentialUtilities.jl using MKL using LinearAl…

---

## [Runtime dispatch for plan\_fft](https://discourse.julialang.org/t/runtime-dispatch-for-plan-fft/126958)

<div class="topic-metadata">

**Author:** [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Replies:** 1\
**Last updated:** [March 14, 2025, 5:24pm UTC](https://discourse.julialang.org/t/runtime-dispatch-for-plan-fft/126958 "2025-03-14T17:24:10Z")

</div>

Hi, I am learning about JET.jl while optimizing a function that involves FFT. I happened to find that JET.jl detected a runtime dispatch for plan\_fft or plan\_fft!: using JET using FFTW julia\> @report\_opt plan\_fft!(zer…

---

## [Reducing the number of allocations in a function](https://discourse.julialang.org/t/reducing-the-number-of-allocations-in-a-function/126906)

<div class="topic-metadata">

**Author:** [@andrea\_bertozzi](https://discourse.julialang.org/u/andrea_bertozzi)\
**Replies:** 14\
**Last updated:** [March 14, 2025, 12:30pm UTC](https://discourse.julialang.org/t/reducing-the-number-of-allocations-in-a-function/126906 "2025-03-14T12:30:39Z")

</div>

Hello, I have this function. When running benchmark, I get 519 allocations. Does anyone know how I can reduce those? Thank you! using LinearAlgebra struct Settings rho::Float64 g\_earth::Vector{Float64} cd…

---

## [How to modularize/package a large project | What kind of package/project directory structure works well?](https://discourse.julialang.org/t/how-to-modularize-package-a-large-project-what-kind-of-package-project-directory-structure-works-well/126819)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 2\
**Last updated:** [March 14, 2025, 8:15am UTC](https://discourse.julialang.org/t/how-to-modularize-package-a-large-project-what-kind-of-package-project-directory-structure-works-well/126819 "2025-03-14T08:15:02Z")

</div>

I’m having some issues trying to find a directory structure for a large Julia project which works well. I have two requirements objectives. A structure which is convenient for deployment A structure which is convenien…

---

## [Serializing many different arrays incrementally over time](https://discourse.julialang.org/t/serializing-many-different-arrays-incrementally-over-time/117777)

<div class="topic-metadata">

**Author:** [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)\
**Replies:** 5\
**Last updated:** [March 14, 2025, 4:17am UTC](https://discourse.julialang.org/t/serializing-many-different-arrays-incrementally-over-time/117777 "2025-03-14T04:17:13Z")

</div>

I have a simulation that’s going to run for a long time, producing a lot of results, and I need those results to go do disk while the sim is running rather than all at once at the end (not enough RAM for all those result…

---

## [Best practice to handle type annotations](https://discourse.julialang.org/t/best-practice-to-handle-type-annotations/126925)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 12\
**Last updated:** [March 13, 2025, 6:26pm UTC](https://discourse.julialang.org/t/best-practice-to-handle-type-annotations/126925 "2025-03-13T18:26:55Z")

</div>

From reading the Performance Tips in the Julia manual, I grasped that type declarations generally improve the performance and abstract types should be avoided. So lets say I have a function function func(x, n::Integer) …

---

## [Sparse dot product: return 1x1 SparseArray, not Float64](https://discourse.julialang.org/t/sparse-dot-product-return-1x1-sparsearray-not-float64/126873)

<div class="topic-metadata">

**Author:** [@luke-kiernan](https://discourse.julialang.org/u/luke-kiernan)\
**Replies:** 6\
**Last updated:** [March 13, 2025, 4:46pm UTC](https://discourse.julialang.org/t/sparse-dot-product-return-1x1-sparsearray-not-float64/126873 "2025-03-13T16:46:49Z")

</div>

I have an array J with a known fixed sparsity structure–it’s the Jacobian of some function f(x) from R^n to R^n, but the sparsity structure doesn’t depend on x. I’m repeatedly calculating M = c\_1 I+c\_2 J(x\_1)' J(x\_2), fo…

---

## [Usage of Tullio.jl](https://discourse.julialang.org/t/usage-of-tullio-jl/126908)

<div class="topic-metadata">

**Author:** [@hssn15](https://discourse.julialang.org/u/hssn15)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 3:37pm UTC](https://discourse.julialang.org/t/usage-of-tullio-jl/126908 "2025-03-13T15:37:49Z")

</div>

I have a really big code, that is separated into bunch of functions, modules, and files. I would like to implement Tullio.jl to optimize loops and array operations. Normally I’m using @tullio macro before the loop or ar…

---

## [Matrix view based on BitVector?](https://discourse.julialang.org/t/matrix-view-based-on-bitvector/126922)

<div class="topic-metadata">

**Author:** [@AdaemmerP](https://discourse.julialang.org/u/AdaemmerP)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 3:15pm UTC](https://discourse.julialang.org/t/matrix-view-based-on-bitvector/126922 "2025-03-13T15:15:17Z")

</div>

I have a pre-allocated BitVector that fills randomly inside a loop. Based on that BitVector, I want to create a view of a Matrix but it allocates. Is there a workaround? A simple example: using Chairmarks ix = BitVecto…

---

## [How to apply a small anonymous function defined in a yaml file?](https://discourse.julialang.org/t/how-to-apply-a-small-anonymous-function-defined-in-a-yaml-file/126874)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 11\
**Last updated:** [March 13, 2025, 12:20pm UTC](https://discourse.julialang.org/t/how-to-apply-a-small-anonymous-function-defined-in-a-yaml-file/126874 "2025-03-13T12:20:12Z")

</div>

I am trying to define simple anonimous “transformation” functions (something like “x → x/100”) in a yaml file (in a dictionary keyed by climatic variables) and then trying to apply the transformation to a Raster file. I …

---

## [Fetching the latest value from external sources using Channel](https://discourse.julialang.org/t/fetching-the-latest-value-from-external-sources-using-channel/126901)

<div class="topic-metadata">

**Author:** [@leejm516](https://discourse.julialang.org/u/leejm516)\
**Replies:** 0\
**Last updated:** [March 13, 2025, 9:54am UTC](https://discourse.julialang.org/t/fetching-the-latest-value-from-external-sources-using-channel/126901 "2025-03-13T09:54:14Z")

</div>

Hi! Sorry for my bad English to describe the title. I am trying to make a small code which fetches a value from a MCU (Arduino, ESP32, etc.) upon request. The MCU periodically saves the sensor value measured into its …

---

## [Async but ordered task queue](https://discourse.julialang.org/t/async-but-ordered-task-queue/126864)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 5:33am UTC](https://discourse.julialang.org/t/async-but-ordered-task-queue/126864 "2025-03-13T05:33:54Z")

</div>

I want to queue up some async tasks: however i’d like to push them in queues such that the order within a queue is conserved. Concretely, my problem are async plots into a Makie axis. My starting point is something like…

---

## [Multithreading broadcasted array ops](https://discourse.julialang.org/t/multithreading-broadcasted-array-ops/126842)

<div class="topic-metadata">

**Author:** [@pxshen](https://discourse.julialang.org/u/pxshen)\
**Replies:** 4\
**Last updated:** [March 13, 2025, 3:05am UTC](https://discourse.julialang.org/t/multithreading-broadcasted-array-ops/126842 "2025-03-13T03:05:38Z")

</div>

What’s best practice for multithreading broadcasted array ops? I know of various multithreaded map functions but wish for a simple macro like @threads A.+B doesn’t seem to work? Even better why can’t compiler automatic…

---

## [How to avoid code getting precompiled because it gets executed while the package is being defined?](https://discourse.julialang.org/t/how-to-avoid-code-getting-precompiled-because-it-gets-executed-while-the-package-is-being-defined/126890)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 2:12am UTC](https://discourse.julialang.org/t/how-to-avoid-code-getting-precompiled-because-it-gets-executed-while-the-package-is-being-defined/126890 "2025-03-13T02:12:17Z")

</div>

Often times I have some code in a package that executes only during precompilation, not at run time. AFAIK Julia saves the MethodInstances of all such compiled Methods into the precompilation files, for some reason. How …

---

## [Is there a way to automatically define default methods for a type wrapper?](https://discourse.julialang.org/t/is-there-a-way-to-automatically-define-default-methods-for-a-type-wrapper/126854)

<div class="topic-metadata">

**Author:** [@TimHargreaves](https://discourse.julialang.org/u/TimHargreaves)\
**Replies:** 4\
**Last updated:** [March 12, 2025, 11:30pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-automatically-define-default-methods-for-a-type-wrapper/126854 "2025-03-12T23:30:46Z")

</div>

Suppose a concrete type Foo is defined in another package that is unlikely to want any changes made to it. There are many methods defined using Foo. I would like to create a type Bar that is essentially the same as Foo …

---

## [Calling C/Fortran program that embeds Julia in Julia](https://discourse.julialang.org/t/calling-c-fortran-program-that-embeds-julia-in-julia/126839)

<div class="topic-metadata">

**Author:** [@AreWeDreaming](https://discourse.julialang.org/u/AreWeDreaming)\
**Replies:** 2\
**Last updated:** [March 12, 2025, 10:52pm UTC](https://discourse.julialang.org/t/calling-c-fortran-program-that-embeds-julia-in-julia/126839 "2025-03-12T22:52:24Z")

</div>

We have a Julia framework that needs to interact with a lot of legacy Fortran/C(++) applications. Instead of manually preparing the proper interface for the applications which involves lots of manual type conversions, we…

---

## [Wondering if extending Base: max with max(a) = max(a...) would be safe?!](https://discourse.julialang.org/t/wondering-if-extending-base-max-with-max-a-max-a-would-be-safe/126885)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 6\
**Last updated:** [March 12, 2025, 10:02pm UTC](https://discourse.julialang.org/t/wondering-if-extending-base-max-with-max-a-max-a-would-be-safe/126885 "2025-03-12T22:02:45Z")

</div>

So I am wondering if import Base: max max(a) = max(a...) export max would be safe, after all I am extending the “concept” to vectors or NTuples. Bu then it may well be a rather stupid thing to do, and have serious side…

---

## [Optimizing or replacing IF-ELSEIF-ELSE statements](https://discourse.julialang.org/t/optimizing-or-replacing-if-elseif-else-statements/126867)

<div class="topic-metadata">

**Author:** [@hssn15](https://discourse.julialang.org/u/hssn15)\
**Replies:** 9\
**Last updated:** [March 12, 2025, 4:30pm UTC](https://discourse.julialang.org/t/optimizing-or-replacing-if-elseif-else-statements/126867 "2025-03-12T16:30:58Z")

</div>

I am developing a simulator but I dont have a lot experience and tricks about Julia. I have a case that seems like it has some kind of other way around that is much more efficient and optimized. I will give you and exam…

---

## [Failure of CI job](https://discourse.julialang.org/t/failure-of-ci-job/126826)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [March 12, 2025, 2:53pm UTC](https://discourse.julialang.org/t/failure-of-ci-job/126826 "2025-03-12T14:53:45Z")

</div>

Since today, the job that builds the documentation fails: Why? It used to work until now. What has changed? Error message: ERROR: LoadError: ArgumentError: Path to conda environment is not valid: /home/runner/.juli…

---

## [Distributed.jl vs MPI.jl](https://discourse.julialang.org/t/distributed-jl-vs-mpi-jl/71315)

<div class="topic-metadata">

**Author:** [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Replies:** 26\
**Last updated:** [January 31, 2022, 4:13am UTC](https://discourse.julialang.org/t/distributed-jl-vs-mpi-jl/71315 "2022-01-31T04:13:13Z")

</div>

Hi all, I am relatively new to Julia, but have ported one of my older programs from Fortran to Julia. I picked a program from my collection which doesn’t have any parallelims in it with the intention to implement it fr…

---

## [Conditional Multithreading](https://discourse.julialang.org/t/conditional-multithreading/32421)

<div class="topic-metadata">

**Author:** [@bjack205](https://discourse.julialang.org/u/bjack205)\
**Replies:** 12\
**Last updated:** [March 12, 2025, 11:50am UTC](https://discourse.julialang.org/t/conditional-multithreading/32421 "2025-03-12T11:50:04Z")

</div>

Is there a way to enable/disable calls to Threads.@threads? I’m developing an optimization solver, and when the problem is sufficiently small, using multi-threading hurts performance, and incurs allocations (my code doe…

---

## [Min/max swap using SIMD](https://discourse.julialang.org/t/min-max-swap-using-simd/126832)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 18\
**Last updated:** [March 12, 2025, 11:35am UTC](https://discourse.julialang.org/t/min-max-swap-using-simd/126832 "2025-03-12T11:35:22Z")

</div>

I would like to request some help to SIMD the following code: import Test: @test n = 10\_000\_000 A = repeat(\[3, 1, 4, 2, 7, 8, 5, 6\], outer=n); B = repeat(\[5, 6, 0, 7, 2, 3, 1, 4\], outer=n); C = copy(A); D = copy(B); …

---

## [Is it possible to make \`HDF5\` show progress in \`copy\_object\`?](https://discourse.julialang.org/t/is-it-possible-to-make-hdf5-show-progress-in-copy-object/126860)

<div class="topic-metadata">

**Author:** [@VinceNeede](https://discourse.julialang.org/u/VinceNeede)\
**Replies:** 0\
**Last updated:** [March 12, 2025, 10:57am UTC](https://discourse.julialang.org/t/is-it-possible-to-make-hdf5-show-progress-in-copy-object/126860 "2025-03-12T10:57:34Z")

</div>

I was copying a big HDF5.Group and I was wondering whether there was a way to make copy\_object show a progress bar or something similar

---

## [Avoiding redundant computation when using Zygote and ForwardDiff for forward-over-reverse hessians](https://discourse.julialang.org/t/avoiding-redundant-computation-when-using-zygote-and-forwarddiff-for-forward-over-reverse-hessians/126827)

<div class="topic-metadata">

**Author:** [@IvanBioli](https://discourse.julialang.org/u/IvanBioli)\
**Replies:** 4\
**Last updated:** [March 12, 2025, 8:53am UTC](https://discourse.julialang.org/t/avoiding-redundant-computation-when-using-zygote-and-forwarddiff-for-forward-over-reverse-hessians/126827 "2025-03-12T08:53:29Z")

</div>

I am computing the Hessian of a function using a combination of Zygote (reverse-mode AD) and ForwardDiff (forward-mode AD). A MWE of my current implementation is as follows: using Zygote, ForwardDiff, DiffResults # Def…

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

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