# General Usage

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

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

**Page:** 715

---

## [Why is this scenario of function parameter estimation acting strangely? Using LsqFit](https://discourse.julialang.org/t/why-is-this-scenario-of-function-parameter-estimation-acting-strangely-using-lsqfit/44778)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 2\
**Last updated:** [August 13, 2020, 1:24pm UTC](https://discourse.julialang.org/t/why-is-this-scenario-of-function-parameter-estimation-acting-strangely-using-lsqfit/44778 "2020-08-13T13:24:24Z")

</div>

FYI for the other definitions of model (commented out), I’ve tested them with the same pair of parameters. using Plots using LsqFit # Define expected curve behaviour # @. model(t, p) = p\[2\]\*exp(p\[1\]\*t) # works # @. mod…

---

## [\[compat\] resolution logic; unsatisfiable requirement that should work?](https://discourse.julialang.org/t/compat-resolution-logic-unsatisfiable-requirement-that-should-work/44855)

<div class="topic-metadata">

**Author:** [@BioTurboNick](https://discourse.julialang.org/u/BioTurboNick)\
**Replies:** 6\
**Last updated:** [August 13, 2020, 12:55pm UTC](https://discourse.julialang.org/t/compat-resolution-logic-unsatisfiable-requirement-that-should-work/44855 "2020-08-13T12:55:01Z")

</div>

Summary of below: How do I resolve this \[compat\] and Manifest.toml conflict, and how do I keep it from happening again? I have a package that depends on Distributions.jl. Currently its \[compat\] entry contains this: \[c…

---

## [Slower execution with multi-threading using @threads macro](https://discourse.julialang.org/t/slower-execution-with-multi-threading-using-threads-macro/44867)

<div class="topic-metadata">

**Author:** [@trathi](https://discourse.julialang.org/u/trathi)\
**Replies:** 5\
**Last updated:** [August 13, 2020, 12:45pm UTC](https://discourse.julialang.org/t/slower-execution-with-multi-threading-using-threads-macro/44867 "2020-08-13T12:45:40Z")

</div>

I am running into an issue where allowing multi-threading leads to slower execution time. Following is the simple code where I am testing it: function sqr(x) return x\*x end y = zeros(10) for i=1:8 y\[i\] = sqr(i)…

---

## [Fast sparse interval matrices?](https://discourse.julialang.org/t/fast-sparse-interval-matrices/44864)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 1\
**Last updated:** [August 13, 2020, 12:41pm UTC](https://discourse.julialang.org/t/fast-sparse-interval-matrices/44864 "2020-08-13T12:41:50Z")

</div>

I have noticed that using sparse interval matrices is a big performance hit: using ValidatedNumerics, SparseArrays import ValidatedNumerics.IntervalArithmetic.hull n = 10000 P = sprand(n, n, 0.01) Q = sprandn(n, n, 0.0…

---

## [Why should I not "use unnecessary static parameters"](https://discourse.julialang.org/t/why-should-i-not-use-unnecessary-static-parameters/44859)

<div class="topic-metadata">

**Author:** [@HenrikM](https://discourse.julialang.org/u/HenrikM)\
**Replies:** 9\
**Last updated:** [August 13, 2020, 11:10am UTC](https://discourse.julialang.org/t/why-should-i-not-use-unnecessary-static-parameters/44859 "2020-08-13T11:10:41Z")

</div>

The style guide says Don’t use unnecessary static parameters but does not explain why. Is this just a question of style or are there other considerations?

---

## [BinaryBuilder.jl: how to select gcc 9.1.0](https://discourse.julialang.org/t/binarybuilder-jl-how-to-select-gcc-9-1-0/44857)

<div class="topic-metadata">

**Author:** [@MichelJuillard](https://discourse.julialang.org/u/MichelJuillard)\
**Replies:** 2\
**Last updated:** [August 13, 2020, 7:36am UTC](https://discourse.julialang.org/t/binarybuilder-jl-how-to-select-gcc-9-1-0/44857 "2020-08-13T07:36:52Z")

</div>

I have a binary executable that needs to be compiled with gcc 9.1.0. I see in the code of BinaryBuilderBase.jl that there is provision for gcc 9.1.0, but I don’t undertstand how I can request such a shard. Selecting libg…

---

## [TBB and Julia threads composability](https://discourse.julialang.org/t/tbb-and-julia-threads-composability/43688)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 1\
**Last updated:** [August 12, 2020, 11:37pm UTC](https://discourse.julialang.org/t/tbb-and-julia-threads-composability/43688 "2020-08-12T23:37:53Z")

</div>

I would like to call parallel C++ libraries from a multithreaded Julia program, using the composable parallelism of Julia and Intel’s TBB in tandem. While the Julia thread blog post and the docs do not address this issu…

---

## [Mmap error on windows](https://discourse.julialang.org/t/mmap-error-on-windows/24594)

<div class="topic-metadata">

**Author:** [@ranjan](https://discourse.julialang.org/u/ranjan)\
**Replies:** 5\
**Last updated:** [August 12, 2020, 10:46pm UTC](https://discourse.julialang.org/t/mmap-error-on-windows/24594 "2020-08-12T22:46:49Z")

</div>

Hello, I am using SharedArrays to accumulate matrices that have been generated by different worker processes in my package Circuitscape. However, on windows, when I run the tests, I get: Got exception outside of a @tes…

---

## [Which line is resulting is huge memory allocation?](https://discourse.julialang.org/t/which-line-is-resulting-is-huge-memory-allocation/44822)

<div class="topic-metadata">

**Author:** [@Sanji\_Vinsmoke](https://discourse.julialang.org/u/Sanji_Vinsmoke)\
**Replies:** 10\
**Last updated:** [August 12, 2020, 8:23pm UTC](https://discourse.julialang.org/t/which-line-is-resulting-is-huge-memory-allocation/44822 "2020-08-12T20:23:30Z")

</div>

This code below is running very very slow must be due to the ridiculous number of memory allocations. input = "1113222113" function lookandsay(s::AbstractString)::AbstractString result = "" i = 1 while i \<=…

---

## [Simple Mat-Vec multiply (understanding performance, without the bugs)](https://discourse.julialang.org/t/simple-mat-vec-multiply-understanding-performance-without-the-bugs/44762)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 16\
**Last updated:** [August 12, 2020, 11:22am UTC](https://discourse.julialang.org/t/simple-mat-vec-multiply-understanding-performance-without-the-bugs/44762 "2020-08-12T11:22:53Z")

</div>

I wanted to show someone that straight ahead Julia code is reasonably fast. So I used the following: using BenchmarkTools,LinearAlgebra function matmul(A,v) if size(A,2) != length(v) throw(DimensionMismatch…

---

## [RROR: UndefVarError: insertcolafter not defined in JuliaDB](https://discourse.julialang.org/t/rror-undefvarerror-insertcolafter-not-defined-in-juliadb/44810)

<div class="topic-metadata">

**Author:** [@hafez\_ahmad](https://discourse.julialang.org/u/hafez_ahmad)\
**Replies:** 2\
**Last updated:** [August 12, 2020, 3:11pm UTC](https://discourse.julialang.org/t/rror-undefvarerror-insertcolafter-not-defined-in-juliadb/44810 "2020-08-12T15:11:59Z")

</div>

I am using Julia 1.5 in windows 10. I am just reading and practicing JuliaDB \> t = table(\[0.01, 0.05\], \[2,1\], \[3,4\], names=\[:t, :x, :y\], pkey=:t) \> \> insertcolafter(t, :t, :w, \[0,1\]) \> ERROR: UndefVarError: insertcol…

---

## [Why does Distances 0.9.0 depends on Plots 1.5.7](https://discourse.julialang.org/t/why-does-distances-0-9-0-depends-on-plots-1-5-7/44784)

<div class="topic-metadata">

**Author:** [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Replies:** 6\
**Last updated:** [August 12, 2020, 3:05pm UTC](https://discourse.julialang.org/t/why-does-distances-0-9-0-depends-on-plots-1-5-7/44784 "2020-08-12T15:05:16Z")

</div>

I dont understand why the package Distances which calculates euclidean distances would depends on Plot 1.5.7 I could not figure out what in Plots 1.5.8 broke Distances 0.9.0 (@v1.5) pkg\> up Updating registry at \`~/.…

---

## [Noteworthy differences from Fortran](https://discourse.julialang.org/t/noteworthy-differences-from-fortran/44502)

<div class="topic-metadata">

**Author:** [@zyth0s](https://discourse.julialang.org/u/zyth0s)\
**Replies:** 38\
**Last updated:** [August 12, 2020, 3:01pm UTC](https://discourse.julialang.org/t/noteworthy-differences-from-fortran/44502 "2020-08-12T15:01:45Z")

</div>

I have noticed that there is no short list of noteworthy differences with Fortran in the documentation: Noteworthy Differences from other Languages · The Julia Language Considering that many Fortran programmers would b…

---

## [Irrational numbers are unique, so which package gets to define them?](https://discourse.julialang.org/t/irrational-numbers-are-unique-so-which-package-gets-to-define-them/44798)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [August 12, 2020, 12:11pm UTC](https://discourse.julialang.org/t/irrational-numbers-are-unique-so-which-package-gets-to-define-them/44798 "2020-08-12T12:11:27Z")

</div>

Irrational numbers are singleton types and are unique, so we have something like julia\> Irrational{:pi}() === Irrational{:pi}() true Not many irrational numbers are defined in Base, therefore packages are free to defin…

---

## [How to quote special characters in run() function](https://discourse.julialang.org/t/how-to-quote-special-characters-in-run-function/21359)

<div class="topic-metadata">

**Author:** [@Fred](https://discourse.julialang.org/u/Fred)\
**Replies:** 4\
**Last updated:** [August 12, 2020, 12:09pm UTC](https://discourse.julialang.org/t/how-to-quote-special-characters-in-run-function/21359 "2020-08-12T12:09:04Z")

</div>

Hi, I try to execute a shell command with Julia 1.1 on linux with the run() function. julia\> a "f1.txt" julia\> b "f2.txt" julia\> run(\`cat $a \>\> $b\`) ERROR: failed process: Process(\`cat f1.txt '\>\>' f2.txt\`, ProcessExi…

---

## [Expected Behavior for Varible Scoping with try/finally?](https://discourse.julialang.org/t/expected-behavior-for-varible-scoping-with-try-finally/44799)

<div class="topic-metadata">

**Author:** [@RodBiren](https://discourse.julialang.org/u/RodBiren)\
**Replies:** 1\
**Last updated:** [August 12, 2020, 11:25am UTC](https://discourse.julialang.org/t/expected-behavior-for-varible-scoping-with-try-finally/44799 "2020-08-12T11:25:04Z")

</div>

Hello, I am learning Julia and was reading through the docs for Essentials. I ran into behavior that did not seem to match what I expected. Steps to reproduce: Open up REPL Set variable “a” to value “b” Have a try blo…

---

## [Function wrapper with parameterse from struct](https://discourse.julialang.org/t/function-wrapper-with-parameterse-from-struct/44794)

<div class="topic-metadata">

**Author:** [@Znerual](https://discourse.julialang.org/u/Znerual)\
**Replies:** 2\
**Last updated:** [August 12, 2020, 11:09am UTC](https://discourse.julialang.org/t/function-wrapper-with-parameterse-from-struct/44794 "2020-08-12T11:09:59Z")

</div>

Dear all, I’m trying to figure out how to nicely wrap my function into a struct (or possible other type), which holds all the parameters I want to set before the function is called. The idea around that is that I’m pas…

---

## [Unable to enter Pkg REPL](https://discourse.julialang.org/t/unable-to-enter-pkg-repl/44786)

<div class="topic-metadata">

**Author:** [@cliang](https://discourse.julialang.org/u/cliang)\
**Replies:** 4\
**Last updated:** [August 12, 2020, 10:32am UTC](https://discourse.julialang.org/t/unable-to-enter-pkg-repl/44786 "2020-08-12T10:32:04Z")

</div>

julia\> \] ERROR: syntax: unexpected "\]" Stacktrace: \[1\] top-level scope at none:1 According to the document Pkg comes with a REPL. Enter the Pkg REPL by pressing \] from the Julia REPL. To get back to the Julia REPL…

---

## [Advice on over- vs. proper use of type parameters](https://discourse.julialang.org/t/advice-on-over-vs-proper-use-of-type-parameters/44779)

<div class="topic-metadata">

**Author:** [@nben](https://discourse.julialang.org/u/nben)\
**Replies:** 2\
**Last updated:** [August 12, 2020, 10:12am UTC](https://discourse.julialang.org/t/advice-on-over-vs-proper-use-of-type-parameters/44779 "2020-08-12T10:12:15Z")

</div>

I am writing an immutable type in Julia and have realized while working on it that I have an opportunity to go a little crazy with the type parameters. Here’s a contrived example that deals with the same problem. I’m cur…

---

## [Generic API to reconstruct from factorize](https://discourse.julialang.org/t/generic-api-to-reconstruct-from-factorize/44748)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [August 12, 2020, 10:03am UTC](https://discourse.julialang.org/t/generic-api-to-reconstruct-from-factorize/44748 "2020-08-12T10:03:26Z")

</div>

Is there a generic function/API to recover the original matrix from a factorization? Eg LinearAlgebra defines Matrix in various places, so A = randn(5, 5) F = factorize(A) Matrix(F) # \<- is there a generic API here? wo…

---

## [Got ArgumentError: Type must be isbitstype when code with MPI](https://discourse.julialang.org/t/got-argumenterror-type-must-be-isbitstype-when-code-with-mpi/44749)

<div class="topic-metadata">

**Author:** [@Ke\_Gao](https://discourse.julialang.org/u/Ke_Gao)\
**Replies:** 6\
**Last updated:** [August 12, 2020, 9:49am UTC](https://discourse.julialang.org/t/got-argumenterror-type-must-be-isbitstype-when-code-with-mpi/44749 "2020-08-12T09:49:15Z")

</div>

Hi guys, I got an ArgumentError: Type must be isbitstype when I tried to work with MPI.jl. Here is a piece of code: for row in eachrow(init\_ele) println(i) send\_mesg = vec(convert(Array, row)) println(sen…

---

## [A possible way to improve training in Flux?](https://discourse.julialang.org/t/a-possible-way-to-improve-training-in-flux/44629)

<div class="topic-metadata">

**Author:** [@SambitMishra98](https://discourse.julialang.org/u/SambitMishra98)\
**Replies:** 15\
**Last updated:** [August 12, 2020, 7:44am UTC](https://discourse.julialang.org/t/a-possible-way-to-improve-training-in-flux/44629 "2020-08-12T07:44:42Z")

</div>

Let’s say I need my weights to be determined with an accuracy of 10^10 and hence want to train my network using Float64. Does it make sense to train my network with Float32 and then (after I get around 10^-7 accurac…

---

## [Package for byte swapping](https://discourse.julialang.org/t/package-for-byte-swapping/44782)

<div class="topic-metadata">

**Author:** [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Replies:** 0\
**Last updated:** [August 12, 2020, 5:50am UTC](https://discourse.julialang.org/t/package-for-byte-swapping/44782 "2020-08-12T05:50:17Z")

</div>

Are there any packages that handle byte swapping a stream of data automatically? I asked about this a while ago on Zulip and it didn’t seem like there were any solutions available at the time, so I just put together the …

---

## [Define function with begin or with let?](https://discourse.julialang.org/t/define-function-with-begin-or-with-let/44767)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 2\
**Last updated:** [August 11, 2020, 10:59pm UTC](https://discourse.julialang.org/t/define-function-with-begin-or-with-let/44767 "2020-08-11T22:59:09Z")

</div>

Consider these two functions f(x) = begin x^2 end g(x) = let x^2 end using InteractiveUtils @code\_warntype f(1) @code\_warntype g(1) The compiler seems to generate the same code for both functions. So my ques…

---

## [Quadrature from x=0 to x=Inf?](https://discourse.julialang.org/t/quadrature-from-x-0-to-x-inf/44751)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 11\
**Last updated:** [August 11, 2020, 9:38pm UTC](https://discourse.julialang.org/t/quadrature-from-x-0-to-x-inf/44751 "2020-08-11T21:38:03Z")

</div>

I have previously used QuadGK over a finite interval. Now I need to do numeric integration from x=0 to x=Inf, and wonder if there is a routine that supports this? \[I need to check scaling, etc. of the “continuous” Poisso…

---

## [Performance inv & solve in Julia & R](https://discourse.julialang.org/t/performance-inv-solve-in-julia-r/44625)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 15\
**Last updated:** [August 11, 2020, 9:26pm UTC](https://discourse.julialang.org/t/performance-inv-solve-in-julia-r/44625 "2020-08-11T21:26:47Z")

</div>

How can it be: Matrix inv(A) where A 150x150 matrix twice slower (2.643 ms) than in R (1.049 ms). But invercing by blocks in R ( 3.275 ms) slower than in Julia (58.917 μs) many times. Second not surprising, but first… …

---

## [Creating an abstract type as a wrapper for types different functions that serve the same purpose](https://discourse.julialang.org/t/creating-an-abstract-type-as-a-wrapper-for-types-different-functions-that-serve-the-same-purpose/44758)

<div class="topic-metadata">

**Author:** [@gottacatchenall](https://discourse.julialang.org/u/gottacatchenall)\
**Replies:** 1\
**Last updated:** [August 11, 2020, 8:36pm UTC](https://discourse.julialang.org/t/creating-an-abstract-type-as-a-wrapper-for-types-different-functions-that-serve-the-same-purpose/44758 "2020-08-11T20:36:59Z")

</div>

I’m trying to create an abstract type that is a superclass (called Kernel) several different of functions, each a subclass of Kernel --i.e. abstract type Kernel end struct ExponentialKernel \<: Kernel ExponentialKer…

---

## [DataFrame array subset](https://discourse.julialang.org/t/dataframe-array-subset/44722)

<div class="topic-metadata">

**Author:** [@sriharitn](https://discourse.julialang.org/u/sriharitn)\
**Replies:** 18\
**Last updated:** [August 11, 2020, 5:05pm UTC](https://discourse.julialang.org/t/dataframe-array-subset/44722 "2020-08-11T17:05:54Z")

</div>

I have a DataFrame dfy = DataFrame(a = \[\[1,2,3\],\[4,5,6\],\[7,8,9\]\], b = \[“M”,“F”,“F”\]) 3×2 DataFrame │ Row │ a │ b │ │ │ Array… │ String │ ├─────┼───────────┼────────┤ │ 1 │ \[1, 2, 3\] │ M …

---

## [Compiling a library from a custom module](https://discourse.julialang.org/t/compiling-a-library-from-a-custom-module/44691)

<div class="topic-metadata">

**Author:** [@maximilianpreisinger](https://discourse.julialang.org/u/maximilianpreisinger)\
**Replies:** 2\
**Last updated:** [August 11, 2020, 4:48pm UTC](https://discourse.julialang.org/t/compiling-a-library-from-a-custom-module/44691 "2020-08-11T16:48:44Z")

</div>

Hi there! I hope this is the right place to ask this question. I wrote a custom module “MOD”, and eventually I want to compile this module and its functions into a DLL, which functions I can call from a LabView program…

---

## [Expose multiple modules from a single package](https://discourse.julialang.org/t/expose-multiple-modules-from-a-single-package/44745)

<div class="topic-metadata">

**Author:** [@benninkrs](https://discourse.julialang.org/u/benninkrs)\
**Replies:** 8\
**Last updated:** [August 11, 2020, 4:09pm UTC](https://discourse.julialang.org/t/expose-multiple-modules-from-a-single-package/44745 "2020-08-11T16:09:23Z")

</div>

I have a question that was discussed a few years ago here and here, but those discussions seem to be outdated as none of the solutions given there work for me. Say I have a package MyPackage with a module MyPackage.jl t…

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

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