# General Usage

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

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

**Page:** 334

---

## [Finding low frequency numbers in a large collection](https://discourse.julialang.org/t/finding-low-frequency-numbers-in-a-large-collection/93556)

<div class="topic-metadata">

**Author:** [@CodeGodz](https://discourse.julialang.org/u/CodeGodz)\
**Replies:** 20\
**Last updated:** [February 3, 2023, 8:21pm UTC](https://discourse.julialang.org/t/finding-low-frequency-numbers-in-a-large-collection/93556 "2023-02-03T20:21:18Z")

</div>

Hey all :slight\_smile: See edit here for clarification I want to find all numbers in a file that have a frequency \<=100. The numbers are in the UInt32 range so I could allocate a Vector{UInt8}(typemax(UInt32)) to coun…

---

## [Getting KrylovKit to return specified number of values](https://discourse.julialang.org/t/getting-krylovkit-to-return-specified-number-of-values/93852)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 2\
**Last updated:** [February 3, 2023, 11:14pm UTC](https://discourse.julialang.org/t/getting-krylovkit-to-return-specified-number-of-values/93852 "2023-02-03T23:14:59Z")

</div>

I’m working on a problem (reduced order models of circuits) and am trying to use KrylovKit to return a specified number of eigenvalues in the solution. I couldn’t make it work, but it was easy in Arpack x = eigs(a, nev…

---

## [My generated Julia function from a niche DSL language takes 4min to compile](https://discourse.julialang.org/t/my-generated-julia-function-from-a-niche-dsl-language-takes-4min-to-compile/93974)

<div class="topic-metadata">

**Author:** [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Replies:** 8\
**Last updated:** [February 3, 2023, 9:08pm UTC](https://discourse.julialang.org/t/my-generated-julia-function-from-a-niche-dsl-language-takes-4min-to-compile/93974 "2023-02-03T21:08:08Z")

</div>

I have an application that generates Julia code from a niche DSL language. The generated code is correct and returns the same results as the DSL interpreter. One problem, though, is that for a real-world application, the…

---

## [Convert matrix elements from Int to Float](https://discourse.julialang.org/t/convert-matrix-elements-from-int-to-float/93980)

<div class="topic-metadata">

**Author:** [@ahmad88](https://discourse.julialang.org/u/ahmad88)\
**Replies:** 3\
**Last updated:** [February 3, 2023, 8:19pm UTC](https://discourse.julialang.org/t/convert-matrix-elements-from-int-to-float/93980 "2023-02-03T20:19:21Z")

</div>

If I have the following matrix sparse(\[1, 2, 3, 4, 1, 2, 4, 1, 3, 4, 5, 1, 2, 3, 4, 5, 3, 4, 5\], \[1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5\], \[3, -1, -1, -1, -1, 2, -1, -1, 3, -1, -1, -1, -1, -1, 4, -1, -1…

---

## [Performance hit in generated function using dispatching on argument](https://discourse.julialang.org/t/performance-hit-in-generated-function-using-dispatching-on-argument/94011)

<div class="topic-metadata">

**Author:** [@f.ij](https://discourse.julialang.org/u/f.ij)\
**Replies:** 0\
**Last updated:** [February 3, 2023, 8:05pm UTC](https://discourse.julialang.org/t/performance-hit-in-generated-function-using-dispatching-on-argument/94011 "2023-02-03T20:05:51Z")

</div>

I’m trying to use generated functions since I need to loop over a sum of elements from different vectors, but the vectors that are used in the sum depend on the type of one of the arguments. The last argument is an insta…

---

## [Possible Performance Regression for Loops on 1.9?](https://discourse.julialang.org/t/possible-performance-regression-for-loops-on-1-9/93994)

<div class="topic-metadata">

**Author:** [@jacobxk](https://discourse.julialang.org/u/jacobxk)\
**Replies:** 12\
**Last updated:** [February 3, 2023, 6:23pm UTC](https://discourse.julialang.org/t/possible-performance-regression-for-loops-on-1-9/93994 "2023-02-03T18:23:02Z")

</div>

There is a function in Bogumił Kamiński’s book Julia for Data Analysis(page 7) with the purpose to show off the optimizations done by Julia compiler. function sum\_n(n) s = 0 for i in 1:n s += i end …

---

## [Has anyone built a graph database of all the dependencies in the Julia General registry?](https://discourse.julialang.org/t/has-anyone-built-a-graph-database-of-all-the-dependencies-in-the-julia-general-registry/68141)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 1\
**Last updated:** [February 3, 2023, 4:45pm UTC](https://discourse.julialang.org/t/has-anyone-built-a-graph-database-of-all-the-dependencies-in-the-julia-general-registry/68141 "2023-02-03T16:45:33Z")

</div>

E.g. when I go to R’s CRAN I can see reverse suggest etc meaning package A was suggested by package B so essentially some kind of graph is built for package dependencies. Wonder if such a thing already exists for Julia. …

---

## [Problems with starting circuitscape from R package JuliaCall](https://discourse.julialang.org/t/problems-with-starting-circuitscape-from-r-package-juliacall/93965)

<div class="topic-metadata">

**Author:** [@Lfreitas](https://discourse.julialang.org/u/Lfreitas)\
**Replies:** 3\
**Last updated:** [February 3, 2023, 3:15pm UTC](https://discourse.julialang.org/t/problems-with-starting-circuitscape-from-r-package-juliacall/93965 "2023-02-03T15:15:55Z")

</div>

Hi, I’m brandnew to julia and I am facing a hard time while trying to run my analysis. The situation is that I’m trying to run the package Circuitscape using JuliaCall within R in a custom docker container and I kept ge…

---

## [(More) Debugging of Statically Compiled Code](https://discourse.julialang.org/t/more-debugging-of-statically-compiled-code/93987)

<div class="topic-metadata">

**Author:** [@wave\_and\_matter](https://discourse.julialang.org/u/wave_and_matter)\
**Replies:** 1\
**Last updated:** [February 3, 2023, 3:00pm UTC](https://discourse.julialang.org/t/more-debugging-of-statically-compiled-code/93987 "2023-02-03T15:00:53Z")

</div>

After having successfully implemented a first algorithm of mine in statically compiled julia i now struggle with debugging of a second one. Since the error messages or reasons for crashes from statically compiled julia …

---

## [Function structure for ForwardDiff jacobian](https://discourse.julialang.org/t/function-structure-for-forwarddiff-jacobian/93991)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 0\
**Last updated:** [February 3, 2023, 2:22pm UTC](https://discourse.julialang.org/t/function-structure-for-forwarddiff-jacobian/93991 "2023-02-03T14:22:00Z")

</div>

Hello, I’m working with images, and I’m seeing some strange behaviour on Jacobian computation, so I suspect my function formulation is incorrect. I have two patches in an image, and my function F which returns a vector…

---

## [Base.accumulate! seems slow due to keyword argument handling, can it be sped up?](https://discourse.julialang.org/t/base-accumulate-seems-slow-due-to-keyword-argument-handling-can-it-be-sped-up/93650)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 3\
**Last updated:** [February 3, 2023, 2:11pm UTC](https://discourse.julialang.org/t/base-accumulate-seems-slow-due-to-keyword-argument-handling-can-it-be-sped-up/93650 "2023-02-03T14:11:22Z")

</div>

Before I found accumulate, I had written a simple implementation. Then I was informed about accumulate! and tried using that. @btime’ing it showed allocations and that it took nearly twice as long to run as the implement…

---

## [Macro or DSL for easier DBInterface usage?](https://discourse.julialang.org/t/macro-or-dsl-for-easier-dbinterface-usage/93942)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 6\
**Last updated:** [February 3, 2023, 2:02pm UTC](https://discourse.julialang.org/t/macro-or-dsl-for-easier-dbinterface-usage/93942 "2023-02-03T14:02:31Z")

</div>

DBInterface is great for using SQL and database queries. However, SQL queries can get lengthy, and the mixing of SQL and Julia code is a bit ugly. I am wondering if there are packages that would replace lines like this …

---

## [JSON3 to mutable Dict{String,Any}](https://discourse.julialang.org/t/json3-to-mutable-dict-string-any/93443)

<div class="topic-metadata">

**Author:** [@JesperMartinsson](https://discourse.julialang.org/u/JesperMartinsson)\
**Replies:** 3\
**Last updated:** [February 3, 2023, 1:57pm UTC](https://discourse.julialang.org/t/json3-to-mutable-dict-string-any/93443 "2023-02-03T13:57:26Z")

</div>

I’m using JSON3 to parse an input that can be either a json or an array of json string. I want to convert the output of JSON3.read to either a mutable Dict{String,Any} or Array{Dict{String,Any}}, respectively. I see that…

---

## [Possible performance regression in 1.9 / StaticArrays](https://discourse.julialang.org/t/possible-performance-regression-in-1-9-staticarrays/93422)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 11\
**Last updated:** [February 3, 2023, 1:07pm UTC](https://discourse.julialang.org/t/possible-performance-regression-in-1-9-staticarrays/93422 "2023-02-03T13:07:59Z")

</div>

This is a followup from: Accelerating an N^2 nested loop - #14 by lmiq I have the following code, which tries to compute some sort of acceleration for particles. There is an implementation based on standard 1D arrays to…

---

## [Why am I unable to precompile my project?](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832)

<div class="topic-metadata">

**Author:** [@kannan975](https://discourse.julialang.org/u/kannan975)\
**Replies:** 7\
**Last updated:** [January 31, 2023, 8:54pm UTC](https://discourse.julialang.org/t/why-am-i-unable-to-precompile-my-project/93832 "2023-01-31T20:54:11Z")

</div>

Hi, I am quite new to Julia and I am trying to working on and developing a package that my colleague has made. Following the instructions on pkgdocs, I used dev to clone the project followed by activate . and instantia…

---

## [How to benchmark in-place functions?](https://discourse.julialang.org/t/how-to-benchmark-in-place-functions/36493)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 8\
**Last updated:** [February 3, 2023, 12:32pm UTC](https://discourse.julialang.org/t/how-to-benchmark-in-place-functions/36493 "2023-02-03T12:32:13Z")

</div>

Hi all, I wondered how to benchmark functions correctly that modify always the same input in-place. In particular, using the @btime macro of BenchmarkTools.jl. For example consider the following minimal code: using Ben…

---

## [Based on which packages is Base.Threads built?](https://discourse.julialang.org/t/based-on-which-packages-is-base-threads-built/93930)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 4\
**Last updated:** [February 3, 2023, 12:01pm UTC](https://discourse.julialang.org/t/based-on-which-packages-is-base-threads-built/93930 "2023-02-03T12:01:47Z")

</div>

I am happy to use the functions in Base.Threads, and I am carious to know that based on which packages this Base.Threads is built? is it OneAPI, OpenMP, etc.?

---

## [\[SOLVED\] Precompilation of OrdinaryDiffEq fails in julia 1.8.5 on manjaro (arch) linux](https://discourse.julialang.org/t/solved-precompilation-of-ordinarydiffeq-fails-in-julia-1-8-5-on-manjaro-arch-linux/93979)

<div class="topic-metadata">

**Author:** [@SeverinBang](https://discourse.julialang.org/u/SeverinBang)\
**Replies:** 2\
**Last updated:** [February 3, 2023, 11:53am UTC](https://discourse.julialang.org/t/solved-precompilation-of-ordinarydiffeq-fails-in-julia-1-8-5-on-manjaro-arch-linux/93979 "2023-02-03T11:53:51Z")

</div>

Dear Community, I am relatively new to julia and want to model ordinary differential equations. Installing the OrdinaryDiffEq package failed, and the output of julia\> import Pkg; Pkg.precompile() is: julia\> import Pkg;…

---

## [QHull and Polyhedra give different volume estimates](https://discourse.julialang.org/t/qhull-and-polyhedra-give-different-volume-estimates/74487)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 0\
**Last updated:** [January 12, 2022, 1:33pm UTC](https://discourse.julialang.org/t/qhull-and-polyhedra-give-different-volume-estimates/74487 "2022-01-12T13:33:45Z")

</div>

I am trying to figure out why QHull and Polyhedra give different volume estimates for the same inputs. They agree in the 2D case, but diverge in the 3D case. Results 2D Polyhedra.jl: 0.982 QHull.jl: 0.982 3D Polyhedra.…

---

## [Globals / Constants Act Differently Depending on Use?](https://discourse.julialang.org/t/globals-constants-act-differently-depending-on-use/93933)

<div class="topic-metadata">

**Author:** [@dkzwart](https://discourse.julialang.org/u/dkzwart)\
**Replies:** 2\
**Last updated:** [February 2, 2023, 5:38pm UTC](https://discourse.julialang.org/t/globals-constants-act-differently-depending-on-use/93933 "2023-02-02T17:38:45Z")

</div>

I’ve been doing a lot of reading on Constants and Globals, and I realize I really don’t understand what I am reading. Having said that, can you all help me understand why var1 is undefined in the function? It seems to be…

---

## [Clever way to sum](https://discourse.julialang.org/t/clever-way-to-sum/93967)

<div class="topic-metadata">

**Author:** [@Gattu\_Mytraya](https://discourse.julialang.org/u/Gattu_Mytraya)\
**Replies:** 4\
**Last updated:** [February 3, 2023, 2:54am UTC](https://discourse.julialang.org/t/clever-way-to-sum/93967 "2023-02-03T02:54:19Z")

</div>

I was wondering whether there’s an efficient way to calculate sums of the form: Sn = a1-n + a2-n + … + an-n Currently, I’m just doing something like: sum(x-\>x^(-n), a) I would require all the sums from 1 to n. The e…

---

## [Make a Copy of a DataFrame Row](https://discourse.julialang.org/t/make-a-copy-of-a-dataframe-row/93953)

<div class="topic-metadata">

**Author:** [@quietlight](https://discourse.julialang.org/u/quietlight)\
**Replies:** 9\
**Last updated:** [February 2, 2023, 11:34pm UTC](https://discourse.julialang.org/t/make-a-copy-of-a-dataframe-row/93953 "2023-02-02T23:34:03Z")

</div>

I am stuck on this for loop. I need a copy of a dataframe row so I can modify it and then push the modified row onto to the dataframe. My K-MF label means a male and female kiwi are both calling at the same time, I want…

---

## [Doc string for overloaded Base method?](https://discourse.julialang.org/t/doc-string-for-overloaded-base-method/93957)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [February 2, 2023, 11:30pm UTC](https://discourse.julialang.org/t/doc-string-for-overloaded-base-method/93957 "2023-02-02T23:30:23Z")

</div>

If I overload e.g. Base.getindex() for my custom type, how do I include a doc string that gets automatically displayed by Documenter.jl for documenting my package? Documenter.jl seems to use the “original” doc string inc…

---

## [Delete all variables - Pluto notebook - Julia](https://discourse.julialang.org/t/delete-all-variables-pluto-notebook-julia/93245)

<div class="topic-metadata">

**Author:** [@Students](https://discourse.julialang.org/u/Students)\
**Replies:** 6\
**Last updated:** [January 22, 2023, 3:03am UTC](https://discourse.julialang.org/t/delete-all-variables-pluto-notebook-julia/93245 "2023-01-22T03:03:31Z")

</div>

Hello, I want to clear all the variables defined before by running a cell in pluto notebook. I am new here! Thanks for the help Thank you!

---

## [min(NaN,5) = NaN (why no @fastmath?)](https://discourse.julialang.org/t/min-nan-5-nan-why-no-fastmath/93736)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 47\
**Last updated:** [February 2, 2023, 9:03pm UTC](https://discourse.julialang.org/t/min-nan-5-nan-why-no-fastmath/93736 "2023-02-02T21:03:44Z")

</div>

Hey Julianners, I just want to ask, as I ran into this problem 4th times even after that I know what causes this problem. Shouldn’t we make it happen to be correct as it is expected like in other languages? So basic…

---

## [Qhull.jl personalisation](https://discourse.julialang.org/t/qhull-jl-personalisation/92805)

<div class="topic-metadata">

**Author:** [@jeffzwe](https://discourse.julialang.org/u/jeffzwe)\
**Replies:** 0\
**Last updated:** [January 11, 2023, 12:40pm UTC](https://discourse.julialang.org/t/qhull-jl-personalisation/92805 "2023-01-11T12:40:49Z")

</div>

Hi there! I’m using QHull.jl for a project where I need to calculate the volume of convex hulls in 8-d. I’m starting out with about 10 points and then iteratively adding more and more points to be included in the convex…

---

## [What does \`\<:\` as a type parameter mean?](https://discourse.julialang.org/t/what-does-as-a-type-parameter-mean/93916)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [February 2, 2023, 12:52pm UTC](https://discourse.julialang.org/t/what-does-as-a-type-parameter-mean/93916 "2023-02-02T12:52:35Z")

</div>

julia\> Array{\<:,2} Matrix{\<:} (alias for Array{\<:, 2}) julia\> Array{\<:,2} === Array{\<:Any,2} false julia\> Matrix{\<:} isa UnionAll false I wonder if Matrix{\<:} means anything?

---

## [GridapGmsh error loading .msh file when line and surface elements are used](https://discourse.julialang.org/t/gridapgmsh-error-loading-msh-file-when-line-and-surface-elements-are-used/93922)

<div class="topic-metadata">

**Author:** [@jav](https://discourse.julialang.org/u/jav)\
**Replies:** 0\
**Last updated:** [February 2, 2023, 12:44pm UTC](https://discourse.julialang.org/t/gridapgmsh-error-loading-msh-file-when-line-and-surface-elements-are-used/93922 "2023-02-02T12:44:09Z")

</div>

Hello all, for a task, one model contains shells (surface elements) and beams (line elements). The goal was to get a simple working model. Please see the picture: If this is loaded with GridapGmsh an error message o…

---

## [JuliaFormatter: multi-line matrix in VSCode](https://discourse.julialang.org/t/juliaformatter-multi-line-matrix-in-vscode/93872)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 7\
**Last updated:** [February 2, 2023, 11:38am UTC](https://discourse.julialang.org/t/juliaformatter-multi-line-matrix-in-vscode/93872 "2023-02-02T11:38:10Z")

</div>

In VSCode, when I use the formatter on something like this: m = \[ 1 0 0 1 \] I get something like this: m = \[ 1 0 0 1 \] Is there some option or simple way to disable that formatting of multi-line matrices?

---

## [How to add gaussian noise with different standard deviations to different elements of an array?](https://discourse.julialang.org/t/how-to-add-gaussian-noise-with-different-standard-deviations-to-different-elements-of-an-array/93906)

<div class="topic-metadata">

**Author:** [@CurioMath](https://discourse.julialang.org/u/CurioMath)\
**Replies:** 1\
**Last updated:** [February 2, 2023, 6:18am UTC](https://discourse.julialang.org/t/how-to-add-gaussian-noise-with-different-standard-deviations-to-different-elements-of-an-array/93906 "2023-02-02T06:18:04Z")

</div>

Hi, I have an array of measurements of different variables, of varying magnitude, to which I have to add gaussian noise. But note that I have to add noise with different standard deviation to each measurement(i.e. to ea…

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

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