# General Usage

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

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

**Page:** 488

---

## [Getting Allocations with Static Arrays](https://discourse.julialang.org/t/getting-allocations-with-static-arrays/75744)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 5\
**Last updated:** [February 3, 2022, 6:49pm UTC](https://discourse.julialang.org/t/getting-allocations-with-static-arrays/75744 "2022-02-03T18:49:32Z")

</div>

Hello, I am trying to optimize some code and have some questions on behavior I am observing related to static arrays. I have read that if you have lots of small arrays (less than 100 elements) then static arrays are on…

---

## [Symlink can not create hardlink in windows10](https://discourse.julialang.org/t/symlink-can-not-create-hardlink-in-windows10/75702)

<div class="topic-metadata">

**Author:** [@babaq](https://discourse.julialang.org/u/babaq)\
**Replies:** 2\
**Last updated:** [February 3, 2022, 5:37pm UTC](https://discourse.julialang.org/t/symlink-can-not-create-hardlink-in-windows10/75702 "2022-02-03T17:37:31Z")

</div>

I tried mklink link target and mklink \\h link target in windows CMD, and it works fine. But when using symlink(target, link), it always creates soft link regardless of absolute/relative path. Is anyone have similar exp…

---

## [If and symbol, bug or feature?](https://discourse.julialang.org/t/if-and-symbol-bug-or-feature/75729)

<div class="topic-metadata">

**Author:** [@bertschi](https://discourse.julialang.org/u/bertschi)\
**Replies:** 6\
**Last updated:** [February 3, 2022, 3:12pm UTC](https://discourse.julialang.org/t/if-and-symbol-bug-or-feature/75729 "2022-02-03T15:12:41Z")

</div>

Hi, first of all many thanks for Julia … what a great language! As I could not find this issue, I post it here: When using an if statement with a symbol, the parser seems to understand it differently as I would: if t…

---

## [Exact solution of linear system with Symbolics](https://discourse.julialang.org/t/exact-solution-of-linear-system-with-symbolics/75718)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 2\
**Last updated:** [February 3, 2022, 1:37pm UTC](https://discourse.julialang.org/t/exact-solution-of-linear-system-with-symbolics/75718 "2022-02-03T13:37:51Z")

</div>

How can I get an exact solution to a linear system using Symbolics.jl? For example: @variables x y Symbolics.solve\_for(\[x + y ~ 2, x - y ~ 1\], \[x, y\]) # Result: 2-element Vector…

---

## [Julia + VSCode Import error from ModelingToolkit](https://discourse.julialang.org/t/julia-vscode-import-error-from-modelingtoolkit/75720)

<div class="topic-metadata">

**Author:** [@koustavpal](https://discourse.julialang.org/u/koustavpal)\
**Replies:** 1\
**Last updated:** [February 3, 2022, 11:40am UTC](https://discourse.julialang.org/t/julia-vscode-import-error-from-modelingtoolkit/75720 "2022-02-03T11:40:07Z")

</div>

Hi, I’m trying to get started with ModelingToolKit. I’m using Julia through a jupyter notebook in VSCode. The environment is different from the default environment used by the command line julia executable. Julia itself…

---

## [Inconsistency with \`reduce(vcat, v)\` when the vector has a single element](https://discourse.julialang.org/t/inconsistency-with-reduce-vcat-v-when-the-vector-has-a-single-element/75694)

<div class="topic-metadata">

**Author:** [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Replies:** 4\
**Last updated:** [February 3, 2022, 10:21am UTC](https://discourse.julialang.org/t/inconsistency-with-reduce-vcat-v-when-the-vector-has-a-single-element/75694 "2022-02-03T10:21:14Z")

</div>

Hello! I guess that this might have been discussed somewhere. But I couldn’t find it. I’ll put an example to show the problem, which in my opinion needs at least some consideration julia\> vcat(1,2) == reduce(vcat, \[1,2\]…

---

## [Outperformed by Matlab](https://discourse.julialang.org/t/outperformed-by-matlab/71603)

<div class="topic-metadata">

**Author:** [@Germinator](https://discourse.julialang.org/u/Germinator)\
**Replies:** 54\
**Last updated:** [November 23, 2021, 7:28pm UTC](https://discourse.julialang.org/t/outperformed-by-matlab/71603 "2021-11-23T19:28:46Z")

</div>

Dear Julia users, I am trying to set up the normal equations ( https://en.wikipedia.org/wiki/Linear\_least\_squares ) which means constructing X'X and X'y in (X'X+\\lambda M) w = X'y where M is SPD, and in my case, each…

---

## [Autocov with FFT](https://discourse.julialang.org/t/autocov-with-fft/4178)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 14\
**Last updated:** [February 3, 2022, 7:36am UTC](https://discourse.julialang.org/t/autocov-with-fft/4178 "2022-02-03T07:36:14Z")

</div>

Is there a package which has an implementation of autocovariances using FFT? With lots of lags, it should be much faster than the simple approach (eg in StatsBase.autocov). If there is none, which appears to be my impre…

---

## [Why so large memory allocations?](https://discourse.julialang.org/t/why-so-large-memory-allocations/75662)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 6\
**Last updated:** [February 3, 2022, 2:58am UTC](https://discourse.julialang.org/t/why-so-large-memory-allocations/75662 "2022-02-03T02:58:36Z")

</div>

I met a weird problem in the following trivial code: using BenchmarkTools const p=150 dd = randn(p,p) function d2(ψ::Matrix{Float64})::Matrix{Float64} ψr = similar(ψ) ddψ = dd\*ψ @time @inbounds for i in ea…

---

## [Number of threads, puzzle](https://discourse.julialang.org/t/number-of-threads-puzzle/74965)

<div class="topic-metadata">

**Author:** [@HANHAOHAN](https://discourse.julialang.org/u/HANHAOHAN)\
**Replies:** 9\
**Last updated:** [February 2, 2022, 10:06pm UTC](https://discourse.julialang.org/t/number-of-threads-puzzle/74965 "2022-02-02T22:06:50Z")

</div>

draft.jl c1 = Channel(100) c2 = Channel(100) c3 = Channel(100) function task\_1() while true wait(c1) take!(c1) end end function task\_2() while true wait(c2) take!(c2) end…

---

## [What is the correct procedure to calculate ONLY the execution time of code not its embedded compilation time?](https://discourse.julialang.org/t/what-is-the-correct-procedure-to-calculate-only-the-execution-time-of-code-not-its-embedded-compilation-time/75678)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 4\
**Last updated:** [February 2, 2022, 8:55pm UTC](https://discourse.julialang.org/t/what-is-the-correct-procedure-to-calculate-only-the-execution-time-of-code-not-its-embedded-compilation-time/75678 "2022-02-02T20:55:27Z")

</div>

As far as I know that, using @time calculates the total time (compilation and execution). However, if I only need to calculate the execution time, what is the correct way to do that?

---

## [Generate Tree Struct using EzXML.jl?](https://discourse.julialang.org/t/generate-tree-struct-using-ezxml-jl/73770)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [February 2, 2022, 7:04pm UTC](https://discourse.julialang.org/t/generate-tree-struct-using-ezxml-jl/73770 "2022-02-02T19:04:59Z")

</div>

Hello! Is it possible to use EzXML.jl to extract the full tree of an XML file I am generating? For example if I have an XML as such: \<Main\> \<SubTag1\> \<LowerTag1 x="0" y="0" z="0" /\> \</SubTag1\> …

---

## [Interpreting version compatibility error during package installation](https://discourse.julialang.org/t/interpreting-version-compatibility-error-during-package-installation/75258)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 3\
**Last updated:** [February 2, 2022, 6:50pm UTC](https://discourse.julialang.org/t/interpreting-version-compatibility-error-during-package-installation/75258 "2022-02-02T18:50:42Z")

</div>

I don’t understand the following version compatibility error during installation of ContinuumArrays.jl: (@v1.7) pkg\> add ContinuumArrays Resolving package versions... ERROR: Unsatisfiable requirements detected for pa…

---

## [What is the correct procedure to compare the execution time between sequential code and parallel code?](https://discourse.julialang.org/t/what-is-the-correct-procedure-to-compare-the-execution-time-between-sequential-code-and-parallel-code/68121)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 15\
**Last updated:** [September 17, 2021, 4:39pm UTC](https://discourse.julialang.org/t/what-is-the-correct-procedure-to-compare-the-execution-time-between-sequential-code-and-parallel-code/68121 "2021-09-17T16:39:40Z")

</div>

I am trying to compare between two codes; one with parallel computing (6 threads) and the other with single thread (normal). I put each code between “@time … end”, i.e.,: @time begin ... sequential code ... end #@time …

---

## [Correct typing of struct field with late initialization](https://discourse.julialang.org/t/correct-typing-of-struct-field-with-late-initialization/75635)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 2\
**Last updated:** [February 2, 2022, 3:50pm UTC](https://discourse.julialang.org/t/correct-typing-of-struct-field-with-late-initialization/75635 "2022-02-02T15:50:43Z")

</div>

Consider the following mutable struct: Base.@kwdef mutable struct MyStruct data::Union{String, Nothing} = nothing end Is this the most efficient way to represent the fact that data may be “empty”, or does the type …

---

## [Save yourself some headache and don't put JULIA\_DEPOT\_PATH on your NFS home directory](https://discourse.julialang.org/t/save-yourself-some-headache-and-dont-put-julia-depot-path-on-your-nfs-home-directory/75601)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 1\
**Last updated:** [February 2, 2022, 4:55pm UTC](https://discourse.julialang.org/t/save-yourself-some-headache-and-dont-put-julia-depot-path-on-your-nfs-home-directory/75601 "2022-02-02T16:55:39Z")

</div>

I have my home directory on NFS so that I have one place to back up all my files and can go from one computer to another in my house and get a consistent set of files and etc… But Julia and especially Pkg don’t play nic…

---

## [How to give an one-time assignment to a large parametric matrix?](https://discourse.julialang.org/t/how-to-give-an-one-time-assignment-to-a-large-parametric-matrix/75664)

<div class="topic-metadata">

**Author:** [@GtJeight](https://discourse.julialang.org/u/GtJeight)\
**Replies:** 5\
**Last updated:** [February 2, 2022, 4:24pm UTC](https://discourse.julialang.org/t/how-to-give-an-one-time-assignment-to-a-large-parametric-matrix/75664 "2022-02-02T16:24:03Z")

</div>

One-time assignment means something essentially equal to this: function Mf(t) M=\[t t^2;t^3 t^4\] #assignment, just list all its entries in the bracket end but not this: function Mf(t) M=zeros(2,2) #assign…

---

## [Insert value into sorted array with fixed size](https://discourse.julialang.org/t/insert-value-into-sorted-array-with-fixed-size/75660)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 1\
**Last updated:** [February 2, 2022, 3:45pm UTC](https://discourse.julialang.org/t/insert-value-into-sorted-array-with-fixed-size/75660 "2022-02-02T15:45:03Z")

</div>

I want to insert a value into a sorted array with fixed size, removing the last (greatest) value of the array. A naive solution is this function that combines insert! (or pushfirst!) and pop!: function insertandropgreat…

---

## [Are eigenvectors of real symmetric or hermitian matrix computed from \`eigen\` all orthogonal](https://discourse.julialang.org/t/are-eigenvectors-of-real-symmetric-or-hermitian-matrix-computed-from-eigen-all-orthogonal/60893)

<div class="topic-metadata">

**Author:** [@ZhiyuanYao](https://discourse.julialang.org/u/ZhiyuanYao)\
**Replies:** 28\
**Last updated:** [February 2, 2022, 3:23pm UTC](https://discourse.julialang.org/t/are-eigenvectors-of-real-symmetric-or-hermitian-matrix-computed-from-eigen-all-orthogonal/60893 "2022-02-02T15:23:41Z")

</div>

In Fortran/C, for a real symmetric or complex Hermitian matrix A, I can call Lapack dsyev /zheev and the resulting eigenvectors are normalized and mutually orthogonal. What method is Julia using for diagonalizing such ma…

---

## [Apparent mismatch of run times during summation](https://discourse.julialang.org/t/apparent-mismatch-of-run-times-during-summation/75527)

<div class="topic-metadata">

**Author:** [@lzxnl](https://discourse.julialang.org/u/lzxnl)\
**Replies:** 5\
**Last updated:** [February 2, 2022, 3:21pm UTC](https://discourse.julialang.org/t/apparent-mismatch-of-run-times-during-summation/75527 "2022-02-02T15:21:52Z")

</div>

Hi guys, Julia newbie here. I have a very simple question that I haven’t been able to get my head around. I ultimately want to sum f(n)\*g(n)\*x\[n-1\] where n ranges from 1 to a predetermined integer, where f is some funct…

---

## [DataFrame, aggregate by month of date](https://discourse.julialang.org/t/dataframe-aggregate-by-month-of-date/34428)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 4\
**Last updated:** [February 2, 2022, 1:51pm UTC](https://discourse.julialang.org/t/dataframe-aggregate-by-month-of-date/34428 "2022-02-02T13:51:35Z")

</div>

I am sorry for the easy question. I have DataFrame, one the column is Date and Count:: Int. What is the easiest way to calculate the sum(Count) per month? thank you. P.S. I have done by loop, but I fill there has to …

---

## [Multithreaded code on beefy computer runs just as fast as serial code on M1 Mac](https://discourse.julialang.org/t/multithreaded-code-on-beefy-computer-runs-just-as-fast-as-serial-code-on-m1-mac/75210)

<div class="topic-metadata">

**Author:** [@ash](https://discourse.julialang.org/u/ash)\
**Replies:** 41\
**Last updated:** [February 2, 2022, 1:10pm UTC](https://discourse.julialang.org/t/multithreaded-code-on-beefy-computer-runs-just-as-fast-as-serial-code-on-m1-mac/75210 "2022-02-02T13:10:16Z")

</div>

I have 2 machines: M1 Mac Mini, with horrible thermals and a peak of 3.2 GHz and 8 GB of RAM (absolutely love it though) A beefy linux (Ubuntu 21.10) workstation with 64 GB of DDR5 RAM and a 12th-Gen 4.9 GHz processor …

---

## [Efficiently creating array of dimension 3 from element-wise matrix addition](https://discourse.julialang.org/t/efficiently-creating-array-of-dimension-3-from-element-wise-matrix-addition/75646)

<div class="topic-metadata">

**Author:** [@Eriklw](https://discourse.julialang.org/u/Eriklw)\
**Replies:** 2\
**Last updated:** [February 2, 2022, 12:14pm UTC](https://discourse.julialang.org/t/efficiently-creating-array-of-dimension-3-from-element-wise-matrix-addition/75646 "2022-02-02T12:14:25Z")

</div>

I have to perfrom an operation, in which I create an array with dimension 3 from two matrices in the following way: C\[i,j,k\] = A\[i,j\] + B\[j,k\] I can do this of course with a loop but this seems by far not the best way …

---

## [Smallest magnitude eigenvalues of the generalized eigenvalue equation for a large sparse matrix](https://discourse.julialang.org/t/smallest-magnitude-eigenvalues-of-the-generalized-eigenvalue-equation-for-a-large-sparse-matrix/75485)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 20\
**Last updated:** [February 2, 2022, 12:05pm UTC](https://discourse.julialang.org/t/smallest-magnitude-eigenvalues-of-the-generalized-eigenvalue-equation-for-a-large-sparse-matrix/75485 "2022-02-02T12:05:42Z")

</div>

I have a generalized eigenvalue problem Hx=\\lambda S x to solve, where H is Hermitian and S is positive definite. Both H and S are sparse matrices and their dimensions (size(H, 1)) are on the order of 10^5. Roughly 1% of…

---

## [Generate Julia expressions with Symbolics](https://discourse.julialang.org/t/generate-julia-expressions-with-symbolics/75528)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 2\
**Last updated:** [February 2, 2022, 8:30am UTC](https://discourse.julialang.org/t/generate-julia-expressions-with-symbolics/75528 "2022-02-02T08:30:26Z")

</div>

Dear all, I’m starting with Symbolics.jl, however I’m stuck with a basic functionality. I often use sympy to generate some text expressions that I then copy/paste in either C, MATLAB or Julia codes. I was wondering how…

---

## [What is our equivalent of numpy.argpartition?](https://discourse.julialang.org/t/what-is-our-equivalent-of-numpy-argpartition/75626)

<div class="topic-metadata">

**Author:** [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)\
**Replies:** 1\
**Last updated:** [February 2, 2022, 7:32am UTC](https://discourse.julialang.org/t/what-is-our-equivalent-of-numpy-argpartition/75626 "2022-02-02T07:32:27Z")

</div>

What is the julia equivalent of numpy’s argpartition? Here is how it works: Let’s say you want to get the indices of the top five entries of an array. As an example, say I have probabilites of n events stored in an ar…

---

## [How to get the full history of step sizes and coefficients](https://discourse.julialang.org/t/how-to-get-the-full-history-of-step-sizes-and-coefficients/75597)

<div class="topic-metadata">

**Author:** [@1115](https://discourse.julialang.org/u/1115)\
**Replies:** 3\
**Last updated:** [February 2, 2022, 5:06am UTC](https://discourse.julialang.org/t/how-to-get-the-full-history-of-step-sizes-and-coefficients/75597 "2022-02-02T05:06:16Z")

</div>

Regarding to solving an ordinary differential equation f(u, t) with OrdinaryDiffEq.jl. Is it possible to store time steps as times and coefficients as coeffs so that one can replay the integration as for k=1:K u += …

---

## [Avoiding \`readavailable()\` when communicating with long-lived external program](https://discourse.julialang.org/t/avoiding-readavailable-when-communicating-with-long-lived-external-program/61611)

<div class="topic-metadata">

**Author:** [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Replies:** 26\
**Last updated:** [February 2, 2022, 3:42am UTC](https://discourse.julialang.org/t/avoiding-readavailable-when-communicating-with-long-lived-external-program/61611 "2022-02-02T03:42:31Z")

</div>

I would like to ask for comments and suggestions on my solution to the following problem. I maintain a frontend to gnuplot, which implements the following plotting process: Run gnuplot and connect to it via stdin, stdo…

---

## [Is there a function for the inverse of \`ismissing()\`](https://discourse.julialang.org/t/is-there-a-function-for-the-inverse-of-ismissing/75575)

<div class="topic-metadata">

**Author:** [@drarnau](https://discourse.julialang.org/u/drarnau)\
**Replies:** 18\
**Last updated:** [February 2, 2022, 2:20am UTC](https://discourse.julialang.org/t/is-there-a-function-for-the-inverse-of-ismissing/75575 "2022-02-02T02:20:40Z")

</div>

Hi all, Is there a function that returns the inverse of ismissing()? Obviously, I can use ismissing(foo) == false but it seems not elegant. Thanks!

---

## [ArchGDAL Convexhull not return a polygon](https://discourse.julialang.org/t/archgdal-convexhull-not-return-a-polygon/75609)

<div class="topic-metadata">

**Author:** [@ZWJZ9](https://discourse.julialang.org/u/ZWJZ9)\
**Replies:** 1\
**Last updated:** [February 2, 2022, 12:35am UTC](https://discourse.julialang.org/t/archgdal-convexhull-not-return-a-polygon/75609 "2022-02-02T00:35:52Z")

</div>

Hello Everyone, I am new to julia and currently using ArchGDAL. Currently, I want to compute a convex hull for a lot of points. When I using AG.convexhull, and save the result to a shapefile using GeoDataFrames. When I …

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

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