# Latest

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

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

**Page:** 1481

---

## [How to put filepath as title in plots?](https://discourse.julialang.org/t/how-to-put-filepath-as-title-in-plots/55841)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 5\
**Last updated:** [February 24, 2021, 12:21pm UTC](https://discourse.julialang.org/t/how-to-put-filepath-as-title-in-plots/55841 "2021-02-24T12:21:09Z")

</div>

Hello! Suppose I have a complete filepath on Windows: C:\\Users\\MyAccount\\My System Drive - On This PC\\FileYay.txt And when I need to load this file, I can simply do so by using raw infront of it, and it will escape pr…

---

## [How to save results for each outcome?](https://discourse.julialang.org/t/how-to-save-results-for-each-outcome/55914)

<div class="topic-metadata">

**Author:** [@younghan-lee](https://discourse.julialang.org/u/younghan-lee)\
**Replies:** 10\
**Last updated:** [February 24, 2021, 11:43am UTC](https://discourse.julialang.org/t/how-to-save-results-for-each-outcome/55914 "2021-02-24T11:43:34Z")

</div>

I am trying to save results for each outcome. For example, list = \[:A, :B\] for i in 1:length(list) result$i = lm((@eval @formula($i ~ x1 + x2)), data) end So that I can save the results for each outcome like resul…

---

## [Is there a way to restrict two fields in a struct to either be both \`AbstractTypeA](https://discourse.julialang.org/t/is-there-a-way-to-restrict-two-fields-in-a-struct-to-either-be-both-abstracttypea/55873)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [February 24, 2021, 9:41am UTC](https://discourse.julialang.org/t/is-there-a-way-to-restrict-two-fields-in-a-struct-to-either-be-both-abstracttypea/55873 "2021-02-24T09:41:52Z")

</div>

Is there a way to restrict two fields in a struct to either be both AbstractTypeA or both AbstractTypeB, but not necessarily the same concrete type? Note that the original poster on Slack cannot see your response here o…

---

## [Should + always be commutative?](https://discourse.julialang.org/t/should-always-be-commutative/55906)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 12\
**Last updated:** [February 24, 2021, 6:56am UTC](https://discourse.julialang.org/t/should-always-be-commutative/55906 "2021-02-24T06:56:46Z")

</div>

From the manual: While \* may seem like a surprising choice to users of languages that provide + for string concatenation, this use of \* has precedent in mathematics, particularly in abstract algebra. In mathematics, + …

---

## [Sum over arrays - What am I doing wrong?](https://discourse.julialang.org/t/sum-over-arrays-what-am-i-doing-wrong/55831)

<div class="topic-metadata">

**Author:** [@SubhadityaMukherjee](https://discourse.julialang.org/u/SubhadityaMukherjee)\
**Replies:** 6\
**Last updated:** [February 24, 2021, 6:37am UTC](https://discourse.julialang.org/t/sum-over-arrays-what-am-i-doing-wrong/55831 "2021-02-24T06:37:22Z")

</div>

Im trying to port a python numpy implementation of something into Julia and one step is import numpy as np np.random.rand(12,10) + np.random.rand(10) Output shape - (12, 10) but in Julia rand(12,10) + rand(10) throw…

---

## [Calculating hessian of a NN w.r.t params](https://discourse.julialang.org/t/calculating-hessian-of-a-nn-w-r-t-params/55911)

<div class="topic-metadata">

**Author:** [@stash-196](https://discourse.julialang.org/u/stash-196)\
**Replies:** 0\
**Last updated:** [February 24, 2021, 5:15am UTC](https://discourse.julialang.org/t/calculating-hessian-of-a-nn-w-r-t-params/55911 "2021-02-24T05:15:47Z")

</div>

How would you calculate a hessian of a Neural Network w.r.t. it’s parameters? For instance, a hessian of the loss function below using Flux: Chain, Dense, σ, crossentropy, params using Zygote model = Chain( x -\> re…

---

## [How to add two symmetric matrices inplace?](https://discourse.julialang.org/t/how-to-add-two-symmetric-matrices-inplace/55849)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [February 24, 2021, 5:24am UTC](https://discourse.julialang.org/t/how-to-add-two-symmetric-matrices-inplace/55849 "2021-02-24T05:24:02Z")

</div>

Symmetric matrices do not permit editing off-diagonal elements. I have two matrices S1 and S2 and I’m trying to evaluate S1 + S2 and save the result into S2. Typically S2 .+= S1 would achieve this but this doesn’t work f…

---

## [Finding function/method definition (in e.g. VSCode) and Intellisense](https://discourse.julialang.org/t/finding-function-method-definition-in-e-g-vscode-and-intellisense/55899)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [February 24, 2021, 12:04am UTC](https://discourse.julialang.org/t/finding-function-method-definition-in-e-g-vscode-and-intellisense/55899 "2021-02-24T00:04:04Z")

</div>

A. If I do: julia\> @which select(:chosen\_index; options=:drop\_down) (::Genie.Renderer.Html.var"#select##kw")(::Any, ::typeof(select), children, args...) in Genie.Renderer.Html at none:1 Long story short, I actually fo…

---

## [How to plot credible intervals for MCMCChains?](https://discourse.julialang.org/t/how-to-plot-credible-intervals-for-mcmcchains/55639)

<div class="topic-metadata">

**Author:** [@mkarikom](https://discourse.julialang.org/u/mkarikom)\
**Replies:** 3\
**Last updated:** [February 23, 2021, 11:58pm UTC](https://discourse.julialang.org/t/how-to-plot-credible-intervals-for-mcmcchains/55639 "2021-02-23T23:58:25Z")

</div>

Is there a way to get plots of intervals given mysample::MCMCChains.Chains? I’m looking for something like the following from stan:

---

## [How to plot a multivariate normal distribution?](https://discourse.julialang.org/t/how-to-plot-a-multivariate-normal-distribution/35486)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 6\
**Last updated:** [February 23, 2021, 11:37pm UTC](https://discourse.julialang.org/t/how-to-plot-a-multivariate-normal-distribution/35486 "2021-02-23T23:37:34Z")

</div>

Plotting univariate distributions is really simple: using Distributions using StatsPlots norm = fit(Normal, rand(100)) plot(norm) However, how would I plot a multivariate distribution? The above code doesn’t work for …

---

## ["Nullable" (really "Nothingable") Types](https://discourse.julialang.org/t/nullable-really-nothingable-types/55894)

<div class="topic-metadata">

**Author:** [@astrobc1](https://discourse.julialang.org/u/astrobc1)\
**Replies:** 3\
**Last updated:** [February 23, 2021, 11:27pm UTC](https://discourse.julialang.org/t/nullable-really-nothingable-types/55894 "2021-02-23T23:27:57Z")

</div>

I’m curious if there’s a proper Julian way to implement optional struct fields through an effective Union{T, Nothing}. I’ve written the macro below and it seems to work for my very simple test case. Is there a better wa…

---

## [What is the difference between Zygote vs ForwardDiff and ReverseDiff](https://discourse.julialang.org/t/what-is-the-difference-between-zygote-vs-forwarddiff-and-reversediff/55789)

<div class="topic-metadata">

**Author:** [@qft](https://discourse.julialang.org/u/qft)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 11:27pm UTC](https://discourse.julialang.org/t/what-is-the-difference-between-zygote-vs-forwarddiff-and-reversediff/55789 "2021-02-23T23:27:28Z")

</div>

As far as I can tell from the documentation, both ForwardDiff and ReverseDiff can already do automatic differentiation on arbitrary Julia functions. Also Zygote depends on ForwardDiff. What unique feature does Zygote bri…

---

## [Julia's applicable context is getting narrower over time?](https://discourse.julialang.org/t/julias-applicable-context-is-getting-narrower-over-time/55042)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 84\
**Last updated:** [February 23, 2021, 11:06pm UTC](https://discourse.julialang.org/t/julias-applicable-context-is-getting-narrower-over-time/55042 "2021-02-23T23:06:27Z")

</div>

I heard some Python guys said that Julia’s niche will get narrower over time. The argument is that the basic built-in functions of Python are written in C so they are faster than the Julia counterparts. For large package…

---

## [Help with filling dataframe](https://discourse.julialang.org/t/help-with-filling-dataframe/55839)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 9\
**Last updated:** [February 23, 2021, 10:39pm UTC](https://discourse.julialang.org/t/help-with-filling-dataframe/55839 "2021-02-23T22:39:31Z")

</div>

I’m having trouble with the code to fill a dataframe with some strings say the strings are defined as data = \["a\\tb","c\\td","e\\tf"\] a dataframe is preallocated as df = DataFrame(\[String, String\],\[:X,:Y\],3) I’m tryin…

---

## [How to use \`copy!\`(or other array operations) inside a CUDA kernel?](https://discourse.julialang.org/t/how-to-use-copy-or-other-array-operations-inside-a-cuda-kernel/55762)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 7\
**Last updated:** [February 23, 2021, 9:34pm UTC](https://discourse.julialang.org/t/how-to-use-copy-or-other-array-operations-inside-a-cuda-kernel/55762 "2021-02-23T21:34:09Z")

</div>

I want to copy a column of matrix Y to another matrix X inside a custom kernel in ONE thread. X = CUDA.rand(10, 5) Y = CUDA.rand(10, 5); The following possible methods have been tried. - Method 1: error function kern…

---

## [How to overload .=?](https://discourse.julialang.org/t/how-to-overload/55864)

<div class="topic-metadata">

**Author:** [@verseve](https://discourse.julialang.org/u/verseve)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 8:35pm UTC](https://discourse.julialang.org/t/how-to-overload/55864 "2021-02-23T20:35:06Z")

</div>

I would like to overload broadcasted assignment (.=). What is the correct way to do this, while still using .=? Is this possible?

---

## [Hi all I have this piece of multithreaded code, however it is only executing the f](https://discourse.julialang.org/t/hi-all-i-have-this-piece-of-multithreaded-code-however-it-is-only-executing-the-f/55878)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 8:33pm UTC](https://discourse.julialang.org/t/hi-all-i-have-this-piece-of-multithreaded-code-however-it-is-only-executing-the-f/55878 "2021-02-23T20:33:57Z")

</div>

Hi all I have this piece of multithreaded code, however it is only executing the first queue in \_queues. Could anyone give any pointer :slightly\_smiling\_face: ? function execute\_queues!() @async begin amqp\_c…

---

## [VegaLite.jl plot from multiple columns](https://discourse.julialang.org/t/vegalite-jl-plot-from-multiple-columns/55879)

<div class="topic-metadata">

**Author:** [@davide-f](https://discourse.julialang.org/u/davide-f)\
**Replies:** 0\
**Last updated:** [February 23, 2021, 7:38pm UTC](https://discourse.julialang.org/t/vegalite-jl-plot-from-multiple-columns/55879 "2021-02-23T19:38:35Z")

</div>

Dear Community, I would like to plot a stacked plot with VegaLite.jl and the stacked bars come from different columns. In particular, I would like to obtain a format like the one below, but with a different structure o…

---

## [Why? isa(\[(x,1),(y,1)\], Array{Tuple{Stuff,Number},1}) = false](https://discourse.julialang.org/t/why-isa-x-1-y-1-array-tuple-stuff-number-1-false/55777)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 25\
**Last updated:** [February 23, 2021, 6:51pm UTC](https://discourse.julialang.org/t/why-isa-x-1-y-1-array-tuple-stuff-number-1-false/55777 "2021-02-23T18:51:50Z")

</div>

Hello, I do not understand the output of this script: struct Stuff a end x = Stuff("x") y = Stuff("y") test1 = isa(1, Number) test2 = isa((x,1), Tuple{Stuff,Number}) test3 = isa(\[(x,1),(y,1)\], Array{Tuple{Stuff,N…

---

## [Initialize row vector multiple lines](https://discourse.julialang.org/t/initialize-row-vector-multiple-lines/55859)

<div class="topic-metadata">

**Author:** [@davide-f](https://discourse.julialang.org/u/davide-f)\
**Replies:** 5\
**Last updated:** [February 23, 2021, 7:07pm UTC](https://discourse.julialang.org/t/initialize-row-vector-multiple-lines/55859 "2021-02-23T19:07:05Z")

</div>

Dear Community, I am trying to achieve the same result of \[1 2 3\], with a code spanning over multiple lines, i.e. \[1 2 3\] However, the latter code returns a column vector. Since the population of the array is long,…

---

## [If I have a DataFrame and want to get \`unique\` columns but treat each column as a](https://discourse.julialang.org/t/if-i-have-a-dataframe-and-want-to-get-unique-columns-but-treat-each-column-as-a/55852)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 3:15pm UTC](https://discourse.julialang.org/t/if-i-have-a-dataframe-and-want-to-get-unique-columns-but-treat-each-column-as-a/55852 "2021-02-23T15:15:26Z")

</div>

if I have a DataFrame and want to get unique columns but treat each column as a separate entity, what is the best way to do it? MATLAB has a convenience argument unique(A(:,1:2),'rows') (yuk!) … but I can’t find an equi…

---

## [What (..) in variables and parameters means in ModelingToolkit](https://discourse.julialang.org/t/what-in-variables-and-parameters-means-in-modelingtoolkit/55874)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 0\
**Last updated:** [February 23, 2021, 6:39pm UTC](https://discourse.julialang.org/t/what-in-variables-and-parameters-means-in-modelingtoolkit/55874 "2021-02-23T18:39:02Z")

</div>

Transcribing part of a Slack conversation here (slackhole, Slack threads suck, etc): \[airpmb:\] Could you help me understand what the (..) syntax for variables and parameters declaration means? Docs say Note that @pa…

---

## [Status of "let" statements before Threads.@threads](https://discourse.julialang.org/t/status-of-let-statements-before-threads-threads/55813)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 6:33pm UTC](https://discourse.julialang.org/t/status-of-let-statements-before-threads-threads/55813 "2021-02-23T18:33:10Z")

</div>

Hello! I found myself using a lot of let statements before multi-threaded for-loops with the Threads.@threads command in my code. I wanted to know if these were still useful in the present version of julia now. Does an…

---

## [Write CSV with columns in a specific order](https://discourse.julialang.org/t/write-csv-with-columns-in-a-specific-order/55308)

<div class="topic-metadata">

**Author:** [@yogi1](https://discourse.julialang.org/u/yogi1)\
**Replies:** 4\
**Last updated:** [February 23, 2021, 3:17pm UTC](https://discourse.julialang.org/t/write-csv-with-columns-in-a-specific-order/55308 "2021-02-23T15:17:21Z")

</div>

Hi all, I currently have some code which reads in a csv and does some manipulation and I want to then output my new dataframe in a specific order by column. Currently I have column headers from the input: Country, Reg…

---

## [How to list all methods defined in a file, including extension methods](https://discourse.julialang.org/t/how-to-list-all-methods-defined-in-a-file-including-extension-methods/55855)

<div class="topic-metadata">

**Author:** [@maajdl](https://discourse.julialang.org/u/maajdl)\
**Replies:** 0\
**Last updated:** [February 23, 2021, 2:36pm UTC](https://discourse.julialang.org/t/how-to-list-all-methods-defined-in-a-file-including-extension-methods/55855 "2021-02-23T14:36:01Z")

</div>

Hello, I already found here a trick for how to list functions defined in a given Julia file: I can go further for methods using methods(f, \[types\], \[module\]) . However, I can’t figure out how to also get the extens…

---

## [Question) How can I multiply a vector to a stochastic matrix?](https://discourse.julialang.org/t/question-how-can-i-multiply-a-vector-to-a-stochastic-matrix/55782)

<div class="topic-metadata">

**Author:** [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Replies:** 12\
**Last updated:** [February 23, 2021, 2:14pm UTC](https://discourse.julialang.org/t/question-how-can-i-multiply-a-vector-to-a-stochastic-matrix/55782 "2021-02-23T14:14:26Z")

</div>

I finally managed to use tauchen function. However, the type of outcome is Discrete Markov Chain stochastic matrix of type Array{Float64,2}: I tried to multiply a scalar, a vector, or any kind of algebra on it, but Juli…

---

## [Error adding package to Julia](https://discourse.julialang.org/t/error-adding-package-to-julia/55845)

<div class="topic-metadata">

**Author:** [@thommasmont](https://discourse.julialang.org/u/thommasmont)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 1:55pm UTC](https://discourse.julialang.org/t/error-adding-package-to-julia/55845 "2021-02-23T13:55:02Z")

</div>

I am a Windows user I installed julia 1.5.3 and when I add the package JuMP notifies me of this error, if we can help thank you. (@v1.5) pkg\> up No Changes to C:\\Users\\Usuario\\.julia\\environments\\v1.5\\Project.toml No …

---

## [Fast hamming distance function in Julia that returns a distance matrix](https://discourse.julialang.org/t/fast-hamming-distance-function-in-julia-that-returns-a-distance-matrix/55716)

<div class="topic-metadata">

**Author:** [@giac](https://discourse.julialang.org/u/giac)\
**Replies:** 12\
**Last updated:** [February 21, 2021, 6:20pm UTC](https://discourse.julialang.org/t/fast-hamming-distance-function-in-julia-that-returns-a-distance-matrix/55716 "2021-02-21T18:20:28Z")

</div>

I am trying to compute the hamming distance on a very large dataset. I need to get back a distance matrix between rows in order to run further analysis on this matrix. For my purposes, it is useful that the data are sto…

---

## [Using array elements as input for IterTools.product()](https://discourse.julialang.org/t/using-array-elements-as-input-for-itertools-product/55843)

<div class="topic-metadata">

**Author:** [@Lucalino](https://discourse.julialang.org/u/Lucalino)\
**Replies:** 1\
**Last updated:** [February 23, 2021, 12:05pm UTC](https://discourse.julialang.org/t/using-array-elements-as-input-for-itertools-product/55843 "2021-02-23T12:05:54Z")

</div>

Hi, I want to take elements of an array of arrays like \[ \[list1\] , \[list2\] , \[list3\] \] and feed them as input into IterTools.product(), so that I obtain IterTools.product( \[list1\] , \[list2\] , \[list3\] ) which can be exec…

---

## [Evaluate Piecewise Functions Effciently](https://discourse.julialang.org/t/evaluate-piecewise-functions-effciently/55832)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 3\
**Last updated:** [February 23, 2021, 11:54am UTC](https://discourse.julialang.org/t/evaluate-piecewise-functions-effciently/55832 "2021-02-23T11:54:46Z")

</div>

Dear all, I have a very basic (maybe stupid) question. I need to evaluate a piecewise function many times. My naive approach is to do something like: function myPiecewise(a,b) if a \< 0 return 0.5\*a + b else …

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

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