# General Usage

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

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

**Page:** 432

---

## [Should we control/optimize communications in Julia?](https://discourse.julialang.org/t/should-we-control-optimize-communications-in-julia/83231)

<div class="topic-metadata">

**Author:** [@EdTi](https://discourse.julialang.org/u/EdTi)\
**Replies:** 6\
**Last updated:** [June 24, 2022, 4:34pm UTC](https://discourse.julialang.org/t/should-we-control-optimize-communications-in-julia/83231 "2022-06-24T16:34:01Z")

</div>

Hi everyone, This is an edit of a previous question, as I sense that I wasn’t clear enough. I’m taking examples from the distributed computing documentation version 1.7.3 : Multi-processing and Distributed Computing · T…

---

## [Efficient way to split string at specific index](https://discourse.julialang.org/t/efficient-way-to-split-string-at-specific-index/83115)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 19\
**Last updated:** [June 24, 2022, 3:02pm UTC](https://discourse.julialang.org/t/efficient-way-to-split-string-at-specific-index/83115 "2022-06-24T15:02:57Z")

</div>

I’m currently trying to parse a file whose data lines are composed of 8 character columns without delimiter. Such as \<.. 1..\>\<.. 2..\>\<.. 3..\>\<.. 4..\>\<.. 5..\>\<.. 6..\>\<.. 7..\>\<.. 8..\>\<.. 9..\>\<..10..\> 111111112222222233333…

---

## [What does passing a vector as \`dims\` to \`Statistics.std\` mean?](https://discourse.julialang.org/t/what-does-passing-a-vector-as-dims-to-statistics-std-mean/83295)

<div class="topic-metadata">

**Author:** [@Saransh-cpp](https://discourse.julialang.org/u/Saransh-cpp)\
**Replies:** 3\
**Last updated:** [June 24, 2022, 1:17pm UTC](https://discourse.julialang.org/t/what-does-passing-a-vector-as-dims-to-statistics-std-mean/83295 "2022-06-24T13:17:16Z")

</div>

I have been trying to use the std function on a batch of images. For instance, this is a batch of 2 images having 3 channels each - xs = rand(3, 3, 3, 2) I want to find the standard deviation of the first image which c…

---

## [Parsing Float64 as Float64](https://discourse.julialang.org/t/parsing-float64-as-float64/83301)

<div class="topic-metadata">

**Author:** [@ccookeopen](https://discourse.julialang.org/u/ccookeopen)\
**Replies:** 3\
**Last updated:** [June 24, 2022, 11:59am UTC](https://discourse.julialang.org/t/parsing-float64-as-float64/83301 "2022-06-24T11:59:13Z")

</div>

Hi, Reading data from various excel files, sometimes it is correctly formatted as a Float, sometimes it is interpreted as a string. If I account for the second case, I must use parse(Float64, input). Using this code in…

---

## [How to reshape wide to long?](https://discourse.julialang.org/t/how-to-reshape-wide-to-long/83284)

<div class="topic-metadata">

**Author:** [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Replies:** 13\
**Last updated:** [June 24, 2022, 10:48am UTC](https://discourse.julialang.org/t/how-to-reshape-wide-to-long/83284 "2022-06-24T10:48:42Z")

</div>

Dear all, I want to reshape the wide data to panel data, here is an example. julia\> df = DataFrame(id = \[1, 2, 3\], gdp1999 = \[2, 3, 4\], gdp2000 = \[3, 4, 5\], gdp2001 = \[6, 7, 8\], emp1999 = \[3, 2, 1…

---

## [Eigenvector for small non-Hermitian matrices](https://discourse.julialang.org/t/eigenvector-for-small-non-hermitian-matrices/83204)

<div class="topic-metadata">

**Author:** [@itzui](https://discourse.julialang.org/u/itzui)\
**Replies:** 6\
**Last updated:** [June 24, 2022, 10:05am UTC](https://discourse.julialang.org/t/eigenvector-for-small-non-hermitian-matrices/83204 "2022-06-24T10:05:53Z")

</div>

I have to calculate the eigenvector and eigenvalues for many (more than 60.000) non-Hermitian 4x4 matrices. I know that this can be slightly speed up by means of using LinearAlgebra.LAPACK.geevx! instead of using the eig…

---

## [Change values to missing in a column](https://discourse.julialang.org/t/change-values-to-missing-in-a-column/82858)

<div class="topic-metadata">

**Author:** [@Billpete002](https://discourse.julialang.org/u/Billpete002)\
**Replies:** 9\
**Last updated:** [June 24, 2022, 9:12am UTC](https://discourse.julialang.org/t/change-values-to-missing-in-a-column/82858 "2022-06-24T09:12:16Z")

</div>

So I have been trying to wrap my head around how to set a value to missing with an IF ELSE statement… It seems like this should be an easy way to do it: df= @chain df begin @transform :x= begin if :x != 0 …

---

## [MathTexEngine Warning](https://discourse.julialang.org/t/mathtexengine-warning/83286)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 1\
**Last updated:** [June 24, 2022, 8:30am UTC](https://discourse.julialang.org/t/mathtexengine-warning/83286 "2022-06-24T08:30:20Z")

</div>

I am developing a package for my own research and started getting this weird warning when it pre-compiles. I’m not sure what is causing it or how to fix it. For reference, I have TexLive 2020 installed on my system. The…

---

## [Are these criticisms of Julia true?](https://discourse.julialang.org/t/are-these-criticisms-of-julia-true/83291)

<div class="topic-metadata">

**Author:** [@tatsumaru](https://discourse.julialang.org/u/tatsumaru)\
**Replies:** 3\
**Last updated:** [June 24, 2022, 7:35am UTC](https://discourse.julialang.org/t/are-these-criticisms-of-julia-true/83291 "2022-06-24T07:35:12Z")

</div>

I found this Reddit thread about someone asking if it’s still worth learning Julia in 2022 and some person listed a few items that he considered deal breakers when it came to Julia that I wanted to get a second opinion o…

---

## [Why is generating a list of posts in Franklin.jl so cumbersome?](https://discourse.julialang.org/t/why-is-generating-a-list-of-posts-in-franklin-jl-so-cumbersome/83260)

<div class="topic-metadata">

**Author:** [@philip](https://discourse.julialang.org/u/philip)\
**Replies:** 3\
**Last updated:** [June 24, 2022, 6:51am UTC](https://discourse.julialang.org/t/why-is-generating-a-list-of-posts-in-franklin-jl-so-cumbersome/83260 "2022-06-24T06:51:34Z")

</div>

I’ve been using Jekyll and love Julia, so thought I’d give Franklin.jl a try. But comparing the solution in Franklin.jl for generating a list of posts: to the solution in Jekyll: {% for post in site.posts %} \<li\> …

---

## [Type stability while looping over Tuple](https://discourse.julialang.org/t/type-stability-while-looping-over-tuple/83272)

<div class="topic-metadata">

**Author:** [@NicolasW](https://discourse.julialang.org/u/NicolasW)\
**Replies:** 6\
**Last updated:** [June 24, 2022, 12:41am UTC](https://discourse.julialang.org/t/type-stability-while-looping-over-tuple/83272 "2022-06-24T00:41:59Z")

</div>

In the performance critical part of our code we encountered a type instability. Is there an easy way to resolve this? We have some input struct Sinput{X,D} input::X end s\_input = Sinput{Tuple{Float64,Int64}, 2}((1.3,4…

---

## [Julia vs. Python: Euler's sum of powers conjecture](https://discourse.julialang.org/t/julia-vs-python-eulers-sum-of-powers-conjecture/83262)

<div class="topic-metadata">

**Author:** [@jgforbes](https://discourse.julialang.org/u/jgforbes)\
**Replies:** 16\
**Last updated:** [June 24, 2022, 12:13am UTC](https://discourse.julialang.org/t/julia-vs-python-eulers-sum-of-powers-conjecture/83262 "2022-06-24T00:13:50Z")

</div>

The Julia code on this page is much slower than the Python examples. Euler’s sum of powers conjecture with code examples I wrote a Julia program similar to the fastest Python example: Julia function main() MAX = 25…

---

## [How to impose condition on n-tuple?](https://discourse.julialang.org/t/how-to-impose-condition-on-n-tuple/82882)

<div class="topic-metadata">

**Author:** [@Kevin\_12](https://discourse.julialang.org/u/Kevin_12)\
**Replies:** 9\
**Last updated:** [June 23, 2022, 7:51pm UTC](https://discourse.julialang.org/t/how-to-impose-condition-on-n-tuple/82882 "2022-06-23T19:51:05Z")

</div>

Is it possible to place some condition over the ements of Vector of Tuples to creat another Vector of Tuples? For example, I have buch of tuples demonstraing some properties of devices (property1, property2, deice\_I…

---

## [Reading Python datastructure (from text file) in Julia](https://discourse.julialang.org/t/reading-python-datastructure-from-text-file-in-julia/83261)

<div class="topic-metadata">

**Author:** [@gvdeynde](https://discourse.julialang.org/u/gvdeynde)\
**Replies:** 3\
**Last updated:** [June 23, 2022, 6:54pm UTC](https://discourse.julialang.org/t/reading-python-datastructure-from-text-file-in-julia/83261 "2022-06-23T18:54:29Z")

</div>

Hi I have a file with a nested data structure, coming from a Python tool, that I would like to read in Julia. It’s basically a list with each item of the list being a dict which in its turn contains key/value-pairs of a…

---

## [Ylabel location in stacked subplots](https://discourse.julialang.org/t/ylabel-location-in-stacked-subplots/83245)

<div class="topic-metadata">

**Author:** [@usman0311](https://discourse.julialang.org/u/usman0311)\
**Replies:** 0\
**Last updated:** [June 23, 2022, 2:22pm UTC](https://discourse.julialang.org/t/ylabel-location-in-stacked-subplots/83245 "2022-06-23T14:22:44Z")

</div>

How to place ylabel (“Intensity”) at the center of the stacked subplot. pyplot(grid=:false, frame=:box) x=LinRange(-π,π,1000) p1=plot(x,10\*sin.(10\*x), xticks=:false,yticks=:false,ylabel="Intensity") p2=plot(x,exp.(x)…

---

## [Plot crash - not enviroment related](https://discourse.julialang.org/t/plot-crash-not-enviroment-related/82976)

<div class="topic-metadata">

**Author:** [@GiRallis](https://discourse.julialang.org/u/GiRallis)\
**Replies:** 2\
**Last updated:** [June 23, 2022, 1:59pm UTC](https://discourse.julialang.org/t/plot-crash-not-enviroment-related/82976 "2022-06-23T13:59:10Z")

</div>

I have downloaded Julia run everything and it works ok except for one thing. Tthe Plots, which I can download and can run the command using Plots. But when I run a plot(x,y) command afterwards it just runs forever and so…

---

## [Wrap conditional selection of dataframe into function](https://discourse.julialang.org/t/wrap-conditional-selection-of-dataframe-into-function/83235)

<div class="topic-metadata">

**Author:** [@daharn](https://discourse.julialang.org/u/daharn)\
**Replies:** 4\
**Last updated:** [June 23, 2022, 12:39pm UTC](https://discourse.julialang.org/t/wrap-conditional-selection-of-dataframe-into-function/83235 "2022-06-23T12:39:07Z")

</div>

If I have a DataFrame object with several columns, I can create a subset of this by selecting rows based on conditions either by indexing, subset/@subset or filter. Is there a way I can wrap a function around this sort o…

---

## [Solving Sparse Linear Systems fast](https://discourse.julialang.org/t/solving-sparse-linear-systems-fast/83071)

<div class="topic-metadata">

**Author:** [@pushkar\_khandare](https://discourse.julialang.org/u/pushkar_khandare)\
**Replies:** 11\
**Last updated:** [June 23, 2022, 11:22am UTC](https://discourse.julialang.org/t/solving-sparse-linear-systems-fast/83071 "2022-06-23T11:22:30Z")

</div>

I want to solve Ax = b where A is a sparse matrix of size 10^5 x 10^5 (around 18 non-zero entries per row), x and b are vectors. A is constant throughout my simulation, while b changes at every step in my loop, and I hav…

---

## [Efficiently resample a large vector?](https://discourse.julialang.org/t/efficiently-resample-a-large-vector/83177)

<div class="topic-metadata">

**Author:** [@JedPhillips](https://discourse.julialang.org/u/JedPhillips)\
**Replies:** 5\
**Last updated:** [June 23, 2022, 10:52am UTC](https://discourse.julialang.org/t/efficiently-resample-a-large-vector/83177 "2022-06-23T10:52:19Z")

</div>

I’m doing some simulations and need to efficiently sample a set of items, and then subset/filter a large vector (1\>million entries) whose elements are contained in the sampled items. Here’s some minimal code. Random.see…

---

## [Immutable struct with an Array slower than a constant global Array](https://discourse.julialang.org/t/immutable-struct-with-an-array-slower-than-a-constant-global-array/83145)

<div class="topic-metadata">

**Author:** [@bchaber](https://discourse.julialang.org/u/bchaber)\
**Replies:** 14\
**Last updated:** [June 23, 2022, 8:26am UTC](https://discourse.julialang.org/t/immutable-struct-with-an-array-slower-than-a-constant-global-array/83145 "2022-06-23T08:26:24Z")

</div>

Hello, I’m trying to write a Lattice Boltzmann Solver in Julia. My initial version strongly relies on global constants (mostly numeric values and Arrays). I’ve tried to use immutable structures that hold the state of my…

---

## [Inference bug when using nested generators?](https://discourse.julialang.org/t/inference-bug-when-using-nested-generators/82991)

<div class="topic-metadata">

**Author:** [@jonathan-laurent](https://discourse.julialang.org/u/jonathan-laurent)\
**Replies:** 21\
**Last updated:** [June 23, 2022, 6:44am UTC](https://discourse.julialang.org/t/inference-bug-when-using-nested-generators/82991 "2022-06-23T06:44:02Z")

</div>

The following code does not infer: f(n) = (i^2 for i in 1:n) g(n) = sum(x^2 for x in f(n)) @code\_warntype g(3) Output: MethodInstance for g(::Int64) from g(n) in Main at /home/jonathan/AlphaZero.jl/redesign/private/…

---

## [GPU Array indexing failed when using Transformers.Basic](https://discourse.julialang.org/t/gpu-array-indexing-failed-when-using-transformers-basic/83222)

<div class="topic-metadata">

**Author:** [@Molox](https://discourse.julialang.org/u/Molox)\
**Replies:** 0\
**Last updated:** [June 23, 2022, 4:51am UTC](https://discourse.julialang.org/t/gpu-array-indexing-failed-when-using-transformers-basic/83222 "2022-06-23T04:51:07Z")

</div>

I was doing indexing on a GPU array using GPU index, and everything works fine, but once I import Transformers package and run it again, it gives me an error. using CUDA x = CuArray(1:3) list = CuArray(1:10) list\[ x …

---

## [Can PackageCompiler.jl compile just parts of packages?](https://discourse.julialang.org/t/can-packagecompiler-jl-compile-just-parts-of-packages/64000)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 7\
**Last updated:** [June 23, 2022, 3:07am UTC](https://discourse.julialang.org/t/can-packagecompiler-jl-compile-just-parts-of-packages/64000 "2022-06-23T03:07:36Z")

</div>

I’m developing a package, and it takes quite a while to compile (~30s), which is long enough to be annoying when trying to test/bugfix/retest. PackageCompiler.jl is awesome and can get rid of the compilation overhead (by…

---

## [Mac/cross-platform screen capture](https://discourse.julialang.org/t/mac-cross-platform-screen-capture/83214)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 2\
**Last updated:** [June 23, 2022, 2:45am UTC](https://discourse.julialang.org/t/mac-cross-platform-screen-capture/83214 "2022-06-23T02:45:28Z")

</div>

For Windows, we have the beautiful ImageMagick.load("screenshot:") For Linux, we have another less elegant solution with ImageMagick For Mac or cross-platform, how can we take a screenshot programmatically? Ideally a J…

---

## [Code organization for running on a cluster](https://discourse.julialang.org/t/code-organization-for-running-on-a-cluster/83215)

<div class="topic-metadata">

**Author:** [@amrods](https://discourse.julialang.org/u/amrods)\
**Replies:** 0\
**Last updated:** [June 23, 2022, 12:37am UTC](https://discourse.julialang.org/t/code-organization-for-running-on-a-cluster/83215 "2022-06-23T00:37:51Z")

</div>

I’d like to get some input on how to organize my code to run on a computer cluster. I have programmed the computation I want to perform on a file main.jl. The contents of main.jl would be something like this: #! main.jl…

---

## [2d finite differences implementation for a Numerical Analysis lecture](https://discourse.julialang.org/t/2d-finite-differences-implementation-for-a-numerical-analysis-lecture/70222)

<div class="topic-metadata">

**Author:** [@vicdolean](https://discourse.julialang.org/u/vicdolean)\
**Replies:** 4\
**Last updated:** [June 23, 2022, 12:22am UTC](https://discourse.julialang.org/t/2d-finite-differences-implementation-for-a-numerical-analysis-lecture/70222 "2022-06-23T00:22:31Z")

</div>

Hi! I’m new to Julia world and would need some help in the transition from Matlab. I am teaching a numerical analysis class where I use finite differences on a two dimensional (cartesian but not necessarily square) doma…

---

## [Radial Basis Finite Difference](https://discourse.julialang.org/t/radial-basis-finite-difference/66379)

<div class="topic-metadata">

**Author:** [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Replies:** 2\
**Last updated:** [June 22, 2022, 11:21pm UTC](https://discourse.julialang.org/t/radial-basis-finite-difference/66379 "2022-06-22T23:21:34Z")

</div>

Hello People I was trying to simulate heat equation using Julia by the method of finite difference. I would like to simulate for Radial Basis Finite Difference method also. Please help me to find the code for it my c…

---

## [Iterator powers?](https://discourse.julialang.org/t/iterator-powers/83060)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 5\
**Last updated:** [June 22, 2022, 11:17pm UTC](https://discourse.julialang.org/t/iterator-powers/83060 "2022-06-22T23:17:52Z")

</div>

How to get something like (0:7)^4, but for a custom iterator, and for an arbitrary positive integer exponent? The result should be similar to Iterators.product(0:7, 0:7, 0:7, 0:7), but type stable.

---

## [How to define a function that accepts a vector when all elements are \<: S even if the vector is defined as Vector{T} with S \<: T](https://discourse.julialang.org/t/how-to-define-a-function-that-accepts-a-vector-when-all-elements-are-s-even-if-the-vector-is-defined-as-vector-t-with-s-t/83182)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 5\
**Last updated:** [June 22, 2022, 8:24pm UTC](https://discourse.julialang.org/t/how-to-define-a-function-that-accepts-a-vector-when-all-elements-are-s-even-if-the-vector-is-defined-as-vector-t-with-s-t/83182 "2022-06-22T20:24:21Z")

</div>

I have a situation where I want to remain general on the type of a specific container (AbstractAbstractFoo), as in the future I may develop other types (say AbstractFoo2 in the example below), but I have a concrete appli…

---

## [Error caused by Sending Vector{Int64} to Vector{Integer} type function](https://discourse.julialang.org/t/error-caused-by-sending-vector-int64-to-vector-integer-type-function/83194)

<div class="topic-metadata">

**Author:** [@Jack\_N](https://discourse.julialang.org/u/Jack_N)\
**Replies:** 2\
**Last updated:** [June 22, 2022, 7:17pm UTC](https://discourse.julialang.org/t/error-caused-by-sending-vector-int64-to-vector-integer-type-function/83194 "2022-06-22T19:17:33Z")

</div>

I know that if I had some function function a(b::Integer) then I can call a using parameters of any sub-type of Integer, so Int64 or Int32, for example. I am wondering if there is any way to do the same thing with vec…

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

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