# General Usage

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

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

**Page:** 411

---

## [@threads - machine stops using allocated cores during run](https://discourse.julialang.org/t/threads-machine-stops-using-allocated-cores-during-run/85330)

<div class="topic-metadata">

**Author:** [@mrVeng](https://discourse.julialang.org/u/mrVeng)\
**Replies:** 4\
**Last updated:** [August 11, 2022, 12:39pm UTC](https://discourse.julialang.org/t/threads-machine-stops-using-allocated-cores-during-run/85330 "2022-08-11T12:39:35Z")

</div>

Dear all, I have a function in a function that I can run in parallel, and I am using the ‘@threads’ macro for that. Calling that outside function takes several hours, and, at the beginning, works as expected and all int…

---

## [.. (two dots) as a operator name](https://discourse.julialang.org/t/two-dots-as-a-operator-name/85611)

<div class="topic-metadata">

**Author:** [@owiecc](https://discourse.julialang.org/u/owiecc)\
**Replies:** 5\
**Last updated:** [August 11, 2022, 11:49am UTC](https://discourse.julialang.org/t/two-dots-as-a-operator-name/85611 "2022-08-11T11:49:11Z")

</div>

IntervalSets.jl defines .. as a interval operator. I tried using ... as an operator but Julia complains that it is an invalid identifier name. This means that .. is treated somewhat special. Where can I find the list of …

---

## [How to Use Python inside Julia with py""" """ to Plot an angle between 2 vectors/lines?](https://discourse.julialang.org/t/how-to-use-python-inside-julia-with-py-to-plot-an-angle-between-2-vectors-lines/85578)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 6\
**Last updated:** [August 11, 2022, 10:54am UTC](https://discourse.julialang.org/t/how-to-use-python-inside-julia-with-py-to-plot-an-angle-between-2-vectors-lines/85578 "2022-08-11T10:54:59Z")

</div>

Hi all, this is basically still using Julia (calling Python), but I want to know whether this code works: using PyCall py""" import matplotlib.pyplot as plt from matplotlib.patches import Arc from matplotlib.lines imp…

---

## [How to combine prettytables and pager?](https://discourse.julialang.org/t/how-to-combine-prettytables-and-pager/85593)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 4\
**Last updated:** [August 11, 2022, 7:44am UTC](https://discourse.julialang.org/t/how-to-combine-prettytables-and-pager/85593 "2022-08-11T07:44:11Z")

</div>

When using prettytables I have a lot of keyword options that I can use to display a pretty table. With the function pager from TerminalPager I can browse through a dataset that does not fit on the screen. How can I combi…

---

## [Any faster way of computing small gradients?](https://discourse.julialang.org/t/any-faster-way-of-computing-small-gradients/85531)

<div class="topic-metadata">

**Author:** [@ForceBru](https://discourse.julialang.org/u/ForceBru)\
**Replies:** 21\
**Last updated:** [August 11, 2022, 7:21am UTC](https://discourse.julialang.org/t/any-faster-way-of-computing-small-gradients/85531 "2022-08-11T07:21:52Z")

</div>

I’ve tested multiple packages to compute the gradient of a log-likelihood (huge sum of the same function applied to different data points): const AV = AbstractVector{T} where T normal\_pdf(x::Real, mean::Real, var::Real…

---

## [Access field of custom struct by user-provided name](https://discourse.julialang.org/t/access-field-of-custom-struct-by-user-provided-name/85546)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 10\
**Last updated:** [August 11, 2022, 6:03am UTC](https://discourse.julialang.org/t/access-field-of-custom-struct-by-user-provided-name/85546 "2022-08-11T06:03:41Z")

</div>

Suppose I want a struct that has to store a variable which can be quite general. Most typically, it will contain an array of forces, or alternatively an energy value. Something like: struct System{T} property::T end…

---

## [Is there a Julia Latex "symbol"? So Latex in Latex is \`\\LaTeX{}\`, is there somethi](https://discourse.julialang.org/t/is-there-a-julia-latex-symbol-so-latex-in-latex-is-latex-is-there-somethi/54703)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 15\
**Last updated:** [August 11, 2022, 2:58am UTC](https://discourse.julialang.org/t/is-there-a-julia-latex-symbol-so-latex-in-latex-is-latex-is-there-somethi/54703 "2022-08-11T02:58:57Z")

</div>

Is there a Julia Latex “symbol”? So Latex in Latex is \\LaTeX{}, is there something like \\Julia{} (presumably after \\usepackage{juliasymbols} or something)? Note that the original poster on Slack cannot see your response…

---

## [Is there a good way to run an interpreted IJulia session?](https://discourse.julialang.org/t/is-there-a-good-way-to-run-an-interpreted-ijulia-session/85554)

<div class="topic-metadata">

**Author:** [@kjohnsen](https://discourse.julialang.org/u/kjohnsen)\
**Replies:** 4\
**Last updated:** [August 10, 2022, 8:25pm UTC](https://discourse.julialang.org/t/is-there-a-good-way-to-run-an-interpreted-ijulia-session/85554 "2022-08-10T20:25:51Z")

</div>

Hello all, I know about JuliaInterpreter and things like Revise to avoid recompilation for package development and DaemonMode to achieve a similar end for script development, but a use case where time-to-first-plot has …

---

## [Using TensorCast with JuliaPy](https://discourse.julialang.org/t/using-tensorcast-with-juliapy/85588)

<div class="topic-metadata">

**Author:** [@andrewkhardy](https://discourse.julialang.org/u/andrewkhardy)\
**Replies:** 0\
**Last updated:** [August 10, 2022, 2:33pm UTC](https://discourse.julialang.org/t/using-tensorcast-with-juliapy/85588 "2022-08-10T14:33:16Z")

</div>

I am getting a world age bug when running TensorCast in JuliaPy, but not when using it normally. If I run an example function such as function testfunc() V = \[10,20,30\] M = collect(reshape(1:12, 3,4)) @cast…

---

## [Approximating non-standard evaluation like in R, e.g. for plot labels](https://discourse.julialang.org/t/approximating-non-standard-evaluation-like-in-r-e-g-for-plot-labels/41889)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 15\
**Last updated:** [August 10, 2022, 1:55pm UTC](https://discourse.julialang.org/t/approximating-non-standard-evaluation-like-in-r-e-g-for-plot-labels/41889 "2022-08-10T13:55:39Z")

</div>

Sometimes I miss R’s functionality where expressions passed into plotting functions are used as label names. The non-standard evaluation part of it I find pretty confusing actually, i.e. that the expressions are not run …

---

## [Tullio Order of Operations](https://discourse.julialang.org/t/tullio-order-of-operations/85538)

<div class="topic-metadata">

**Author:** [@andrewkhardy](https://discourse.julialang.org/u/andrewkhardy)\
**Replies:** 5\
**Last updated:** [August 10, 2022, 1:38pm UTC](https://discourse.julialang.org/t/tullio-order-of-operations/85538 "2022-08-10T13:38:06Z")

</div>

I’m attempting to use Tullio to perform a sum over matrices and running into difficulty. I need to take the sum of inverses and instead am taking the inverse of sums. Is there a way to properly write order of operations,…

---

## [Can we reuse Dictionary allocation?](https://discourse.julialang.org/t/can-we-reuse-dictionary-allocation/85582)

<div class="topic-metadata">

**Author:** [@CodeGodz](https://discourse.julialang.org/u/CodeGodz)\
**Replies:** 2\
**Last updated:** [August 10, 2022, 1:26pm UTC](https://discourse.julialang.org/t/can-we-reuse-dictionary-allocation/85582 "2022-08-10T13:26:22Z")

</div>

In our application we have to allocate over 20K dictionaries each having ~1M keys. Each of them is created in a for loop and since they are only used within the iteration garbage collection temporarily freezes the code w…

---

## [How to "unroll" getindexes to a Tuple parametrically?](https://discourse.julialang.org/t/how-to-unroll-getindexes-to-a-tuple-parametrically/83131)

<div class="topic-metadata">

**Author:** [@Daniel\_Gonzalez](https://discourse.julialang.org/u/Daniel_Gonzalez)\
**Replies:** 3\
**Last updated:** [August 10, 2022, 1:00pm UTC](https://discourse.julialang.org/t/how-to-unroll-getindexes-to-a-tuple-parametrically/83131 "2022-08-10T13:00:34Z")

</div>

Consider the following code: abstract type Op end struct Add{T} \<: Op foo::T end struct Mul{T} \<: Op foo::T end op(o::Add, value) = o.foo + value op(o::Mul, value) = o.foo \* value abstract type AbstractCalcu…

---

## [How to add LaTeX Annotations for 3-d Plots (Backend GR and Pyplot)](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [August 10, 2022, 9:20am UTC](https://discourse.julialang.org/t/how-to-add-latex-annotations-for-3-d-plots-backend-gr-and-pyplot/85473 "2022-08-10T09:20:35Z")

</div>

Hi all, I create this 3-d plot for vectors in 3-d, tried annotate!() and it does not work. Is it possible to add annotate? If possible, I want to add latex symbol like subscript. # Plot norm of a vector in 3-d using P…

---

## [Computing the SVD of a LinearMap](https://discourse.julialang.org/t/computing-the-svd-of-a-linearmap/85534)

<div class="topic-metadata">

**Author:** [@AnshPatel7](https://discourse.julialang.org/u/AnshPatel7)\
**Replies:** 5\
**Last updated:** [August 10, 2022, 7:32am UTC](https://discourse.julialang.org/t/computing-the-svd-of-a-linearmap/85534 "2022-08-10T07:32:41Z")

</div>

I’m trying to compute the SVD of a LinearMap since a dense representation of the matrix would go out of memory. I tried using IterativeSolvers.svdl but it does not give me all of the singular values or the U matrix. Is t…

---

## [How to install CUDA.jl without Julia package manager](https://discourse.julialang.org/t/how-to-install-cuda-jl-without-julia-package-manager/85514)

<div class="topic-metadata">

**Author:** [@Pilbum](https://discourse.julialang.org/u/Pilbum)\
**Replies:** 14\
**Last updated:** [August 10, 2022, 3:28am UTC](https://discourse.julialang.org/t/how-to-install-cuda-jl-without-julia-package-manager/85514 "2022-08-10T03:28:29Z")

</div>

Hello all, It may be a dumb question, but I was not able to find an answer online. Due to the security reasons and firewalls, I cannot use Julia package manager which makes hard to install CUDA.jl. Is there anyway to …

---

## [Does InMemoryDatasets support the Tables interface?](https://discourse.julialang.org/t/does-inmemorydatasets-support-the-tables-interface/85457)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [August 10, 2022, 2:19am UTC](https://discourse.julialang.org/t/does-inmemorydatasets-support-the-tables-interface/85457 "2022-08-10T02:19:05Z")

</div>

See title. I wonder because it is not listed in Tables.jl/INTEGRATIONS.md at main · JuliaData/Tables.jl · GitHub .

---

## [Is dropping support for an old version of Julia a breaking change?](https://discourse.julialang.org/t/is-dropping-support-for-an-old-version-of-julia-a-breaking-change/85558)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 2\
**Last updated:** [August 9, 2022, 10:30pm UTC](https://discourse.julialang.org/t/is-dropping-support-for-an-old-version-of-julia-a-breaking-change/85558 "2022-08-09T22:30:23Z")

</div>

If I have this package and I want to get rid of the version-specific code module MyPackage export do\_thing function do\_thing() VERSION \< v"1.7" && return do\_it\_the\_old\_way() ... end function do\_it\_the\_old\_wa…

---

## [How to save function output as a variable?](https://discourse.julialang.org/t/how-to-save-function-output-as-a-variable/85553)

<div class="topic-metadata">

**Author:** [@albrightand](https://discourse.julialang.org/u/albrightand)\
**Replies:** 3\
**Last updated:** [August 9, 2022, 9:11pm UTC](https://discourse.julialang.org/t/how-to-save-function-output-as-a-variable/85553 "2022-08-09T21:11:59Z")

</div>

I’m new to Julia and practicing writing functions… The function below works great, if I call it from the command line like: julia\> prime(5) \[1, 2, 3, 5\] BUT if I try to set the output of the function to a variable, th…

---

## [How to solve a limit boundary value ODE in SciML (possibly using shooting methods)](https://discourse.julialang.org/t/how-to-solve-a-limit-boundary-value-ode-in-sciml-possibly-using-shooting-methods/85509)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 6\
**Last updated:** [August 9, 2022, 9:05pm UTC](https://discourse.julialang.org/t/how-to-solve-a-limit-boundary-value-ode-in-sciml-possibly-using-shooting-methods/85509 "2022-08-09T21:05:39Z")

</div>

In many fields it is common to encounter systems of differential equations with boundary conditions that occur at limits (rather than at finite points). For example, the Neoclassical growth model boils down to a system …

---

## [Pkg.test() vs julia --project=. test/runtests.jl](https://discourse.julialang.org/t/pkg-test-vs-julia-project-test-runtests-jl/85549)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 2\
**Last updated:** [August 9, 2022, 8:05pm UTC](https://discourse.julialang.org/t/pkg-test-vs-julia-project-test-runtests-jl/85549 "2022-08-09T20:05:03Z")

</div>

I have a package where julia --project=. test/runtests.jl shows all testss passing even after deleting the manifest and rebuilding it from scratch. But \] test fails - and I cannot for the life of me understand how the er…

---

## [Optimizing matrix multiplication code and being compatible with autodiff](https://discourse.julialang.org/t/optimizing-matrix-multiplication-code-and-being-compatible-with-autodiff/85448)

<div class="topic-metadata">

**Author:** [@SebastianCallh](https://discourse.julialang.org/u/SebastianCallh)\
**Replies:** 6\
**Last updated:** [August 9, 2022, 7:42pm UTC](https://discourse.julialang.org/t/optimizing-matrix-multiplication-code-and-being-compatible-with-autodiff/85448 "2022-08-09T19:42:20Z")

</div>

I am trying to optimize some matrix multiplications inside a Turing model (a Kalman filter) but since I am depending on autodiff I can’t pre-allocate matrices and mutate things. How does one go about optimizing this type…

---

## [Symbolics: how do I create an array of subscripted symbolic variables?](https://discourse.julialang.org/t/symbolics-how-do-i-create-an-array-of-subscripted-symbolic-variables/85530)

<div class="topic-metadata">

**Author:** [@mendeli](https://discourse.julialang.org/u/mendeli)\
**Replies:** 2\
**Last updated:** [August 9, 2022, 6:09pm UTC](https://discourse.julialang.org/t/symbolics-how-do-i-create-an-array-of-subscripted-symbolic-variables/85530 "2022-08-09T18:09:58Z")

</div>

Is there a way to automatically create an array of subscripted variables given n in Symbolics? For the case n=6, I would like to do what the code below does without having to type out the variables explicitly. using P…

---

## [ThinFilmsTools packages Error: type TMMOptics has no field beam](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535)

<div class="topic-metadata">

**Author:** [@willliyg](https://discourse.julialang.org/u/willliyg)\
**Replies:** 4\
**Last updated:** [August 9, 2022, 5:41pm UTC](https://discourse.julialang.org/t/thinfilmstools-packages-error-type-tmmoptics-has-no-field-beam/85535 "2022-08-09T17:41:19Z")

</div>

When using the ThinFilmsTools.jl to run these examples, I always get an error of: ERROR: type TMMOptics has no field beam Stacktrace: \[1\] getproperty(x::TMMOptics{ThinFilmsTools.TransferMatrixMethod.Spectra{Float64, C…

---

## [Best practice for passing parameters to functions passed as parameters](https://discourse.julialang.org/t/best-practice-for-passing-parameters-to-functions-passed-as-parameters/85479)

<div class="topic-metadata">

**Author:** [@nsquare](https://discourse.julialang.org/u/nsquare)\
**Replies:** 5\
**Last updated:** [August 9, 2022, 3:47pm UTC](https://discourse.julialang.org/t/best-practice-for-passing-parameters-to-functions-passed-as-parameters/85479 "2022-08-09T15:47:13Z")

</div>

Hello! I want to write a general function with several subroutines. I would like this method to be able to use different functions as subroutines, by taking them as parameters, as shown in the toy example below. functi…

---

## [Broadcasting matrix-vector multiplication over specific axis for n-dimensional arrays](https://discourse.julialang.org/t/broadcasting-matrix-vector-multiplication-over-specific-axis-for-n-dimensional-arrays/85533)

<div class="topic-metadata">

**Author:** [@b-fg](https://discourse.julialang.org/u/b-fg)\
**Replies:** 3\
**Last updated:** [August 9, 2022, 2:58pm UTC](https://discourse.julialang.org/t/broadcasting-matrix-vector-multiplication-over-specific-axis-for-n-dimensional-arrays/85533 "2022-08-09T14:58:59Z")

</div>

I have a matrix-vector multiplication to fill axis=2 of my 3D array a (where basis is type Matrix): @inbounds for n ∈ 1:size(a, 1), s ∈ 1:size(a, 3) a\[n, :, s\] = @views basis \* b\[n, :, s\] end The question is how c…

---

## [Using A: B does not put in scope exported B objects](https://discourse.julialang.org/t/using-a-b-does-not-put-in-scope-exported-b-objects/85537)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [August 9, 2022, 2:25pm UTC](https://discourse.julialang.org/t/using-a-b-does-not-put-in-scope-exported-b-objects/85537 "2022-08-09T14:25:10Z")

</div>

For example: julia\> module A module B export f f(x) = 1 end end Main.A julia\> using .A: B julia\> f(1) ERROR: UndefVarError: f not defined Stacktrace: \[1\] top…

---

## [Using an imported struct as a type annotation](https://discourse.julialang.org/t/using-an-imported-struct-as-a-type-annotation/85477)

<div class="topic-metadata">

**Author:** [@wg12385](https://discourse.julialang.org/u/wg12385)\
**Replies:** 3\
**Last updated:** [August 9, 2022, 10:06am UTC](https://discourse.julialang.org/t/using-an-imported-struct-as-a-type-annotation/85477 "2022-08-09T10:06:11Z")

</div>

I have been running into a consistent problem which i assume is because i’m either trying to do something you’re not meant to do in julia, or i’m just doing it wrong. The core of it is i am trying to put type annotation…

---

## [How to create columns in a loop](https://discourse.julialang.org/t/how-to-create-columns-in-a-loop/85519)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [August 9, 2022, 8:02am UTC](https://discourse.julialang.org/t/how-to-create-columns-in-a-loop/85519 "2022-08-09T08:02:58Z")

</div>

I have the following code: using InMemoryDatasets # create a demo data set of CAN bus messages function demo\_data() n = 100000 time = 0.1:0.1:n\*0.1 addr = rand(Int16(0x101):Int16(0x12e), n) d1 = rand(UI…

---

## [Get array type (e.g. Array, CuArray, etc.) from concrete array](https://discourse.julialang.org/t/get-array-type-e-g-array-cuarray-etc-from-concrete-array/85516)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 9\
**Last updated:** [August 9, 2022, 5:26am UTC](https://discourse.julialang.org/t/get-array-type-e-g-array-cuarray-etc-from-concrete-array/85516 "2022-08-09T05:26:19Z")

</div>

This should be easy, but I haven’t found a way to do it. I want a function that takes some concrete array type (\<: AbstractArray), that might be backed by Array, or CuArray, or ROCArray or whatever, and returns the unpa…

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

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