# Latest

**URL:** https://discourse.julialang.org/latest.md?page=672

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

**Page:** 673

---

## [How to calculate the Hessian vector product in a Flux model?](https://discourse.julialang.org/t/how-to-calculate-the-hessian-vector-product-in-a-flux-model/100215)

<div class="topic-metadata">

**Author:** [@taizoooo](https://discourse.julialang.org/u/taizoooo)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 8:42pm UTC](https://discourse.julialang.org/t/how-to-calculate-the-hessian-vector-product-in-a-flux-model/100215 "2023-06-13T20:42:26Z")

</div>

Hello. I implemented the Hessian vector product referring to the following link: Hessian Vector Products on GPU using ForwardDiff, Zygote, and Flux. The implementation works correctly on both CPU and GPU for a flux mod…

---

## [When using channels, errors do not get raised, and computation stalls](https://discourse.julialang.org/t/when-using-channels-errors-do-not-get-raised-and-computation-stalls/100291)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 3\
**Last updated:** [June 13, 2023, 8:18pm UTC](https://discourse.julialang.org/t/when-using-channels-errors-do-not-get-raised-and-computation-stalls/100291 "2023-06-13T20:18:54Z")

</div>

This is intended behavior, a known issue, or an unknown bug? julia\> function test() buff = Channel{Int}(3) for \_ in 1:3 put!(buff, 0) end @sync for \_ in 1:3…

---

## [I am confused using tanh(M)](https://discourse.julialang.org/t/i-am-confused-using-tanh-m/32247)

<div class="topic-metadata">

**Author:** [@floriano](https://discourse.julialang.org/u/floriano)\
**Replies:** 6\
**Last updated:** [December 22, 2019, 10:56am UTC](https://discourse.julialang.org/t/i-am-confused-using-tanh-m/32247 "2019-12-22T10:56:57Z")

</div>

Hello, I am pritty new to Julia and try to find my first steps. I am a bit confused now. In Python I had this (simplyfied) piece of code: import numpy as np a = \[\[1,2\], \[3,4\]\] M = np.array(a) np.tanh(M) It brings me…

---

## [Multithreading with shared memory caches](https://discourse.julialang.org/t/multithreading-with-shared-memory-caches/100194)

<div class="topic-metadata">

**Author:** [@joaquinpelle](https://discourse.julialang.org/u/joaquinpelle)\
**Replies:** 27\
**Last updated:** [June 13, 2023, 6:46pm UTC](https://discourse.julialang.org/t/multithreading-with-shared-memory-caches/100194 "2023-06-13T18:46:25Z")

</div>

Hi there, I have a loop that uses a cache array to avoid excessive memory allocations. The structure is captured in the following example: A = rand(10000) B = similar(A) cache = zeros(3) for i in eachindex(A) f!(ca…

---

## [Extract vector value of affine and solve operator in FE](https://discourse.julialang.org/t/extract-vector-value-of-affine-and-solve-operator-in-fe/100295)

<div class="topic-metadata">

**Author:** [@mary](https://discourse.julialang.org/u/mary)\
**Replies:** 0\
**Last updated:** [June 13, 2023, 6:40pm UTC](https://discourse.julialang.org/t/extract-vector-value-of-affine-and-solve-operator-in-fe/100295 "2023-06-13T18:40:06Z")

</div>

Hi, I need the vector values of an affine operator and solve. to get this i used op\_Disp = AffineFEOperator(a\_Disp ,b\_Disp ,fem\_params.U\_Disp ,fem\_params.V0\_Disp) uh\_out = solve(op\_Disp) return get\_free\_dof\_val…

---

## [How to create local copy of Sockets to get at source to determine code path for error codes](https://discourse.julialang.org/t/how-to-create-local-copy-of-sockets-to-get-at-source-to-determine-code-path-for-error-codes/100292)

<div class="topic-metadata">

**Author:** [@schaefer0](https://discourse.julialang.org/u/schaefer0)\
**Replies:** 2\
**Last updated:** [June 13, 2023, 6:37pm UTC](https://discourse.julialang.org/t/how-to-create-local-copy-of-sockets-to-get-at-source-to-determine-code-path-for-error-codes/100292 "2023-06-13T18:37:40Z")

</div>

The intent is to convert an error code to an error message. All errors return Unknown System Error julia\>Sockets.DNSError(“nebula.mit.edu”,2) DNSError: nebula.mit.edu, Unknown system error 2 (Unknown system error 2) I…

---

## [Zygote.jl: How to get the gradient of sparse matrix](https://discourse.julialang.org/t/zygote-jl-how-to-get-the-gradient-of-sparse-matrix/59067)

<div class="topic-metadata">

**Author:** [@Richard-Li](https://discourse.julialang.org/u/Richard-Li)\
**Replies:** 11\
**Last updated:** [June 13, 2023, 5:17pm UTC](https://discourse.julialang.org/t/zygote-jl-how-to-get-the-gradient-of-sparse-matrix/59067 "2023-06-13T17:17:20Z")

</div>

Hi there, I am trying to differentiate through sparse matrix, and here is the MWE: using LinearAlgebra using SparseArrays using ChainRulesCore using Zygote Zygote.@adjoint function SparseMatrixCSC{T,N}(arr) where {T,N}…

---

## [How to use \`precondprep\` with \`Optim.jl\`?](https://discourse.julialang.org/t/how-to-use-precondprep-with-optim-jl/100288)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 0\
**Last updated:** [June 13, 2023, 3:57pm UTC](https://discourse.julialang.org/t/how-to-use-precondprep-with-optim-jl/100288 "2023-06-13T15:57:13Z")

</div>

How do I use precondprep within Optim.jl to use a preconditioner that changes at each step? The results of the function seem to be ignored in my attempts. Example: using Optim res = optimize(x-\>(x\[1\]-1)^4 + x\[2\]^2, \[2.;…

---

## [New pre-release distribution method for the Julia VS Code extension](https://discourse.julialang.org/t/new-pre-release-distribution-method-for-the-julia-vs-code-extension/88313)

<div class="topic-metadata">

**Author:** [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Replies:** 2\
**Last updated:** [June 13, 2023, 4:13pm UTC](https://discourse.julialang.org/t/new-pre-release-distribution-method-for-the-julia-vs-code-extension/88313 "2023-06-13T16:13:54Z")

</div>

We just changed how we distribute pre-release versions of the Julia extension for VS Code. In the past we had a separate extension in the VS Code marketplace that was called Julia Insider for this purpose. That insider e…

---

## [What do people think about pair programming?](https://discourse.julialang.org/t/what-do-people-think-about-pair-programming/99476)

<div class="topic-metadata">

**Author:** [@Kirby\_Zhang](https://discourse.julialang.org/u/Kirby_Zhang)\
**Replies:** 3\
**Last updated:** [June 13, 2023, 3:42pm UTC](https://discourse.julialang.org/t/what-do-people-think-about-pair-programming/99476 "2023-06-13T15:42:47Z")

</div>

According to research PP produces better code while not reducing productivity. Why CI is BETTER Than Feature Branching - YouTube I made some notes about how I’d like to do pair programming, especially in a remote work …

---

## [Announcing Genie Cloud (Private Beta), the no-code platform to quickly build and deploy Genie apps](https://discourse.julialang.org/t/announcing-genie-cloud-private-beta-the-no-code-platform-to-quickly-build-and-deploy-genie-apps/96522)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 3:33pm UTC](https://discourse.julialang.org/t/announcing-genie-cloud-private-beta-the-no-code-platform-to-quickly-build-and-deploy-genie-apps/96522 "2023-06-13T15:33:41Z")

</div>

Hi everyone! I’m super happy to announce the private beta release of Genie Cloud, the no-code platform to quickly build and deploy Genie web apps. With Genie Cloud, anybody can build a Julia web app in just a few simpl…

---

## [Is there an attribute to shorten the arrow tail at the tail?](https://discourse.julialang.org/t/is-there-an-attribute-to-shorten-the-arrow-tail-at-the-tail/99982)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 3:08pm UTC](https://discourse.julialang.org/t/is-there-an-attribute-to-shorten-the-arrow-tail-at-the-tail/99982 "2023-06-13T15:08:34Z")

</div>

I’m reading Eugenia Cheng’s book The Joy of Abstraction - An Exploration of Math, Category Theory, and Life. On page 61 there is an interesting diagram of all the order permutations of the multiplication 2 \* 3 \* 5 = 30 t…

---

## [Dictionary for random effects in MultiLevel.jl model](https://discourse.julialang.org/t/dictionary-for-random-effects-in-multilevel-jl-model/24515)

<div class="topic-metadata">

**Author:** [@spinkney](https://discourse.julialang.org/u/spinkney)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 2:47pm UTC](https://discourse.julialang.org/t/dictionary-for-random-effects-in-multilevel-jl-model/24515 "2023-06-13T14:47:40Z")

</div>

Coming from an R background and lme4. I have 210 market\_no’s and I’m fitting a logistic regression with a varying intercept on market\_no’s. I can’t seem to find the match between the market\_no’s and the fit random effect…

---

## [In theory, what exactly is difference between MCMCThreads and MCMCDistributed?](https://discourse.julialang.org/t/in-theory-what-exactly-is-difference-between-mcmcthreads-and-mcmcdistributed/100284)

<div class="topic-metadata">

**Author:** [@Sahil\_Khan](https://discourse.julialang.org/u/Sahil_Khan)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 2:30pm UTC](https://discourse.julialang.org/t/in-theory-what-exactly-is-difference-between-mcmcthreads-and-mcmcdistributed/100284 "2023-06-13T14:30:08Z")

</div>

Can someone explain MCMCThreads and MCMCDistributed?

---

## [Access to underlying GridSpace grid cells](https://discourse.julialang.org/t/access-to-underlying-gridspace-grid-cells/99338)

<div class="topic-metadata">

**Author:** [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Replies:** 5\
**Last updated:** [June 13, 2023, 1:53pm UTC](https://discourse.julialang.org/t/access-to-underlying-gridspace-grid-cells/99338 "2023-06-13T13:53:26Z")

</div>

Beginner user of Agents.jl here … With a space defined as space = GridSpaceSingle(..., is it possible to access the underlying grid and its cells in some way, so as to be able to store and retrieve information, eg abou…

---

## [Practical use for the \`only\` function?](https://discourse.julialang.org/t/practical-use-for-the-only-function/100280)

<div class="topic-metadata">

**Author:** [@frylock](https://discourse.julialang.org/u/frylock)\
**Replies:** 2\
**Last updated:** [June 13, 2023, 1:13pm UTC](https://discourse.julialang.org/t/practical-use-for-the-only-function/100280 "2023-06-13T13:13:47Z")

</div>

I’ve tried to search around github a bit, but only is a pretty common word. Can someone give me an example of a practical use for this function?

---

## [Genetic Algorithm packages](https://discourse.julialang.org/t/genetic-algorithm-packages/100159)

<div class="topic-metadata">

**Author:** [@jonathanfischer97](https://discourse.julialang.org/u/jonathanfischer97)\
**Replies:** 12\
**Last updated:** [June 13, 2023, 12:58pm UTC](https://discourse.julialang.org/t/genetic-algorithm-packages/100159 "2023-06-13T12:58:52Z")

</div>

For those who run genetic algorithms or similar optimizations methods in Julia, which package do you use? I’ve been using Evolutionary.jl and it works well, but am wondering there are any alternatives worth checking out…

---

## [Sampling from a probability distribution on GPU](https://discourse.julialang.org/t/sampling-from-a-probability-distribution-on-gpu/94389)

<div class="topic-metadata">

**Author:** [@ArjunNarayanan](https://discourse.julialang.org/u/ArjunNarayanan)\
**Replies:** 13\
**Last updated:** [June 13, 2023, 12:52pm UTC](https://discourse.julialang.org/t/sampling-from-a-probability-distribution-on-gpu/94389 "2023-06-13T12:52:00Z")

</div>

I’m interested in doing something like using Distributions: Categorical using CUDA p = cu(\[0.7,0.2,0.1\]) idx = rand(Categorical(p)) Is there a way to sample from a vector of probability masses on the GPU? This kind of…

---

## [How to get a handle to the Terminal](https://discourse.julialang.org/t/how-to-get-a-handle-to-the-terminal/99592)

<div class="topic-metadata">

**Author:** [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)\
**Replies:** 2\
**Last updated:** [June 13, 2023, 11:05am UTC](https://discourse.julialang.org/t/how-to-get-a-handle-to-the-terminal/99592 "2023-06-13T11:05:50Z")

</div>

Let’s say I want to clear my terminal programmatically, i.e. not with Ctrl+l, but by running Julia code. I can do the following: import REPL julia\> t = REPL.Terminals.TTYTerminal(string(), stdin, stdout, stderr) REPL.Te…

---

## [Custom Iterator with one big computation at the begin + in place operation at every iterations](https://discourse.julialang.org/t/custom-iterator-with-one-big-computation-at-the-begin-in-place-operation-at-every-iterations/100045)

<div class="topic-metadata">

**Author:** [@dmetivie](https://discourse.julialang.org/u/dmetivie)\
**Replies:** 2\
**Last updated:** [June 13, 2023, 11:44am UTC](https://discourse.julialang.org/t/custom-iterator-with-one-big-computation-at-the-begin-in-place-operation-at-every-iterations/100045 "2023-06-13T11:44:15Z")

</div>

I am trying to build a custom iterator for the QuasiMonteCarlo.jl package. I did not find an example doing the kind of things I want. I need first to generate 3 big matrices for 1:M “randomize” in place these matr…

---

## [We don't know how to parse constraints containing expressions of type :generator](https://discourse.julialang.org/t/we-dont-know-how-to-parse-constraints-containing-expressions-of-type-generator/100270)

<div class="topic-metadata">

**Author:** [@A.Marx](https://discourse.julialang.org/u/A.Marx)\
**Replies:** 3\
**Last updated:** [June 13, 2023, 8:53am UTC](https://discourse.julialang.org/t/we-dont-know-how-to-parse-constraints-containing-expressions-of-type-generator/100270 "2023-06-13T08:53:49Z")

</div>

I am trying to set up the following dispatch optimization problem. However, the capacity constraints gives me the error: \`@constraint(m, \[t in time\], (cfD\[:p\] \>= y\[p, t\] for p = plants))\`: Unsupported constraint express…

---

## [Question on simple performance comparison between Python and Julia](https://discourse.julialang.org/t/question-on-simple-performance-comparison-between-python-and-julia/100225)

<div class="topic-metadata">

**Author:** [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Replies:** 23\
**Last updated:** [June 13, 2023, 8:38am UTC](https://discourse.julialang.org/t/question-on-simple-performance-comparison-between-python-and-julia/100225 "2023-06-13T08:38:12Z")

</div>

I ran the following for loops with Python and Julia respectively on the terminal by commands python test.py and julia test.jl, but it turned out that Python (≈ 37 sec) spent less time than Julia (≈ 52 sec). Why? test.py…

---

## [Why running remote ssh cmd in threads is still blocked?](https://discourse.julialang.org/t/why-running-remote-ssh-cmd-in-threads-is-still-blocked/100262)

<div class="topic-metadata">

**Author:** [@peng](https://discourse.julialang.org/u/peng)\
**Replies:** 8\
**Last updated:** [June 13, 2023, 7:04am UTC](https://discourse.julialang.org/t/why-running-remote-ssh-cmd-in-threads-is-still-blocked/100262 "2023-06-13T07:04:48Z")

</div>

Hi there, I want to run some commands on remote machine. I use julia to manage my commands. To avoid blocking in main threads, I run the commands in a spawned thread.For example: cmd = """ sleep 3 echo Hello """ Threads…

---

## [Running neural ODE on measurement](https://discourse.julialang.org/t/running-neural-ode-on-measurement/100179)

<div class="topic-metadata">

**Author:** [@Ordens\_Ritter](https://discourse.julialang.org/u/Ordens_Ritter)\
**Replies:** 7\
**Last updated:** [June 13, 2023, 6:33am UTC](https://discourse.julialang.org/t/running-neural-ode-on-measurement/100179 "2023-06-13T06:33:43Z")

</div>

I am trying get a neural ODE working, that doesn’t have a function/ode as input but a measurement. I want to apply the neural ODE to get the original function expressed by the measurement and not the derivative. I am t…

---

## [\[ANN\] SumTypes.jl v0.4](https://discourse.julialang.org/t/ann-sumtypes-jl-v0-4/97038)

<div class="topic-metadata">

**Author:** [@Mason](https://discourse.julialang.org/u/Mason)\
**Replies:** 21\
**Last updated:** [June 13, 2023, 4:13am UTC](https://discourse.julialang.org/t/ann-sumtypes-jl-v0-4/97038 "2023-06-13T04:13:49Z")

</div>

I recently started tinkering with SumTypes.jl again, and it led to a flurry of refactors and overhauls and I think the package is now getting into some pretty interesting territory. I see this package as a proof of conc…

---

## [Why does the following setindex call allocate?](https://discourse.julialang.org/t/why-does-the-following-setindex-call-allocate/100216)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 6\
**Last updated:** [June 12, 2023, 10:15am UTC](https://discourse.julialang.org/t/why-does-the-following-setindex-call-allocate/100216 "2023-06-12T10:15:04Z")

</div>

julia\> function f!(v, A, r) v\[eachindex(r)\] = @view A\[r\] v end f! (generic function with 1 method) julia\> v = zeros(10); A = ones(4,10); julia\> @btime f!($v, $A, 4:3:13); 56.050 ns (2 all…

---

## [Create a out-of-place form for ODE over than 1 function](https://discourse.julialang.org/t/create-a-out-of-place-form-for-ode-over-than-1-function/100155)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 5\
**Last updated:** [June 13, 2023, 3:14am UTC](https://discourse.julialang.org/t/create-a-out-of-place-form-for-ode-over-than-1-function/100155 "2023-06-13T03:14:43Z")

</div>

The tutorial of neuralPDE to solve the ODE system just has a simple function, and the optimizer just supports out-of-place form only. How could implement the ODE system with 2 or more functions? For example. du\[1\] = co…

---

## [DiffEqFlux.initial\_params not defined](https://discourse.julialang.org/t/diffeqflux-initial-params-not-defined/100156)

<div class="topic-metadata">

**Author:** [@Reza\_AO](https://discourse.julialang.org/u/Reza_AO)\
**Replies:** 3\
**Last updated:** [June 13, 2023, 2:08am UTC](https://discourse.julialang.org/t/diffeqflux-initial-params-not-defined/100156 "2023-06-13T02:08:20Z")

</div>

Hi I want to run a PINN code on my GPU. I used to use the code below to run the code on my GPU and I also want to use QuasiRanodmTraining. initθ = DiffEqFlux.initial\_params(chain) |\> gpu I get the error below: ERROR…

---

## [How to pick out selected output components of a named tuple?](https://discourse.julialang.org/t/how-to-pick-out-selected-output-components-of-a-named-tuple/100209)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 13\
**Last updated:** [June 13, 2023, 1:50am UTC](https://discourse.julialang.org/t/how-to-pick-out-selected-output-components-of-a-named-tuple/100209 "2023-06-13T01:50:50Z")

</div>

I have a function f() = (a=1, b=2, c=3) , and I can pick out one of the returned components of the tuple as julia\> f().a 1 Can I select in this way a and at the same time c? In other words, I would l…

---

## [Writing matrix in Julia](https://discourse.julialang.org/t/writing-matrix-in-julia/100253)

<div class="topic-metadata">

**Author:** [@Umishra](https://discourse.julialang.org/u/Umishra)\
**Replies:** 1\
**Last updated:** [June 13, 2023, 1:19am UTC](https://discourse.julialang.org/t/writing-matrix-in-julia/100253 "2023-06-13T01:19:18Z")

</div>

I wanted to write matrix for the total coin angular momentum with the following code mvalues = -j:1:j cardinality = length(mvalues) Jminus is zero except for directly above the diagonal There is an implicit \\hbar & sq…

[Previous page](https://discourse.julialang.org/latest.md?page=671)

[Next page](https://discourse.julialang.org/latest.md?page=673)
