# General Usage

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

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

**Page:** 396

---

## [Pre-allocate for findall](https://discourse.julialang.org/t/pre-allocate-for-findall/87454)

<div class="topic-metadata">

**Author:** [@MacKenzieHnC](https://discourse.julialang.org/u/MacKenzieHnC)\
**Replies:** 16\
**Last updated:** [September 19, 2022, 1:24am UTC](https://discourse.julialang.org/t/pre-allocate-for-findall/87454 "2022-09-19T01:24:43Z")

</div>

I am absolutely sure something like this has been asked before but I cannot for the life of me find it. I’m currently working on a memory- and speed-efficient way to access the first 1 billion primes as part of a differ…

---

## [Fetching progress: why does it almost always stall at 99.9%?](https://discourse.julialang.org/t/fetching-progress-why-does-it-almost-always-stall-at-99-9/87360)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 7\
**Last updated:** [September 18, 2022, 5:55pm UTC](https://discourse.julialang.org/t/fetching-progress-why-does-it-almost-always-stall-at-99-9/87360 "2022-09-18T17:55:33Z")

</div>

When I install Julia packages, sometimes fetching occurs. And when fetching occurs, a lot of times it progresses quite fast until 99.9 % (within a few seconds), but then it stalls there for several minutes: (@v1.8) pkg\>…

---

## [Should transpose of a Vector be a Matrix?](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444)

<div class="topic-metadata">

**Author:** [@owiecc](https://discourse.julialang.org/u/owiecc)\
**Replies:** 3\
**Last updated:** [September 18, 2022, 4:47pm UTC](https://discourse.julialang.org/t/should-transpose-of-a-vector-be-a-matrix/87444 "2022-09-18T16:47:33Z")

</div>

As Julia has a true 1D vector data type, shouldn’t the transpose of a Vector just be a Vector (essentially an identity operation)? See Conor Hoekstra’s comments in APL vs BQN vs J vs Q vs NumPy vs Julia vs R - YouTube I…

---

## [What does \`export Foo\` do when there are multiple \`Foo\`'s?](https://discourse.julialang.org/t/what-does-export-foo-do-when-there-are-multiple-foo-s/86579)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 6\
**Last updated:** [September 18, 2022, 4:18pm UTC](https://discourse.julialang.org/t/what-does-export-foo-do-when-there-are-multiple-foo-s/86579 "2022-09-18T16:18:48Z")

</div>

export works on names, but sometimes there are several objects with the same name. Which of them are exported? I’m wondering about this because I have struct Foo and a constructor function Foo. The discussion of keywo…

---

## [How to point Julia to the correct package location?](https://discourse.julialang.org/t/how-to-point-julia-to-the-correct-package-location/87442)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 0\
**Last updated:** [September 18, 2022, 2:27pm UTC](https://discourse.julialang.org/t/how-to-point-julia-to-the-correct-package-location/87442 "2022-09-18T14:27:07Z")

</div>

If I’ve installed and loaded a package, and then in the same session develop said package, I would expect that pkgdir(\<developed package\>) would point to the developed package path. This is not my experience, the direct…

---

## [L strings not working in Makie](https://discourse.julialang.org/t/l-strings-not-working-in-makie/87366)

<div class="topic-metadata">

**Author:** [@Thomas\_Mikaelsen](https://discourse.julialang.org/u/Thomas_Mikaelsen)\
**Replies:** 6\
**Last updated:** [September 18, 2022, 2:05pm UTC](https://discourse.julialang.org/t/l-strings-not-working-in-makie/87366 "2022-09-18T14:05:59Z")

</div>

Hello. First post on this forum so I apologize if I fall short of the conventions. I can’t get L strings to work with Makie on Jupyter Notebook. I just installed Makie, CairoMakie and MakieTeX. I couldn’t get my own exa…

---

## [Allocation during construction of compile-time sized structure](https://discourse.julialang.org/t/allocation-during-construction-of-compile-time-sized-structure/87435)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 1\
**Last updated:** [September 18, 2022, 12:25pm UTC](https://discourse.julialang.org/t/allocation-during-construction-of-compile-time-sized-structure/87435 "2022-09-18T12:25:04Z")

</div>

I have a simple, immutable structure that wraps a statically sized matrix. When I construct it with an initialization value, it causes a memory allocation. I expected there to be no such allocation. Should there be an al…

---

## [Combining Lux.jl with Optimization.jl](https://discourse.julialang.org/t/combining-lux-jl-with-optimization-jl/87412)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 11\
**Last updated:** [September 18, 2022, 3:26am UTC](https://discourse.julialang.org/t/combining-lux-jl-with-optimization-jl/87412 "2022-09-18T03:26:41Z")

</div>

Hi there, while trying to compile a state-of-the-art NeuralDifferentialEquations tutorial I stumbled upon the recent addition of Lux.jl and Optimization.jl It seems they don’t really work together, because Optimization…

---

## [Struct/method definition order advice](https://discourse.julialang.org/t/struct-method-definition-order-advice/87377)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 12\
**Last updated:** [September 17, 2022, 10:13am UTC](https://discourse.julialang.org/t/struct-method-definition-order-advice/87377 "2022-09-17T10:13:27Z")

</div>

In Julia, you can have # in src/monster.jl struct Monster end # in src/player.jl struct Player end capture(::Player, ::Monster) This will only work if include("src/player.jl") is done after include("src/monster.jl"). …

---

## [Feeding Julia strings in pipe to external program](https://discourse.julialang.org/t/feeding-julia-strings-in-pipe-to-external-program/1333)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 7\
**Last updated:** [September 17, 2022, 6:36pm UTC](https://discourse.julialang.org/t/feeding-julia-strings-in-pipe-to-external-program/1333 "2022-09-17T18:36:13Z")

</div>

Is it possible to use a string, instead of the output of a command, when using pipeline? For example instead of writing run(pipeline(\`echo hello\`, \`sort\`)) I would write something like run(pipeline("hello", \`sort\`))

---

## [How to convert code from python to julia. the magic squares](https://discourse.julialang.org/t/how-to-convert-code-from-python-to-julia-the-magic-squares/87397)

<div class="topic-metadata">

**Author:** [@TesMar](https://discourse.julialang.org/u/TesMar)\
**Replies:** 1\
**Last updated:** [September 17, 2022, 8:47am UTC](https://discourse.julialang.org/t/how-to-convert-code-from-python-to-julia-the-magic-squares/87397 "2022-09-17T08:47:33Z")

</div>

Hello everybody. I ask for help to convert this python code to Julia: sorry for the language errors, but i’m italian. Blockquote import collections from statistics import\* import numpy as np import pylab as pl fi…

---

## [Usage of lm with Unitful](https://discourse.julialang.org/t/usage-of-lm-with-unitful/87394)

<div class="topic-metadata">

**Author:** [@wheeheee](https://discourse.julialang.org/u/wheeheee)\
**Replies:** 0\
**Last updated:** [September 17, 2022, 6:25am UTC](https://discourse.julialang.org/t/usage-of-lm-with-unitful/87394 "2022-09-17T06:25:16Z")

</div>

I tried to use lm from GLM.jl with units from Unitful, but then received this error below. Is there some way to make this work? Or should I stick to stripping the units first before using lm? julia\> test\_df = DataFr…

---

## [Latex docstring for functions](https://discourse.julialang.org/t/latex-docstring-for-functions/87191)

<div class="topic-metadata">

**Author:** [@Rex\_Wang](https://discourse.julialang.org/u/Rex_Wang)\
**Replies:** 4\
**Last updated:** [September 17, 2022, 6:22am UTC](https://discourse.julialang.org/t/latex-docstring-for-functions/87191 "2022-09-17T06:22:07Z")

</div>

I’m trying to use latex strings for function documentation. It works fine following the instruction here: LaTeX Syntax @doc raw""" balabala... \`\`some equations\`\` """ myfun(x) = x However, the tex string become inval…

---

## [Permission Denied when installing package with Julia 1.8.1 on Windows](https://discourse.julialang.org/t/permission-denied-when-installing-package-with-julia-1-8-1-on-windows/87376)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 1\
**Last updated:** [September 16, 2022, 11:24pm UTC](https://discourse.julialang.org/t/permission-denied-when-installing-package-with-julia-1-8-1-on-windows/87376 "2022-09-16T23:24:31Z")

</div>

Windows 10 laptop. Julia Version 1.8.1 (2022-09-06) I upgraded using juliaup yesterday julia\> using BenchmarkTools │ Package BenchmarkTools not found, but a package named BenchmarkTools is available from a registry. …

---

## [Bounded optimization without prior knowledge of bounds](https://discourse.julialang.org/t/bounded-optimization-without-prior-knowledge-of-bounds/87385)

<div class="topic-metadata">

**Author:** [@structural](https://discourse.julialang.org/u/structural)\
**Replies:** 1\
**Last updated:** [September 16, 2022, 7:47pm UTC](https://discourse.julialang.org/t/bounded-optimization-without-prior-knowledge-of-bounds/87385 "2022-09-16T19:47:59Z")

</div>

I need to optimize a function f(x) over some region A. The function returns an error if evaluated outside the region. However I do not know the region A beforehand. I can only tell whether x' \\in A by evaluating f(x') an…

---

## [Is there a way to use MKLPardisoSolver or other parallel solver with KLU?](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 6:30pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-use-mklpardisosolver-or-other-parallel-solver-with-klu/87382 "2022-09-16T18:30:27Z")

</div>

Does MKLPardisoSolver only accept matrix inputs? A= sprand(10000, 10000, 0.1); II= rand(10000, 2); # typeof(II) is Matrix{Float64} (alias for Array{Float64, 2}) V= zeros(10000, 2); ps = MKLPardisoSolver() solve!(ps…

---

## [How to overload operators and their doc bindings](https://discourse.julialang.org/t/how-to-overload-operators-and-their-doc-bindings/87372)

<div class="topic-metadata">

**Author:** [@uje](https://discourse.julialang.org/u/uje)\
**Replies:** 20\
**Last updated:** [September 16, 2022, 5:04pm UTC](https://discourse.julialang.org/t/how-to-overload-operators-and-their-doc-bindings/87372 "2022-09-16T17:04:44Z")

</div>

julia\> module Foo struct Point x::Int y::Int end """ \<(a::Point, b::Point) -\> Bool Compare two \`Point\`s…

---

## [Nice work on Julia 1.8/1.8.1 on MacOS ARM](https://discourse.julialang.org/t/nice-work-on-julia-1-8-1-8-1-on-macos-arm/87378)

<div class="topic-metadata">

**Author:** [@lewis](https://discourse.julialang.org/u/lewis)\
**Replies:** 0\
**Last updated:** [September 16, 2022, 4:18pm UTC](https://discourse.julialang.org/t/nice-work-on-julia-1-8-1-8-1-on-macos-arm/87378 "2022-09-16T16:18:42Z")

</div>

This build is giving me no problems at all. I’d say the Julia native ARM version is around 30% faster than the Intel version running on Rosetta (Apple’s Intel emulation layer) based on very informal timings. I time sect…

---

## [Shouldn't 1.8.0 be faster than Julia 1.7?](https://discourse.julialang.org/t/shouldnt-1-8-0-be-faster-than-julia-1-7/82143)

<div class="topic-metadata">

**Author:** [@mindaslab](https://discourse.julialang.org/u/mindaslab)\
**Replies:** 30\
**Last updated:** [September 16, 2022, 3:01pm UTC](https://discourse.julialang.org/t/shouldnt-1-8-0-be-faster-than-julia-1-7/82143 "2022-09-16T15:01:12Z")

</div>

---

## [How to mutate values of matrix which by mutating its sub-matrix?](https://discourse.julialang.org/t/how-to-mutate-values-of-matrix-which-by-mutating-its-sub-matrix/87325)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 9\
**Last updated:** [September 16, 2022, 2:36pm UTC](https://discourse.julialang.org/t/how-to-mutate-values-of-matrix-which-by-mutating-its-sub-matrix/87325 "2022-09-16T14:36:31Z")

</div>

In the below, I building matrix A which consists of for sub-matrices Y,A1,A2,A3.I want the mutation on A3 be applied automatically on A as well. How can I do that please? using BenchmarkTools, StaticArrays, LinearAlgeb…

---

## [How to clear workspace variables？](https://discourse.julialang.org/t/how-to-clear-workspace-variables/44095)

<div class="topic-metadata">

**Author:** [@dty](https://discourse.julialang.org/u/dty)\
**Replies:** 15\
**Last updated:** [September 16, 2022, 1:07pm UTC](https://discourse.julialang.org/t/how-to-clear-workspace-variables/44095 "2022-09-16T13:07:18Z")

</div>

I’ve installed it revise.jl How can I use this bag? How can I clear the previous working variables after modifying the program to see the new variable values

---

## [Mesh generation](https://discourse.julialang.org/t/mesh-generation/82263)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 16\
**Last updated:** [September 16, 2022, 1:04pm UTC](https://discourse.julialang.org/t/mesh-generation/82263 "2022-09-16T13:04:01Z")

</div>

Dear all, I would like to know if there exists a generic mesh generator (2D/3D) that allows for: in 2D: the use either triangles or quadrangles controlling order of elements including regional attributes to elements r…

---

## [Threads.at-spawn: idle threads when printing](https://discourse.julialang.org/t/threads-at-spawn-idle-threads-when-printing/87363)

<div class="topic-metadata">

**Author:** [@rfourquet](https://discourse.julialang.org/u/rfourquet)\
**Replies:** 0\
**Last updated:** [September 16, 2022, 12:31pm UTC](https://discourse.julialang.org/t/threads-at-spawn-idle-threads-when-printing/87363 "2022-09-16T12:31:13Z")

</div>

When running multiple tasks which do some printing using Threads.@spawn, threads can become idle, I would like help understanding the reason and am looking for workarounds. Here is an example, assuming Threads.nthreads()…

---

## [Forbid Pkg to try and download artifact from outside world?](https://discourse.julialang.org/t/forbid-pkg-to-try-and-download-artifact-from-outside-world/87357)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 0\
**Last updated:** [September 16, 2022, 8:52am UTC](https://discourse.julialang.org/t/forbid-pkg-to-try-and-download-artifact-from-outside-world/87357 "2022-09-16T08:52:03Z")

</div>

I just managed to add an artifact to one of my packages, however while attempting that I had some address issues to my local storage. This resulted in Pkg errors during instantiate. The error prompted that Pkg tried to …

---

## [\`add\_artifact!\` fails because of a checksum test, while the tarball was made with \`Tar.jl\`](https://discourse.julialang.org/t/add-artifact-fails-because-of-a-checksum-test-while-the-tarball-was-made-with-tar-jl/87306)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 8:41am UTC](https://discourse.julialang.org/t/add-artifact-fails-because-of-a-checksum-test-while-the-tarball-was-made-with-tar-jl/87306 "2022-09-16T08:41:31Z")

</div>

Hello, I’m trying to add some binary artifacts to one of my packages. As I am on windows, I do not use BinaryBuilder as it does not seem supported at the moment for that OS. However, I tried using ArtifactUtils to ease …

---

## [How to Convert this Code to For loop / Function?](https://discourse.julialang.org/t/how-to-convert-this-code-to-for-loop-function/87260)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 11\
**Last updated:** [September 16, 2022, 7:26am UTC](https://discourse.julialang.org/t/how-to-convert-this-code-to-for-loop-function/87260 "2022-09-16T07:26:57Z")

</div>

Hi all, I plot a series manually, then I thought I want to learn to use for loop / function. I don’t know which one is better. The series are famous: a\_{n} = \\frac{(-1)^{n}}{n} For n even it will be \\frac{1}{n} For n…

---

## [Rational pseudo-inverse matrix](https://discourse.julialang.org/t/rational-pseudo-inverse-matrix/43773)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 10\
**Last updated:** [September 16, 2022, 6:53am UTC](https://discourse.julialang.org/t/rational-pseudo-inverse-matrix/43773 "2022-09-16T06:53:56Z")

</div>

Given a generic non-square matrix A, one can compute the pseudo-inverse (aka Moore-Penrose inverse) via the LinearAlgebra.pinv function, or also from the LinearAlgebra.qr decomposition (pinv(A) = inv(qr(A).R) \* qr(A).Q')…

---

## [Indexing Vectors of Structs](https://discourse.julialang.org/t/indexing-vectors-of-structs/87346)

<div class="topic-metadata">

**Author:** [@Name1](https://discourse.julialang.org/u/Name1)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 4:54am UTC](https://discourse.julialang.org/t/indexing-vectors-of-structs/87346 "2022-09-16T04:54:11Z")

</div>

Hi all, for ii in myStructArray ii.parameterOne = lowercase(ii.parameterOne) ii.parameterTwo = lowercase(ii.parameterTwo) print("On loop iteration " + ii) end I’m looping…

---

## [FLoops ThreadedEx scheduling](https://discourse.julialang.org/t/floops-threadedex-scheduling/86024)

<div class="topic-metadata">

**Author:** [@ignis](https://discourse.julialang.org/u/ignis)\
**Replies:** 2\
**Last updated:** [September 16, 2022, 4:07am UTC](https://discourse.julialang.org/t/floops-threadedex-scheduling/86024 "2022-09-16T04:07:42Z")

</div>

I’ve been studying different types of loop scheduling in multithreading and I couldn’t really understand how the executor ThreadedEx in FLoops/FoldsThreads work. The docs say: this executor takes a divide-and-conquer …

---

## [What causes the delay when adding procs](https://discourse.julialang.org/t/what-causes-the-delay-when-adding-procs/87344)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 0\
**Last updated:** [September 16, 2022, 4:04am UTC](https://discourse.julialang.org/t/what-causes-the-delay-when-adding-procs/87344 "2022-09-16T04:04:36Z")

</div>

I am using ClusterManagers.jl and Distributed.jl to connect to a cluster. I’ve done this many times before and seem to understand how it all works, but something that eludes me is that when adding a large number of proce…

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

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