# General Usage

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

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

**Page:** 527

---

## [Optimized code for complex function with Symbolics.jl](https://discourse.julialang.org/t/optimized-code-for-complex-function-with-symbolics-jl/70360)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 10\
**Last updated:** [October 30, 2021, 6:33pm UTC](https://discourse.julialang.org/t/optimized-code-for-complex-function-with-symbolics-jl/70360 "2021-10-30T18:33:23Z")

</div>

Hello, I need to write up an optimized code for a nasty analytical expression, the baby version is \\begin{aligned} f\_L = & \\sum\_{J} \\frac{-\\Gamma\_J}{\\pi^2} \\frac{\\text{Im}(z\_J) \\text{Im}(z\_L)}{|x - z\_J|^2|x - z\_L|^2}…

---

## [Efficient trace of product of matrices](https://discourse.julialang.org/t/efficient-trace-of-product-of-matrices/13313)

<div class="topic-metadata">

**Author:** [@garrison](https://discourse.julialang.org/u/garrison)\
**Replies:** 15\
**Last updated:** [October 30, 2021, 5:00pm UTC](https://discourse.julialang.org/t/efficient-trace-of-product-of-matrices/13313 "2021-10-30T17:00:42Z")

</div>

In quantum statistical mechanics, it is common to compute the trace of the product of two (or more) matrices. The obvious way of expressing this in julia is tr(A \* B); however, this results in the computation of all ele…

---

## [Avoid ugly 'isempty' pattern](https://discourse.julialang.org/t/avoid-ugly-isempty-pattern/70601)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 8\
**Last updated:** [October 30, 2021, 4:37pm UTC](https://discourse.julialang.org/t/avoid-ugly-isempty-pattern/70601 "2021-10-30T16:37:22Z")

</div>

Hello! Through some Discourse posts and my own personal experience, I’ve seen a pattern for isempty that repeats a lot, but there is no easy way around it. It is the case for when the result of a function call returns a…

---

## [Mat2grid question](https://discourse.julialang.org/t/mat2grid-question/70645)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 14\
**Last updated:** [October 30, 2021, 3:59pm UTC](https://discourse.julialang.org/t/mat2grid-question/70645 "2021-10-30T15:59:21Z")

</div>

Sorry for the very basic question. Unfortunately, I’m struggling to get it to work. Is below the right way to use mat2grid? My variable A stores the temperature values at a grid that is defined by lon and lat with the si…

---

## [Use package not in current environment for testing/development](https://discourse.julialang.org/t/use-package-not-in-current-environment-for-testing-development/70424)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 12\
**Last updated:** [October 30, 2021, 1:57pm UTC](https://discourse.julialang.org/t/use-package-not-in-current-environment-for-testing-development/70424 "2021-10-30T13:57:30Z")

</div>

There is one part of the development workflow that I may not be doing quite right. When I am developing a package, the environment that package is generally the one activated. Frequently, I have to use, for testing, so…

---

## [Problem updating a \*single\* package](https://discourse.julialang.org/t/problem-updating-a-single-package/70619)

<div class="topic-metadata">

**Author:** [@erans](https://discourse.julialang.org/u/erans)\
**Replies:** 11\
**Last updated:** [October 30, 2021, 7:51am UTC](https://discourse.julialang.org/t/problem-updating-a-single-package/70619 "2021-10-30T07:51:44Z")

</div>

Hi, I have a non registered package that I added with \] add https://github.com/.../MyPkg.git so that when I do \] status I see: (@v1.6) pkg\> status \[...\] MyPkg v0.1.0 \`https://github.com/.../MyPkg.git#main\` Now, I wo…

---

## [Bicgstabl from IterativeSolvers.jl gives different result every time](https://discourse.julialang.org/t/bicgstabl-from-iterativesolvers-jl-gives-different-result-every-time/70527)

<div class="topic-metadata">

**Author:** [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Replies:** 17\
**Last updated:** [October 30, 2021, 3:42am UTC](https://discourse.julialang.org/t/bicgstabl-from-iterativesolvers-jl-gives-different-result-every-time/70527 "2021-10-30T03:42:46Z")

</div>

Hi all, I am using Julia as a framework for development and testing of discretization methods in computational fluid dynamics and as a part of it, have to solve linear system of equations for velocities and pressure pre…

---

## [Segfault using @cfunction in callback for Mosquitto MQTT client, no idea what could be wrong](https://discourse.julialang.org/t/segfault-using-cfunction-in-callback-for-mosquitto-mqtt-client-no-idea-what-could-be-wrong/70430)

<div class="topic-metadata">

**Author:** [@Christian\_Dengler](https://discourse.julialang.org/u/Christian_Dengler)\
**Replies:** 10\
**Last updated:** [October 29, 2021, 10:11pm UTC](https://discourse.julialang.org/t/segfault-using-cfunction-in-callback-for-mosquitto-mqtt-client-no-idea-what-could-be-wrong/70430 "2021-10-29T22:11:11Z")

</div>

Hello, I have been stuck trying to wrap the Mosquitto C API v2.0.12 in Julia. While I managed to get connection and publishing messages done without major problems, I cannot seem to get any callback function to work. To …

---

## [Heroku – Memory quota vastly exceeded](https://discourse.julialang.org/t/heroku-memory-quota-vastly-exceeded/70562)

<div class="topic-metadata">

**Author:** [@cepel](https://discourse.julialang.org/u/cepel)\
**Replies:** 10\
**Last updated:** [October 29, 2021, 9:06pm UTC](https://discourse.julialang.org/t/heroku-memory-quota-vastly-exceeded/70562 "2021-10-29T21:06:17Z")

</div>

Hey there, I developed a Julia application using Dash and ObjectDetector, and deployed on Heroku. But I am having “R15 - Memory quota vastly exceeded” error. I checked the memory usage on my local computer and the ap…

---

## [LaTeX and Markdown in the same Weave Chunk](https://discourse.julialang.org/t/latex-and-markdown-in-the-same-weave-chunk/70640)

<div class="topic-metadata">

**Author:** [@Derek\_Vetsch](https://discourse.julialang.org/u/Derek_Vetsch)\
**Replies:** 0\
**Last updated:** [October 29, 2021, 8:31pm UTC](https://discourse.julialang.org/t/latex-and-markdown-in-the-same-weave-chunk/70640 "2021-10-29T20:31:01Z")

</div>

Is it possible to mix LaTeX and Markdown in the same chunk? I tried something like this but when I weave it it looks as if I printed this in the REPL. I know if you just put everything in its own chunk that works fine bu…

---

## [Display progress in ThreadsX](https://discourse.julialang.org/t/display-progress-in-threadsx/70599)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 1\
**Last updated:** [October 29, 2021, 8:15pm UTC](https://discourse.julialang.org/t/display-progress-in-threadsx/70599 "2021-10-29T20:15:41Z")

</div>

How can I display progress when using ThreadsX, with for example ProgressMeter? Silly MWE, but imagine fun was a relatively expensive function: using ThreadsX fun(x) = (sleep(1); sin(x)) x = rand(100) y = ThreadsX.map(…

---

## [How to set the projection for Earth relief grid based maps in GMT?](https://discourse.julialang.org/t/how-to-set-the-projection-for-earth-relief-grid-based-maps-in-gmt/70625)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 3\
**Last updated:** [October 29, 2021, 6:22pm UTC](https://discourse.julialang.org/t/how-to-set-the-projection-for-earth-relief-grid-based-maps-in-gmt/70625 "2021-10-29T18:22:41Z")

</div>

I’m able to plot my first GMT map: using GMT grdimage("@earth\_relief\_10m", region=(180,320,10,80), coast=true, fmt=:png, show=true) My goal is to set its projection to lambert. I tried to add the below argument to the …

---

## [How to speed up create julia sysimage?](https://discourse.julialang.org/t/how-to-speed-up-create-julia-sysimage/70618)

<div class="topic-metadata">

**Author:** [@Ravinder\_Ram](https://discourse.julialang.org/u/Ravinder_Ram)\
**Replies:** 2\
**Last updated:** [October 29, 2021, 6:02pm UTC](https://discourse.julialang.org/t/how-to-speed-up-create-julia-sysimage/70618 "2021-10-29T18:02:06Z")

</div>

I’m creating julia sysimage it taking more than 15 min?

---

## [Use math symbols with Markdown.parse](https://discourse.julialang.org/t/use-math-symbols-with-markdown-parse/70632)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [October 29, 2021, 4:38pm UTC](https://discourse.julialang.org/t/use-math-symbols-with-markdown-parse/70632 "2021-10-29T16:38:53Z")

</div>

I need to use Markdown.parse in Pluto in order provide links between notebooks (see this post). It is not clear to me how to use math symbols in Markdown.parse. Is that possible? I have a related question about supporti…

---

## [DifferentialEquations.jl inputting out of domain value](https://discourse.julialang.org/t/differentialequations-jl-inputting-out-of-domain-value/70501)

<div class="topic-metadata">

**Author:** [@hellmrf](https://discourse.julialang.org/u/hellmrf)\
**Replies:** 1\
**Last updated:** [October 29, 2021, 2:26pm UTC](https://discourse.julialang.org/t/differentialequations-jl-inputting-out-of-domain-value/70501 "2021-10-29T14:26:43Z")

</div>

Hello everyone. I’m trying to solve a differential equation (actually it’s part of an optimization process, so it’s solved each optimization iteration). The problem is: my u is a parameter that has a physical meaning of…

---

## [Turing -- extract information of estimates/chains?](https://discourse.julialang.org/t/turing-extract-information-of-estimates-chains/70554)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [October 29, 2021, 2:09pm UTC](https://discourse.julialang.org/t/turing-extract-information-of-estimates-chains/70554 "2021-10-29T14:09:13Z")

</div>

I have run a Turing fitting session, and look at the results (estimates? chain?): julia\> p\_est leading to: Is it possible to extract the tables, e.g., Summary Statistics and Quantiles in DataFrames so that I can Pr…

---

## [Create multidimensional array spanned by unknown number of arrays](https://discourse.julialang.org/t/create-multidimensional-array-spanned-by-unknown-number-of-arrays/70608)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 2\
**Last updated:** [October 29, 2021, 1:02pm UTC](https://discourse.julialang.org/t/create-multidimensional-array-spanned-by-unknown-number-of-arrays/70608 "2021-10-29T13:02:23Z")

</div>

I have an (unknown) number of arrays, stored in an array: arrays = \[\[1,2,3\],\[1,2,3,4\],\[1,2,3,4,5\]\] # In this case three I want to create a multidimensional array, with one dimension for each array (so I don’t know …

---

## [CI error on nightly](https://discourse.julialang.org/t/ci-error-on-nightly/70589)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [October 29, 2021, 2:09am UTC](https://discourse.julialang.org/t/ci-error-on-nightly/70589 "2021-10-29T02:09:21Z")

</div>

I am getting sort of randomly these errors in the nightly build. Should I worry or report it? \[ Info: Attempting to clone the General registry Cloning registry from "https://github.com/JuliaRegistries/General.git"…

---

## [Unicode ⊧ not an operator](https://discourse.julialang.org/t/unicode-not-an-operator/56698)

<div class="topic-metadata">

**Author:** [@guyvdb](https://discourse.julialang.org/u/guyvdb)\
**Replies:** 6\
**Last updated:** [October 29, 2021, 1:47am UTC](https://discourse.julialang.org/t/unicode-not-an-operator/56698 "2021-10-29T01:47:09Z")

</div>

I wondering if it’s worth filing an issue about the ⊧ unicode character: Julia supports entering it with \\models but it cannot be used as either a variable or an operator (contrary to most other unicode math operator cha…

---

## [Behaviour of == on Vectors of vectors](https://discourse.julialang.org/t/behaviour-of-on-vectors-of-vectors/70582)

<div class="topic-metadata">

**Author:** [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Replies:** 2\
**Last updated:** [October 28, 2021, 9:22pm UTC](https://discourse.julialang.org/t/behaviour-of-on-vectors-of-vectors/70582 "2021-10-28T21:22:59Z")

</div>

Good evening good folks! Can someone explain the below to me? I haven’t given it that much thought so maybe the answer is trivial…or not? julia\> \[\[1,2\],\[3,4\]\] == \[\[1,2\],\[3,4\]\] true julia\> \[\[1,2\],\[3,4\]\] !== \[\[1,2\],\[3,4\]…

---

## [Peak finding from a distribution](https://discourse.julialang.org/t/peak-finding-from-a-distribution/70485)

<div class="topic-metadata">

**Author:** [@newtothis](https://discourse.julialang.org/u/newtothis)\
**Replies:** 9\
**Last updated:** [October 28, 2021, 6:35pm UTC](https://discourse.julialang.org/t/peak-finding-from-a-distribution/70485 "2021-10-28T18:35:09Z")

</div>

I have a distribution as a vector in Julia. I can plot a histogram and/or a kde of for this data, but I want to find the peak values. The naive way in which I am doing it is to plot the histogram and then just retrieve t…

---

## [\[BUG\] what does this mean and how can I fix the precompile on MIRT and HDF5?](https://discourse.julialang.org/t/bug-what-does-this-mean-and-how-can-i-fix-the-precompile-on-mirt-and-hdf5/70575)

<div class="topic-metadata">

**Author:** [@finger1517](https://discourse.julialang.org/u/finger1517)\
**Replies:** 0\
**Last updated:** [October 28, 2021, 6:19pm UTC](https://discourse.julialang.org/t/bug-what-does-this-mean-and-how-can-i-fix-the-precompile-on-mirt-and-hdf5/70575 "2021-10-28T18:19:19Z")

</div>

(@v1.6) pkg\> precompile Precompiling project... ? HDF5 ? MIRTio ? StatsPlots ? MIRT and when I using MIRT module, it will give the error julia\> using MIRT WARNING: could not import HDF5.Group into \_hdf5\_impleme…

---

## [Cannot execute Ghostscript (gs): GMT error number = 79](https://discourse.julialang.org/t/cannot-execute-ghostscript-gs-gmt-error-number-79/70531)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 8\
**Last updated:** [October 28, 2021, 6:10pm UTC](https://discourse.julialang.org/t/cannot-execute-ghostscript-gs-gmt-error-number-79/70531 "2021-10-28T18:10:53Z")

</div>

Has anyone seen this error before? It seems that my program is having trouble executing Ghostscript. I’m on a Mac OS system. Error message: psconvert \[ERROR\]: Cannot execute Ghostscript (gs). \*\*ERROR:\*\* LoadError: So…

---

## [OutOfMemory() when loading a database of images](https://discourse.julialang.org/t/outofmemory-when-loading-a-database-of-images/70523)

<div class="topic-metadata">

**Author:** [@Ivan](https://discourse.julialang.org/u/Ivan)\
**Replies:** 9\
**Last updated:** [October 28, 2021, 2:40pm UTC](https://discourse.julialang.org/t/outofmemory-when-loading-a-database-of-images/70523 "2021-10-28T14:40:54Z")

</div>

I am trying to work with a database of images (2767 images in total), but I run into an OutOfMemory() error when loading the data. This is how I am doing it: path = string(pwd(), "/Data") list = readdir(path, join = tru…

---

## [Accessing type internal fields in package interfaces](https://discourse.julialang.org/t/accessing-type-internal-fields-in-package-interfaces/70263)

<div class="topic-metadata">

**Author:** [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Replies:** 14\
**Last updated:** [October 28, 2021, 2:36pm UTC](https://discourse.julialang.org/t/accessing-type-internal-fields-in-package-interfaces/70263 "2021-10-28T14:36:28Z")

</div>

Hi all, we come just from small course where several people have taught several Julia packages to students over the last week. One thing we realized was that some packages naturally assume a workflow in which you consta…

---

## [Cannot Install JuliaDB](https://discourse.julialang.org/t/cannot-install-juliadb/53057)

<div class="topic-metadata">

**Author:** [@PikaPhD](https://discourse.julialang.org/u/PikaPhD)\
**Replies:** 2\
**Last updated:** [October 28, 2021, 1:34pm UTC](https://discourse.julialang.org/t/cannot-install-juliadb/53057 "2021-10-28T13:34:07Z")

</div>

I am trying to install JuliaDB so I can start learning how to use databases in Juila. I am having a conflict with StatsBase. If I understand the error message correctly, JuliaDB requires version 0.13.1 or earlier of Sta…

---

## [Indexing an arbitrary array over its last dimension](https://discourse.julialang.org/t/indexing-an-arbitrary-array-over-its-last-dimension/70443)

<div class="topic-metadata">

**Author:** [@MattSainsbury-Dale](https://discourse.julialang.org/u/MattSainsbury-Dale)\
**Replies:** 4\
**Last updated:** [October 28, 2021, 1:31pm UTC](https://discourse.julialang.org/t/indexing-an-arbitrary-array-over-its-last-dimension/70443 "2021-10-28T13:31:17Z")

</div>

I am trying to index over the last dimension of an array of unknown dimension. Please see the following MWE for a 2-dimensional array: a = rand(2, 4) indices = \[1:2, 3:4\] colons = repeat(\[:\], ndims(a) - 1) v …

---

## [Question on Defining Functions Inside Structs](https://discourse.julialang.org/t/question-on-defining-functions-inside-structs/70532)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 8\
**Last updated:** [October 28, 2021, 1:20pm UTC](https://discourse.julialang.org/t/question-on-defining-functions-inside-structs/70532 "2021-10-28T13:20:31Z")

</div>

I noticed in this video here that several constructors for the struct are defined inside the struct block itself. I’ve not personally done this to date, it just didn’t occur to me. I’ve always defined alternate construct…

---

## [Help with deploying documentation with GitHub Actions](https://discourse.julialang.org/t/help-with-deploying-documentation-with-github-actions/63872)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 6\
**Last updated:** [October 28, 2021, 12:58pm UTC](https://discourse.julialang.org/t/help-with-deploying-documentation-with-github-actions/63872 "2021-10-28T12:58:32Z")

</div>

I followed all steps in the tutorial below to deploy my unregistered package documentation. However, the gh-pages branch is not updated. It only displays a default GitHub page. What am I missing? I enabled Actions an…

---

## [How to use custom sysimage if cannot set flags on Julia startup](https://discourse.julialang.org/t/how-to-use-custom-sysimage-if-cannot-set-flags-on-julia-startup/70482)

<div class="topic-metadata">

**Author:** [@Bakaburg1](https://discourse.julialang.org/u/Bakaburg1)\
**Replies:** 8\
**Last updated:** [October 28, 2021, 11:46am UTC](https://discourse.julialang.org/t/how-to-use-custom-sysimage-if-cannot-set-flags-on-julia-startup/70482 "2021-10-28T11:46:49Z")

</div>

Hello, I have a custom Julia package (only local) inside an R project. I’m interacting with the Julia package via https://github.com/stefan-m-lenz/JuliaConnectoR. I’d like to precompile this package and its functions s…

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

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