# General Usage

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

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

**Page:** 747

---

## [Estimating a Multivariate Distribution](https://discourse.julialang.org/t/estimating-a-multivariate-distribution/40375)

<div class="topic-metadata">

**Author:** [@Ian\_Slagle](https://discourse.julialang.org/u/Ian_Slagle)\
**Replies:** 6\
**Last updated:** [May 29, 2020, 10:03pm UTC](https://discourse.julialang.org/t/estimating-a-multivariate-distribution/40375 "2020-05-29T22:03:45Z")

</div>

Is there a package that can estimate a multivariate distribution? The input to this estimation isn’t really set in stone right now, but preferably it’s something that Optim.jl could work with. I essentially want somethin…

---

## [Avoid GC freeing Ptr{Nothing}](https://discourse.julialang.org/t/avoid-gc-freeing-ptr-nothing/38664)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 25\
**Last updated:** [May 29, 2020, 9:34pm UTC](https://discourse.julialang.org/t/avoid-gc-freeing-ptr-nothing/38664 "2020-05-29T21:34:28Z")

</div>

I’m using (as interface between C-APIs) a mutable struct InterpreterHooks closure::Ptr{Nothing} surface\_create::Ptr{Nothing} surface\_destroy::Ptr{Nothing} context\_create::Ptr{Nothing} context\_destroy::Ptr{Nothi…

---

## [Understanding nested Threads.@threads scheduling](https://discourse.julialang.org/t/understanding-nested-threads-threads-scheduling/40400)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 4\
**Last updated:** [May 29, 2020, 6:05pm UTC](https://discourse.julialang.org/t/understanding-nested-threads-threads-scheduling/40400 "2020-05-29T18:05:38Z")

</div>

When I nest Threads.@threads loops, scheduling looks strange: using Base.Threads using Dates function tmap(f, arr) out = similar(arr, Any) Threads.@threads for i in eachindex(arr) out\[i\] = f(arr\[i\]) …

---

## [Problem with a hypergeometric Turing model](https://discourse.julialang.org/t/problem-with-a-hypergeometric-turing-model/40425)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 9\
**Last updated:** [May 29, 2020, 5:50pm UTC](https://discourse.julialang.org/t/problem-with-a-hypergeometric-turing-model/40425 "2020-05-29T17:50:12Z")

</div>

Hi all, I’m trying to get a bit more into probabilistic programming with Turing.jl. I want to build a simple hypergeometric model. Imagine you have a large box with Nred red and Nblue blue balls (makes N = Nred + Nblue …

---

## [Pipeline writes out of order](https://discourse.julialang.org/t/pipeline-writes-out-of-order/40351)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 10\
**Last updated:** [May 29, 2020, 4:23pm UTC](https://discourse.julialang.org/t/pipeline-writes-out-of-order/40351 "2020-05-29T16:23:17Z")

</div>

Is the following a bug or am I doing something wrong? julia\> open("test.txt", "w") do file write(file, "line1\\n") run(pipeline(\`echo line2\`, file)) write(file, "line3\\n") end; sh…

---

## [Profiling doesn't count matrix products correctly](https://discourse.julialang.org/t/profiling-doesnt-count-matrix-products-correctly/40420)

<div class="topic-metadata">

**Author:** [@mhauru](https://discourse.julialang.org/u/mhauru)\
**Replies:** 1\
**Last updated:** [May 29, 2020, 3:52pm UTC](https://discourse.julialang.org/t/profiling-doesnt-count-matrix-products-correctly/40420 "2020-05-29T15:52:17Z")

</div>

Here’s a function that should spend exactly half of its time doing a matrix product, the other half sleeping: function f(A, B) starttime = time() C = A\*B # C = sort(A\[:\]) # C = svd(A) endtime = time(…

---

## [Finding saddle point](https://discourse.julialang.org/t/finding-saddle-point/21168)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 36\
**Last updated:** [May 29, 2020, 3:35pm UTC](https://discourse.julialang.org/t/finding-saddle-point/21168 "2020-05-29T15:35:51Z")

</div>

I’m trying to find the saddle point of a function. I’ve programmed a function saddle below (but if you know of a library to find saddle points, please let me know). The idea is that the input function should be specified…

---

## [What crazy instability is this?](https://discourse.julialang.org/t/what-crazy-instability-is-this/40340)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 20\
**Last updated:** [May 29, 2020, 2:50pm UTC](https://discourse.julialang.org/t/what-crazy-instability-is-this/40340 "2020-05-29T14:50:35Z")

</div>

The MWE function img16to8(mat::Array{UInt16}; kw...) d = Dict{Symbol,Any}(kw) img = Array{UInt8}(undef,size(mat)); if (haskey(d, :histo\_bounds)) val\_ = d\[:histo\_bounds\] val = UInt16.(val\_) # Th…

---

## [How to structure a mid-sized OOP-like project physically and logically - Types.jl, Submodules or "deep Hierarchies"?](https://discourse.julialang.org/t/how-to-structure-a-mid-sized-oop-like-project-physically-and-logically-types-jl-submodules-or-deep-hierarchies/40410)

<div class="topic-metadata">

**Author:** [@PeterKeffer](https://discourse.julialang.org/u/PeterKeffer)\
**Replies:** 3\
**Last updated:** [May 29, 2020, 2:00pm UTC](https://discourse.julialang.org/t/how-to-structure-a-mid-sized-oop-like-project-physically-and-logically-types-jl-submodules-or-deep-hierarchies/40410 "2020-05-29T14:00:59Z")

</div>

Hey there Julians! I’m still a bloody beginner with Julia, but want to start with a medium size OOP-structured project. (I’m also a CS student, so I’m still learning how to engineer software the right way) I started wr…

---

## [Diffeqpy, using ensembling](https://discourse.julialang.org/t/diffeqpy-using-ensembling/40411)

<div class="topic-metadata">

**Author:** [@Abolfazl\_Ziaeemehr](https://discourse.julialang.org/u/Abolfazl_Ziaeemehr)\
**Replies:** 1\
**Last updated:** [May 29, 2020, 12:36pm UTC](https://discourse.julialang.org/t/diffeqpy-using-ensembling/40411 "2020-05-29T12:36:03Z")

</div>

It is possible to use use ensembling in diffeqpy? here is my example code: import numpy as np import pylab as pl from time import time from sys import exit try: from diffeqpy import de from julia import Main e…

---

## [Numerical integration from 0.0 to Inf](https://discourse.julialang.org/t/numerical-integration-from-0-0-to-inf/40379)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 5\
**Last updated:** [May 29, 2020, 12:00pm UTC](https://discourse.julialang.org/t/numerical-integration-from-0-0-to-inf/40379 "2020-05-29T12:00:03Z")

</div>

Hello everyone, I was playing around with QuadGK.jl on my function f(x) which has some strong oscillations but a finite value when integrating from 0 to \\infty. I used the transformation described in this link to solve…

---

## [DocStringExtensions - interpolation string "$" allowed only in the preamble but not inside the structure](https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349)

<div class="topic-metadata">

**Author:** [@yurier](https://discourse.julialang.org/u/yurier)\
**Replies:** 2\
**Last updated:** [May 29, 2020, 11:34am UTC](https://discourse.julialang.org/t/docstringextensions-interpolation-string-allowed-only-in-the-preamble-but-not-inside-the-structure/40349 "2020-05-29T11:34:39Z")

</div>

I would like to pass a function to some docstrings inside a structure (by using $) not only in the preamble as in the example. works without $ inside the structure using Parameters, DocStringExtensions """ # My parame…

---

## [Tuple or immutable struct as function argument regarding speed and optimization](https://discourse.julialang.org/t/tuple-or-immutable-struct-as-function-argument-regarding-speed-and-optimization/23088)

<div class="topic-metadata">

**Author:** [@OvidiusCicero](https://discourse.julialang.org/u/OvidiusCicero)\
**Replies:** 10\
**Last updated:** [May 29, 2020, 3:44am UTC](https://discourse.julialang.org/t/tuple-or-immutable-struct-as-function-argument-regarding-speed-and-optimization/23088 "2020-05-29T03:44:08Z")

</div>

I have a function with many named arguments that should not depend on global variables for performance reasons In the following I will call the variables a,b,c, ... ,y,z I want to replace them with an immutable struct …

---

## [Is it possible to mmap part of the file?](https://discourse.julialang.org/t/is-it-possible-to-mmap-part-of-the-file/40391)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 1\
**Last updated:** [May 29, 2020, 3:36am UTC](https://discourse.julialang.org/t/is-it-possible-to-mmap-part-of-the-file/40391 "2020-05-29T03:36:25Z")

</div>

I see the doc here has example of how to mmap the whole file Memory-mapped I/O · The Julia Language But say if I want to mmap bytes n to m of a file to an array, is that possible? Do I have to use unsafe\_wrap?

---

## [Need help with performance in a very large loop](https://discourse.julialang.org/t/need-help-with-performance-in-a-very-large-loop/40292)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 28\
**Last updated:** [May 28, 2020, 10:58pm UTC](https://discourse.julialang.org/t/need-help-with-performance-in-a-very-large-loop/40292 "2020-05-28T22:58:47Z")

</div>

Hello, I hope you guys are safe and healthy in these unprecedented times. I am trying to improve the performance of a loop, in terms of both time and memory usage, that attempts to find a maximum among a number of alter…

---

## [C array of function pointers](https://discourse.julialang.org/t/c-array-of-function-pointers/40368)

<div class="topic-metadata">

**Author:** [@Matt\_Davis](https://discourse.julialang.org/u/Matt_Davis)\
**Replies:** 2\
**Last updated:** [May 28, 2020, 9:03pm UTC](https://discourse.julialang.org/t/c-array-of-function-pointers/40368 "2020-05-28T21:03:56Z")

</div>

I’m working on wrapping some C code, and one of the fundamental objects in the library is an array of function pointers. I can obtain a pointer to the object with dlsym fine, but when I try to wrap the pointer into an ar…

---

## [Help with converting Numpy einsum to Julia](https://discourse.julialang.org/t/help-with-converting-numpy-einsum-to-julia/40275)

<div class="topic-metadata">

**Author:** [@dinskid](https://discourse.julialang.org/u/dinskid)\
**Replies:** 8\
**Last updated:** [May 28, 2020, 8:22pm UTC](https://discourse.julialang.org/t/help-with-converting-numpy-einsum-to-julia/40275 "2020-05-28T20:22:58Z")

</div>

I want to convert this particular einsum expression to Julia. What is the most Julia way to do this? Python code import numpy as np x = np.arange(2\*3\*4\*5\*4).reshape(2, 3, 4, 5, 4) np.einsum('ijklk-\>ijkl', x\[:,:,1,:,:,1,…

---

## [Atom + Juno -- package Plots doesn't work](https://discourse.julialang.org/t/atom-juno-package-plots-doesnt-work/40367)

<div class="topic-metadata">

**Author:** [@Jing\_Zhang](https://discourse.julialang.org/u/Jing_Zhang)\
**Replies:** 3\
**Last updated:** [May 28, 2020, 8:07pm UTC](https://discourse.julialang.org/t/atom-juno-package-plots-doesnt-work/40367 "2020-05-28T20:07:32Z")

</div>

Package Plots works fine directly in Julia 1.0. However, it doesn’t work well when I tried in Atom + Juno. See below.

---

## [How to understand Traceur's output?](https://discourse.julialang.org/t/how-to-understand-traceurs-output/25191)

<div class="topic-metadata">

**Author:** [@cserteGT3](https://discourse.julialang.org/u/cserteGT3)\
**Replies:** 7\
**Last updated:** [May 28, 2020, 7:07pm UTC](https://discourse.julialang.org/t/how-to-understand-traceurs-output/25191 "2020-05-28T19:07:32Z")

</div>

I am not sure, that I understand correctly the performance tips regards type declarations and containers with abstract types, so I tested my code with Traceur. But I don’t really understand the output, could you please …

---

## [Julia optimisation difference](https://discourse.julialang.org/t/julia-optimisation-difference/40366)

<div class="topic-metadata">

**Author:** [@haankers](https://discourse.julialang.org/u/haankers)\
**Replies:** 0\
**Last updated:** [May 28, 2020, 6:53pm UTC](https://discourse.julialang.org/t/julia-optimisation-difference/40366 "2020-05-28T18:53:35Z")

</div>

When the following code is run x = muladd((5270536651468945146),(π),13656) println(x\*(10^-19)) it produces 1.6557879224730618 at optimisation level 0 and 1, but it produces 1.6557879224730616 at 2 and 3. I know the pr…

---

## [Latest versions of Clp, Cbc, SCIP](https://discourse.julialang.org/t/latest-versions-of-clp-cbc-scip/40324)

<div class="topic-metadata">

**Author:** [@greg\_plowman](https://discourse.julialang.org/u/greg_plowman)\
**Replies:** 2\
**Last updated:** [May 28, 2020, 5:11pm UTC](https://discourse.julialang.org/t/latest-versions-of-clp-cbc-scip/40324 "2020-05-28T17:11:13Z")

</div>

For me, the latest versions of Clp, Cbc and SCIP don’t seem to want to co-exist. I think the CEnum entries in the \[compat\] section of the Project.toml files are incompatible: Clp: CEnum = "0.3" Cbc: CEnum = "0.3, 0.4…

---

## [How difficult is it to write allocation-free code to avoid GC pauses?](https://discourse.julialang.org/t/how-difficult-is-it-to-write-allocation-free-code-to-avoid-gc-pauses/40235)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 8\
**Last updated:** [May 28, 2020, 4:40pm UTC](https://discourse.julialang.org/t/how-difficult-is-it-to-write-allocation-free-code-to-avoid-gc-pauses/40235 "2020-05-28T16:40:44Z")

</div>

I’m doing almost all of my analysis in Julia, so it would be nice if I could avoid rewriting some of my algorithms in another language for production. The problem is that in production I have latency requirements that b…

---

## [Generating function for multi-dimensional array indexing](https://discourse.julialang.org/t/generating-function-for-multi-dimensional-array-indexing/40342)

<div class="topic-metadata">

**Author:** [@Alex\_Ellison](https://discourse.julialang.org/u/Alex_Ellison)\
**Replies:** 2\
**Last updated:** [May 28, 2020, 2:42pm UTC](https://discourse.julialang.org/t/generating-function-for-multi-dimensional-array-indexing/40342 "2020-05-28T14:42:00Z")

</div>

Hey all, I’m trying to generate some functions, and while they work, I don’t fully understand the behavior coming out. Also, there may be some function in Base which does this, I just can’t find it. Illumination of eith…

---

## [Save Dataframe in file and read it again](https://discourse.julialang.org/t/save-dataframe-in-file-and-read-it-again/40336)

<div class="topic-metadata">

**Author:** [@FrootLoops](https://discourse.julialang.org/u/FrootLoops)\
**Replies:** 4\
**Last updated:** [May 28, 2020, 1:45pm UTC](https://discourse.julialang.org/t/save-dataframe-in-file-and-read-it-again/40336 "2020-05-28T13:45:22Z")

</div>

Hello, right now I am trying to save a Dataframe into a file and read it again. For this I used the CSV package. My dataframe has two columns where each entry is a vector. Here is an small example: using DataFrames usi…

---

## [Annotation for each row and column of subplots in layout, plot by column in layout, copy figure](https://discourse.julialang.org/t/annotation-for-each-row-and-column-of-subplots-in-layout-plot-by-column-in-layout-copy-figure/40258)

<div class="topic-metadata">

**Author:** [@1634](https://discourse.julialang.org/u/1634)\
**Replies:** 4\
**Last updated:** [May 28, 2020, 1:41pm UTC](https://discourse.julialang.org/t/annotation-for-each-row-and-column-of-subplots-in-layout-plot-by-column-in-layout-copy-figure/40258 "2020-05-28T13:41:56Z")

</div>

Hi, (1) except annotate!(), is there any method to set the annotation for each row and column (as highlighted) in plot layout? (2) And also any shortkey or quick way of copying the plot generated by Atom instead of …

---

## [Append to zipped CSV file](https://discourse.julialang.org/t/append-to-zipped-csv-file/40321)

<div class="topic-metadata">

**Author:** [@HenrikM](https://discourse.julialang.org/u/HenrikM)\
**Replies:** 4\
**Last updated:** [May 28, 2020, 1:33pm UTC](https://discourse.julialang.org/t/append-to-zipped-csv-file/40321 "2020-05-28T13:33:42Z")

</div>

Hello, I have a program that outputs numerical data. Currently I’m appending into a CSV file so that the progress is saved even if the program is suddenly terminated. Please find the MWE below. How could I output to an…

---

## [Julia for prototyping, compared to MATLAB?](https://discourse.julialang.org/t/julia-for-prototyping-compared-to-matlab/33900)

<div class="topic-metadata">

**Author:** [@ElectronicTeaCup](https://discourse.julialang.org/u/ElectronicTeaCup)\
**Replies:** 70\
**Last updated:** [May 28, 2020, 5:03am UTC](https://discourse.julialang.org/t/julia-for-prototyping-compared-to-matlab/33900 "2020-05-28T05:03:47Z")

</div>

I was talking to a colleague, and they were basically telling me how they would not want to use Julia because most of their time is actually spent on trying different analyses, and exploring data. And for that MATLAB is …

---

## [Macro: no method matching size](https://discourse.julialang.org/t/macro-no-method-matching-size/40311)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 2\
**Last updated:** [May 28, 2020, 3:51am UTC](https://discourse.julialang.org/t/macro-no-method-matching-size/40311 "2020-05-28T03:51:28Z")

</div>

Would you help me with Macros Why macros does not see functions: size() or length()? Julia ver 1.1.1 macro test\_macro(e::Expr) return (ones(size(e)\[1\]) .+ e) end MethodError: no method matching size(::Expr) Closest…

---

## [Help? for deprecated and renamed items](https://discourse.julialang.org/t/help-for-deprecated-and-renamed-items/40307)

<div class="topic-metadata">

**Author:** [@virtualgraham](https://discourse.julialang.org/u/virtualgraham)\
**Replies:** 1\
**Last updated:** [May 28, 2020, 2:00am UTC](https://discourse.julialang.org/t/help-for-deprecated-and-renamed-items/40307 "2020-05-28T02:00:10Z")

</div>

It would be great if Julia help? would offer suggestions for deprecated and renamed items. Many times I have searched Google and found posted solutions that use functions or keywords that have since been deprecated or re…

---

## [Does \`GC.@preserve a b\` preserves the location of \`a\` and \`b\`](https://discourse.julialang.org/t/does-gc-preserve-a-b-preserves-the-location-of-a-and-b/40233)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 11\
**Last updated:** [May 28, 2020, 12:42am UTC](https://discourse.julialang.org/t/does-gc-preserve-a-b-preserves-the-location-of-a-and-b/40233 "2020-05-28T00:42:22Z")

</div>

I am using GC.@preserve in my code as follows GC.@preserve missing\_bytes res begin src\_ptr = Ptr{UInt8}(pointer(missing\_bytes)) dest\_ptr = Ptr{UInt8}(pointer(res, res\_len+1)) + from - 1 # copy content over …

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

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