# General Usage

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

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

**Page:** 562

---

## [Vector of Atomics](https://discourse.julialang.org/t/vector-of-atomics/64984)

<div class="topic-metadata">

**Author:** [@nabla](https://discourse.julialang.org/u/nabla)\
**Replies:** 3\
**Last updated:** [August 13, 2021, 8:27am UTC](https://discourse.julialang.org/t/vector-of-atomics/64984 "2021-08-13T08:27:19Z")

</div>

I’m aware of the Atomic{Int8} type, which wraps an Int8 into an atomically modifiable value. Internally, this is a mutable struct containing the Int8, and it seems to be the only possibility since by nature the Int8 must…

---

## [\[ANN\] SQLiteDF a simple package to use Tables.jl sources with SQL queries](https://discourse.julialang.org/t/ann-sqlitedf-a-simple-package-to-use-tables-jl-sources-with-sql-queries/64870)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 2\
**Last updated:** [August 13, 2021, 3:47am UTC](https://discourse.julialang.org/t/ann-sqlitedf-a-simple-package-to-use-tables-jl-sources-with-sql-queries/64870 "2021-08-13T03:47:03Z")

</div>

SQLiteDF.jl is a simple package with currently one macro @sqlitedf a,b,c,...,"select \* from .." in the context where it’s called it loads the data from Tables.jl compatible variables named a,b,c etc into a new in-memor…

---

## [Nested agent based model](https://discourse.julialang.org/t/nested-agent-based-model/66155)

<div class="topic-metadata">

**Author:** [@patagucci](https://discourse.julialang.org/u/patagucci)\
**Replies:** 7\
**Last updated:** [August 13, 2021, 2:14am UTC](https://discourse.julialang.org/t/nested-agent-based-model/66155 "2021-08-13T02:14:44Z")

</div>

Hi everyone, I am currently working on creating an ABM of the the dynamics of a bacterial infection within a population of individuals. Individuals in the model can transmit aiming bacteria to one another, while interac…

---

## [Speed up applying a function to matrices](https://discourse.julialang.org/t/speed-up-applying-a-function-to-matrices/66241)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 8\
**Last updated:** [August 13, 2021, 1:52am UTC](https://discourse.julialang.org/t/speed-up-applying-a-function-to-matrices/66241 "2021-08-13T01:52:16Z")

</div>

I’ve been struggling to speed up this problem I’m working with. Apologies about posting this long snippet, I couldn’t think of a more minimal example that has all the features stumping me. using BenchmarkTools using Fas…

---

## [Calling c function from julia - segmentation fault](https://discourse.julialang.org/t/calling-c-function-from-julia-segmentation-fault/66176)

<div class="topic-metadata">

**Author:** [@mrev](https://discourse.julialang.org/u/mrev)\
**Replies:** 9\
**Last updated:** [August 13, 2021, 1:34am UTC](https://discourse.julialang.org/t/calling-c-function-from-julia-segmentation-fault/66176 "2021-08-13T01:34:43Z")

</div>

Hi all! I’ve been stuck on a problem for a while now and would appreciate any help as I’m not really sure how to debug this further. I’m trying to write a Julia interface for a C function. The function appears to run su…

---

## [Catalyst + DifferentiaEquations startup time](https://discourse.julialang.org/t/catalyst-differentiaequations-startup-time/65946)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 19\
**Last updated:** [August 13, 2021, 12:53am UTC](https://discourse.julialang.org/t/catalyst-differentiaequations-startup-time/65946 "2021-08-13T00:53:22Z")

</div>

I am using Catalyist and DifferentialEquations to study a chemical reaction, but the startup times are somewhat annoying. I have the option, in this case, to write the ODE by hand (thus not requiring Catalyst), and I can…

---

## [Benchmark Tests: Improvements for BenchmarkTools](https://discourse.julialang.org/t/benchmark-tests-improvements-for-benchmarktools/66134)

<div class="topic-metadata">

**Author:** [@viraltux](https://discourse.julialang.org/u/viraltux)\
**Replies:** 16\
**Last updated:** [August 12, 2021, 10:46pm UTC](https://discourse.julialang.org/t/benchmark-tests-improvements-for-benchmarktools/66134 "2021-08-12T22:46:30Z")

</div>

Background In a separate topic discussing why systematic errors appear when using BenchmarkTools, I end up claiming that BenchmarkTools, which happens to be great to measure benchmarks, could introduce improvements when …

---

## [Snippet for serialization of any primitive type](https://discourse.julialang.org/t/snippet-for-serialization-of-any-primitive-type/66304)

<div class="topic-metadata">

**Author:** [@iamed2](https://discourse.julialang.org/u/iamed2)\
**Replies:** 0\
**Last updated:** [August 12, 2021, 10:25pm UTC](https://discourse.julialang.org/t/snippet-for-serialization-of-any-primitive-type/66304 "2021-08-12T22:25:09Z")

</div>

https://gist.github.com/iamed2/7800a9b391d9e11f0f2b7fbbfbb84c32 I recently came up with this for InlineString and realized it is nearly universally applicable for primitive types. Standard library Julia serialization w…

---

## [Adding constrain on the range of \`N\` in parametric types for function arguments](https://discourse.julialang.org/t/adding-constrain-on-the-range-of-n-in-parametric-types-for-function-arguments/65994)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 6\
**Last updated:** [August 12, 2021, 9:59pm UTC](https://discourse.julialang.org/t/adding-constrain-on-the-range-of-n-in-parametric-types-for-function-arguments/65994 "2021-08-12T21:59:12Z")

</div>

I’d like to know if it’s possible to set a range of N in a parametric type PT{T, N} when it’s the type of an argument for a defined function. E.g. f(a::Array{\<:Number, N}) where {N} = a and I want to set some constrai…

---

## [Seeing allocations only when assigning to a Vector of Union{Nothing, Struct} when Struct is immutable, but contains mutable data](https://discourse.julialang.org/t/seeing-allocations-only-when-assigning-to-a-vector-of-union-nothing-struct-when-struct-is-immutable-but-contains-mutable-data/66272)

<div class="topic-metadata">

**Author:** [@Lars\_Wander](https://discourse.julialang.org/u/Lars_Wander)\
**Replies:** 12\
**Last updated:** [August 12, 2021, 8:36pm UTC](https://discourse.julialang.org/t/seeing-allocations-only-when-assigning-to-a-vector-of-union-nothing-struct-when-struct-is-immutable-but-contains-mutable-data/66272 "2021-08-12T20:36:11Z")

</div>

Hello Julia folks, Context: while writing code to search for aperiodic tilings of the plane, I noticed that every assignment to an element of Vector{Union{Nothing, Tile}} was causing an allocation according to --track-a…

---

## [Help with @distributed with an iterator and speed issue](https://discourse.julialang.org/t/help-with-distributed-with-an-iterator-and-speed-issue/66292)

<div class="topic-metadata">

**Author:** [@scheinerman](https://discourse.julialang.org/u/scheinerman)\
**Replies:** 0\
**Last updated:** [August 12, 2021, 8:01pm UTC](https://discourse.julialang.org/t/help-with-distributed-with-an-iterator-and-speed-issue/66292 "2021-08-12T20:01:56Z")

</div>

I have two questions about the following code (in which I’m looking to get the largest eigenvalue of a matrix by permuting its rows). using LinearAlgebra, Combinatorics, Distributed function maxeig(A::Matrix) retur…

---

## [Pluto: does mardown needs a local installation of LaTeX?](https://discourse.julialang.org/t/pluto-does-mardown-needs-a-local-installation-of-latex/66264)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 2\
**Last updated:** [August 12, 2021, 4:54pm UTC](https://discourse.julialang.org/t/pluto-does-mardown-needs-a-local-installation-of-latex/66264 "2021-08-12T16:54:45Z")

</div>

Hi all, I have a local installation of LaTeX on my computer, and Pluto markdown is running smoothly. I am going to ask a lot of students to install Pluto, and most of them do not have a LaTeX local installation on their…

---

## [How to set the elements of an array of defined type in one line?](https://discourse.julialang.org/t/how-to-set-the-elements-of-an-array-of-defined-type-in-one-line/66171)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 33\
**Last updated:** [August 12, 2021, 4:06pm UTC](https://discourse.julialang.org/t/how-to-set-the-elements-of-an-array-of-defined-type-in-one-line/66171 "2021-08-12T16:06:31Z")

</div>

I have a simple code and a simple question. it is with type My\_w, and a 2-element array www whose type is My\_w, mutable struct My\_w w::Float64 end www = Array{My\_w,1}(undef,2) Now, I want to set www\[1\] and www\[2\] …

---

## [Adding saveat to DifferentialEquations.jl solve causes conversion error when using custom variable type](https://discourse.julialang.org/t/adding-saveat-to-differentialequations-jl-solve-causes-conversion-error-when-using-custom-variable-type/66275)

<div class="topic-metadata">

**Author:** [@SMijin](https://discourse.julialang.org/u/SMijin)\
**Replies:** 3\
**Last updated:** [August 12, 2021, 3:43pm UTC](https://discourse.julialang.org/t/adding-saveat-to-differentialequations-jl-solve-causes-conversion-error-when-using-custom-variable-type/66275 "2021-08-12T15:43:27Z")

</div>

I’ve got a simple struct that looks something like this: mutable struct variable{T,N} \<: AbstractArray{T,N} values :: Array{T,N} spaceIDs :: Vector{Int} end I’ve defined Base.:+, as well as Base.:\* and Base:.…

---

## [Segmentation fault, EDIT: Signal 6 - has somebody a clue?](https://discourse.julialang.org/t/segmentation-fault-edit-signal-6-has-somebody-a-clue/66206)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 7\
**Last updated:** [August 12, 2021, 3:08pm UTC](https://discourse.julialang.org/t/segmentation-fault-edit-signal-6-has-somebody-a-clue/66206 "2021-08-12T15:08:06Z")

</div>

Hi there, I am using IRTools to manipulate some intermediate representation, so this may be quite deep into julia. Out of a sudden, I have no clue what is going on, I get the following segmentation fault signal 6: sig…

---

## [Performance depends dramatically on compilation order](https://discourse.julialang.org/t/performance-depends-dramatically-on-compilation-order/58425)

<div class="topic-metadata">

**Author:** [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Replies:** 6\
**Last updated:** [August 12, 2021, 2:25pm UTC](https://discourse.julialang.org/t/performance-depends-dramatically-on-compilation-order/58425 "2021-08-12T14:25:23Z")

</div>

Using ProfileView, I have realized that our code base Gridap.jl suffers from runtime dispatch at some performance critical parts. Luckily, I have been able to reduce the problem to a simple MWE and even found a workaroun…

---

## [Package for fitting a curve and storing the function](https://discourse.julialang.org/t/package-for-fitting-a-curve-and-storing-the-function/66135)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 7\
**Last updated:** [August 12, 2021, 2:08pm UTC](https://discourse.julialang.org/t/package-for-fitting-a-curve-and-storing-the-function/66135 "2021-08-12T14:08:53Z")

</div>

I have a set of point x and y and I would like to find the best (polynomial?) fit and store it so that I can use it as a function. Polynomials.jl creates the fit but not the function (evaluating the function at a point …

---

## [Unit testing for macros?](https://discourse.julialang.org/t/unit-testing-for-macros/66230)

<div class="topic-metadata">

**Author:** [@tbenst](https://discourse.julialang.org/u/tbenst)\
**Replies:** 3\
**Last updated:** [August 12, 2021, 1:50pm UTC](https://discourse.julialang.org/t/unit-testing-for-macros/66230 "2021-08-12T13:50:50Z")

</div>

Suppose I write some complicated macro: "Return exact same expression." macro flawed\_identity(ex) @assert ex.head != :(=) "oops we don't support head of :=" ex end and I write some tests: @testset "identity" b…

---

## [How to splat named tuples into functions?](https://discourse.julialang.org/t/how-to-splat-named-tuples-into-functions/66263)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 1\
**Last updated:** [August 12, 2021, 12:12pm UTC](https://discourse.julialang.org/t/how-to-splat-named-tuples-into-functions/66263 "2021-08-12T12:12:09Z")

</div>

I’d like to be able to do something like this: using NLsolve function f!(F, x) F\[1\] = (x\[1\]+3)\*(x\[2\]^3-7)+18 F\[2\] = sin(x\[2\]\*exp(x\[1\])-1) end opts = (method=:newton, autodiff=:forward) # i'd like to be able t…

---

## [Implementing interface on custom types](https://discourse.julialang.org/t/implementing-interface-on-custom-types/66250)

<div class="topic-metadata">

**Author:** [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Replies:** 3\
**Last updated:** [August 12, 2021, 11:43am UTC](https://discourse.julialang.org/t/implementing-interface-on-custom-types/66250 "2021-08-12T11:43:00Z")

</div>

Is it possible to implement an interface on a simple custom type so that many common functions will work on it? I’m trying to improve my knowledge of Julia. Let’s say we have the following simple custom type. mutable st…

---

## [Julia 1.6.2 not eq comparison operator bug](https://discourse.julialang.org/t/julia-1-6-2-not-eq-comparison-operator-bug/66252)

<div class="topic-metadata">

**Author:** [@hobbymarks](https://discourse.julialang.org/u/hobbymarks)\
**Replies:** 2\
**Last updated:** [August 12, 2021, 10:00am UTC](https://discourse.julialang.org/t/julia-1-6-2-not-eq-comparison-operator-bug/66252 "2021-08-12T10:00:39Z")

</div>

When I want to use the Not-equals comparison operator,I must copy from the julia help documentation. If it is not obtained by copying, even if I input according to the suggestions of the document, and the characters dis…

---

## [Dot operation broadcast for a "StaticSparseVector"](https://discourse.julialang.org/t/dot-operation-broadcast-for-a-staticsparsevector/66124)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 5\
**Last updated:** [August 12, 2021, 7:35am UTC](https://discourse.julialang.org/t/dot-operation-broadcast-for-a-staticsparsevector/66124 "2021-08-12T07:35:23Z")

</div>

For various reasons, I want to create a static sparse vector (SSV) type. In contrast to what is done (for matrices) in LuxurySparse.jl, I want the sparsity structure to be part of the data type. I do that by using a re…

---

## [Are there Julia + MPI applications on Supercomputer?](https://discourse.julialang.org/t/are-there-julia-mpi-applications-on-supercomputer/66240)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 5\
**Last updated:** [August 12, 2021, 7:06am UTC](https://discourse.julialang.org/t/are-there-julia-mpi-applications-on-supercomputer/66240 "2021-08-12T07:06:44Z")

</div>

I am come from modern Fortran with nuclear quantum Monte Carlo (QMC) applications, which, seems many codes are written in modern Fortran. For example, some codes such as Green’s Function Monte Carlo (GFMC) for Carbon 12…

---

## [Transforming arbitrary Julia code to lazy evaluation](https://discourse.julialang.org/t/transforming-arbitrary-julia-code-to-lazy-evaluation/66239)

<div class="topic-metadata">

**Author:** [@tbenst](https://discourse.julialang.org/u/tbenst)\
**Replies:** 4\
**Last updated:** [August 12, 2021, 3:51am UTC](https://discourse.julialang.org/t/transforming-arbitrary-julia-code-to-lazy-evaluation/66239 "2021-08-12T03:51:01Z")

</div>

I’ve been experimenting with methods for transforming arbitrary Julia code for lazy evaluation (repo at https://github.com/tbenst/Thunks.jl). Here’s an example of what I’d like to be able to do in a fraction of a second: …

---

## [Help to get my slow Julia code to run as fast as Rust/Java/Lisp](https://discourse.julialang.org/t/help-to-get-my-slow-julia-code-to-run-as-fast-as-rust-java-lisp/65741)

<div class="topic-metadata">

**Author:** [@renatoathaydes](https://discourse.julialang.org/u/renatoathaydes)\
**Replies:** 100\
**Last updated:** [August 6, 2021, 1:54am UTC](https://discourse.julialang.org/t/help-to-get-my-slow-julia-code-to-run-as-fast-as-rust-java-lisp/65741 "2021-08-06T01:54:53Z")

</div>

Hi there! I had included some Julia code in a benchmark I’ve run to see how it performs compared to a few other languages. Given what other people say, Julia should be very fast, but the program I wrote is much slower t…

---

## [Which reference is undefined here?](https://discourse.julialang.org/t/which-reference-is-undefined-here/65707)

<div class="topic-metadata">

**Author:** [@trg818](https://discourse.julialang.org/u/trg818)\
**Replies:** 10\
**Last updated:** [August 11, 2021, 11:38pm UTC](https://discourse.julialang.org/t/which-reference-is-undefined-here/65707 "2021-08-11T23:38:30Z")

</div>

Hi, I’m still quite new to Julia and am trying to make a simple plot. Please consider the following: zth=Vector{Vector{Float64}}(undef,length(DaT)) tth=Vector{Vector{Float64}}(undef,length(DaT)) ... zthcnvplot=plot(tit…

---

## [How to sample from a truncated distribution without allocating too much memory](https://discourse.julialang.org/t/how-to-sample-from-a-truncated-distribution-without-allocating-too-much-memory/66232)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 1\
**Last updated:** [August 11, 2021, 10:12pm UTC](https://discourse.julialang.org/t/how-to-sample-from-a-truncated-distribution-without-allocating-too-much-memory/66232 "2021-08-11T22:12:59Z")

</div>

Hello everyone! I’m writing a code that samples millions of times from a truncated distribution. Everything works well and is also enough fast, but I am not satisfied with the memory allocations and the gc time, in my …

---

## [Parameterized subtying syntax strangeness](https://discourse.julialang.org/t/parameterized-subtying-syntax-strangeness/66226)

<div class="topic-metadata">

**Author:** [@Joseph\_Campolongo](https://discourse.julialang.org/u/Joseph_Campolongo)\
**Replies:** 0\
**Last updated:** [August 11, 2021, 8:27pm UTC](https://discourse.julialang.org/t/parameterized-subtying-syntax-strangeness/66226 "2021-08-11T20:27:03Z")

</div>

Given two syntactically different but semantically equal (?) type definitions, one fails with an invalid subtyping error, while the other succeeds. Can someone explain why this is happening? julia\> abstract type F{X} e…

---

## [Download/unzip a .zip file](https://discourse.julialang.org/t/download-unzip-a-zip-file/21271)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 3\
**Last updated:** [August 11, 2021, 7:51pm UTC](https://discourse.julialang.org/t/download-unzip-a-zip-file/21271 "2021-08-11T19:51:08Z")

</div>

I set out to download/unzip a .zip file from a URL today and never thought it would be such a problem. I get an error when installing ZipFile.jl and there seems to be a lot of complaints about that package anyways. Can s…

---

## [Is there any padding function available to pad a matrix or array?](https://discourse.julialang.org/t/is-there-any-padding-function-available-to-pad-a-matrix-or-array/8521)

<div class="topic-metadata">

**Author:** [@tosalonijain](https://discourse.julialang.org/u/tosalonijain)\
**Replies:** 7\
**Last updated:** [August 11, 2021, 4:54pm UTC](https://discourse.julialang.org/t/is-there-any-padding-function-available-to-pad-a-matrix-or-array/8521 "2021-08-11T16:54:53Z")

</div>

If yes, Please share, if not than also a response would be appreciated.

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

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