# General Usage

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

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

**Page:** 637

---

## [Plans to port SLICOT Toeplitz solvers to Julia?](https://discourse.julialang.org/t/plans-to-port-slicot-toeplitz-solvers-to-julia/55996)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 5\
**Last updated:** [February 26, 2021, 6:35pm UTC](https://discourse.julialang.org/t/plans-to-port-slicot-toeplitz-solvers-to-julia/55996 "2021-02-26T18:35:53Z")

</div>

I saw that the MatrixEquations.jl package was released to reproduce some solvers related to Riccati and Lyapunov equations, linked with the SLICOT library. Are there any plans to link the Toeplitz specialized solvers fr…

---

## [Julia Distributed, AllReduce, and Distributed Training](https://discourse.julialang.org/t/julia-distributed-allreduce-and-distributed-training/55808)

<div class="topic-metadata">

**Author:** [@asaxton](https://discourse.julialang.org/u/asaxton)\
**Replies:** 3\
**Last updated:** [February 26, 2021, 6:31pm UTC](https://discourse.julialang.org/t/julia-distributed-allreduce-and-distributed-training/55808 "2021-02-26T18:31:03Z")

</div>

I’m working with Distributed Julia on multiple hosts and want to write some code that does distributed training with a machine learning model and distributed data. I don’t want to use MPI. I have the ClusterManager worki…

---

## [Optimizing a Loss Function that takes arguments in addition to parameters](https://discourse.julialang.org/t/optimizing-a-loss-function-that-takes-arguments-in-addition-to-parameters/56040)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 2\
**Last updated:** [February 26, 2021, 5:48pm UTC](https://discourse.julialang.org/t/optimizing-a-loss-function-that-takes-arguments-in-addition-to-parameters/56040 "2021-02-26T17:48:03Z")

</div>

If I have a loss function that I want to use for optimizing a set of parameters, can that function take additional arguments as well (e.g., arrays that might vary in size, and boolean statements)? If the answer is “yes”…

---

## [How to use for loop or collection in SemialgebraicSets?](https://discourse.julialang.org/t/how-to-use-for-loop-or-collection-in-semialgebraicsets/56106)

<div class="topic-metadata">

**Author:** [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Replies:** 0\
**Last updated:** [February 26, 2021, 6:11pm UTC](https://discourse.julialang.org/t/how-to-use-for-loop-or-collection-in-semialgebraicsets/56106 "2021-02-26T18:11:31Z")

</div>

I’m trying to specify a semialgebraic set in a SumofSquare model: @set vec(A\*vec\_x1)\[1\]\>=0 && vec(A\*vec\_x1)\[2\] && vec(A\*vec\_x1)\[3\]\>=0&&vec(A\*vec\_x1)\[4\] where A is a two-dimensional polyvar, vec\_x1 is a constant vector.…

---

## [Hi everyone, hope this is the right channel. New to Julia, long-time R user. I am](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 3\
**Last updated:** [February 26, 2021, 6:07pm UTC](https://discourse.julialang.org/t/hi-everyone-hope-this-is-the-right-channel-new-to-julia-long-time-r-user-i-am/56087 "2021-02-26T18:07:43Z")

</div>

Hi everyone, hope this is the right channel. New to Julia, long-time R user. I am looking for the equivalent of R’s approxfun in Julia and its use in ODE systems (as in here: https://tpetzoldt.github.io/deSolve-forcing/d…

---

## [Reduce order of differential equations to first-order](https://discourse.julialang.org/t/reduce-order-of-differential-equations-to-first-order/56090)

<div class="topic-metadata">

**Author:** [@fms-1988](https://discourse.julialang.org/u/fms-1988)\
**Replies:** 2\
**Last updated:** [February 26, 2021, 5:48pm UTC](https://discourse.julialang.org/t/reduce-order-of-differential-equations-to-first-order/56090 "2021-02-26T17:48:56Z")

</div>

I am working with differential equations. Some of my procedures require me to reduce the order of the ODE. Matlab has an efficient algorithm to do this (here). My doubt is: is there an algorithm similar to this for Ju…

---

## [Plot: format dates in x axis](https://discourse.julialang.org/t/plot-format-dates-in-x-axis/56097)

<div class="topic-metadata">

**Author:** [@ZettEff](https://discourse.julialang.org/u/ZettEff)\
**Replies:** 3\
**Last updated:** [February 26, 2021, 5:12pm UTC](https://discourse.julialang.org/t/plot-format-dates-in-x-axis/56097 "2021-02-26T17:12:59Z")

</div>

Hi there, I have a question regarding date formatting when using plot with gr() backend. Two question: Is there a more julian way to format your dates - here: to only show years - then my last line of code? Is th…

---

## [Private Julia subsystem for Python, as is done in PyCall.jl for the opposite](https://discourse.julialang.org/t/private-julia-subsystem-for-python-as-is-done-in-pycall-jl-for-the-opposite/56101)

<div class="topic-metadata">

**Author:** [@chkwon](https://discourse.julialang.org/u/chkwon)\
**Replies:** 2\
**Last updated:** [February 26, 2021, 4:52pm UTC](https://discourse.julialang.org/t/private-julia-subsystem-for-python-as-is-done-in-pycall-jl-for-the-opposite/56101 "2021-02-26T16:52:51Z")

</div>

We have pyjulia, which I believe works for an existing Julia installation. Is it also possible to let Python to install a private Julia subsystem, that is independent from any existing or non-existing Julia installation? …

---

## [Redefining functions in the REPL alleviates large allocations (MWE with IntervalArithmetic.jl)](https://discourse.julialang.org/t/redefining-functions-in-the-repl-alleviates-large-allocations-mwe-with-intervalarithmetic-jl/53515)

<div class="topic-metadata">

**Author:** [@OlivierHnt](https://discourse.julialang.org/u/OlivierHnt)\
**Replies:** 10\
**Last updated:** [February 26, 2021, 4:13pm UTC](https://discourse.julialang.org/t/redefining-functions-in-the-repl-alleviates-large-allocations-mwe-with-intervalarithmetic-jl/53515 "2021-02-26T16:13:06Z")

</div>

I noticed a lot of memory allocations with IntervalArithmetic.jl on Julia 1.5.3 (it appears to be the same in 1.6) when I used a vector of Interval as an input for a custom function in a module. Interestingly, redefining…

---

## [Error building packages when startup file is used (v1.0)](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 4\
**Last updated:** [February 26, 2021, 3:31pm UTC](https://discourse.julialang.org/t/error-building-packages-when-startup-file-is-used-v1-0/14318 "2021-02-26T15:31:58Z")

</div>

With v1.0, I find that I get errors building Plots or NLopt when I start julia with a ./.julia/config/startup.jl file that contains using Revise, and/or using OhMyREPL but if I start without the startup file, the packag…

---

## [Hi evrybody, I'm trying to overlay a scatter plot with a heatmap using Plots.jl bu](https://discourse.julialang.org/t/hi-evrybody-im-trying-to-overlay-a-scatter-plot-with-a-heatmap-using-plots-jl-bu/56067)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [February 26, 2021, 12:41pm UTC](https://discourse.julialang.org/t/hi-evrybody-im-trying-to-overlay-a-scatter-plot-with-a-heatmap-using-plots-jl-bu/56067 "2021-02-26T12:41:09Z")

</div>

Hi evrybody, I’m trying to overlay a scatter plot with a heatmap using Plots.jl but I can’t figure it out how heatmap is oriented (or find much documentation on the plots.jl heatmap function). The heat map seems turned …

---

## [What is the maximum inlining depth in practice?](https://discourse.julialang.org/t/what-is-the-maximum-inlining-depth-in-practice/55929)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 7\
**Last updated:** [February 26, 2021, 12:24pm UTC](https://discourse.julialang.org/t/what-is-the-maximum-inlining-depth-in-practice/55929 "2021-02-26T12:24:54Z")

</div>

Out of professional curiosity: What is the maximum depth for inlining function calls in Julia in practice? My programming intuition says that there must exist a practical limit regarding how deeply nested functions may …

---

## [Cannot use Cuda.jl after turning on from sleep](https://discourse.julialang.org/t/cannot-use-cuda-jl-after-turning-on-from-sleep/56081)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 0\
**Last updated:** [February 26, 2021, 11:59am UTC](https://discourse.julialang.org/t/cannot-use-cuda-jl-after-turning-on-from-sleep/56081 "2021-02-26T11:59:26Z")

</div>

Hello, I have a problem with CUDA.jl package. Every time I turn on my computer from sleep I am not able to use CUDA.jl. Is there any solution without restarting the computer ? I am using fedora Linux by the way. B.R.

---

## [So does Julia compile or interpret?](https://discourse.julialang.org/t/so-does-julia-compile-or-interpret/56073)

<div class="topic-metadata">

**Author:** [@xyz1](https://discourse.julialang.org/u/xyz1)\
**Replies:** 1\
**Last updated:** [February 26, 2021, 10:57am UTC](https://discourse.julialang.org/t/so-does-julia-compile-or-interpret/56073 "2021-02-26T10:57:35Z")

</div>

Hi, I’ve been searching for this but I’m not sure there is a definitive answer written somewhere. I understand it may be an “implementation detail” and that “julia compiles to efficient native code for multiple platforms…

---

## [Packages for LaTeX templating in julia (and symbolic algebra)](https://discourse.julialang.org/t/packages-for-latex-templating-in-julia-and-symbolic-algebra/55923)

<div class="topic-metadata">

**Author:** [@Luapulu](https://discourse.julialang.org/u/Luapulu)\
**Replies:** 4\
**Last updated:** [February 26, 2021, 8:26am UTC](https://discourse.julialang.org/t/packages-for-latex-templating-in-julia-and-symbolic-algebra/55923 "2021-02-26T08:26:56Z")

</div>

I want to make some tutorial sheets and fill them with partly randomised questions. I’m thinking of using some kind of template library in julia to replace certain tags in the document with questions (and separately with…

---

## [Contourf with a zebra-like colormap?](https://discourse.julialang.org/t/contourf-with-a-zebra-like-colormap/56069)

<div class="topic-metadata">

**Author:** [@Alexander\_Buck](https://discourse.julialang.org/u/Alexander_Buck)\
**Replies:** 0\
**Last updated:** [February 26, 2021, 8:09am UTC](https://discourse.julialang.org/t/contourf-with-a-zebra-like-colormap/56069 "2021-02-26T08:09:42Z")

</div>

Is there a way to create a colormap for a filled-contour plot such that the fill color alternates between two colors? For example, in the image below, between the 1 and 2 level it would be gray, between the 2 and 3 level…

---

## [Help with PyCall-related segfault](https://discourse.julialang.org/t/help-with-pycall-related-segfault/55998)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 4\
**Last updated:** [February 26, 2021, 7:54am UTC](https://discourse.julialang.org/t/help-with-pycall-related-segfault/55998 "2021-02-26T07:54:03Z")

</div>

I posted this also here but hoping to get more eyes on this. The MWE is simple, run the following with julia --threads=2: using PyCall Threads.@sync begin Threads.@spawn GC.gc(true) Threads.@spawn GC.gc(true) e…

---

## [With Missings, Julia is slower than R](https://discourse.julialang.org/t/with-missings-julia-is-slower-than-r/11838)

<div class="topic-metadata">

**Author:** [@gaspardelanuit](https://discourse.julialang.org/u/gaspardelanuit)\
**Replies:** 30\
**Last updated:** [February 26, 2021, 4:10am UTC](https://discourse.julialang.org/t/with-missings-julia-is-slower-than-r/11838 "2021-02-26T04:10:59Z")

</div>

As shown by the code below, Julia is twice slower than R (!) to sum elements of a Float64 vector with missing values, even with Julia 0.7. In R, missing values are encoded with sentinelle values. In Julia, they are enco…

---

## [Deploy pluto.jl code into the server?](https://discourse.julialang.org/t/deploy-pluto-jl-code-into-the-server/56063)

<div class="topic-metadata">

**Author:** [@Ravinder\_Ram](https://discourse.julialang.org/u/Ravinder_Ram)\
**Replies:** 0\
**Last updated:** [February 26, 2021, 3:15am UTC](https://discourse.julialang.org/t/deploy-pluto-jl-code-into-the-server/56063 "2021-02-26T03:15:17Z")

</div>

if pluto.jl convert julia code into javascritpt, css, html… then how to deploy code in server like in digitalocean, heroku

---

## [Force package to download (specific) lazy artifacts](https://discourse.julialang.org/t/force-package-to-download-specific-lazy-artifacts/44300)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 11:48pm UTC](https://discourse.julialang.org/t/force-package-to-download-specific-lazy-artifacts/44300 "2021-02-25T23:48:38Z")

</div>

I’m building a read-only container for a Julia application. It relies on third-party packages, in particular CUDAjl, that have a bunch of lazy artifacts that are only downloaded based on the system type or CUDA version. …

---

## [Build a formula from a string](https://discourse.julialang.org/t/build-a-formula-from-a-string/55804)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 5\
**Last updated:** [February 25, 2021, 11:20pm UTC](https://discourse.julialang.org/t/build-a-formula-from-a-string/55804 "2021-02-25T23:20:15Z")

</div>

I want to build a StatsModels formula from a string. This is the closest I’ve gotten. text = "y ~ x" StatsModels.terms!(StatsModels.sort\_terms!(StatsModels.parse!(Meta.parse(text)))) # :(($(Expr(:escape, :~)))(Term(:y),…

---

## [What is the latest for using \`Weave.jl\` with Tikz images?](https://discourse.julialang.org/t/what-is-the-latest-for-using-weave-jl-with-tikz-images/56047)

<div class="topic-metadata">

**Author:** [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 10:58pm UTC](https://discourse.julialang.org/t/what-is-the-latest-for-using-weave-jl-with-tikz-images/56047 "2021-02-25T22:58:54Z")

</div>

I was wondering if it is possible to embed Tikz images into Weave files, for rendering to html or pdf? I have tikz snippets and I was wondering if there is an easy way to migrate these into Weave rendered documents. Now…

---

## [How to create an instance of a mutable composite type with most fields left empty?](https://discourse.julialang.org/t/how-to-create-an-instance-of-a-mutable-composite-type-with-most-fields-left-empty/56021)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 4\
**Last updated:** [February 25, 2021, 10:49pm UTC](https://discourse.julialang.org/t/how-to-create-an-instance-of-a-mutable-composite-type-with-most-fields-left-empty/56021 "2021-02-25T22:49:39Z")

</div>

Let’s say I have a mutable composite type and want to create an instance of it. However, at first, I only want to initialise one of the fields (lets say in the example bellow Cost = 120.5) and leave all the others empty.…

---

## [How to distinguish between "found" and "not found" in \`findfirst(dict)\`? E.g.:\`\`\`](https://discourse.julialang.org/t/how-to-distinguish-between-found-and-not-found-in-findfirst-dict-e-g/56014)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 9:29pm UTC](https://discourse.julialang.org/t/how-to-distinguish-between-found-and-not-found-in-findfirst-dict-e-g/56014 "2021-02-25T21:29:27Z")

</div>

How to distinguish between “found” and “not found” in findfirst(dict)? E.g.: d = Dict(nothing =&gt; 1, 2 =&gt; 3) findfirst(==(3), d) # == 2, ok: d\[2\] == 3 findfirst(==(1), d) # == nothing, ok: d\[nothing\] = 1 findfirs…

---

## [Most efficient way of calculating a multidimensional complex function many times](https://discourse.julialang.org/t/most-efficient-way-of-calculating-a-multidimensional-complex-function-many-times/55943)

<div class="topic-metadata">

**Author:** [@O\_Julia](https://discourse.julialang.org/u/O_Julia)\
**Replies:** 7\
**Last updated:** [February 25, 2021, 8:56pm UTC](https://discourse.julialang.org/t/most-efficient-way-of-calculating-a-multidimensional-complex-function-many-times/55943 "2021-02-25T20:56:26Z")

</div>

I have a very long function depends on X,Y,T. X and Y are vectors with length between 400-10000. I have to calculate the function in a for loop many times. Are my approachs efficient? If not, how can I improve them? Than…

---

## [Recovering MATLAB addict needs help to understand Julia indexing](https://discourse.julialang.org/t/recovering-matlab-addict-needs-help-to-understand-julia-indexing/56046)

<div class="topic-metadata">

**Author:** [@neuralian](https://discourse.julialang.org/u/neuralian)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 8:37pm UTC](https://discourse.julialang.org/t/recovering-matlab-addict-needs-help-to-understand-julia-indexing/56046 "2021-02-25T20:37:31Z")

</div>

(In the REPL) Create a 1D array of 1D arrays of Points: julia\>using GLMakie julia\> A = fill(fill(Point2f0(0,0), 2), 2) 2-element Array{Array{Point{2,Float32},1},1}: \[\[0.0, 0.0\], \[0.0, 0.0\]\] \[\[0.0, 0.0\], \[0.0, 0.0\]\] C…

---

## [Not able to load a module from custom system image](https://discourse.julialang.org/t/not-able-to-load-a-module-from-custom-system-image/37571)

<div class="topic-metadata">

**Author:** [@Vangelis](https://discourse.julialang.org/u/Vangelis)\
**Replies:** 5\
**Last updated:** [February 25, 2021, 5:07pm UTC](https://discourse.julialang.org/t/not-able-to-load-a-module-from-custom-system-image/37571 "2021-02-25T17:07:22Z")

</div>

Dear experts, I have recently started using Julia because of its nice ability to create a binary out of the code. Apologies for the long post, but I am trying to give you the full picture. While I followed this documen…

---

## [Can the compiler sometimes optimize small unions to avoid boxing?](https://discourse.julialang.org/t/can-the-compiler-sometimes-optimize-small-unions-to-avoid-boxing/56028)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 4:46pm UTC](https://discourse.julialang.org/t/can-the-compiler-sometimes-optimize-small-unions-to-avoid-boxing/56028 "2021-02-25T16:46:03Z")

</div>

Hi, random question about performance: can the compiler sometimes optimize Union type variables so that there is no boxing or unboxing? For example, if I declare an “optional” integer type like Union{Nothing, Int}would t…

---

## [How to record a video with WGLMakie/Atom without live plotting?](https://discourse.julialang.org/t/how-to-record-a-video-with-wglmakie-atom-without-live-plotting/54032)

<div class="topic-metadata">

**Author:** [@sfmiller940](https://discourse.julialang.org/u/sfmiller940)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 4:05pm UTC](https://discourse.julialang.org/t/how-to-record-a-video-with-wglmakie-atom-without-live-plotting/54032 "2021-02-25T16:05:02Z")

</div>

I’m using WGLMakie with Atom/Juno to record videos. Is it possible to record videos without live plotting in Atom? Sometimes I just want the video and live plotting seems like a drain on resources. Thanks!

---

## [Sorting a Matrix by column1 then column2](https://discourse.julialang.org/t/sorting-a-matrix-by-column1-then-column2/55980)

<div class="topic-metadata">

**Author:** [@eduardosalaz](https://discourse.julialang.org/u/eduardosalaz)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 3:24pm UTC](https://discourse.julialang.org/t/sorting-a-matrix-by-column1-then-column2/55980 "2021-02-25T15:24:34Z")

</div>

So I am currently working on a greedy heuristic for knapsack, representing the values and weights of items in a 2D array. Basically I have to reverse sort the matrix first by col1, which puts the most profitable items on…

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

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