# General Usage

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

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

**Page:** 273

---

## [Package oddities](https://discourse.julialang.org/t/package-oddities/101174)

<div class="topic-metadata">

**Author:** [@vapidbabble](https://discourse.julialang.org/u/vapidbabble)\
**Replies:** 3\
**Last updated:** [July 4, 2023, 3:03pm UTC](https://discourse.julialang.org/t/package-oddities/101174 "2023-07-04T15:03:50Z")

</div>

I’m fine in the US, but some others on HOJ (Humans of Julia) discord are unable to update packages. They noticed Status says it’s offline. I tried to ping and I mistyped pkg.julialang.org as pkg.juliakabg.org and got a …

---

## [Indexing on a pseudo-dimension](https://discourse.julialang.org/t/indexing-on-a-pseudo-dimension/101119)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 10\
**Last updated:** [July 4, 2023, 2:43pm UTC](https://discourse.julialang.org/t/indexing-on-a-pseudo-dimension/101119 "2023-07-04T14:43:21Z")

</div>

Suppose I have a K x M array, my\_arr, but I want to pretend that it is a K x M x N array, my\_pseudo\_arr , so that indexing it with my\_pseudo\_arr\[k, m, n\] equals my\_arr\[k, m\], my\_pseudo\_arr\[k, m, :\] equals repeat(\[my\_arr\[…

---

## [Painful debugging in VSC](https://discourse.julialang.org/t/painful-debugging-in-vsc/49597)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 6\
**Last updated:** [July 4, 2023, 2:07pm UTC](https://discourse.julialang.org/t/painful-debugging-in-vsc/49597 "2023-07-04T14:07:35Z")

</div>

Is it only me or others share this experience that debugging in VSC is becoming more and more painful? See the example of the attached fig. The code flow did not stop at the breakpoint. It did land directly at the positi…

---

## [Delay partial differential equations](https://discourse.julialang.org/t/delay-partial-differential-equations/101161)

<div class="topic-metadata">

**Author:** [@rjku](https://discourse.julialang.org/u/rjku)\
**Replies:** 2\
**Last updated:** [July 4, 2023, 2:05pm UTC](https://discourse.julialang.org/t/delay-partial-differential-equations/101161 "2023-07-04T14:05:36Z")

</div>

Hi all, is there any way of dealing with Delay Partial Differential Equations using DifferentialEquations.jl, MethodsOfLines.jl, or any other package? Alternatively, has anybody any suggestion/recommendation about how …

---

## [Large vs Small Packages](https://discourse.julialang.org/t/large-vs-small-packages/9447)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 22\
**Last updated:** [July 4, 2023, 12:39pm UTC](https://discourse.julialang.org/t/large-vs-small-packages/9447 "2023-07-04T12:39:30Z")

</div>

I’m considering splitting a large monolithic package into 3-4 smaller ones. The thought was they might be easier to maintain, migrate, test, etc. But I am a bit concerned that the “admin overhead” will actually increase.…

---

## [Zero-based indexing ... (not) again](https://discourse.julialang.org/t/zero-based-indexing-not-again/100944)

<div class="topic-metadata">

**Author:** [@bertschi](https://discourse.julialang.org/u/bertschi)\
**Replies:** 19\
**Last updated:** [July 4, 2023, 12:12pm UTC](https://discourse.julialang.org/t/zero-based-indexing-not-again/100944 "2023-07-04T12:12:34Z")

</div>

Just realized that zero-based, i.e., offset-based indexing, can easily be done in Julia already: v\[1\] == v\[begin + 0\] For fun and the sake of it, here is a macro that does that translation for you :wink: using MacroTo…

---

## [Vectors of Unions between concrete type and singleton type](https://discourse.julialang.org/t/vectors-of-unions-between-concrete-type-and-singleton-type/101158)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 2\
**Last updated:** [July 4, 2023, 9:38am UTC](https://discourse.julialang.org/t/vectors-of-unions-between-concrete-type-and-singleton-type/101158 "2023-07-04T09:38:42Z")

</div>

According to the docs, Vector{Union{Missing, \<:Any}} can be fast fast because they use a special memory layout to mark “missing” fields. Is that special handling for missing, or is it true for Arrays of all singleton un…

---

## [Calling AVX-512 intrinsics from Julia](https://discourse.julialang.org/t/calling-avx-512-intrinsics-from-julia/101079)

<div class="topic-metadata">

**Author:** [@giacomogiudice](https://discourse.julialang.org/u/giacomogiudice)\
**Replies:** 6\
**Last updated:** [July 4, 2023, 8:45am UTC](https://discourse.julialang.org/t/calling-avx-512-intrinsics-from-julia/101079 "2023-07-04T08:45:48Z")

</div>

I am having trouble calling some AVX-512 intrinsics from Julia, coming directly from this post. The example on the blog post compiles and runs fine on the CPU, since it has the avx512\_bitalg CPU flag. The problematic i…

---

## [Name this method extension technique, piracy evasion](https://discourse.julialang.org/t/name-this-method-extension-technique-piracy-evasion/101099)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 21\
**Last updated:** [July 4, 2023, 7:42am UTC](https://discourse.julialang.org/t/name-this-method-extension-technique-piracy-evasion/101099 "2023-07-04T07:42:40Z")

</div>

Let’s say I want to change how Base.write works with a Base type, NTuple{N,UInt8} from a package. Currently, writing NTuple via Base.write errors. julia\> iob = IOBuffer() IOBuffer(data=UInt8\[...\], readable=true, writab…

---

## [Package update gets stalled for some reason](https://discourse.julialang.org/t/package-update-gets-stalled-for-some-reason/101153)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [July 4, 2023, 6:17am UTC](https://discourse.julialang.org/t/package-update-gets-stalled-for-some-reason/101153 "2023-07-04T06:17:50Z")

</div>

Nothing seems to happen when I run up, and on aborting the process with CTRL+C, this is what I find: (@v1.9) pkg\> up ^C^Cfatal: error thrown and no exception handler available. InterruptException() \_jl\_mutex\_unlock at /…

---

## [High order derivative of Flux.Chain network](https://discourse.julialang.org/t/high-order-derivative-of-flux-chain-network/101150)

<div class="topic-metadata">

**Author:** [@daybrown](https://discourse.julialang.org/u/daybrown)\
**Replies:** 1\
**Last updated:** [July 4, 2023, 5:43am UTC](https://discourse.julialang.org/t/high-order-derivative-of-flux-chain-network/101150 "2023-07-04T05:43:24Z")

</div>

using Zygote model = Chain( Dense(2, 8, σ), Dense(8, 1) ) xs = \[1,1\] g(x) = model(x)\[1\] g\_p(x,m) = Zygote.gradient(m → sum(m(x)), m)\[1\] g\_x(x,m) = Zygote.gradient(x → sum(m(x)), x)\[1\] g\_xx(x,m) = Zygote.diaghess…

---

## [Matrix operations with custom number type](https://discourse.julialang.org/t/matrix-operations-with-custom-number-type/101148)

<div class="topic-metadata">

**Author:** [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Replies:** 4\
**Last updated:** [July 4, 2023, 4:32am UTC](https://discourse.julialang.org/t/matrix-operations-with-custom-number-type/101148 "2023-07-04T04:32:17Z")

</div>

Given this definition of a custom number type: struct Node \<: Number end export Node Base.:\*(a::Node, b::Node) = Node() Base.:+(a::Node, b::Node) = Node() why does this julia\> a = Node();b=Node(); julia\> A = \[a b;a …

---

## [Wanting to know if VideoIO supports Alpha channels](https://discourse.julialang.org/t/wanting-to-know-if-videoio-supports-alpha-channels/101069)

<div class="topic-metadata">

**Author:** [@HarmonDavid](https://discourse.julialang.org/u/HarmonDavid)\
**Replies:** 1\
**Last updated:** [July 3, 2023, 8:50pm UTC](https://discourse.julialang.org/t/wanting-to-know-if-videoio-supports-alpha-channels/101069 "2023-07-03T20:50:31Z")

</div>

Like the title says, I am trying to find out if VideoIO can handle dealing with pixel data that uses the alpha channel.

---

## [UndefVarError: \`Random\` not defined](https://discourse.julialang.org/t/undefvarerror-random-not-defined/101142)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 1\
**Last updated:** [July 3, 2023, 8:38pm UTC](https://discourse.julialang.org/t/undefvarerror-random-not-defined/101142 "2023-07-03T20:38:44Z")

</div>

I tried to use the function with Random as below: init\_params = Float64.(ComponentArray(Lux.setup(Random.default\_rng(), chain)\[1\])) and I got the message: UndefVarError: \`Random\` not defined. Please help me to fix it. …

---

## [Compile-time type filtering from a tuple - is it possible?](https://discourse.julialang.org/t/compile-time-type-filtering-from-a-tuple-is-it-possible/101090)

<div class="topic-metadata">

**Author:** [@anicusan](https://discourse.julialang.org/u/anicusan)\
**Replies:** 5\
**Last updated:** [July 3, 2023, 4:29pm UTC](https://discourse.julialang.org/t/compile-time-type-filtering-from-a-tuple-is-it-possible/101090 "2023-07-03T16:29:39Z")

</div>

Hi all, I am developing a library where I would like to split some structs into, say, two categories based on their type; this is better shown as a minimal example: abstract type Vowel end abstract type Consonant end …

---

## [How to do in-place least square \`\\\`?](https://discourse.julialang.org/t/how-to-do-in-place-least-square/101131)

<div class="topic-metadata">

**Author:** [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Replies:** 5\
**Last updated:** [July 3, 2023, 4:09pm UTC](https://discourse.julialang.org/t/how-to-do-in-place-least-square/101131 "2023-07-03T16:09:20Z")

</div>

Suppose I want to solve the least square problem, I can just do x = A \\ b where A is a ‘tall’ matrix. Is there an in-place version for this? If I’m not mistaken it just performs a QR factorization behind the scene to sol…

---

## [R package JuliaCall does not work with Julia v1.9.1](https://discourse.julialang.org/t/r-package-juliacall-does-not-work-with-julia-v1-9-1/101134)

<div class="topic-metadata">

**Author:** [@\_stla](https://discourse.julialang.org/u/_stla)\
**Replies:** 3\
**Last updated:** [July 3, 2023, 3:44pm UTC](https://discourse.julialang.org/t/r-package-juliacall-does-not-work-with-julia-v1-9-1/101134 "2023-07-03T15:44:32Z")

</div>

Hello, In order to use the R package JuliaCall, one firstly had to run the command julia\_setup() in R. This command executes some Julia scripts. But it does not work. We get this error: julia\> ENV\["R\_HOME"\] = "C:/Users…

---

## [Need a function similar to python struct.unpack](https://discourse.julialang.org/t/need-a-function-similar-to-python-struct-unpack/100991)

<div class="topic-metadata">

**Author:** [@jjgomezcadenas](https://discourse.julialang.org/u/jjgomezcadenas)\
**Replies:** 12\
**Last updated:** [July 3, 2023, 3:15pm UTC](https://discourse.julialang.org/t/need-a-function-similar-to-python-struct-unpack/100991 "2023-07-03T15:15:23Z")

</div>

Hello everybody. I need to read binary file from a specific module (HydraHarp) which comes with python and matlab codes for decoding the file. The python code uses extensively the struct.unapck functions. For example: …

---

## [Gitlab ci cache julia packages](https://discourse.julialang.org/t/gitlab-ci-cache-julia-packages/8639)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 1\
**Last updated:** [July 3, 2023, 2:36pm UTC](https://discourse.julialang.org/t/gitlab-ci-cache-julia-packages/8639 "2023-07-03T14:36:20Z")

</div>

I have my own private gitlab server but probably this is general gitlab stuff. How can I cache my julia packages which are dependencies of the package I want to test? If I run Pkg.test("PkgName") everything gets saved …

---

## [Convert Packed Image Format into Planar Format without Dependency](https://discourse.julialang.org/t/convert-packed-image-format-into-planar-format-without-dependency/100784)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 7\
**Last updated:** [July 3, 2023, 1:03pm UTC](https://discourse.julialang.org/t/convert-packed-image-format-into-planar-format-without-dependency/100784 "2023-07-03T13:03:01Z")

</div>

I am loading images using FileIO.jl. I want to convert the output into a Planar Format of the appropriate element type. I want to achieve this without any farther dependencies, so channelview() as in Most idomatic way …

---

## [How to split a vector of complex into a real and an imag vector](https://discourse.julialang.org/t/how-to-split-a-vector-of-complex-into-a-real-and-an-imag-vector/101053)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 12\
**Last updated:** [July 3, 2023, 10:55am UTC](https://discourse.julialang.org/t/how-to-split-a-vector-of-complex-into-a-real-and-an-imag-vector/101053 "2023-07-03T10:55:42Z")

</div>

I have the following example: julia\> a=1+2im 1 + 2im julia\> A=a\*ones(3) 3-element Vector{ComplexF64}: 1.0 + 2.0im 1.0 + 2.0im 1.0 + 2.0im How can I can convert A into two vectors, a vector of the real values and a …

---

## [Adding test-specific dependencies](https://discourse.julialang.org/t/adding-test-specific-dependencies/101100)

<div class="topic-metadata">

**Author:** [@algunion](https://discourse.julialang.org/u/algunion)\
**Replies:** 5\
**Last updated:** [July 3, 2023, 9:55am UTC](https://discourse.julialang.org/t/adding-test-specific-dependencies/101100 "2023-07-03T09:55:56Z")

</div>

The Pkg documentation related to adding test-specific dependencies mentions the addition of the required packages under \[extras\] and \[target\] in the following way: \[extras\] Markdown = "d6f4376e-aef5-505a-96c1-9c02739460…

---

## [Sync'ing Julia packages between multiple machines](https://discourse.julialang.org/t/syncing-julia-packages-between-multiple-machines/101081)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 6\
**Last updated:** [July 3, 2023, 9:05am UTC](https://discourse.julialang.org/t/syncing-julia-packages-between-multiple-machines/101081 "2023-07-03T09:05:16Z")

</div>

Suppose you use multiple machines and personally manage your Julia environment. What do you do to sync packages between those machines? I’m not a “developer” and I don’t need serious version control at all. I’m happy w…

---

## [Solving A\*x=b in Nemo](https://discourse.julialang.org/t/solving-a-x-b-in-nemo/101051)

<div class="topic-metadata">

**Author:** [@blociss](https://discourse.julialang.org/u/blociss)\
**Replies:** 7\
**Last updated:** [July 3, 2023, 7:30am UTC](https://discourse.julialang.org/t/solving-a-x-b-in-nemo/101051 "2023-07-03T07:30:06Z")

</div>

Let A = \[1 0 0; 0 1 1; 0 3 0; 0 0 1\] a matrix of type 4×3 Matrix{QQFieldElem}: and Q=\[2 ,-3 , 1, 1\] of type 4-element Vector{QQFieldElem}: My goal is to compute A \\setminus Q but I got error MethodError: no m…

---

## [1x1 Matrix automatically converted to number](https://discourse.julialang.org/t/1x1-matrix-automatically-converted-to-number/101106)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 3\
**Last updated:** [July 3, 2023, 6:57am UTC](https://discourse.julialang.org/t/1x1-matrix-automatically-converted-to-number/101106 "2023-07-03T06:57:36Z")

</div>

I would like julia\> \[1; 0\]' \* \[1 0; 0 2\] \* \[1; 0\] 1 to return a 1x1 Matrix. Is there a more convenient syntax than julia\> Matrix(transpose(\[1; 0\])) \* \[1 0; 0 2\] \* \[1; 0\] 1-element Vector{Int64}: 1 which still does n…

---

## [Calculating Third (and Higher) Derivatives: ReverseDiff gives 0s while ForwardDiff works](https://discourse.julialang.org/t/calculating-third-and-higher-derivatives-reversediff-gives-0s-while-forwarddiff-works/101095)

<div class="topic-metadata">

**Author:** [@HappyQuokka](https://discourse.julialang.org/u/HappyQuokka)\
**Replies:** 1\
**Last updated:** [July 3, 2023, 2:14am UTC](https://discourse.julialang.org/t/calculating-third-and-higher-derivatives-reversediff-gives-0s-while-forwarddiff-works/101095 "2023-07-03T02:14:33Z")

</div>

I am trying to calculate the third derivative (tensor). ForwardDiff seems to work but is incredibly slow, also for lower orders. ReverseDiff, while fast for lower derivatives, doesn’t seem to work for third derivatives o…

---

## [Creating a Neural ODE in Lux that explicitly depends on time](https://discourse.julialang.org/t/creating-a-neural-ode-in-lux-that-explicitly-depends-on-time/101062)

<div class="topic-metadata">

**Author:** [@George\_Stepaniants](https://discourse.julialang.org/u/George_Stepaniants)\
**Replies:** 4\
**Last updated:** [July 2, 2023, 10:03pm UTC](https://discourse.julialang.org/t/creating-a-neural-ode-in-lux-that-explicitly-depends-on-time/101062 "2023-07-02T22:03:24Z")

</div>

Hello, I am very excited to use Lux for Neural ODE training but am having trouble understanding how to extend neural ODEs to accept time t as an argument. I noticed this thread: DiffEqFlux with time as additional input…

---

## [LogNormal calculation of standard deviation gets two different answers](https://discourse.julialang.org/t/lognormal-calculation-of-standard-deviation-gets-two-different-answers/101080)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 5\
**Last updated:** [July 2, 2023, 6:34pm UTC](https://discourse.julialang.org/t/lognormal-calculation-of-standard-deviation-gets-two-different-answers/101080 "2023-07-02T18:34:39Z")

</div>

I noticed that calculating the standard deviation of a LogNormal distribution directly or from a very large sample yields quite different results. This is not true for the mean. mulog = -12.0 sdlog = 3.0 dist = Distrib…

---

## [Mathematical Explanation of log(x^20) and 20 log(x) Plot](https://discourse.julialang.org/t/mathematical-explanation-of-log-x-20-and-20-log-x-plot/101075)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [July 2, 2023, 1:16pm UTC](https://discourse.julialang.org/t/mathematical-explanation-of-log-x-20-and-20-log-x-plot/101075 "2023-07-02T13:16:05Z")

</div>

Hi all, There is this weird thing since the formula saying that: log (a^b) = b log(a) But the plot says different: But if we use calculator, the plot is correct, since we can plot log((-5)^20) just the same as …

---

## [What is "incremental compilation" and what does it mean for it to be "broken"?](https://discourse.julialang.org/t/what-is-incremental-compilation-and-what-does-it-mean-for-it-to-be-broken/100956)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 16\
**Last updated:** [July 2, 2023, 9:30am UTC](https://discourse.julialang.org/t/what-is-incremental-compilation-and-what-does-it-mean-for-it-to-be-broken/100956 "2023-07-02T09:30:29Z")

</div>

I’ve seen posts talking about a warning “incremental compilation may be fatally broken for this module”. Sometimes it’s not clear why, sometimes it happens because they overwrote a method in a package. What does this mea…

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

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