# General Usage

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

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

**Page:** 881

---

## [Matrix square root (Error)](https://discourse.julialang.org/t/matrix-square-root-error/22556)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 5\
**Last updated:** [March 31, 2019, 9:49am UTC](https://discourse.julialang.org/t/matrix-square-root-error/22556 "2019-03-31T09:49:25Z")

</div>

Hi, which command is for Matrix square root? it worked before: julia\> X = sqrtm(\[1.0 -0.9; -0.9 1.0\]) 2x2 Float64 Array: 0.847316 -0.531089 -0.531089 0.847316 But now in Julia 1.1.0 X = sqrtm(\[1.0 -0.9; -0.9 …

---

## [Julia gets stuck on recursive function](https://discourse.julialang.org/t/julia-gets-stuck-on-recursive-function/22548)

<div class="topic-metadata">

**Author:** [@simeonschaub](https://discourse.julialang.org/u/simeonschaub)\
**Replies:** 11\
**Last updated:** [March 31, 2019, 3:01am UTC](https://discourse.julialang.org/t/julia-gets-stuck-on-recursive-function/22548 "2019-03-31T03:01:46Z")

</div>

I defined the following merge function for a custom Dict type: struct MixedKeyDict{T\<:Tuple} #\<: AbstractDict{Any,Any} dicts::T end Base.merge(f::Function, d::MixedKeyDict, others::MixedKeyDict...) = \_merge(f, (), …

---

## [Must have Data Science and Operations Research Packages](https://discourse.julialang.org/t/must-have-data-science-and-operations-research-packages/22327)

<div class="topic-metadata">

**Author:** [@Phillip\_Sutton](https://discourse.julialang.org/u/Phillip_Sutton)\
**Replies:** 3\
**Last updated:** [March 31, 2019, 12:06am UTC](https://discourse.julialang.org/t/must-have-data-science-and-operations-research-packages/22327 "2019-03-31T00:06:28Z")

</div>

Hello all! My team is working to install Julia on a closed network (yes we have received permission to do so!). My questions for the community are- What are some best practices to hosting Julia on a multi-server close…

---

## [How to update variables in loop in Julia 1.1.0](https://discourse.julialang.org/t/how-to-update-variables-in-loop-in-julia-1-1-0/22554)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 1\
**Last updated:** [March 30, 2019, 11:28pm UTC](https://discourse.julialang.org/t/how-to-update-variables-in-loop-in-julia-1-1-0/22554 "2019-03-30T23:28:28Z")

</div>

Dear All, how can we update the variable s in loop in Julia? un = zeros(Float64,3,1) an1 = zeros(Float64,3,1) for n in 1 : 3 an1 = un un = an1 end ERROR: LoadError: UndefVarError: un not defined I know…

---

## [Why Union{Missing, Int}==Union{Int, Missing}, while Tuple differs?](https://discourse.julialang.org/t/why-union-missing-int-union-int-missing-while-tuple-differs/22538)

<div class="topic-metadata">

**Author:** [@Gu\_Junhua](https://discourse.julialang.org/u/Gu_Junhua)\
**Replies:** 2\
**Last updated:** [March 30, 2019, 4:07pm UTC](https://discourse.julialang.org/t/why-union-missing-int-union-int-missing-while-tuple-differs/22538 "2019-03-30T16:07:02Z")

</div>

I know it is necessary for Union to behavior like this, while the type parameter order of Tuple must batter. But how? Is Union specially handled by the julia compiler?

---

## [How to change working directory in julia with atom](https://discourse.julialang.org/t/how-to-change-working-directory-in-julia-with-atom/7588)

<div class="topic-metadata">

**Author:** [@renbro](https://discourse.julialang.org/u/renbro)\
**Replies:** 14\
**Last updated:** [March 30, 2019, 3:30pm UTC](https://discourse.julialang.org/t/how-to-change-working-directory-in-julia-with-atom/7588 "2019-03-30T15:30:05Z")

</div>

The command to change working directory is cd(dir::AbstractString=homedir()). Can anyone give an example as how to use it?

---

## [How to write a fast loop through structure fields](https://discourse.julialang.org/t/how-to-write-a-fast-loop-through-structure-fields/22535)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 4\
**Last updated:** [March 30, 2019, 2:26pm UTC](https://discourse.julialang.org/t/how-to-write-a-fast-loop-through-structure-fields/22535 "2019-03-30T14:26:18Z")

</div>

Hi all, Novice question. I am looping through structure fields and would like to know how to keep this fast. Is there a way to work on these that is faster? #Function that works on values function test(x,y,z) x=x.+1 …

---

## [How-to debug intermittent memory corruption errors (segfaults during GC) in large codebases](https://discourse.julialang.org/t/how-to-debug-intermittent-memory-corruption-errors-segfaults-during-gc-in-large-codebases/21135)

<div class="topic-metadata">

**Author:** [@helgee](https://discourse.julialang.org/u/helgee)\
**Replies:** 16\
**Last updated:** [March 30, 2019, 10:33am UTC](https://discourse.julialang.org/t/how-to-debug-intermittent-memory-corruption-errors-segfaults-during-gc-in-large-codebases/21135 "2019-03-30T10:33:25Z")

</div>

Hi folks, I have an interesting (in the Chinese proverb sense) problem here. While working on SPICE.jl I have been having problems with Julia crashing in the test suite but I had not been able to reproduce it consisten…

---

## [Is it possible to declare deps by path in Project.toml?](https://discourse.julialang.org/t/is-it-possible-to-declare-deps-by-path-in-project-toml/22530)

<div class="topic-metadata">

**Author:** [@Gu\_Junhua](https://discourse.julialang.org/u/Gu_Junhua)\
**Replies:** 1\
**Last updated:** [March 30, 2019, 8:40am UTC](https://discourse.julialang.org/t/is-it-possible-to-declare-deps-by-path-in-project-toml/22530 "2019-03-30T08:40:46Z")

</div>

Julist like in Rust, one can declare a dependence as SOMEPKG={path=“…”} or SOMEPKG={git=“…”} So is it possile to do similar thing in Julia project? rather than denoting a pkg by uuid?

---

## [Manipulation of matrix symbols](https://discourse.julialang.org/t/manipulation-of-matrix-symbols/22526)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 0\
**Last updated:** [March 30, 2019, 7:17am UTC](https://discourse.julialang.org/t/manipulation-of-matrix-symbols/22526 "2019-03-30T07:17:17Z")

</div>

I have several times found myself wanting a package that can perform symbolic manipulations on matrix level. Many of the symbolic packages out there support creating matrices of symbols and using these in expressions (Sy…

---

## [Subtracting row minima](https://discourse.julialang.org/t/subtracting-row-minima/22508)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 9\
**Last updated:** [March 30, 2019, 2:22am UTC](https://discourse.julialang.org/t/subtracting-row-minima/22508 "2019-03-30T02:22:59Z")

</div>

I know that arrays are column based in julia but maybe I’m missing something. Want to subtract the column minimum from each column in a matrix and then the same with rows. Currently doing this: # subtract col minimum …

---

## [Bad interactions between ProfileView, Makie and ImageMagick?](https://discourse.julialang.org/t/bad-interactions-between-profileview-makie-and-imagemagick/22516)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 0\
**Last updated:** [March 29, 2019, 9:35pm UTC](https://discourse.julialang.org/t/bad-interactions-between-profileview-makie-and-imagemagick/22516 "2019-03-29T21:35:12Z")

</div>

While trying to install Makie, I noticed the following behavior: shell$ julia -q julia\> using Makie julia\> using ProfileView while shell$ julia -q julia\> using ProfileView julia\> using Makie ERROR: InitError: /tmp/.ju…

---

## [Camera input - Nvidia librargus and OpenKCam](https://discourse.julialang.org/t/camera-input-nvidia-librargus-and-openkcam/22501)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 0\
**Last updated:** [March 29, 2019, 2:12pm UTC](https://discourse.julialang.org/t/camera-input-nvidia-librargus-and-openkcam/22501 "2019-03-29T14:12:07Z")

</div>

I read that Nvidia development boards us an API called libargus to read in camera data This is based on OpenKCam OpenKCam Overview - The Khronos Group Inc I can imagine reading camera data ‘properly’ is important in m…

---

## [Multiple Line Output to .txt and .inp](https://discourse.julialang.org/t/multiple-line-output-to-txt-and-inp/22468)

<div class="topic-metadata">

**Author:** [@Ulrich](https://discourse.julialang.org/u/Ulrich)\
**Replies:** 3\
**Last updated:** [March 29, 2019, 1:44pm UTC](https://discourse.julialang.org/t/multiple-line-output-to-txt-and-inp/22468 "2019-03-29T13:44:48Z")

</div>

Hello, I just started using Julia and I cant seem to figure out how to write to .txt or .inp properly. I need to create a list with different compounds on different lines on .txt. I tried working with the normal text fi…

---

## [Multiple axis in Plots Recipes](https://discourse.julialang.org/t/multiple-axis-in-plots-recipes/22491)

<div class="topic-metadata">

**Author:** [@Santiago\_Cuervo](https://discourse.julialang.org/u/Santiago_Cuervo)\
**Replies:** 1\
**Last updated:** [March 29, 2019, 12:55pm UTC](https://discourse.julialang.org/t/multiple-axis-in-plots-recipes/22491 "2019-03-29T12:55:07Z")

</div>

@userplot pho @recipe function f(h::pho) legend --\> false yflip := true xmirror := true x, y, a, b =h.args @series begin seriestype := :scatter …

---

## [Am I too stupid to use the Julia vscode plugin?](https://discourse.julialang.org/t/am-i-too-stupid-to-use-the-julia-vscode-plugin/22353)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 13\
**Last updated:** [March 29, 2019, 11:38am UTC](https://discourse.julialang.org/t/am-i-too-stupid-to-use-the-julia-vscode-plugin/22353 "2019-03-29T11:38:18Z")

</div>

I just installed a fresh vscode. Afterwards I installed the julia extension. Now, I create a new empty Julia file text.jl and start typing: No autocompletion. Even when triggered by CTRL + SPACE it just says “No sugg…

---

## [Efficient creation of power series matrix or array of arrays](https://discourse.julialang.org/t/efficient-creation-of-power-series-matrix-or-array-of-arrays/18988)

<div class="topic-metadata">

**Author:** [@taqtiqa-mark](https://discourse.julialang.org/u/taqtiqa-mark)\
**Replies:** 23\
**Last updated:** [March 29, 2019, 7:24am UTC](https://discourse.julialang.org/t/efficient-creation-of-power-series-matrix-or-array-of-arrays/18988 "2019-03-29T07:24:50Z")

</div>

Hi, Thank you for all the effort that has gone into getting Julia to this point. I’m very new to Julia and trying to get my head around when I get faster run-times or smaller fpo-counts by handing things over to the co…

---

## [How to write the type signature of a tuple of types?](https://discourse.julialang.org/t/how-to-write-the-type-signature-of-a-tuple-of-types/22492)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 3\
**Last updated:** [March 29, 2019, 6:59am UTC](https://discourse.julialang.org/t/how-to-write-the-type-signature-of-a-tuple-of-types/22492 "2019-03-29T06:59:19Z")

</div>

For example, I have a type abstract type Axis{a,A} end How can I express in function type signature that I have a tuple of unknown numbers of Axis with different type parameters? For instance, julia\> Tuple{Axis{a,A}, …

---

## [Package does not have ... in its dependencies, but it does](https://discourse.julialang.org/t/package-does-not-have-in-its-dependencies-but-it-does/22017)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 8\
**Last updated:** [March 29, 2019, 6:08am UTC](https://discourse.julialang.org/t/package-does-not-have-in-its-dependencies-but-it-does/22017 "2019-03-29T06:08:13Z")

</div>

I developed a package called EquationsOfState.jl. However, when I try to build the latest version (v1.1.1), I got such error: (v1.0) pkg\> st Status \`~/.julia/environments/v1.0/Project.toml\` \[0438fec6\] EquationsOfS…

---

## [TypeVar Problem](https://discourse.julialang.org/t/typevar-problem/22440)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 1\
**Last updated:** [March 28, 2019, 11:51pm UTC](https://discourse.julialang.org/t/typevar-problem/22440 "2019-03-28T23:51:37Z")

</div>

abstract type MM{A} end t = TypeVar(:T) ff(::Type{T}) where T = T MM{t} # this returns MM{T}, obviously a DataType ff(Int) # this returns Int ff(MM{t}) # ERROR: UndefVarError: T not defined I see that I can’t construc…

---

## [Threads.@threads memory leak](https://discourse.julialang.org/t/threads-threads-memory-leak/22442)

<div class="topic-metadata">

**Author:** [@Eric\_Chen](https://discourse.julialang.org/u/Eric_Chen)\
**Replies:** 6\
**Last updated:** [March 28, 2019, 7:14pm UTC](https://discourse.julialang.org/t/threads-threads-memory-leak/22442 "2019-03-28T19:14:57Z")

</div>

I am running Julia 1.1, here is my Code using BenchmarkTools using DataFrames df = DataFrame(rand(10\_000\_000, 10)); Threads.nthreads() function singlethread(df) N = nrow(df) M = ncol(df) cumsum = 0.0 …

---

## [Atom Editor + Monte Carlo Simulations](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805)

<div class="topic-metadata">

**Author:** [@ennvvy](https://discourse.julialang.org/u/ennvvy)\
**Replies:** 11\
**Last updated:** [March 28, 2019, 6:59pm UTC](https://discourse.julialang.org/t/atom-editor-monte-carlo-simulations/21805 "2019-03-28T18:59:23Z")

</div>

I am using the Atom editor to run MC simulations using Julia. I have implemented a parallel program for the same and am currently using addprocs(5). But, at the end or in the course of the simulations, the editor either …

---

## [WebIO / PlotlyJS click event coordinates](https://discourse.julialang.org/t/webio-plotlyjs-click-event-coordinates/22471)

<div class="topic-metadata">

**Author:** [@rand5](https://discourse.julialang.org/u/rand5)\
**Replies:** 0\
**Last updated:** [March 28, 2019, 6:00pm UTC](https://discourse.julialang.org/t/webio-plotlyjs-click-event-coordinates/22471 "2019-03-28T18:00:31Z")

</div>

I need to get the x,y coordinates of the cursor during a click event. The following example returns the location of the nearest point (based on the x-coordinates), so it must be using the cursor location somewhere, but …

---

## [Avoiding Repeated Function Compilation](https://discourse.julialang.org/t/avoiding-repeated-function-compilation/22379)

<div class="topic-metadata">

**Author:** [@JTomlinson](https://discourse.julialang.org/u/JTomlinson)\
**Replies:** 11\
**Last updated:** [March 28, 2019, 3:03pm UTC](https://discourse.julialang.org/t/avoiding-repeated-function-compilation/22379 "2019-03-28T15:03:13Z")

</div>

I am having trouble precompiling a function I am writing. It is pretty important that I precompile this function as the current compile time is ~700 seconds, and I would like to only pay this the first time I call it wit…

---

## [Use function as objective of JuMP](https://discourse.julialang.org/t/use-function-as-objective-of-jump/22332)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 17\
**Last updated:** [March 28, 2019, 8:35am UTC](https://discourse.julialang.org/t/use-function-as-objective-of-jump/22332 "2019-03-28T08:35:25Z")

</div>

I am trying to optimize a function in JuMP, but got the error message: ERROR: MathOptInterface.UnsupportedConstraint{MathOptInterface.SingleVariable,MathOptInterface.Integer}: MathOptInterface.SingleVariable-in-MathOptI…

---

## [Help needed with some matrix manipulation](https://discourse.julialang.org/t/help-needed-with-some-matrix-manipulation/22341)

<div class="topic-metadata">

**Author:** [@timueh](https://discourse.julialang.org/u/timueh)\
**Replies:** 4\
**Last updated:** [March 28, 2019, 1:48am UTC](https://discourse.julialang.org/t/help-needed-with-some-matrix-manipulation/22341 "2019-03-28T01:48:03Z")

</div>

I need some code review… :slight\_smile: Suppose you are given a matrix A \\in \\mathbb{N}^{m \\times n} you are to determine all the rows k \\leq m of A that have a given maximum interaction j which is given by j = \\sum\_…

---

## [IFFT Inverse discrete Fourier transform](https://discourse.julialang.org/t/ifft-inverse-discrete-fourier-transform/22434)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 2\
**Last updated:** [March 28, 2019, 1:44am UTC](https://discourse.julialang.org/t/ifft-inverse-discrete-fourier-transform/22434 "2019-03-28T01:44:45Z")

</div>

Dear All, how can we solve IFFT Inverse discrete Fourier transform problem in Julia? in Matlab is IFFT function.

---

## [fill(anArray,2) behaviour](https://discourse.julialang.org/t/fill-anarray-2-behaviour/22429)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 5\
**Last updated:** [March 27, 2019, 10:01pm UTC](https://discourse.julialang.org/t/fill-anarray-2-behaviour/22429 "2019-03-27T22:01:20Z")

</div>

I have doubts about the usefulness of fill(anArray,2). The use case for the current behaviour seems limited (who needs 2 copies of the same array in an array?) and the potential for being misleading is considerable (fals…

---

## [Subplot(xyz)](https://discourse.julialang.org/t/subplot-xyz/22432)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 2\
**Last updated:** [March 27, 2019, 9:58pm UTC](https://discourse.julialang.org/t/subplot-xyz/22432 "2019-03-27T21:58:45Z")

</div>

Dear All, how can I use subplot in the following way? In matlab: nn =2; subplot(2,2,nn); In Julia using PyPlot nn = 2 subplot(12nn) ValueError('Integer subplot specification must be a three-digit number, not 36',) …

---

## [LAPACK multithreading](https://discourse.julialang.org/t/lapack-multithreading/22230)

<div class="topic-metadata">

**Author:** [@abhinavd](https://discourse.julialang.org/u/abhinavd)\
**Replies:** 3\
**Last updated:** [March 27, 2019, 9:01pm UTC](https://discourse.julialang.org/t/lapack-multithreading/22230 "2019-03-27T21:01:24Z")

</div>

Hello everyone, I would like to know how the binaries on the Julia downloads page page are generated. For example, what are the default compilation flags used? Would I get the same result if I compiled them on some (Lin…

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

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