# General Usage

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

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

**Page:** 380

---

## [Arrays with non-uniform dimensions](https://discourse.julialang.org/t/arrays-with-non-uniform-dimensions/88725)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 8\
**Last updated:** [October 22, 2022, 9:35pm UTC](https://discourse.julialang.org/t/arrays-with-non-uniform-dimensions/88725 "2022-10-22T21:35:56Z")

</div>

I’m looking for a data-structure that essentially works as an array-of-arrays, where each “row” can have a different number of “columns”. The point of that is being able to easily perform map or broadcast, etc, as if it …

---

## [CSV.jl type stability](https://discourse.julialang.org/t/csv-jl-type-stability/89097)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 26\
**Last updated:** [October 22, 2022, 8:10pm UTC](https://discourse.julialang.org/t/csv-jl-type-stability/89097 "2022-10-22T20:10:57Z")

</div>

I want to convert the rows of a CSV file into custom types in my own code. I have defined the Base.convert methods I need: Base.convert(::Type{MyCustomType}, row::CSV.Row) = begin MyCustomType( a = row.a, …

---

## [Plot of integral curves not showing all of them](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [October 22, 2022, 6:22pm UTC](https://discourse.julialang.org/t/plot-of-integral-curves-not-showing-all-of-them/89112 "2022-10-22T18:22:48Z")

</div>

Dear all, I have tried to solve this initial value problem ty' + 2y = 4t^{2} y(1) = 2 I plot it with this code: using Plots, LaTeXStrings, Plots.PlotMeasures gr() f(x) = x^(2) + (1 / x^(2)) p = plot(f, -1, 5, xtic…

---

## [Is my plot $-x^{2}$ that has vertical asymptote is correct?](https://discourse.julialang.org/t/is-my-plot-x-2-that-has-vertical-asymptote-is-correct/88781)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [October 22, 2022, 5:32pm UTC](https://discourse.julialang.org/t/is-my-plot-x-2-that-has-vertical-asymptote-is-correct/88781 "2022-10-22T17:32:17Z")

</div>

Dear all, I just want to ask and satisfy my curiosity, I see this I wonder whether my plotting is correct or not (how to show the - \\frac{1}{x-5} graph only the one below x-axis?): using Plots, LaTeXStrings, Plots.…

---

## [Debugging a segfault with lldb](https://discourse.julialang.org/t/debugging-a-segfault-with-lldb/89103)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 2\
**Last updated:** [October 22, 2022, 5:05pm UTC](https://discourse.julialang.org/t/debugging-a-segfault-with-lldb/89103 "2022-10-22T17:05:05Z")

</div>

I’m trying to find out why RadeonProRender.jl segfaults on Mac. I put the code at the bottom into a script rpr.jl and then ran this: lldb julia -- rpr.jl (lldb) target create "julia" Current executable set to 'julia' (…

---

## [Custom layer for a good guess of system dynamics](https://discourse.julialang.org/t/custom-layer-for-a-good-guess-of-system-dynamics/88728)

<div class="topic-metadata">

**Author:** [@Antonino\_Gandolfo](https://discourse.julialang.org/u/Antonino_Gandolfo)\
**Replies:** 9\
**Last updated:** [October 22, 2022, 4:25pm UTC](https://discourse.julialang.org/t/custom-layer-for-a-good-guess-of-system-dynamics/88728 "2022-10-22T16:25:09Z")

</div>

Hi, I’m trying to create a NeuralODE for the forcasting of a dynamic system. I did a NN for the forcasting of the system under different initial conditions and it’s work very well. Now I would like to create NN capable…

---

## [Why doesn't \`@nospecialize\` work in this example?](https://discourse.julialang.org/t/why-doesnt-nospecialize-work-in-this-example/88695)

<div class="topic-metadata">

**Author:** [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Replies:** 10\
**Last updated:** [October 22, 2022, 3:01pm UTC](https://discourse.julialang.org/t/why-doesnt-nospecialize-work-in-this-example/88695 "2022-10-22T15:01:07Z")

</div>

Just discovered that using @nospecialize on a method loses it’s effect as soon as its called by a specialized method. julia\> using MethodAnalysis julia\> struct Foo{X} x::X end julia\> @nospecialize j…

---

## [Map a function at a given level of a tree](https://discourse.julialang.org/t/map-a-function-at-a-given-level-of-a-tree/27910)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 7\
**Last updated:** [October 22, 2022, 1:59pm UTC](https://discourse.julialang.org/t/map-a-function-at-a-given-level-of-a-tree/27910 "2022-10-22T13:59:56Z")

</div>

I feel a bit dumb asking this very basic question, but I have looked and looked but cannot figure it out. Imagine I have a “tree”, in the sense of a container of containers of containers… Such as julia\> tree = \[\[\[1,2\],…

---

## [Aliased parameterized type confusion, cannot construct instance](https://discourse.julialang.org/t/aliased-parameterized-type-confusion-cannot-construct-instance/89088)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 3\
**Last updated:** [October 22, 2022, 1:18pm UTC](https://discourse.julialang.org/t/aliased-parameterized-type-confusion-cannot-construct-instance/89088 "2022-10-22T13:18:15Z")

</div>

Why does this work, tst{T \<: AbstractFloat} = SMatrix{3,3,T} tst(rand(3,3)) 3×3 SMatrix{3, 3, Float64, 9} with indices SOneTo(3)×SOneTo(3): 0.901624 0.966323 0.397229 0.716175 0.758242 0.791737 0.839526 0.7984…

---

## [How to optimize computation within vectorized list operation and large array?](https://discourse.julialang.org/t/how-to-optimize-computation-within-vectorized-list-operation-and-large-array/89008)

<div class="topic-metadata">

**Author:** [@swish47](https://discourse.julialang.org/u/swish47)\
**Replies:** 16\
**Last updated:** [October 21, 2022, 4:23pm UTC](https://discourse.julialang.org/t/how-to-optimize-computation-within-vectorized-list-operation-and-large-array/89008 "2022-10-21T16:23:27Z")

</div>

I want to do this type of computation: ot=collect(range(start=-3,length=3600\*4,stop=3)); st=rand(1000000); sgf=zeros(ComplexF64, length(ot)); @elapsed @time for nn in 1:length(ot) sgf\[nn\]=sum(1 ./ (ot\[nn\]+0.001\*im.-…

---

## [Stability of sort()](https://discourse.julialang.org/t/stability-of-sort/89101)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [October 22, 2022, 10:04am UTC](https://discourse.julialang.org/t/stability-of-sort/89101 "2022-10-22T10:04:11Z")

</div>

Is the sort function stable by default, i.e preserving entries that are equal under the comparison function? If not, can I still expect the outcome of sort to be independent of the Julia version, say, 1.7 vs 1.8, for rep…

---

## [Memory hogging loops](https://discourse.julialang.org/t/memory-hogging-loops/89073)

<div class="topic-metadata">

**Author:** [@jrhalket](https://discourse.julialang.org/u/jrhalket)\
**Replies:** 18\
**Last updated:** [October 22, 2022, 6:32am UTC](https://discourse.julialang.org/t/memory-hogging-loops/89073 "2022-10-22T06:32:34Z")

</div>

Hi all, I’m still trying to figure out how to get around a familiar problem regarding repeated calls of a function causing nearly linearly increases in memory demands. Here’s a minimal example. I’m not really interested …

---

## [Write a function that stands up and shuts down workers?](https://discourse.julialang.org/t/write-a-function-that-stands-up-and-shuts-down-workers/89041)

<div class="topic-metadata">

**Author:** [@tuckermcclure](https://discourse.julialang.org/u/tuckermcclure)\
**Replies:** 5\
**Last updated:** [October 22, 2022, 5:25am UTC](https://discourse.julialang.org/t/write-a-function-that-stands-up-and-shuts-down-workers/89041 "2022-10-22T05:25:19Z")

</div>

I have a utility in a package to run a batch of things. I’d like for that batch function to be able to take in an argument like n\_workers, then stand those workers up, distribute the work, and then remove those new worke…

---

## [Significant time spent in type inference in profiler flame graphs](https://discourse.julialang.org/t/significant-time-spent-in-type-inference-in-profiler-flame-graphs/89094)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 4\
**Last updated:** [October 22, 2022, 3:58am UTC](https://discourse.julialang.org/t/significant-time-spent-in-type-inference-in-profiler-flame-graphs/89094 "2022-10-22T03:58:45Z")

</div>

I am currently profiling the search speed of SymbolicRegression.jl. In particular I am attempting to speed up this PR, which integrates the package with DynamicExpressions.jl. I am using the following code for profiling…

---

## [VSCode Debugger Crashing On Working Code](https://discourse.julialang.org/t/vscode-debugger-crashing-on-working-code/89096)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 0\
**Last updated:** [October 22, 2022, 1:46am UTC](https://discourse.julialang.org/t/vscode-debugger-crashing-on-working-code/89096 "2022-10-22T01:46:34Z")

</div>

I have code that works when I execute it in the REPL and when I use the julia command from the command line directly. However, when I run the debugger on an attempted dispatch the debugger crashes with: ┌ Error: Some …

---

## [How to specify paths relative to a file rather than current directory?](https://discourse.julialang.org/t/how-to-specify-paths-relative-to-a-file-rather-than-current-directory/89092)

<div class="topic-metadata">

**Author:** [@lkmc](https://discourse.julialang.org/u/lkmc)\
**Replies:** 2\
**Last updated:** [October 22, 2022, 12:25am UTC](https://discourse.julialang.org/t/how-to-specify-paths-relative-to-a-file-rather-than-current-directory/89092 "2022-10-22T00:25:00Z")

</div>

I have a file that I would like to be able to be read from multiple directories. I cannot use absolute paths because I need the code to be able to run for different users on different machines who may have put their rep…

---

## [Julia related responses to 2022 Kaggle ML & DS survey](https://discourse.julialang.org/t/julia-related-responses-to-2022-kaggle-ml-ds-survey/89089)

<div class="topic-metadata">

**Author:** [@empet](https://discourse.julialang.org/u/empet)\
**Replies:** 0\
**Last updated:** [October 21, 2022, 10:26pm UTC](https://discourse.julialang.org/t/julia-related-responses-to-2022-kaggle-ml-ds-survey/89089 "2022-10-21T22:26:08Z")

</div>

Survey data are available at https://www.kaggle.com/competitions/kaggle-survey-2022/data.

---

## [Efficient static bit array](https://discourse.julialang.org/t/efficient-static-bit-array/89084)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 1\
**Last updated:** [October 21, 2022, 10:16pm UTC](https://discourse.julialang.org/t/efficient-static-bit-array/89084 "2022-10-21T22:16:33Z")

</div>

I’m trying to find a way to implement a static bit array that is performant and memory efficient. I wonder if someone has solved some of the issues below. For example, I want to be able to create and access them quickly …

---

## [Does setrounding need to be thread unsafe?](https://discourse.julialang.org/t/does-setrounding-need-to-be-thread-unsafe/89086)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 0\
**Last updated:** [October 21, 2022, 9:38pm UTC](https://discourse.julialang.org/t/does-setrounding-need-to-be-thread-unsafe/89086 "2022-10-21T21:38:07Z")

</div>

setrounding is thread unsafe. Is there a problem with making the rounding mode thread- or task-local?

---

## [Is it bad practice to assign values to the String entries of a DataFrame?](https://discourse.julialang.org/t/is-it-bad-practice-to-assign-values-to-the-string-entries-of-a-dataframe/88943)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 10\
**Last updated:** [October 21, 2022, 9:20pm UTC](https://discourse.julialang.org/t/is-it-bad-practice-to-assign-values-to-the-string-entries-of-a-dataframe/88943 "2022-10-21T21:20:20Z")

</div>

I have to create a set of DataFrames based off of the entries of an existing DataFrame. One way to approach would be to create a function that turns the entires in a DataFrame into variables and then assign values to th…

---

## [Parsing with custom type JSON3 makes performance worse](https://discourse.julialang.org/t/parsing-with-custom-type-json3-makes-performance-worse/89030)

<div class="topic-metadata">

**Author:** [@Robert\_J](https://discourse.julialang.org/u/Robert_J)\
**Replies:** 6\
**Last updated:** [October 21, 2022, 8:56pm UTC](https://discourse.julialang.org/t/parsing-with-custom-type-json3-makes-performance-worse/89030 "2022-10-21T20:56:57Z")

</div>

Here is the sample JSON file: "{\\"topic\\":\\"trade.BTCUSDT\\",\\"data\\":\[{\\"symbol\\":\\"BTCUSDT\\",\\"tick\_direction\\":\\"PlusTick\\",\\"price\\":\\"19431.00\\",\\"size\\":0.2,\\"timestamp\\":\\"2022-10-18T14:50:20.000Z\\",\\"trade\_time\_m…

---

## [How to get "total snapshots" for profile results as Int?](https://discourse.julialang.org/t/how-to-get-total-snapshots-for-profile-results-as-int/89057)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 1\
**Last updated:** [October 21, 2022, 7:55pm UTC](https://discourse.julialang.org/t/how-to-get-total-snapshots-for-profile-results-as-int/89057 "2022-10-21T19:55:47Z")

</div>

Hellow, how to get “total snapshots” for profile results as Int ? using Profile f() = 1 for i = 1 : 100 @profile f() end Profile.print() Overhead ╎ \[+additional indent\] Count File:Line; Function ====================…

---

## [Reducing the allocations of my function](https://discourse.julialang.org/t/reducing-the-allocations-of-my-function/89059)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 10\
**Last updated:** [October 21, 2022, 4:48pm UTC](https://discourse.julialang.org/t/reducing-the-allocations-of-my-function/89059 "2022-10-21T16:48:19Z")

</div>

Hi, I have a function that can help me find all the qualified numbers that are within certain range, but it just ocupies a lot of allocations. Since I need to repeat this process thousands of time. I hope I can reduce th…

---

## [How to calculate non linear function](https://discourse.julialang.org/t/how-to-calculate-non-linear-function/89072)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 4\
**Last updated:** [October 21, 2022, 6:08pm UTC](https://discourse.julialang.org/t/how-to-calculate-non-linear-function/89072 "2022-10-21T18:08:46Z")

</div>

So I need to calculate x-sin(x)=y where y is known. It isn’t possible to solve for x so I need to approximate. My first try is using Optim f(x) = abs(x-sin(x) - y) optimize(f, 0, 2π).minimizer But to do this for a mat…

---

## [End-to-end gradients with Enzyme when training ODE parameters](https://discourse.julialang.org/t/end-to-end-gradients-with-enzyme-when-training-ode-parameters/89062)

<div class="topic-metadata">

**Author:** [@nrontsis](https://discourse.julialang.org/u/nrontsis)\
**Replies:** 1\
**Last updated:** [October 21, 2022, 5:19pm UTC](https://discourse.julialang.org/t/end-to-end-gradients-with-enzyme-when-training-ode-parameters/89062 "2022-10-21T17:19:03Z")

</div>

When reading the SciMLSensitivity docs I am somewhat surprised that Enzyme.jl is only mentioned as an option for JVPs. Why is doing e.g. end to end gradient computations with Enzyme (e.g. much like ForwardDiff.jl does) …

---

## [Fast LogSumExp over 4th dimension](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182)

<div class="topic-metadata">

**Author:** [@jroon](https://discourse.julialang.org/u/jroon)\
**Replies:** 36\
**Last updated:** [October 21, 2022, 5:17pm UTC](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182 "2022-10-21T17:17:02Z")

</div>

Hi all, I’m rewriting a function from R to Julia that reduces an array across the 4th dimension via LogSumExp, and I’m currently trying to optimise the speed. I’ve made a bit of progress through the Tullio package, but …

---

## [Speeding up my logsumexp function](https://discourse.julialang.org/t/speeding-up-my-logsumexp-function/42380)

<div class="topic-metadata">

**Author:** [@vkv](https://discourse.julialang.org/u/vkv)\
**Replies:** 35\
**Last updated:** [October 21, 2022, 5:14pm UTC](https://discourse.julialang.org/t/speeding-up-my-logsumexp-function/42380 "2022-10-21T17:14:51Z")

</div>

I wrote a logsumexp function based on the code here, that takes matrix as input and applies logsumexp along a dimension in a numerically stable way. function lsexp\_mat(mat, zero1\_mat; dims=1) # To use the function zer…

---

## [Find where a specific method gets called](https://discourse.julialang.org/t/find-where-a-specific-method-gets-called/89068)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 2\
**Last updated:** [October 21, 2022, 3:09pm UTC](https://discourse.julialang.org/t/find-where-a-specific-method-gets-called/89068 "2022-10-21T15:09:07Z")

</div>

Is there a way to find all places in my code base where a specific method (not function!) gets called (or may get called)? The method in question for me is Base.\*, so greping for \* over the whole code base produces way t…

---

## [Configure a specific axis in a figure with multiple subplots](https://discourse.julialang.org/t/configure-a-specific-axis-in-a-figure-with-multiple-subplots/89014)

<div class="topic-metadata">

**Author:** [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Replies:** 5\
**Last updated:** [October 21, 2022, 1:44pm UTC](https://discourse.julialang.org/t/configure-a-specific-axis-in-a-figure-with-multiple-subplots/89014 "2022-10-21T13:44:47Z")

</div>

Today it gave me a headache to understand how to plot two subplots, one with a single y-axis and another with two y-axis with specific axis titles. The logic seems to be, each subplot with one y-axis adds 1 y-axis and ea…

---

## [Performance of Horner's method on Vector Polynomial vs Multiplication by Vandermonde Matrix](https://discourse.julialang.org/t/performance-of-horners-method-on-vector-polynomial-vs-multiplication-by-vandermonde-matrix/89035)

<div class="topic-metadata">

**Author:** [@ndinsmore](https://discourse.julialang.org/u/ndinsmore)\
**Replies:** 7\
**Last updated:** [October 21, 2022, 1:30pm UTC](https://discourse.julialang.org/t/performance-of-horners-method-on-vector-polynomial-vs-multiplication-by-vandermonde-matrix/89035 "2022-10-21T13:30:24Z")

</div>

We all know that Horner’s method should be the fastest way to evaluate a polynomial. So it holds that should also be true for a monomial vector polynomial, the coefficients which can be stored in a matrix. Assuming you…

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

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