# General Usage

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

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

**Page:** 523

---

## [How to generate/create a new file in the same folder of a function?](https://discourse.julialang.org/t/how-to-generate-create-a-new-file-in-the-same-folder-of-a-function/71217)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 2\
**Last updated:** [November 9, 2021, 7:41pm UTC](https://discourse.julialang.org/t/how-to-generate-create-a-new-file-in-the-same-folder-of-a-function/71217 "2021-11-09T19:41:26Z")

</div>

I know that the below code will create record.txt it in the default directory of julia. io = open("record.txt", "w") close(io) However, I have a function called Myfile (in which I will share it with others). So, I need…

---

## [Parallel computing on M1 Max?](https://discourse.julialang.org/t/parallel-computing-on-m1-max/70343)

<div class="topic-metadata">

**Author:** [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Replies:** 6\
**Last updated:** [November 9, 2021, 6:22pm UTC](https://discourse.julialang.org/t/parallel-computing-on-m1-max/70343 "2021-11-09T18:22:22Z")

</div>

With the release of 2021 macbook pro with M1 Pro/Max, I’m wondering if there is a good API/Libs for doing parallel computing on that chip? From the reviews, the computational power of that device is insane, sometimes on…

---

## [How to unfold plots](https://discourse.julialang.org/t/how-to-unfold-plots/71196)

<div class="topic-metadata">

**Author:** [@corny85](https://discourse.julialang.org/u/corny85)\
**Replies:** 6\
**Last updated:** [November 9, 2021, 4:24pm UTC](https://discourse.julialang.org/t/how-to-unfold-plots/71196 "2021-11-09T16:24:55Z")

</div>

Hello, I want to unfold a vector of plots but i don’t know how to do it. using Plots p = \[plot(a\[i\]\[1:end,2\],a\[i\]\[1:end,1\]) for i =1:5\] plot(p) It doesn’t work. Thanks for your help

---

## [Why using JLD2 leads to LoadError: too many parameters for type in VS code?](https://discourse.julialang.org/t/why-using-jld2-leads-to-loaderror-too-many-parameters-for-type-in-vs-code/71169)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 4\
**Last updated:** [November 9, 2021, 2:43pm UTC](https://discourse.julialang.org/t/why-using-jld2-leads-to-loaderror-too-many-parameters-for-type-in-vs-code/71169 "2021-11-09T14:43:26Z")

</div>

@simonster @lhupe @staticfloat @ararslan @tim.holy @giordano @jeff.bezanson @gdkrmr @JonasIsensee I am working on VS code with julia v1.4.3 extension. When I call the using JLD2, I have the bellow error. However…

---

## [Reducing allocations when subtracting vectors and multiplying by scalars](https://discourse.julialang.org/t/reducing-allocations-when-subtracting-vectors-and-multiplying-by-scalars/71203)

<div class="topic-metadata">

**Author:** [@jewh](https://discourse.julialang.org/u/jewh)\
**Replies:** 9\
**Last updated:** [November 9, 2021, 1:32pm UTC](https://discourse.julialang.org/t/reducing-allocations-when-subtracting-vectors-and-multiplying-by-scalars/71203 "2021-11-09T13:32:34Z")

</div>

Is it possible to re-write the following function foo(x, y), such that it only uses one allocation? using BenchmarkTools function foo(x::Vector{Float64}, y::Vector{Float64}) (x .- y) .\* 3.0 end This currently yie…

---

## [Unitful and automatic differentiation?](https://discourse.julialang.org/t/unitful-and-automatic-differentiation/71145)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 18\
**Last updated:** [November 9, 2021, 11:41am UTC](https://discourse.julialang.org/t/unitful-and-automatic-differentiation/71145 "2021-11-09T11:41:55Z")

</div>

Automatic differentiation (at least with ForwarDiff) does not support Unitful quantitites: julia\> using Unitful, ForwardDiff julia\> f(x) = x^2 f (generic function with 1 method) julia\> x = 2.0u"nm" 2.0 nm julia\> Forw…

---

## [\[cluster\] Understanding parallel performance. Is GC triggered too early?](https://discourse.julialang.org/t/cluster-understanding-parallel-performance-is-gc-triggered-too-early/71197)

<div class="topic-metadata">

**Author:** [@carlo](https://discourse.julialang.org/u/carlo)\
**Replies:** 0\
**Last updated:** [November 9, 2021, 9:42am UTC](https://discourse.julialang.org/t/cluster-understanding-parallel-performance-is-gc-triggered-too-early/71197 "2021-11-09T09:42:15Z")

</div>

Good morning, everyone! After weeks of lurking in the forum to fix other of my problems (thanks, it’s a precious resource) I decided to go on and ask my own particular question. I am facing the following problem: I am …

---

## [I want to replicate with Named Tuples what I do with Dictionaries but I can't](https://discourse.julialang.org/t/i-want-to-replicate-with-named-tuples-what-i-do-with-dictionaries-but-i-cant/70522)

<div class="topic-metadata">

**Author:** [@Soldalma](https://discourse.julialang.org/u/Soldalma)\
**Replies:** 9\
**Last updated:** [November 9, 2021, 7:51am UTC](https://discourse.julialang.org/t/i-want-to-replicate-with-named-tuples-what-i-do-with-dictionaries-but-i-cant/70522 "2021-11-09T07:51:48Z")

</div>

I wrote some code that fills an array of dictionaries step by step. I did not use Int64 for the values because in “real life” I do not know the types of the values in advance. my\_dicts = \[Dict{String,Any}() for \_ in 1…

---

## [Fastest possible trilinear interpolation with \`Interpolations.jl\`](https://discourse.julialang.org/t/fastest-possible-trilinear-interpolation-with-interpolations-jl/71184)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 1\
**Last updated:** [November 9, 2021, 7:47am UTC](https://discourse.julialang.org/t/fastest-possible-trilinear-interpolation-with-interpolations-jl/71184 "2021-11-09T07:47:40Z")

</div>

I am working on developing a machine learning application in which two instances of our CFD code work simultaneously at different resolutions and data is passed between the two instances. For this, I need to have fastest…

---

## [\`@everywhere begin ... end\` errors when loading packages (but only once)](https://discourse.julialang.org/t/everywhere-begin-end-errors-when-loading-packages-but-only-once/64774)

<div class="topic-metadata">

**Author:** [@StevenWhitaker](https://discourse.julialang.org/u/StevenWhitaker)\
**Replies:** 5\
**Last updated:** [November 8, 2021, 11:25pm UTC](https://discourse.julialang.org/t/everywhere-begin-end-errors-when-loading-packages-but-only-once/64774 "2021-11-08T23:25:38Z")

</div>

Consider a directory that contains only the following two files. # one.jl using Distributed addprocs(4 - nprocs() + 1) @everywhere begin using Pkg Pkg.activate(".") using MAT end println("done") # two.jl …

---

## [LoadError: UndefVarError: @variables not defined](https://discourse.julialang.org/t/loaderror-undefvarerror-variables-not-defined/71170)

<div class="topic-metadata">

**Author:** [@GoH](https://discourse.julialang.org/u/GoH)\
**Replies:** 2\
**Last updated:** [November 8, 2021, 9:24pm UTC](https://discourse.julialang.org/t/loaderror-undefvarerror-variables-not-defined/71170 "2021-11-08T21:24:08Z")

</div>

I got the error ‘LoadError: UndefVarError: @variables not defined’ while testing the code provided by ModelingToolkits webpage Solving Nonlinear Systems with NLsolve · ModelingToolkit.jl Here is the code: begin using …

---

## [How to choose a file by open\_dialog prompt?](https://discourse.julialang.org/t/how-to-choose-a-file-by-open-dialog-prompt/71157)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 9\
**Last updated:** [November 8, 2021, 8:27pm UTC](https://discourse.julialang.org/t/how-to-choose-a-file-by-open-dialog-prompt/71157 "2021-11-08T20:27:23Z")

</div>

I am trying to select a file by using open\_dialog() instead of defining the path of the file. However, after the prompt window is opened and I navigate to the file, I cannot really select it and the prompt window is not …

---

## [How to add unicode special character in Julia](https://discourse.julialang.org/t/how-to-add-unicode-special-character-in-julia/71023)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 17\
**Last updated:** [November 8, 2021, 5:37pm UTC](https://discourse.julialang.org/t/how-to-add-unicode-special-character-in-julia/71023 "2021-11-08T17:37:44Z")

</div>

I’m able to find this list: Unicode Input · The Julia Language. In Matlab, if I want to draw something in a figure like “μmol”, all you need to do is to code it this way: “\\mumol”. I tried to do the same thing in Julia…

---

## [Excessive memory consumption when using powermod() with BigInt](https://discourse.julialang.org/t/excessive-memory-consumption-when-using-powermod-with-bigint/71163)

<div class="topic-metadata">

**Author:** [@rbngz](https://discourse.julialang.org/u/rbngz)\
**Replies:** 2\
**Last updated:** [November 8, 2021, 5:24pm UTC](https://discourse.julialang.org/t/excessive-memory-consumption-when-using-powermod-with-bigint/71163 "2021-11-08T17:24:15Z")

</div>

I want to brute force an 64-bit RSA encrypted text using a meet-in-the-middle attack (This is for university, nothing malicious). To do this, I essentially created a Julia vector with 2^34 BigInt values and broadcasted …

---

## [Why does 'map' recompile each time?](https://discourse.julialang.org/t/why-does-map-recompile-each-time/71149)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 4\
**Last updated:** [November 8, 2021, 4:10pm UTC](https://discourse.julialang.org/t/why-does-map-recompile-each-time/71149 "2021-11-08T16:10:44Z")

</div>

Consider the follosing example: y = \[1 2 3\] @time findall(map( x-\> x.== 3, y)) 0.077566 seconds (69.12 k allocations: 4.160 MiB, 13.08% gc time, 99.57% compilation time) 1-element Vector{CartesianIndex{2}}: CartesianI…

---

## [Type-instability in DifferentialEquations.jl](https://discourse.julialang.org/t/type-instability-in-differentialequations-jl/71141)

<div class="topic-metadata">

**Author:** [@Elyco](https://discourse.julialang.org/u/Elyco)\
**Replies:** 3\
**Last updated:** [November 8, 2021, 1:54pm UTC](https://discourse.julialang.org/t/type-instability-in-differentialequations-jl/71141 "2021-11-08T13:54:41Z")

</div>

Hi everyone, I’m trying to solve ODE many times each with different initial conditions, and I would like to optimize my code for that. I’ve tried to save in a (mutable) struct the solver in order to save time and the ne…

---

## [Reference source files is docs using Documenter](https://discourse.julialang.org/t/reference-source-files-is-docs-using-documenter/71148)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 0\
**Last updated:** [November 8, 2021, 1:13pm UTC](https://discourse.julialang.org/t/reference-source-files-is-docs-using-documenter/71148 "2021-11-08T13:13:01Z")

</div>

In some docs of a package, I want to point to some files in the github repository (some example files). Currently, I’m using something: The complete example file is available !\[here\](https://github.com/m3g/CellListMap.…

---

## [How to Find the maximum eigenvalue of the matrix](https://discourse.julialang.org/t/how-to-find-the-maximum-eigenvalue-of-the-matrix/71147)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 1\
**Last updated:** [November 8, 2021, 1:06pm UTC](https://discourse.julialang.org/t/how-to-find-the-maximum-eigenvalue-of-the-matrix/71147 "2021-11-08T13:06:15Z")

</div>

The eigen () function is going to compute all the eigen values of the matrix, and that takes a long time, so I just want the biggest eigen value ,so how to do that?

---

## [Trying to use @eval to overwrite method defined by another package](https://discourse.julialang.org/t/trying-to-use-eval-to-overwrite-method-defined-by-another-package/71022)

<div class="topic-metadata">

**Author:** [@Bruno\_Amorim](https://discourse.julialang.org/u/Bruno_Amorim)\
**Replies:** 4\
**Last updated:** [November 8, 2021, 12:05pm UTC](https://discourse.julialang.org/t/trying-to-use-eval-to-overwrite-method-defined-by-another-package/71022 "2021-11-08T12:05:50Z")

</div>

I am trying to devellop a package that takes advantage of the multithreading provided by Polyester.jl to multithread sparse matrix - vec multiplication for matrices in the CSR format, as defined in the package SparseMatr…

---

## [Issue with PDMP and Forwardiff - DifferentialEquation](https://discourse.julialang.org/t/issue-with-pdmp-and-forwardiff-differentialequation/17925)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 25\
**Last updated:** [November 8, 2021, 11:08am UTC](https://discourse.julialang.org/t/issue-with-pdmp-and-forwardiff-differentialequation/17925 "2021-11-08T11:08:57Z")

</div>

Hi, I repost here an issue posted in DifferentialEquations because I am not sure this issue concerns them entirely. In the following example, Forwardiff which is called from Rosenbrock23() fails. I spent quite some tim…

---

## [Converting XLSX to DataFrame](https://discourse.julialang.org/t/converting-xlsx-to-dataframe/71142)

<div class="topic-metadata">

**Author:** [@jnewbie](https://discourse.julialang.org/u/jnewbie)\
**Replies:** 2\
**Last updated:** [November 8, 2021, 10:27am UTC](https://discourse.julialang.org/t/converting-xlsx-to-dataframe/71142 "2021-11-08T10:27:37Z")

</div>

Hello everyone, I am trying to read an xlsx file in julia : Materials = XLSX.readtable("MatData.xlsx","Sheet1"; header = true) In order to be able to make changes/calculations on it I want to convert it into a DataFra…

---

## [Test.jl and \`@testset\` are saving my package, but why? (and how make it work without them)](https://discourse.julialang.org/t/test-jl-and-testset-are-saving-my-package-but-why-and-how-make-it-work-without-them/71136)

<div class="topic-metadata">

**Author:** [@Azzaare](https://discourse.julialang.org/u/Azzaare)\
**Replies:** 0\
**Last updated:** [November 8, 2021, 9:24am UTC](https://discourse.julialang.org/t/test-jl-and-testset-are-saving-my-package-but-why-and-how-make-it-work-without-them/71136 "2021-11-08T09:24:41Z")

</div>

Hi there! Test.jl and @testset are saving my package in a funny way (and I don’t understand why yet). I am making a semi-automated performance checking package PerfChecker.jl I use a method in the package with one of i…

---

## [Sample rows of a 3 dimensional array without replacement](https://discourse.julialang.org/t/sample-rows-of-a-3-dimensional-array-without-replacement/71116)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 7\
**Last updated:** [November 8, 2021, 8:54am UTC](https://discourse.julialang.org/t/sample-rows-of-a-3-dimensional-array-without-replacement/71116 "2021-11-08T08:54:09Z")

</div>

I would like to sample rows from a three dimensional array without replacement. For example, if I have x = rand(10, 5, 3) a random set of indices might look like {(2,2), (9,3)}, where the first position is the index of…

---

## [Plotting Atomic Orbitals with Makie](https://discourse.julialang.org/t/plotting-atomic-orbitals-with-makie/71032)

<div class="topic-metadata">

**Author:** [@Aroeira](https://discourse.julialang.org/u/Aroeira)\
**Replies:** 4\
**Last updated:** [November 8, 2021, 12:09am UTC](https://discourse.julialang.org/t/plotting-atomic-orbitals-with-makie/71032 "2021-11-08T00:09:03Z")

</div>

Hello, I am trying to write a function to produce an interactive plot for Atomic Orbitals using Makie.jl. The ultimate goal is to plot molecular orbitals, but if I can do atomic ones the extension must be trivial. Firs…

---

## [Why does Julia have around 200MB of memory overhead, even for small programs?](https://discourse.julialang.org/t/why-does-julia-have-around-200mb-of-memory-overhead-even-for-small-programs/71071)

<div class="topic-metadata">

**Author:** [@akriegman](https://discourse.julialang.org/u/akriegman)\
**Replies:** 5\
**Last updated:** [November 7, 2021, 9:03pm UTC](https://discourse.julialang.org/t/why-does-julia-have-around-200mb-of-memory-overhead-even-for-small-programs/71071 "2021-11-07T21:03:49Z")

</div>

I was looking at Julia’s performance in the Computer Language Benchmarks Game. Julia does pretty well in terms of speed, but I was noticing that Julia has a memory footprint of around 200MB for every benchmark, even ones…

---

## [How to "transpose" a vector of vectors?](https://discourse.julialang.org/t/how-to-transpose-a-vector-of-vectors/71085)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 7\
**Last updated:** [November 7, 2021, 8:08pm UTC](https://discourse.julialang.org/t/how-to-transpose-a-vector-of-vectors/71085 "2021-11-07T20:08:12Z")

</div>

I have a vector V1 of length m where each element is a vector of length n. How do I “transpose” that into a vector V2 of length n where each element is a vector of length m and V2\[i\]\[j\] == V1\[j\]\[i\]? As an example: V1 …

---

## [Multiplying boolean matrices](https://discourse.julialang.org/t/multiplying-boolean-matrices/71086)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 4\
**Last updated:** [November 7, 2021, 6:54pm UTC](https://discourse.julialang.org/t/multiplying-boolean-matrices/71086 "2021-11-07T18:54:29Z")

</div>

Why is there such a performance difference between multiplying float matrices and other kinds of matrices? I understand float matrices hit BLAS which is heavily optimized. But is this a fundamental difference or or just …

---

## [\[pkg test\] Error on explicit mention of tested package in Project.toml](https://discourse.julialang.org/t/pkg-test-error-on-explicit-mention-of-tested-package-in-project-toml/41125)

<div class="topic-metadata">

**Author:** [@ksamtsak](https://discourse.julialang.org/u/ksamtsak)\
**Replies:** 4\
**Last updated:** [November 7, 2021, 7:29pm UTC](https://discourse.julialang.org/t/pkg-test-error-on-explicit-mention-of-tested-package-in-project-toml/41125 "2021-11-07T19:29:34Z")

</div>

I’m describing my test-specific dependencies (julia 1.4) in test/Project.toml according to the docs. It’s also mentioned in the docs that: Pkg will add the tested package itself implictly I’d like however to be able …

---

## [Benchmark function that uses CUDA.jl](https://discourse.julialang.org/t/benchmark-function-that-uses-cuda-jl/71093)

<div class="topic-metadata">

**Author:** [@UndefinedBehavior](https://discourse.julialang.org/u/UndefinedBehavior)\
**Replies:** 2\
**Last updated:** [November 7, 2021, 5:34pm UTC](https://discourse.julialang.org/t/benchmark-function-that-uses-cuda-jl/71093 "2021-11-07T17:34:56Z")

</div>

Hello all, I have created a function that computes the eigenvalues of large sparse matrices. I have implemented it both on CPU and GPU. I used CUDA.jl for portions of code that were computationally expensive. Now, I wan…

---

## [Convert iterator (of tuples) to vector](https://discourse.julialang.org/t/convert-iterator-of-tuples-to-vector/71088)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 5\
**Last updated:** [November 7, 2021, 12:44pm UTC](https://discourse.julialang.org/t/convert-iterator-of-tuples-to-vector/71088 "2021-11-07T12:44:33Z")

</div>

I have an iterator, and I wish to convert it into an array. Normally, I could just do: vec = \[i for i in iter\] or vec = map(i -\> i, iter\] but now my iterator happens to contain tuples (of numbers). It is generated as…

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

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