# General Usage

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

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

**Page:** 638

---

## [Benchmarking Parallel Computing Tools](https://discourse.julialang.org/t/benchmarking-parallel-computing-tools/56002)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 12:48pm UTC](https://discourse.julialang.org/t/benchmarking-parallel-computing-tools/56002 "2021-02-25T12:48:38Z")

</div>

I am trying to compare the performances of a couple of functions that solve a couple of differential equations. According to the benchmark results, the performance of the function that uses threads and distributed for ar…

---

## [Force calling the generic for benchmarking](https://discourse.julialang.org/t/force-calling-the-generic-for-benchmarking/56009)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 12:08pm UTC](https://discourse.julialang.org/t/force-calling-the-generic-for-benchmarking/56009 "2021-02-25T12:08:36Z")

</div>

Consider the following dummy example: function f(x) println("We called the generic") prod(x) end function f(x::Real) println("We called the method") x end # Some checks: f(1) f(\[1 2\]) How can I force f…

---

## [Question) How should I solve this equation from a finite-state Markov chain?](https://discourse.julialang.org/t/question-how-should-i-solve-this-equation-from-a-finite-state-markov-chain/55947)

<div class="topic-metadata">

**Author:** [@Zerosum](https://discourse.julialang.org/u/Zerosum)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 11:25am UTC](https://discourse.julialang.org/t/question-how-should-i-solve-this-equation-from-a-finite-state-markov-chain/55947 "2021-02-25T11:25:37Z")

</div>

I have 2,001 states, and say the transition matrix of Markov chain is given. Then there is a variable x(s) attached to each state s \\in \\{1,...,2001\\}, and I have to solve the following equation for any x(s): \\frac{a}{f…

---

## [What does "DataFrame(columns::AbstractMatrix)\` is deprecated, use \`DataFrame(columns, :auto)\`" mean?](https://discourse.julialang.org/t/what-does-dataframe-columns-abstractmatrix-is-deprecated-use-dataframe-columns-auto-mean/55997)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 10:38am UTC](https://discourse.julialang.org/t/what-does-dataframe-columns-abstractmatrix-is-deprecated-use-dataframe-columns-auto-mean/55997 "2021-02-25T10:38:06Z")

</div>

Hi, I re-ran some older code and see changes have been made. I tried following the discussion for this depreciation here but am not understanding the difference or what I need to do to update my code. The warning shows…

---

## [Syntax validation of a julia file](https://discourse.julialang.org/t/syntax-validation-of-a-julia-file/55946)

<div class="topic-metadata">

**Author:** [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Replies:** 2\
**Last updated:** [February 25, 2021, 10:26am UTC](https://discourse.julialang.org/t/syntax-validation-of-a-julia-file/55946 "2021-02-25T10:26:04Z")

</div>

I am trying to come up with a script to check program’s syntax without running it. Ideally this should not rely on external packages as the goal in mind is to use this within online judge system at competitive programmin…

---

## [In place updating of arrays](https://discourse.julialang.org/t/in-place-updating-of-arrays/55983)

<div class="topic-metadata">

**Author:** [@praveenc](https://discourse.julialang.org/u/praveenc)\
**Replies:** 8\
**Last updated:** [February 25, 2021, 7:37am UTC](https://discourse.julialang.org/t/in-place-updating-of-arrays/55983 "2021-02-25T07:37:50Z")

</div>

If we have array equation like x = x + y this creates extra memory allocation. Does the following do in place update x .= x + y How to find out if the update is happening in place ?

---

## [Threaded map and reduce problem](https://discourse.julialang.org/t/threaded-map-and-reduce-problem/55903)

<div class="topic-metadata">

**Author:** [@Adriel](https://discourse.julialang.org/u/Adriel)\
**Replies:** 5\
**Last updated:** [February 25, 2021, 4:39am UTC](https://discourse.julialang.org/t/threaded-map-and-reduce-problem/55903 "2021-02-25T04:39:05Z")

</div>

I have a bottleneck matrix-vector product and reduction that I’m trying to speed up. Any multithreading gurus that could point me to a suitable parallel mapreduce implementation? The current code is function nonthreaded…

---

## [Function with two unitful arguments with the same dimension](https://discourse.julialang.org/t/function-with-two-unitful-arguments-with-the-same-dimension/55978)

<div class="topic-metadata">

**Author:** [@OliverEvans96](https://discourse.julialang.org/u/OliverEvans96)\
**Replies:** 1\
**Last updated:** [February 25, 2021, 3:40am UTC](https://discourse.julialang.org/t/function-with-two-unitful-arguments-with-the-same-dimension/55978 "2021-02-25T03:40:01Z")

</div>

Hello, Using Unitful.jl, you can dispatch on dimensions or specific units. For example, you can write a method that takes any length quantity: using Unitful: m, ft, Length f(x::Length) = println("Got length: $x") Or …

---

## [Fail to precompile MultiJump](https://discourse.julialang.org/t/fail-to-precompile-multijump/25174)

<div class="topic-metadata">

**Author:** [@Kornpong\_Mahitthibur](https://discourse.julialang.org/u/Kornpong_Mahitthibur)\
**Replies:** 11\
**Last updated:** [February 25, 2021, 2:23am UTC](https://discourse.julialang.org/t/fail-to-precompile-multijump/25174 "2021-02-25T02:23:47Z")

</div>

Hi, I tried to precompile MultiJump package on my julia version 1.1.1.1 and JuMP package version v0.19.2 but it fails with the following report. Any idea how to solve this issue? julia\> using MultiJuMP \[ Info: Preco…

---

## [NaN Detector](https://discourse.julialang.org/t/nan-detector/55024)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 10\
**Last updated:** [February 25, 2021, 2:23am UTC](https://discourse.julialang.org/t/nan-detector/55024 "2021-02-25T02:23:39Z")

</div>

I’m trying to find my NaN generator. I think it is due to an uninitialized input variable without proper protection in the code. I know the debugger doesn’t have a nan break and it is very difficult for me to get to th…

---

## [Annotation to elide function call if the return value is unused](https://discourse.julialang.org/t/annotation-to-elide-function-call-if-the-return-value-is-unused/55904)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 5\
**Last updated:** [February 24, 2021, 11:52pm UTC](https://discourse.julialang.org/t/annotation-to-elide-function-call-if-the-return-value-is-unused/55904 "2021-02-24T23:52:26Z")

</div>

Is there some annotation that I can use to give permission to the compiler to elide e.g. x = foo(y) if x is not used? And would it possibly work across function-call boundaries? I’d like to do something like function fo…

---

## [Why specify argument types and return types](https://discourse.julialang.org/t/why-specify-argument-types-and-return-types/55567)

<div class="topic-metadata">

**Author:** [@lancejnelson](https://discourse.julialang.org/u/lancejnelson)\
**Replies:** 38\
**Last updated:** [February 24, 2021, 11:51pm UTC](https://discourse.julialang.org/t/why-specify-argument-types-and-return-types/55567 "2021-02-24T23:51:44Z")

</div>

New Julia user here. Trying to understand the benefit of this: function test(p::Float64,x::Int) :: Float64 \<do something\> end over the more pythonic: function test(p,x) \<do something\> end The same question could…

---

## [SharedArrays and process affinity](https://discourse.julialang.org/t/sharedarrays-and-process-affinity/55684)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 3\
**Last updated:** [February 24, 2021, 10:50pm UTC](https://discourse.julialang.org/t/sharedarrays-and-process-affinity/55684 "2021-02-24T22:50:57Z")

</div>

I am trying to pin my julia workers to specific CPU cores with ClusterManagers.jl. However, it seems LocalAffinityManager does not work well with SharedArrays. using Distributed, SharedArrays, ClusterManagers addprocs(…

---

## [Uploading Multi-part files in julia](https://discourse.julialang.org/t/uploading-multi-part-files-in-julia/54200)

<div class="topic-metadata">

**Author:** [@Dsantra92](https://discourse.julialang.org/u/Dsantra92)\
**Replies:** 5\
**Last updated:** [February 24, 2021, 10:25pm UTC](https://discourse.julialang.org/t/uploading-multi-part-files-in-julia/54200 "2021-02-24T22:25:12Z")

</div>

I am trying to upload an image to Slack using their API. I have successfully uploaded some text message using the following function : function send\_message(msg::T, channel\_id::T, token::T) where T\<:AbstractString …

---

## [Bug detected in Arpack](https://discourse.julialang.org/t/bug-detected-in-arpack/55334)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 6\
**Last updated:** [February 24, 2021, 9:23pm UTC](https://discourse.julialang.org/t/bug-detected-in-arpack/55334 "2021-02-24T21:23:40Z")

</div>

I can say with certainty that the Arpack.eigs has a very serious bug. I am running the following simple code to find the 4 smallest eigenvalues and eigenvectors of a 16X16 symmetric matrix. The file xxx.txt is uploaded h…

---

## [Julia Cuda  Matrix multiplication](https://discourse.julialang.org/t/julia-cuda-matrix-multiplication/21741)

<div class="topic-metadata">

**Author:** [@Noobie76](https://discourse.julialang.org/u/Noobie76)\
**Replies:** 3\
**Last updated:** [February 24, 2021, 6:52pm UTC](https://discourse.julialang.org/t/julia-cuda-matrix-multiplication/21741 "2021-02-24T18:52:38Z")

</div>

Hi, I’m relatively new to Julia and want to implement a numerical method using the CUDA libraries for Julia. I worked myself through the introduction files on GitHub and gained all the basic knowledge to write my own co…

---

## [Creation/Definition of global variable for each step of a loop](https://discourse.julialang.org/t/creation-definition-of-global-variable-for-each-step-of-a-loop/55881)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 11\
**Last updated:** [February 24, 2021, 6:14pm UTC](https://discourse.julialang.org/t/creation-definition-of-global-variable-for-each-step-of-a-loop/55881 "2021-02-24T18:14:14Z")

</div>

Is there a way to create/define a new variable for each step inside a loop? Pseudocode: for i in 1:3 xi = i end The result of this loop would be x1 = 1, x2 = 2, and x3 = 3. Thanks, DS

---

## [Failing to show unicode character in julia file](https://discourse.julialang.org/t/failing-to-show-unicode-character-in-julia-file/55938)

<div class="topic-metadata">

**Author:** [@DocDave](https://discourse.julialang.org/u/DocDave)\
**Replies:** 2\
**Last updated:** [February 24, 2021, 5:31pm UTC](https://discourse.julialang.org/t/failing-to-show-unicode-character-in-julia-file/55938 "2021-02-24T17:31:30Z")

</div>

I am attempting to use the interpunct (·) unicode character within some code, which should be obtainable using the \\cdot TeX command. Tab-completing this command within .jl files gives a blank (whitespace) character but …

---

## [How to use a function in a module without specifying the module name](https://discourse.julialang.org/t/how-to-use-a-function-in-a-module-without-specifying-the-module-name/55942)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 1\
**Last updated:** [February 24, 2021, 4:41pm UTC](https://discourse.julialang.org/t/how-to-use-a-function-in-a-module-without-specifying-the-module-name/55942 "2021-02-24T16:41:01Z")

</div>

I have the following folder and module ExampleFolder - SampleModule.jl - main.jl main: import .Example function main() println(Example.greet\_user("Svetlana")) end main() Is there a way I can say println(gr…

---

## [Is there a simple/intuitive way to partition a matrix by arbitrary strides? Like i](https://discourse.julialang.org/t/is-there-a-simple-intuitive-way-to-partition-a-matrix-by-arbitrary-strides-like-i/55863)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 9\
**Last updated:** [February 24, 2021, 3:26pm UTC](https://discourse.julialang.org/t/is-there-a-simple-intuitive-way-to-partition-a-matrix-by-arbitrary-strides-like-i/55863 "2021-02-24T15:26:12Z")

</div>

Is there a simple/intuitive way to partition a matrix by arbitrary strides? Like if I had a 20 x 5 matrix and wanted the output to be a vector/iterable of 10x5, 3x5, 4x5, 3x5 ? Essentially, the “split” part of split-appl…

---

## [IOError: could not spawn 'cmd' : no such file or directory \<ENOENT\>](https://discourse.julialang.org/t/ioerror-could-not-spawn-cmd-no-such-file-or-directory-enoent/55898)

<div class="topic-metadata">

**Author:** [@abbasn110](https://discourse.julialang.org/u/abbasn110)\
**Replies:** 5\
**Last updated:** [February 24, 2021, 3:05pm UTC](https://discourse.julialang.org/t/ioerror-could-not-spawn-cmd-no-such-file-or-directory-enoent/55898 "2021-02-24T15:05:08Z")

</div>

hi Im kinda new on Julia. While working on REPL, when I want to switch to cmd and type it on Shell I get this error. IOError: could not spawn ‘cmd’ : no such file or directory I also added installation directory to en…

---

## [On the performance of function calls that depends on a variable](https://discourse.julialang.org/t/on-the-performance-of-function-calls-that-depends-on-a-variable/55573)

<div class="topic-metadata">

**Author:** [@moudbis](https://discourse.julialang.org/u/moudbis)\
**Replies:** 12\
**Last updated:** [February 24, 2021, 2:07pm UTC](https://discourse.julialang.org/t/on-the-performance-of-function-calls-that-depends-on-a-variable/55573 "2021-02-24T14:07:39Z")

</div>

Hello everyone, Sorry, it’s going to be a bit long. I’m trying to reach performance in Julia for function calls that depends on a variable. It means given a line in my code, I can’t tell which function will be run in a…

---

## [Function as argument: name, symbol or string?](https://discourse.julialang.org/t/function-as-argument-name-symbol-or-string/55926)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [February 24, 2021, 1:10pm UTC](https://discourse.julialang.org/t/function-as-argument-name-symbol-or-string/55926 "2021-02-24T13:10:41Z")

</div>

I have a function (a Machine Learning algorithm) where one of the parameters is a function (custom versions of gini, variance or entropy). Do you advice using as parameter the name of the function, the symbol or a text …

---

## [Is there a way to restrict two fields in a struct to either be both \`AbstractTypeA](https://discourse.julialang.org/t/is-there-a-way-to-restrict-two-fields-in-a-struct-to-either-be-both-abstracttypea/55873)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [February 24, 2021, 9:41am UTC](https://discourse.julialang.org/t/is-there-a-way-to-restrict-two-fields-in-a-struct-to-either-be-both-abstracttypea/55873 "2021-02-24T09:41:52Z")

</div>

Is there a way to restrict two fields in a struct to either be both AbstractTypeA or both AbstractTypeB, but not necessarily the same concrete type? Note that the original poster on Slack cannot see your response here o…

---

## [Should + always be commutative?](https://discourse.julialang.org/t/should-always-be-commutative/55906)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 12\
**Last updated:** [February 24, 2021, 6:56am UTC](https://discourse.julialang.org/t/should-always-be-commutative/55906 "2021-02-24T06:56:46Z")

</div>

From the manual: While \* may seem like a surprising choice to users of languages that provide + for string concatenation, this use of \* has precedent in mathematics, particularly in abstract algebra. In mathematics, + …

---

## [Sum over arrays - What am I doing wrong?](https://discourse.julialang.org/t/sum-over-arrays-what-am-i-doing-wrong/55831)

<div class="topic-metadata">

**Author:** [@SubhadityaMukherjee](https://discourse.julialang.org/u/SubhadityaMukherjee)\
**Replies:** 6\
**Last updated:** [February 24, 2021, 6:37am UTC](https://discourse.julialang.org/t/sum-over-arrays-what-am-i-doing-wrong/55831 "2021-02-24T06:37:22Z")

</div>

Im trying to port a python numpy implementation of something into Julia and one step is import numpy as np np.random.rand(12,10) + np.random.rand(10) Output shape - (12, 10) but in Julia rand(12,10) + rand(10) throw…

---

## [How to add two symmetric matrices inplace?](https://discourse.julialang.org/t/how-to-add-two-symmetric-matrices-inplace/55849)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 1\
**Last updated:** [February 24, 2021, 5:24am UTC](https://discourse.julialang.org/t/how-to-add-two-symmetric-matrices-inplace/55849 "2021-02-24T05:24:02Z")

</div>

Symmetric matrices do not permit editing off-diagonal elements. I have two matrices S1 and S2 and I’m trying to evaluate S1 + S2 and save the result into S2. Typically S2 .+= S1 would achieve this but this doesn’t work f…

---

## [Finding function/method definition (in e.g. VSCode) and Intellisense](https://discourse.julialang.org/t/finding-function-method-definition-in-e-g-vscode-and-intellisense/55899)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [February 24, 2021, 12:04am UTC](https://discourse.julialang.org/t/finding-function-method-definition-in-e-g-vscode-and-intellisense/55899 "2021-02-24T00:04:04Z")

</div>

A. If I do: julia\> @which select(:chosen\_index; options=:drop\_down) (::Genie.Renderer.Html.var"#select##kw")(::Any, ::typeof(select), children, args...) in Genie.Renderer.Html at none:1 Long story short, I actually fo…

---

## ["Nullable" (really "Nothingable") Types](https://discourse.julialang.org/t/nullable-really-nothingable-types/55894)

<div class="topic-metadata">

**Author:** [@astrobc1](https://discourse.julialang.org/u/astrobc1)\
**Replies:** 3\
**Last updated:** [February 23, 2021, 11:27pm UTC](https://discourse.julialang.org/t/nullable-really-nothingable-types/55894 "2021-02-23T23:27:57Z")

</div>

I’m curious if there’s a proper Julian way to implement optional struct fields through an effective Union{T, Nothing}. I’ve written the macro below and it seems to work for my very simple test case. Is there a better wa…

---

## [Help with filling dataframe](https://discourse.julialang.org/t/help-with-filling-dataframe/55839)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 9\
**Last updated:** [February 23, 2021, 10:39pm UTC](https://discourse.julialang.org/t/help-with-filling-dataframe/55839 "2021-02-23T22:39:31Z")

</div>

I’m having trouble with the code to fill a dataframe with some strings say the strings are defined as data = \["a\\tb","c\\td","e\\tf"\] a dataframe is preallocated as df = DataFrame(\[String, String\],\[:X,:Y\],3) I’m tryin…

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

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