# General Usage

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

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

**Page:** 564

---

## [Confused by extra allocations](https://discourse.julialang.org/t/confused-by-extra-allocations/66086)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 4\
**Last updated:** [August 9, 2021, 8:08pm UTC](https://discourse.julialang.org/t/confused-by-extra-allocations/66086 "2021-08-09T20:08:21Z")

</div>

I’ve written a function that loops over a large table and is running slower than I expected. The source of the problem seems to be a huge amount of extra allocations. I’ve created the following minimal example that dem…

---

## [About mapping functions and a deepmap!() function](https://discourse.julialang.org/t/about-mapping-functions-and-a-deepmap-function/51702)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 4\
**Last updated:** [August 9, 2021, 7:04pm UTC](https://discourse.julialang.org/t/about-mapping-functions-and-a-deepmap-function/51702 "2021-08-09T19:04:59Z")

</div>

I was thinking about how to apply a function f() to all items of a collections I knew that my function needed: first to reach every items in my collection second apply the function f to those items I decide to solve …

---

## [VegaLite: tex support + edit legend](https://discourse.julialang.org/t/vegalite-tex-support-edit-legend/66046)

<div class="topic-metadata">

**Author:** [@jo-fleck](https://discourse.julialang.org/u/jo-fleck)\
**Replies:** 1\
**Last updated:** [August 9, 2021, 6:47pm UTC](https://discourse.julialang.org/t/vegalite-tex-support-edit-legend/66046 "2021-08-09T18:47:19Z")

</div>

Thanks to everyone who is contributing to VegaLite.jl! It’s a fantastic addition to Julia’s plotting ecosystem. Using the examples in the documentation, I was able to generate the plot below. I have two questions relat…

---

## [Vector{Dict} to Tables.jl table](https://discourse.julialang.org/t/vector-dict-to-tables-jl-table/66084)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 0\
**Last updated:** [August 9, 2021, 5:54pm UTC](https://discourse.julialang.org/t/vector-dict-to-tables-jl-table/66084 "2021-08-09T17:54:48Z")

</div>

What’s the most performant way to get a vector of dicts into a Tables.jl table? For example, data = \[ Dict("id" =\> 1, "name" =\> "Bob"), Dict("id" =\> 2, "name" =\> "Bill"), Dict("id" =\> 3, "name" =\> "Betty"),…

---

## [Do I need to specify concrete type of a variable such as Int64 or just Int, Float64 or just Float?](https://discourse.julialang.org/t/do-i-need-to-specify-concrete-type-of-a-variable-such-as-int64-or-just-int-float64-or-just-float/66047)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 10\
**Last updated:** [August 9, 2021, 4:52pm UTC](https://discourse.julialang.org/t/do-i-need-to-specify-concrete-type-of-a-variable-such-as-int64-or-just-int-float64-or-just-float/66047 "2021-08-09T16:52:21Z")

</div>

In Julia, do I need to really set very specific and concrete type of the variable? Like, i::Int64 or i::Int and x::Float or x::Float64 Is there performance difference? Or, like, is it just using Int and Float i…

---

## [Composing collection of iterators that accept iterators and collecting the result](https://discourse.julialang.org/t/composing-collection-of-iterators-that-accept-iterators-and-collecting-the-result/66082)

<div class="topic-metadata">

**Author:** [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Replies:** 0\
**Last updated:** [August 9, 2021, 4:41pm UTC](https://discourse.julialang.org/t/composing-collection-of-iterators-that-accept-iterators-and-collecting-the-result/66082 "2021-08-09T16:41:25Z")

</div>

Hi, I have a series of methods that return the relevant query indexes for a filter type e.g. “Between(0,500\]” or “name = Julia” that are combined: function queryModelCollection(iQuery :: QueryModels.QueryModel, data :…

---

## [How to resize a 2D or higher dimensional array?](https://discourse.julialang.org/t/how-to-resize-a-2d-or-higher-dimensional-array/66055)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 7\
**Last updated:** [August 9, 2021, 2:47pm UTC](https://discourse.julialang.org/t/how-to-resize-a-2d-or-higher-dimensional-array/66055 "2021-08-09T14:47:12Z")

</div>

in a module, can I define a unspecified dimension array first, and then in a function give its particular dimensions? Like global const a=Array{Float64,2}() But obviously the above give me an array. However, the poin…

---

## [Manipulate trace Optim.jl](https://discourse.julialang.org/t/manipulate-trace-optim-jl/66072)

<div class="topic-metadata">

**Author:** [@AhmedAlreweny](https://discourse.julialang.org/u/AhmedAlreweny)\
**Replies:** 0\
**Last updated:** [August 9, 2021, 1:41pm UTC](https://discourse.julialang.org/t/manipulate-trace-optim-jl/66072 "2021-08-09T13:41:57Z")

</div>

Hi, I am using Optim.jl to minimize a certain objective function which includes some secondary calculations. I use algo\_ = LBFGS(;alphaguess =InitialHagerZhang(), linesearch = LineSearches.StrongWolfe()) a = Optim…

---

## [Why typeintersect(Int8,Int16) == Union{}](https://discourse.julialang.org/t/why-typeintersect-int8-int16-union/66053)

<div class="topic-metadata">

**Author:** [@Judd](https://discourse.julialang.org/u/Judd)\
**Replies:** 6\
**Last updated:** [August 9, 2021, 10:40am UTC](https://discourse.julialang.org/t/why-typeintersect-int8-int16-union/66053 "2021-08-09T10:40:47Z")

</div>

Doc: While programs manipulate individual values, a type refers to a set of values. By this, we can say that values come first, then types are created by grouping values. If so, typeintersect(Int8,Int16) should be In…

---

## [Most of the time spent in \`readdlm\` a txt file](https://discourse.julialang.org/t/most-of-the-time-spent-in-readdlm-a-txt-file/66059)

<div class="topic-metadata">

**Author:** [@daviddoij](https://discourse.julialang.org/u/daviddoij)\
**Replies:** 1\
**Last updated:** [August 9, 2021, 7:42am UTC](https://discourse.julialang.org/t/most-of-the-time-spent-in-readdlm-a-txt-file/66059 "2021-08-09T07:42:09Z")

</div>

Hi there, I’m my attempt to learn Julia, I’m solving project euler problems. In one of them, I found the performance not particularly good, when compared with other languages, e.g., Python. The code in question is the …

---

## [Promotion to BigFloat -- no zero padding](https://discourse.julialang.org/t/promotion-to-bigfloat-no-zero-padding/66042)

<div class="topic-metadata">

**Author:** [@LolianSh](https://discourse.julialang.org/u/LolianSh)\
**Replies:** 8\
**Last updated:** [August 9, 2021, 12:47am UTC](https://discourse.julialang.org/t/promotion-to-bigfloat-no-zero-padding/66042 "2021-08-09T00:47:44Z")

</div>

Hi, I am encountering some problems when promoting Float64 to a BigFloat, specifically the fact that I do not get a zero padding beyond the Float64 precision. For example I have the following: julia\> BigFloat(0.01) 0.…

---

## [How to parallelize the product of sparse and dense matrices](https://discourse.julialang.org/t/how-to-parallelize-the-product-of-sparse-and-dense-matrices/65602)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 0\
**Last updated:** [July 31, 2021, 2:39pm UTC](https://discourse.julialang.org/t/how-to-parallelize-the-product-of-sparse-and-dense-matrices/65602 "2021-07-31T14:39:21Z")

</div>

This is a general question. Suppose we have a sparse CSR matrix A and a dense column majour matrix B, and we want to calculate the product. In principle, one can parallelize either over the rows of matrix A, or over the…

---

## [Evaluate function combining Float & Vector](https://discourse.julialang.org/t/evaluate-function-combining-float-vector/66044)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 8\
**Last updated:** [August 8, 2021, 11:08pm UTC](https://discourse.julialang.org/t/evaluate-function-combining-float-vector/66044 "2021-08-08T23:08:52Z")

</div>

Suppose I have a function of 3 variables: f(x,y,z)= x + y + z Suppose I have: a variable s=1.4, which is a Float64 a vector a=\[4.2;5.0\] which is a 2-element Vector{Float64}. How can I evaluate the function f at the…

---

## [StackOverFlow Error in SIR model using ModelingTookit](https://discourse.julialang.org/t/stackoverflow-error-in-sir-model-using-modelingtookit/64604)

<div class="topic-metadata">

**Author:** [@Michael\_Barmann](https://discourse.julialang.org/u/Michael_Barmann)\
**Replies:** 28\
**Last updated:** [August 8, 2021, 10:29pm UTC](https://discourse.julialang.org/t/stackoverflow-error-in-sir-model-using-modelingtookit/64604 "2021-08-08T22:29:00Z")

</div>

I am brand new to ModelingTookit, and as a first exercise I have defined a simple SIR model and tried to solve it and plot the solution. Unfortunately I’m getting a StackOverFlow Error that I can’t figure out. Here’s my …

---

## [DifferentialEquations.jl uses just one core](https://discourse.julialang.org/t/differentialequations-jl-uses-just-one-core/65916)

<div class="topic-metadata">

**Author:** [@Volker\_Weissmann](https://discourse.julialang.org/u/Volker_Weissmann)\
**Replies:** 18\
**Last updated:** [August 8, 2021, 10:18pm UTC](https://discourse.julialang.org/t/differentialequations-jl-uses-just-one-core/65916 "2021-08-08T22:18:26Z")

</div>

The documentation says that EnsembleThreads() uses multithreading: EnsembleThreads() - The default. This uses multithreading. It’s local (single computer, shared memory) parallelism only. Fastest when the trajectories…

---

## [Confusing dimension mismatch error](https://discourse.julialang.org/t/confusing-dimension-mismatch-error/66035)

<div class="topic-metadata">

**Author:** [@usman0311](https://discourse.julialang.org/u/usman0311)\
**Replies:** 8\
**Last updated:** [August 8, 2021, 9:13pm UTC](https://discourse.julialang.org/t/confusing-dimension-mismatch-error/66035 "2021-08-08T21:13:02Z")

</div>

I am trying to extract fitting parameters, but I am unable to understand the error, it looks like dimensions are same. Both En and abs are row vector of size 601. using LsqFit, DataFrames,DelimitedFiles, QuadGK α(E,p) …

---

## [How to speed up this function?](https://discourse.julialang.org/t/how-to-speed-up-this-function/66030)

<div class="topic-metadata">

**Author:** [@le\_go](https://discourse.julialang.org/u/le_go)\
**Replies:** 2\
**Last updated:** [August 8, 2021, 6:01pm UTC](https://discourse.julialang.org/t/how-to-speed-up-this-function/66030 "2021-08-08T18:01:30Z")

</div>

Can anyone spot optimizations? using FLoops function go(arr) record = zeros(Float16,1,9) record\_add = zeros(Float16,1,9) uniq = unique(arr\[:,1\]) for (c\_86, c\_90, c\_89\_1, c\_53, c\_52, c\_89, c\_88) in collect(Iterators.…

---

## [Distributed computing using mutable struct](https://discourse.julialang.org/t/distributed-computing-using-mutable-struct/66029)

<div class="topic-metadata">

**Author:** [@jmurga](https://discourse.julialang.org/u/jmurga)\
**Replies:** 0\
**Last updated:** [August 8, 2021, 4:35pm UTC](https://discourse.julialang.org/t/distributed-computing-using-mutable-struct/66029 "2021-08-08T16:35:21Z")

</div>

Hi everyone, I am developing a bioinformatics package to estimate protein adaptation rate using analytical theory followed by an Approximate Bayesian Computation. I have used a mutable struct to change some mutational …

---

## [How could I analyze my package code to find rarely used or unused functions?](https://discourse.julialang.org/t/how-could-i-analyze-my-package-code-to-find-rarely-used-or-unused-functions/66028)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 0\
**Last updated:** [August 8, 2021, 4:21pm UTC](https://discourse.julialang.org/t/how-could-i-analyze-my-package-code-to-find-rarely-used-or-unused-functions/66028 "2021-08-08T16:21:20Z")

</div>

I thought that maybe with a tool similar to JET it could be possible to find out which of my packages functions are called by how many other functions, so that I get starting points for refactoring. Is there anything lik…

---

## [Correcting ODE initial conditions using automatic differentiation](https://discourse.julialang.org/t/correcting-ode-initial-conditions-using-automatic-differentiation/66018)

<div class="topic-metadata">

**Author:** [@kgupta359](https://discourse.julialang.org/u/kgupta359)\
**Replies:** 2\
**Last updated:** [August 8, 2021, 3:24pm UTC](https://discourse.julialang.org/t/correcting-ode-initial-conditions-using-automatic-differentiation/66018 "2021-08-08T15:24:44Z")

</div>

Hi all, I’m trying to find a way to correct initial conditions of a system of ODEs by using automatic differentiation through the ODE solver. I have implemented a similar algorithm in Python using TorchDIffEq but I’m new…

---

## [Vector of indices vs. for loop to assign values in an array](https://discourse.julialang.org/t/vector-of-indices-vs-for-loop-to-assign-values-in-an-array/66011)

<div class="topic-metadata">

**Author:** [@Valery](https://discourse.julialang.org/u/Valery)\
**Replies:** 4\
**Last updated:** [August 8, 2021, 3:03pm UTC](https://discourse.julialang.org/t/vector-of-indices-vs-for-loop-to-assign-values-in-an-array/66011 "2021-08-08T15:03:47Z")

</div>

Let the following initialisation be. A = zeros(3,3) # 3x3 array of 0 cartId = CartesianIndices(A)\[\[1 2 5 7\]\] # cartesian indices at which some values have to be assigned in A value = rand(length(cartId)) # the values to…

---

## [Recent experience with Julia as the main data science driver](https://discourse.julialang.org/t/recent-experience-with-julia-as-the-main-data-science-driver/64752)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 18\
**Last updated:** [August 8, 2021, 3:50am UTC](https://discourse.julialang.org/t/recent-experience-with-julia-as-the-main-data-science-driver/64752 "2021-08-08T03:50:24Z")

</div>

TLDR Is Julia ready as a full-blown language for doing data science? Like Python and R. Hell yeah! But it’s got some rough edges still. The long bits I want to detail a recent experience I had with trying to use Julia …

---

## [\`Plots.jl\` not working on Julia 1.7.0-beta3 (Windows 10)](https://discourse.julialang.org/t/plots-jl-not-working-on-julia-1-7-0-beta3-windows-10/65658)

<div class="topic-metadata">

**Author:** [@bhaveshshrimali](https://discourse.julialang.org/u/bhaveshshrimali)\
**Replies:** 5\
**Last updated:** [August 8, 2021, 3:56am UTC](https://discourse.julialang.org/t/plots-jl-not-working-on-julia-1-7-0-beta3-windows-10/65658 "2021-08-08T03:56:57Z")

</div>

Hi, I recently updated to Julia-1.7 (beta release) and tried using Plots.jl from the REPL within VS-Code, julia\> using Plots julia\> y = randn(10000); julia\> plot(y) connect: No error GKS: can't connect to GKS socket …

---

## [Unable to construct \`Union\` of \`Vararg\`](https://discourse.julialang.org/t/unable-to-construct-union-of-vararg/65995)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 6\
**Last updated:** [August 7, 2021, 8:34pm UTC](https://discourse.julialang.org/t/unable-to-construct-union-of-vararg/65995 "2021-08-07T20:34:52Z")

</div>

When I tried to construct Union of Vararg like julia\> Union{Vararg{Any, 1}, Vararg{Any, 2}} I got ERROR: TypeError: in Union, expected Type, got Vararg{Any, 1} but clearly julia\> Vararg{Any, 1} isa Type true julia\> …

---

## [Latest Julia binaries: A static URL](https://discourse.julialang.org/t/latest-julia-binaries-a-static-url/65932)

<div class="topic-metadata">

**Author:** [@fedario](https://discourse.julialang.org/u/fedario)\
**Replies:** 15\
**Last updated:** [August 7, 2021, 6:26pm UTC](https://discourse.julialang.org/t/latest-julia-binaries-a-static-url/65932 "2021-08-07T18:26:21Z")

</div>

Hi all, I prefer to setup my Linux system as automatically as possible using a setup script. Currently, I’m downloading the latest Julia binary manually since with each version the URL changes. For example: https://j…

---

## [Julia performance for pointer based data structures?](https://discourse.julialang.org/t/julia-performance-for-pointer-based-data-structures/65992)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [August 7, 2021, 4:53pm UTC](https://discourse.julialang.org/t/julia-performance-for-pointer-based-data-structures/65992 "2021-08-07T16:53:11Z")

</div>

Ignoring GC costs, does the lack of raw pointers cause possible performance issues (compared to C) if you want to implement pointer-based data structures like linked lists and trees? Julia exposes some pointers for C int…

---

## [BoundsError when trying to index certain dimensions of an array with a vector containing indices](https://discourse.julialang.org/t/boundserror-when-trying-to-index-certain-dimensions-of-an-array-with-a-vector-containing-indices/65983)

<div class="topic-metadata">

**Author:** [@Valery](https://discourse.julialang.org/u/Valery)\
**Replies:** 3\
**Last updated:** [August 7, 2021, 4:32pm UTC](https://discourse.julialang.org/t/boundserror-when-trying-to-index-certain-dimensions-of-an-array-with-a-vector-containing-indices/65983 "2021-08-07T16:32:52Z")

</div>

A = rand(3,3) b = findall(vec(A).\>0.5) # contains indices c = rand(2,length(b)) # some values that we want to have at the corresponding indexes stored in b, in array B. B = rand(2,3,3) B\[:,b\] = c # this line returns an e…

---

## [Where can I find some high performance Julia code?](https://discourse.julialang.org/t/where-can-i-find-some-high-performance-julia-code/65794)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 12\
**Last updated:** [August 7, 2021, 3:59pm UTC](https://discourse.julialang.org/t/where-can-i-find-some-high-performance-julia-code/65794 "2021-08-07T15:59:12Z")

</div>

Sorry for this stupid and general question. I am a Fortran guy and new to Julia. I am translating my Fortran code to Julia, and to make a direct comparison between the speed of modern Fortran and Julia. But I want to m…

---

## [Question about broadcasting](https://discourse.julialang.org/t/question-about-broadcasting/65989)

<div class="topic-metadata">

**Author:** [@RJDennis](https://discourse.julialang.org/u/RJDennis)\
**Replies:** 2\
**Last updated:** [August 7, 2021, 2:47pm UTC](https://discourse.julialang.org/t/question-about-broadcasting/65989 "2021-08-07T14:47:26Z")

</div>

Suppose I run the following w = fill(zeros(3,3),3) w\[1\] .= rand(3,3) I expected the result would have the first matrix in w given random numbers with the remaining two matrices remaining zeros, but this is not the case…

---

## [Use CMake generate a shared library .so which is to be used in Julia](https://discourse.julialang.org/t/use-cmake-generate-a-shared-library-so-which-is-to-be-used-in-julia/32197)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 0\
**Last updated:** [December 12, 2019, 1:51pm UTC](https://discourse.julialang.org/t/use-cmake-generate-a-shared-library-so-which-is-to-be-used-in-julia/32197 "2019-12-12T13:51:40Z")

</div>

Following the example 3 this link, Introduction to CMake by Example | derekmolloy.ie, I successfully generate a shared library with name listestStudent.so. Then, following the example 8 of this link: GitHub - JuliaInte…

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

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