# General Usage

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

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

**Page:** 535

---

## [How to obtain the diagonal vector of a Diagonal matrix without allocations?](https://discourse.julialang.org/t/how-to-obtain-the-diagonal-vector-of-a-diagonal-matrix-without-allocations/69773)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [October 14, 2021, 6:37pm UTC](https://discourse.julialang.org/t/how-to-obtain-the-diagonal-vector-of-a-diagonal-matrix-without-allocations/69773 "2021-10-14T18:37:09Z")

</div>

I want to obtain D.diag for a Diagonal matrix D, except I’m not sure if this is public. Using diag(D) allocates unnecessarily in certain cases (as it uses similar to ensure type-stability). julia\> D = Diagonal(3:4) 2×2…

---

## [Is there any issue with https://juliastats.org?](https://discourse.julialang.org/t/is-there-any-issue-with-https-juliastats-org/69729)

<div class="topic-metadata">

**Author:** [@Naba7](https://discourse.julialang.org/u/Naba7)\
**Replies:** 2\
**Last updated:** [October 14, 2021, 2:04pm UTC](https://discourse.julialang.org/t/is-there-any-issue-with-https-juliastats-org/69729 "2021-10-14T14:04:33Z")

</div>

I am finding it difficult to use any of the documentations for juliastats.org. Is this an internal issue or JuliaHub host issue?

---

## [Does Julia have something equivalent to matlab's Cell Array?](https://discourse.julialang.org/t/does-julia-have-something-equivalent-to-matlabs-cell-array/69756)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 3\
**Last updated:** [October 14, 2021, 1:45pm UTC](https://discourse.julialang.org/t/does-julia-have-something-equivalent-to-matlabs-cell-array/69756 "2021-10-14T13:45:22Z")

</div>

I have 20 land/sea masks (gridded data at 360x180 degrees). I want to save them into a cell array called A. In Matlab I would do this: A{1} = grid1; A{2} = grid2; … How could I do the same thing in Julia, so that I c…

---

## [The columns and the rows - puzzled about performance](https://discourse.julialang.org/t/the-columns-and-the-rows-puzzled-about-performance/69741)

<div class="topic-metadata">

**Author:** [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Replies:** 8\
**Last updated:** [October 14, 2021, 12:05pm UTC](https://discourse.julialang.org/t/the-columns-and-the-rows-puzzled-about-performance/69741 "2021-10-14T12:05:29Z")

</div>

Dear all, I have been using Julia for about three weeks now and, to my understanding, she uses a column-major matrix storage system. That would also mean, if I get things right, that loops which access matrix entries i…

---

## [Dimension names in HDF5](https://discourse.julialang.org/t/dimension-names-in-hdf5/69743)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 0\
**Last updated:** [October 14, 2021, 11:20am UTC](https://discourse.julialang.org/t/dimension-names-in-hdf5/69743 "2021-10-14T11:20:44Z")

</div>

I am writing multidimensional arrays to HDF5 and I would like to make use of the HDF option to specify the datasets that contain the dimensions of the array (to be concrete, it is for instance a 3D temperature field, wit…

---

## [Reuse PlotlyJS Blink window](https://discourse.julialang.org/t/reuse-plotlyjs-blink-window/69728)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 1\
**Last updated:** [October 14, 2021, 8:50am UTC](https://discourse.julialang.org/t/reuse-plotlyjs-blink-window/69728 "2021-10-14T08:50:42Z")

</div>

Very basic question: when using PlotlyJS with the Blink display window, how can I get subsequent calls to plot() to reuse the same Blink window rather than opening new windows?

---

## [How to handle an array of dictionaries?](https://discourse.julialang.org/t/how-to-handle-an-array-of-dictionaries/69649)

<div class="topic-metadata">

**Author:** [@trg818](https://discourse.julialang.org/u/trg818)\
**Replies:** 4\
**Last updated:** [October 14, 2021, 8:45am UTC](https://discourse.julialang.org/t/how-to-handle-an-array-of-dictionaries/69649 "2021-10-14T08:45:04Z")

</div>

It’s actually even more convoluted: I have a dictionary rspecs and want to allocate one of its elements, with key rname, as an array of dictionaries, whereby the array is to have length nw. This is what I tried: roomspe…

---

## [Difference between running external programs and Tasks](https://discourse.julialang.org/t/difference-between-running-external-programs-and-tasks/69708)

<div class="topic-metadata">

**Author:** [@cswaney](https://discourse.julialang.org/u/cswaney)\
**Replies:** 1\
**Last updated:** [October 13, 2021, 10:59pm UTC](https://discourse.julialang.org/t/difference-between-running-external-programs-and-tasks/69708 "2021-10-13T22:59:15Z")

</div>

The Julia documentation states that external programs run using run(Cmd) are “run as julia 's immediate child process, using fork and exec calls.” By default, julia waits for the program to return, but commands can also …

---

## [PGFPlotsX.jl Tex Capacity Exceeded](https://discourse.julialang.org/t/pgfplotsx-jl-tex-capacity-exceeded/69697)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 3\
**Last updated:** [October 13, 2021, 6:56pm UTC](https://discourse.julialang.org/t/pgfplotsx-jl-tex-capacity-exceeded/69697 "2021-10-13T18:56:18Z")

</div>

Hi, I did a complex 3d chart in PGFPlotsX.jl. I tried to use it within a figure environment in latex, by including the .tikz version of the chart with \\begin{figure}\[!t\] \\input{./img/chart.tikz} \\end{figure} However,…

---

## [Writing Type Stable Loops](https://discourse.julialang.org/t/writing-type-stable-loops/69705)

<div class="topic-metadata">

**Author:** [@dleather](https://discourse.julialang.org/u/dleather)\
**Replies:** 10\
**Last updated:** [October 13, 2021, 6:49pm UTC](https://discourse.julialang.org/t/writing-type-stable-loops/69705 "2021-10-13T18:49:20Z")

</div>

For /While loops create a local scope. Thus, if you’d like to write a function the outputs variables defined inside of the for /while loop, one must declare these variables as global beforehand, or use a let wrapper. Th…

---

## [Data type related debugging help](https://discourse.julialang.org/t/data-type-related-debugging-help/69700)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 2\
**Last updated:** [October 13, 2021, 5:37pm UTC](https://discourse.julialang.org/t/data-type-related-debugging-help/69700 "2021-10-13T17:37:37Z")

</div>

The below data (test.mat) was created inside Matlab, and the values were double inside Matlab before they were saved into the mat file. However, I’m having lots of trouble using them inside Julia: test.mat Below is my …

---

## [PackageCompiler "create\_app" function failing on slurm cluster: "error: undefined reference to 'ceil'"](https://discourse.julialang.org/t/packagecompiler-create-app-function-failing-on-slurm-cluster-error-undefined-reference-to-ceil/69344)

<div class="topic-metadata">

**Author:** [@amckay1](https://discourse.julialang.org/u/amckay1)\
**Replies:** 18\
**Last updated:** [October 13, 2021, 5:31pm UTC](https://discourse.julialang.org/t/packagecompiler-create-app-function-failing-on-slurm-cluster-error-undefined-reference-to-ceil/69344 "2021-10-13T17:31:35Z")

</div>

Hi, I’m trying to figure out how best to troubleshoot this issue, but I’d like to use PackageCompiler to create a relocatable binary for collaborators. I upgraded PackageCompiler to v1.7.0 (on Julia v1.6.3) and that took…

---

## [Documenter With Nested Modules](https://discourse.julialang.org/t/documenter-with-nested-modules/69702)

<div class="topic-metadata">

**Author:** [@Luapulu](https://discourse.julialang.org/u/Luapulu)\
**Replies:** 0\
**Last updated:** [October 13, 2021, 5:10pm UTC](https://discourse.julialang.org/t/documenter-with-nested-modules/69702 "2021-10-13T17:10:58Z")

</div>

I have a package, which looks something like module MyPackage module Sub1 module SubSub1 # some code end # some code end module Sub2 end end When I try to run docte…

---

## [Writing a module using paralellization with @everywhere and @parallel](https://discourse.julialang.org/t/writing-a-module-using-paralellization-with-everywhere-and-parallel/7334)

<div class="topic-metadata">

**Author:** [@tim](https://discourse.julialang.org/u/tim)\
**Replies:** 1\
**Last updated:** [October 13, 2021, 5:07pm UTC](https://discourse.julialang.org/t/writing-a-module-using-paralellization-with-everywhere-and-parallel/7334 "2021-10-13T17:07:45Z")

</div>

Hi, I am rather new to julia and am trying to speed up some processes by using @parallel . But somehow I get confused with the correct way of including a (possible) parallelization in a module. If I use @everywhere ins…

---

## [How to delete following columns from matrix in julia (specific case)](https://discourse.julialang.org/t/how-to-delete-following-columns-from-matrix-in-julia-specific-case/69607)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 11\
**Last updated:** [October 13, 2021, 3:46pm UTC](https://discourse.julialang.org/t/how-to-delete-following-columns-from-matrix-in-julia-specific-case/69607 "2021-10-13T15:46:47Z")

</div>

consider following matrix, julia\> b = \[-1 1 0 0 0 0;1 -1 -1 1 0 0;0 0 1 -1 -1 1;0 0 0 0 1 -1\] 4×6 Matrix{Int64}: -1 1 0 0 0 0 1 -1 -1 1 0 0 0 0 1 -1 -1 1 0 0 0 0 1 -1 how do i…

---

## [Unrecognized gradient using Zygote for AD with Universal Differential Equations](https://discourse.julialang.org/t/unrecognized-gradient-using-zygote-for-ad-with-universal-differential-equations/63791)

<div class="topic-metadata">

**Author:** [@facusapienza](https://discourse.julialang.org/u/facusapienza)\
**Replies:** 30\
**Last updated:** [October 13, 2021, 2:02pm UTC](https://discourse.julialang.org/t/unrecognized-gradient-using-zygote-for-ad-with-universal-differential-equations/63791 "2021-10-13T14:02:38Z")

</div>

Hi! I am trying to train a Universal Differential Equation (UDE) using implicit automatic differentiation with Zygote. I am doing this manually, without using DifferentialEquations. A large part of my code (that I am not…

---

## [CI tests failing on windows (passing on other OS) while using Github actions](https://discourse.julialang.org/t/ci-tests-failing-on-windows-passing-on-other-os-while-using-github-actions/69677)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [October 13, 2021, 11:17am UTC](https://discourse.julialang.org/t/ci-tests-failing-on-windows-passing-on-other-os-while-using-github-actions/69677 "2021-10-13T11:17:20Z")

</div>

I have submitted this pr and this one where the tests are failing on windows without being initiated at all. I just see a message saying “This check failed” in the log. Is there some issue with the windows machines that…

---

## [Julia vs Fortran speed](https://discourse.julialang.org/t/julia-vs-fortran-speed/69654)

<div class="topic-metadata">

**Author:** [@lancejnelson](https://discourse.julialang.org/u/lancejnelson)\
**Replies:** 5\
**Last updated:** [October 13, 2021, 11:13am UTC](https://discourse.julialang.org/t/julia-vs-fortran-speed/69654 "2021-10-13T11:13:08Z")

</div>

A friend of mine wanted to check the speed of Julia vs a compiled language like C++ or Fortran. So he wrote a simple routine in Julia to invert a matrix. Then he compiled a Fortran code to do the same. Compiler flags wer…

---

## [Unexpected behaviour when interrupting pmap](https://discourse.julialang.org/t/unexpected-behaviour-when-interrupting-pmap/69668)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 0\
**Last updated:** [October 13, 2021, 8:33am UTC](https://discourse.julialang.org/t/unexpected-behaviour-when-interrupting-pmap/69668 "2021-10-13T08:33:07Z")

</div>

I had a problem where I wanted to gracefully stop the execution of long running distributed jobs and return the data collected so far, and I ran into some behaviour for pmap that I found a bit odd. A small example of a …

---

## [How to deal with more threads than requested?](https://discourse.julialang.org/t/how-to-deal-with-more-threads-than-requested/69655)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 1\
**Last updated:** [October 13, 2021, 2:17am UTC](https://discourse.julialang.org/t/how-to-deal-with-more-threads-than-requested/69655 "2021-10-13T02:17:36Z")

</div>

I have a program that I instruct to use the 32 physical cores on a machine. But the program typically uses 37 or 38, presumably due to BLAS being used by one of the loaded packages. As a general rule, would it be faste…

---

## [Install only project dependencies? (for more efficient cached docker builds)](https://discourse.julialang.org/t/install-only-project-dependencies-for-more-efficient-cached-docker-builds/69645)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 1\
**Last updated:** [October 12, 2021, 9:44pm UTC](https://discourse.julialang.org/t/install-only-project-dependencies-for-more-efficient-cached-docker-builds/69645 "2021-10-12T21:44:08Z")

</div>

I have a project with many dependencies that I’m currently deploying with Docker. I am able to install my package and it works fine by using: RUN /opt/julia/bin/julia -e 'using Pkg; Pkg.develop(path="/opt/MyPackage"); …

---

## [About Julia's inline assembly usage](https://discourse.julialang.org/t/about-julias-inline-assembly-usage/30352)

<div class="topic-metadata">

**Author:** [@Sinai\_Pearl](https://discourse.julialang.org/u/Sinai_Pearl)\
**Replies:** 7\
**Last updated:** [October 12, 2021, 8:06pm UTC](https://discourse.julialang.org/t/about-julias-inline-assembly-usage/30352 "2021-10-12T20:06:02Z")

</div>

I tried to use @asmcall in LLVM.jl. Is there way to copy register’s value to variable in julia code?

---

## [How to understand this code that seemingly creates an anonymous type on the fly?](https://discourse.julialang.org/t/how-to-understand-this-code-that-seemingly-creates-an-anonymous-type-on-the-fly/69636)

<div class="topic-metadata">

**Author:** [@nxtruong](https://discourse.julialang.org/u/nxtruong)\
**Replies:** 5\
**Last updated:** [October 12, 2021, 7:43pm UTC](https://discourse.julialang.org/t/how-to-understand-this-code-that-seemingly-creates-an-anonymous-type-on-the-fly/69636 "2021-10-12T19:43:51Z")

</div>

I read this article and found this piece of code that I couldn’t understand how it works. I modified it a bit from the article. function makeatype(number) add() = number += 1 get() = number (var) -\> (number;…

---

## [LoopVectorization does not support functions with kwargs?](https://discourse.julialang.org/t/loopvectorization-does-not-support-functions-with-kwargs/69598)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 9\
**Last updated:** [October 12, 2021, 3:52pm UTC](https://discourse.julialang.org/t/loopvectorization-does-not-support-functions-with-kwargs/69598 "2021-10-12T15:52:16Z")

</div>

I get an error when trying to use LoopVectorization below: using LoopVectorization function f(x; kw=kw) x + kw end function add(z; kw=1) s = zero(eltype(kw)) @turbo for x in 1:z s += f(x; kw=kw) …

---

## [Problem when loading Intel MKL shared library to use with C written shared library](https://discourse.julialang.org/t/problem-when-loading-intel-mkl-shared-library-to-use-with-c-written-shared-library/69323)

<div class="topic-metadata">

**Author:** [@Roman\_Istomin](https://discourse.julialang.org/u/Roman_Istomin)\
**Replies:** 9\
**Last updated:** [October 12, 2021, 3:13pm UTC](https://discourse.julialang.org/t/problem-when-loading-intel-mkl-shared-library-to-use-with-c-written-shared-library/69323 "2021-10-12T15:13:36Z")

</div>

Hi, I have written an optimized C library to do some matrix algebra basically, speeding up some einsum operations. I can compile and use the library from C and C++, it links to Intel MKL and is able to run normally. Thi…

---

## [Normalizing a vector to sum to one does not work?](https://discourse.julialang.org/t/normalizing-a-vector-to-sum-to-one-does-not-work/69560)

<div class="topic-metadata">

**Author:** [@Dan.phi](https://discourse.julialang.org/u/Dan.phi)\
**Replies:** 7\
**Last updated:** [October 11, 2021, 12:41pm UTC](https://discourse.julialang.org/t/normalizing-a-vector-to-sum-to-one-does-not-work/69560 "2021-10-11T12:41:26Z")

</div>

This is an extremely basic question and I have to be missing something, but when trying to normalize matrix A below so that rows sum to one, some (small) differences remain: A = rand(100,4) A = A./sum(A, dims = 2) sum…

---

## [Question:when i update, I get a error:Unexpected end of data : jl\_0E2ipr-download](https://discourse.julialang.org/t/question-when-i-update-i-get-a-error-unexpected-end-of-data-jl-0e2ipr-download/69624)

<div class="topic-metadata">

**Author:** [@fregot](https://discourse.julialang.org/u/fregot)\
**Replies:** 0\
**Last updated:** [October 12, 2021, 1:50pm UTC](https://discourse.julialang.org/t/question-when-i-update-i-get-a-error-unexpected-end-of-data-jl-0e2ipr-download/69624 "2021-10-12T13:50:04Z")

</div>

like this:

---

## [Calling a Julia app from Python (communicating through stdin)](https://discourse.julialang.org/t/calling-a-julia-app-from-python-communicating-through-stdin/69584)

<div class="topic-metadata">

**Author:** [@Nosferican](https://discourse.julialang.org/u/Nosferican)\
**Replies:** 2\
**Last updated:** [October 12, 2021, 1:07pm UTC](https://discourse.julialang.org/t/calling-a-julia-app-from-python-communicating-through-stdin/69584 "2021-10-12T13:07:46Z")

</div>

I am trying to run an app that takes a Python script and calls a Julia app. It should be sending JSON to the Julia app and getting back a text line. The Python side has code like from subprocess import Popen, PIPE ... …

---

## [How to store Julia variables and matrices like mat files in MATLAB](https://discourse.julialang.org/t/how-to-store-julia-variables-and-matrices-like-mat-files-in-matlab/69571)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 4\
**Last updated:** [October 11, 2021, 4:36pm UTC](https://discourse.julialang.org/t/how-to-store-julia-variables-and-matrices-like-mat-files-in-matlab/69571 "2021-10-11T16:36:57Z")

</div>

I just switched from Matlab to Julia. One thing I’m trying to figure out is how to store my variables in Julia like mat files in Matlab? For example, in Matlab I would do this: save(‘test.mat’, ‘Var1’, ‘Var2’, ‘Var3’); …

---

## [Dynamically choosing correct way to filter](https://discourse.julialang.org/t/dynamically-choosing-correct-way-to-filter/69420)

<div class="topic-metadata">

**Author:** [@SpinolaHours](https://discourse.julialang.org/u/SpinolaHours)\
**Replies:** 2\
**Last updated:** [October 12, 2021, 11:28am UTC](https://discourse.julialang.org/t/dynamically-choosing-correct-way-to-filter/69420 "2021-10-12T11:28:41Z")

</div>

Hi there, I have an question regarding best practice. I have a dataframe that I need to filter on several columns based on the value in each column. However depending on the situation I may be filtering based on an ar…

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

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