# General Usage

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

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

**Page:** 689

---

## [Crash on access of EnsembleSolution](https://discourse.julialang.org/t/crash-on-access-of-ensemblesolution/48620)

<div class="topic-metadata">

**Author:** [@peatlux](https://discourse.julialang.org/u/peatlux)\
**Replies:** 8\
**Last updated:** [October 19, 2020, 1:09pm UTC](https://discourse.julialang.org/t/crash-on-access-of-ensemblesolution/48620 "2020-10-19T13:09:09Z")

</div>

Hello, I’ve experienced a crash of julia when I wanted to access my EnsembleSolution. The message told me to report the bug. Since I don’t know where to report it, I do it here. Below is my code to produce the EnsembleS…

---

## [Flux Can 2-Dimensional Input be fed into MLP columnwise for column output?](https://discourse.julialang.org/t/flux-can-2-dimensional-input-be-fed-into-mlp-columnwise-for-column-output/48622)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 0\
**Last updated:** [October 19, 2020, 11:23am UTC](https://discourse.julialang.org/t/flux-can-2-dimensional-input-be-fed-into-mlp-columnwise-for-column-output/48622 "2020-10-19T11:23:21Z")

</div>

I have an MLP with one output and I am using Flux. Is it possible to have an input of k columns of data and have each column applied to this same MLP so that the output is a column of size k? If so, and if the above r…

---

## [Generate a positive definite matrix](https://discourse.julialang.org/t/generate-a-positive-definite-matrix/48582)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 6\
**Last updated:** [October 19, 2020, 10:32am UTC](https://discourse.julialang.org/t/generate-a-positive-definite-matrix/48582 "2020-10-19T10:32:56Z")

</div>

How do I randomly generate a positive definite matrix？ What functions can directly implement this step？

---

## [Rethrow error from @async](https://discourse.julialang.org/t/rethrow-error-from-async/48609)

<div class="topic-metadata">

**Author:** [@kobied](https://discourse.julialang.org/u/kobied)\
**Replies:** 3\
**Last updated:** [October 19, 2020, 9:38am UTC](https://discourse.julialang.org/t/rethrow-error-from-async/48609 "2020-10-19T09:38:48Z")

</div>

hello, I need help understanding why the rethrow from an @async does not work. my test code is as follow: bad\_fun1() = error("this is error from bad\_fun1") function rethrow\_fun1() try bad\_fun1() catch…

---

## [How to calculate loss in a given time budget?](https://discourse.julialang.org/t/how-to-calculate-loss-in-a-given-time-budget/48369)

<div class="topic-metadata">

**Author:** [@Alec\_4](https://discourse.julialang.org/u/Alec_4)\
**Replies:** 6\
**Last updated:** [October 18, 2020, 10:26am UTC](https://discourse.julialang.org/t/how-to-calculate-loss-in-a-given-time-budget/48369 "2020-10-18T10:26:29Z")

</div>

Now i’d like to construct a Dataframe of loss values using different Optimizers in a given processing time budget, which should looks like below. But now my question is how to make this concrete? │ Row │ Optimizer │ 1…

---

## [The performance of saturating operations or adding intrinsics](https://discourse.julialang.org/t/the-performance-of-saturating-operations-or-adding-intrinsics/48575)

<div class="topic-metadata">

**Author:** [@kimikage](https://discourse.julialang.org/u/kimikage)\
**Replies:** 10\
**Last updated:** [October 19, 2020, 4:37am UTC](https://discourse.julialang.org/t/the-performance-of-saturating-operations-or-adding-intrinsics/48575 "2020-10-19T04:37:17Z")

</div>

I (we) will support saturating arithmetic in FixedPointNumbers.jl as an experimental feature until the API design is mature. (If you’re interested in the background and API design, you can also see: ) Since the additi…

---

## [Execute code in Julia Markdown in VS code](https://discourse.julialang.org/t/execute-code-in-julia-markdown-in-vs-code/48564)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 22\
**Last updated:** [October 19, 2020, 2:15am UTC](https://discourse.julialang.org/t/execute-code-in-julia-markdown-in-vs-code/48564 "2020-10-19T02:15:33Z")

</div>

For a Julia file, I can execute code with Alt+Enter. Is there a similar way, to do the same in a Markdown?

---

## [Just switched machines, got "ERROR: expected package \`IfElse \[615f187c\]\` to be registered"](https://discourse.julialang.org/t/just-switched-machines-got-error-expected-package-ifelse-615f187c-to-be-registered/48600)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 1\
**Last updated:** [October 19, 2020, 1:25am UTC](https://discourse.julialang.org/t/just-switched-machines-got-error-expected-package-ifelse-615f187c-to-be-registered/48600 "2020-10-19T01:25:11Z")

</div>

I just moved my project from one machine running Julia 1.5.1 to another machine running 1.5.2, and tried running \] instantiate. The first time I got an error: ERROR: expected package IfElse \[615f187c\] to be registered, b…

---

## [Why can't I get a symbol to interpolate when using ':(for outer $var ...)'](https://discourse.julialang.org/t/why-cant-i-get-a-symbol-to-interpolate-when-using-for-outer-var/45987)

<div class="topic-metadata">

**Author:** [@frtps](https://discourse.julialang.org/u/frtps)\
**Replies:** 10\
**Last updated:** [October 19, 2020, 12:51am UTC](https://discourse.julialang.org/t/why-cant-i-get-a-symbol-to-interpolate-when-using-for-outer-var/45987 "2020-10-19T00:51:02Z")

</div>

I am auto-generating Julia code and wish to construct an Expr for a for statement for which the iteration variable will be available in the enclosing scope (that’s the spec of the source language). For some reason julia…

---

## [Scope and anonymous functions](https://discourse.julialang.org/t/scope-and-anonymous-functions/48590)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 7\
**Last updated:** [October 18, 2020, 8:06pm UTC](https://discourse.julialang.org/t/scope-and-anonymous-functions/48590 "2020-10-18T20:06:10Z")

</div>

I need help :smiley: What is the difference between: function a() funcs = \[\] i = 1 for j=1:100 push!(funcs, (args...)-\>i) i += 1 end return funcs end b = a()…

---

## [How to use xformatter/yformatter in Plot to change the number to 2M (million) or 2K(thousands)](https://discourse.julialang.org/t/how-to-use-xformatter-yformatter-in-plot-to-change-the-number-to-2m-million-or-2k-thousands/48345)

<div class="topic-metadata">

**Author:** [@Kantvishu](https://discourse.julialang.org/u/Kantvishu)\
**Replies:** 1\
**Last updated:** [October 18, 2020, 7:48pm UTC](https://discourse.julialang.org/t/how-to-use-xformatter-yformatter-in-plot-to-change-the-number-to-2m-million-or-2k-thousands/48345 "2020-10-18T19:48:51Z")

</div>

Hi in the follwing figure I want to change my x-axis and y-axis number into format 2M (million) or 2K(thousands). How can I do it? I think I have to use xformatter or yformatter command but i don’t know how exactly I ca…

---

## [How do I build an executable from my (hello world) simple script?](https://discourse.julialang.org/t/how-do-i-build-an-executable-from-my-hello-world-simple-script/48595)

<div class="topic-metadata">

**Author:** [@vadrer](https://discourse.julialang.org/u/vadrer)\
**Replies:** 3\
**Last updated:** [October 18, 2020, 7:45pm UTC](https://discourse.julialang.org/t/how-do-i-build-an-executable-from-my-hello-world-simple-script/48595 "2020-10-18T19:45:50Z")

</div>

given that Julia executes as fast as C and internally compiles to machine code (except when in interpreted mode and thus using microlisp) - then I can easily get my binary? looking into command line options with julia -…

---

## [Behavior of cd() in Julia script](https://discourse.julialang.org/t/behavior-of-cd-in-julia-script/48532)

<div class="topic-metadata">

**Author:** [@ZZP12](https://discourse.julialang.org/u/ZZP12)\
**Replies:** 3\
**Last updated:** [October 18, 2020, 7:11pm UTC](https://discourse.julialang.org/t/behavior-of-cd-in-julia-script/48532 "2020-10-18T19:11:37Z")

</div>

Hi, I have a Julia script as below: generate\_default\_project("./default1") make\_julia\_model("./default1/Network.vff", "./default2") println(pwd()) cd("./default2/") println(pwd()) println("run t…

---

## [What controls if a an operator 1⊕2⊕3 is varadic](https://discourse.julialang.org/t/what-controls-if-a-an-operator-1-2-3-is-varadic/48593)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 3\
**Last updated:** [October 18, 2020, 6:32pm UTC](https://discourse.julialang.org/t/what-controls-if-a-an-operator-1-2-3-is-varadic/48593 "2020-10-18T18:32:31Z")

</div>

Contrast how + parses vs a custom operator: julia\> dump(:(1+2+3)) Expr head: Symbol call args: Array{Any}((4,)) 1: Symbol + 2: Int64 1 3: Int64 2 4: Int64 3 it becomes +(1,2,3) julia\> dump(:(1⊕2⊕3…

---

## [Why is there a performance penalty in evaluating the axes of an OffsetArray?](https://discourse.julialang.org/t/why-is-there-a-performance-penalty-in-evaluating-the-axes-of-an-offsetarray/48542)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 5\
**Last updated:** [October 18, 2020, 3:01pm UTC](https://discourse.julialang.org/t/why-is-there-a-performance-penalty-in-evaluating-the-axes-of-an-offsetarray/48542 "2020-10-18T15:01:10Z")

</div>

Currently evaluating the axes of an OffsetArray is considerably slower than that of an Array as the former uses a custom axis type that wraps the axes of the parent. I am trying to understand how to improve the performan…

---

## [Gnuplot: how to plot into an existing figure?](https://discourse.julialang.org/t/gnuplot-how-to-plot-into-an-existing-figure/48529)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 12\
**Last updated:** [October 18, 2020, 1:30am UTC](https://discourse.julialang.org/t/gnuplot-how-to-plot-into-an-existing-figure/48529 "2020-10-18T01:30:45Z")

</div>

For the Gnuplot aficionados here: Say I plot once into a terminal. Then I call another function and I would like that plot to be added to that existing terminal. Can I do that? I searched through two Gnuplot books, witho…

---

## [Wraping a MKL handle in julia](https://discourse.julialang.org/t/wraping-a-mkl-handle-in-julia/48241)

<div class="topic-metadata">

**Author:** [@j\_tanu](https://discourse.julialang.org/u/j_tanu)\
**Replies:** 16\
**Last updated:** [October 18, 2020, 2:51pm UTC](https://discourse.julialang.org/t/wraping-a-mkl-handle-in-julia/48241 "2020-10-18T14:51:09Z")

</div>

I am trying to implement mkl two-stage algorithm in Julia. “mkl\_sparse\_?\_create\_csc” function creates a handle for a matrix A in CSC format. In c language, the type of the handle is sparse\_matrix\_t. How to wrap this kind…

---

## [Improving dispatch in an event manager](https://discourse.julialang.org/t/improving-dispatch-in-an-event-manager/48569)

<div class="topic-metadata">

**Author:** [@Scott\_Hanna](https://discourse.julialang.org/u/Scott_Hanna)\
**Replies:** 1\
**Last updated:** [October 18, 2020, 1:00pm UTC](https://discourse.julialang.org/t/improving-dispatch-in-an-event-manager/48569 "2020-10-18T13:00:23Z")

</div>

Hello all, I’ve recently started building an event manager in Julia as part of a larger project. I’ve done this in OO languages before and I implemented a similar one in Julia. In such an event manager you have events…

---

## [MacroTools combinedef problem with master but not 1.5.2](https://discourse.julialang.org/t/macrotools-combinedef-problem-with-master-but-not-1-5-2/48534)

<div class="topic-metadata">

**Author:** [@Colin\_Beckingham](https://discourse.julialang.org/u/Colin_Beckingham)\
**Replies:** 3\
**Last updated:** [October 18, 2020, 10:15am UTC](https://discourse.julialang.org/t/macrotools-combinedef-problem-with-master-but-not-1-5-2/48534 "2020-10-18T10:15:26Z")

</div>

After recompile of master (Version 1.6.0-DEV.1262 (2020-10-17)) this morning I can no longer get MacroTools to work. It seems to work fine in 1.5.2 but test MacroTools fails with one error. MacroTools: Error During Test…

---

## [Constructor to delay array allocation in mutable struct](https://discourse.julialang.org/t/constructor-to-delay-array-allocation-in-mutable-struct/48574)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 2\
**Last updated:** [October 18, 2020, 6:28am UTC](https://discourse.julialang.org/t/constructor-to-delay-array-allocation-in-mutable-struct/48574 "2020-10-18T06:28:55Z")

</div>

Hi, I wish to define a mutable structure containing - among other things - an array mutable struct MyType values :: Matrix{Float} # stands for arbitrary Array of arbitrary data end I then wish to create a variab…

---

## [No method matching isless(::Array{Float64,2}, ::Array{Float64,2})](https://discourse.julialang.org/t/no-method-matching-isless-array-float64-2-array-float64-2/48086)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 1\
**Last updated:** [October 10, 2020, 3:12am UTC](https://discourse.julialang.org/t/no-method-matching-isless-array-float64-2-array-float64-2/48086 "2020-10-10T03:12:45Z")

</div>

When I call the Optimizer.jl package, the following error occurs: MethodError: no method matching isless(::Array{Float64,2}, ::Array{Float64,2}) Because of the size of my program, I can’t construct an example to repl…

---

## [@\_\_DIR\_\_ doesn't work properly within backtick \`...\` notation](https://discourse.julialang.org/t/dir-doesnt-work-properly-within-backtick-notation/48566)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 1\
**Last updated:** [October 18, 2020, 12:35am UTC](https://discourse.julialang.org/t/dir-doesnt-work-properly-within-backtick-notation/48566 "2020-10-18T00:35:55Z")

</div>

Consider the following script: # this is correct: println(@\_\_DIR\_\_) # but this is not, it's just the cwd: run(\`echo $(@\_\_DIR\_\_)\`) # but this works: foo = @\_\_DIR\_\_ run(\`echo $foo\`) I get /home/samuela/dev/research/ju…

---

## [Assign x values is plots](https://discourse.julialang.org/t/assign-x-values-is-plots/48516)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 10\
**Last updated:** [October 17, 2020, 9:31pm UTC](https://discourse.julialang.org/t/assign-x-values-is-plots/48516 "2020-10-17T21:31:06Z")

</div>

using Roots using Plots J=f(x)=x^2+10sin(x) g(x)=f(x)-1000 find\_zeros(g,0,10000) plot(J) The above works fine, but I want to plot a horizontal line at 1000, and plot J, so that x goes from 0 to 100. I’m not sure from…

---

## [Error creating Pkg.add("Plots") on v1.5.2-1 version](https://discourse.julialang.org/t/error-creating-pkg-add-plots-on-v1-5-2-1-version/48555)

<div class="topic-metadata">

**Author:** [@iandapaz](https://discourse.julialang.org/u/iandapaz)\
**Replies:** 0\
**Last updated:** [October 17, 2020, 7:51pm UTC](https://discourse.julialang.org/t/error-creating-pkg-add-plots-on-v1-5-2-1-version/48555 "2020-10-17T19:51:56Z")

</div>

I’m using Julia’s v1.5.2-1 version and I’m trying to plot a graphic. But when I use the command Pkg.add(“Plots”) a error message appears… Look…: julia\> Pkg.add(“Plots”) Updating registry at C:\\Users\\user\\.julia\\registr…

---

## [Flux - Has anyone ever gotten Custom Loss Functions to work with Zygote?](https://discourse.julialang.org/t/flux-has-anyone-ever-gotten-custom-loss-functions-to-work-with-zygote/48464)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 7\
**Last updated:** [October 17, 2020, 1:51pm UTC](https://discourse.julialang.org/t/flux-has-anyone-ever-gotten-custom-loss-functions-to-work-with-zygote/48464 "2020-10-17T13:51:26Z")

</div>

I am trying to train an MLP network with 1 output where the outputs are in various groups (as indicated by a stratification variable). I wish to normalise outputs within groups (as in softmax) before applying the loss f…

---

## [Multithreaded computation significantly slower](https://discourse.julialang.org/t/multithreaded-computation-significantly-slower/47474)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 18\
**Last updated:** [October 17, 2020, 1:06pm UTC](https://discourse.julialang.org/t/multithreaded-computation-significantly-slower/47474 "2020-10-17T13:06:50Z")

</div>

I have a numerical calculation (market clearing in a heterogeneous agent overlapping generations model) which is “embarrassingly parallel” in the sense that I can split it up to 10–30 parts that can run separately (the c…

---

## [Displaying outputs of @code\_lowered from two methods side by side](https://discourse.julialang.org/t/displaying-outputs-of-code-lowered-from-two-methods-side-by-side/48536)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [October 17, 2020, 9:39am UTC](https://discourse.julialang.org/t/displaying-outputs-of-code-lowered-from-two-methods-side-by-side/48536 "2020-10-17T09:39:45Z")

</div>

I am trying to compare the output of @code\_lowered from two methods of a function. It struck me that displaying them side by side would make it easier to compare them line-by-line. However something like this doesn’t see…

---

## [Benchmarking a function with side effects](https://discourse.julialang.org/t/benchmarking-a-function-with-side-effects/48531)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 2\
**Last updated:** [October 17, 2020, 4:59am UTC](https://discourse.julialang.org/t/benchmarking-a-function-with-side-effects/48531 "2020-10-17T04:59:52Z")

</div>

I want to compare push!ing an element to an Array with push!!ing an element to a Tuple using BenchmarkTools.jl and BangBang.jl: julia\> using BenchmarkTools, BangBang julia\> a = 1:20 |\> collect; julia\> b = Tuple(a); j…

---

## [I'm confused about methods](https://discourse.julialang.org/t/im-confused-about-methods/48508)

<div class="topic-metadata">

**Author:** [@klaff](https://discourse.julialang.org/u/klaff)\
**Replies:** 21\
**Last updated:** [October 16, 2020, 11:05pm UTC](https://discourse.julialang.org/t/im-confused-about-methods/48508 "2020-10-16T23:05:42Z")

</div>

This surprises me (particularly the part where f() evaluates to 1): julia\> begin f(a)=2 f(a,b)=3 f(;a,b)=4 f()=1 end f (generic function with 3 methods) julia\> methods…

---

## [Subplot problems with histograms](https://discourse.julialang.org/t/subplot-problems-with-histograms/48522)

<div class="topic-metadata">

**Author:** [@Dustin\_Hess](https://discourse.julialang.org/u/Dustin_Hess)\
**Replies:** 0\
**Last updated:** [October 16, 2020, 9:46pm UTC](https://discourse.julialang.org/t/subplot-problems-with-histograms/48522 "2020-10-16T21:46:36Z")

</div>

Hi Guys trying out the PoltlyJS package. I wanted to plot the classic iris data set. I was trying to build my own pairplot. However, plotlyJS gives some strange behavior. When I subplot the histogram it no longer overlay…

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

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