# General Usage

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

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

**Page:** 628

---

## [Hello everyone, I'm trying to write a function that returns an array with all path](https://discourse.julialang.org/t/hello-everyone-im-trying-to-write-a-function-that-returns-an-array-with-all-path/57296)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 16, 2021, 1:32pm UTC](https://discourse.julialang.org/t/hello-everyone-im-trying-to-write-a-function-that-returns-an-array-with-all-path/57296 "2021-03-16T13:32:46Z")

</div>

Hello everyone, I’m trying to write a function that returns an array with all paths from root to leaves in a binary tree, where each path is an array of symbols. The tree struct is defined like this: abstract type Nod…

---

## [How do multiple Julia instances handle JULIA\_NUM\_THREADS?](https://discourse.julialang.org/t/how-do-multiple-julia-instances-handle-julia-num-threads/57298)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 2\
**Last updated:** [March 16, 2021, 1:20pm UTC](https://discourse.julialang.org/t/how-do-multiple-julia-instances-handle-julia-num-threads/57298 "2021-03-16T13:20:45Z")

</div>

Say I have a computer with 12 CPU cores available (i.e. visible to software, 6 cores 12 threads in reality). And say I set JULIA\_NUM\_THREADS to 8, and launch a Julia instance. If I launch another Julia instance, how do …

---

## [Base.Generator being slow because type inference fails with isnothing](https://discourse.julialang.org/t/base-generator-being-slow-because-type-inference-fails-with-isnothing/57297)

<div class="topic-metadata">

**Author:** [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Replies:** 6\
**Last updated:** [March 16, 2021, 1:01pm UTC](https://discourse.julialang.org/t/base-generator-being-slow-because-type-inference-fails-with-isnothing/57297 "2021-03-16T13:01:11Z")

</div>

Hey, consider following two functions, to generate a generator: function f(size; scaling=1.0) if isnothing(scaling) scaling = 1.0 end return (sum(scaling .\* Tuple(index)) for index in CartesianIndic…

---

## [Infinite Increasing Memory Usage Until Crash](https://discourse.julialang.org/t/infinite-increasing-memory-usage-until-crash/38254)

<div class="topic-metadata">

**Author:** [@duncanam](https://discourse.julialang.org/u/duncanam)\
**Replies:** 7\
**Last updated:** [March 16, 2021, 12:53pm UTC](https://discourse.julialang.org/t/infinite-increasing-memory-usage-until-crash/38254 "2021-03-16T12:53:56Z")

</div>

I’ve made a small script to assist with visualizing some data. The script include()s another script that has a module to do all my isosurface and 3D plotting using Makie, as well as all the reading in with CSV. I save al…

---

## [Is there a way to avoid allocating memory when using Chain.jl or pipeing? Technica](https://discourse.julialang.org/t/is-there-a-way-to-avoid-allocating-memory-when-using-chain-jl-or-pipeing-technica/57206)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 16, 2021, 12:11pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-avoid-allocating-memory-when-using-chain-jl-or-pipeing-technica/57206 "2021-03-16T12:11:36Z")

</div>

Is there a way to avoid allocating memory when using Chain.jl or pipeing? Technically these are type stable and can mutate the original array to avoid allocation julia&gt; @time @chain x begin \_ \* 1 en…

---

## [How to build data structures on Arrays without specifying the array implementation?](https://discourse.julialang.org/t/how-to-build-data-structures-on-arrays-without-specifying-the-array-implementation/57251)

<div class="topic-metadata">

**Author:** [@marty0801](https://discourse.julialang.org/u/marty0801)\
**Replies:** 6\
**Last updated:** [March 16, 2021, 10:58am UTC](https://discourse.julialang.org/t/how-to-build-data-structures-on-arrays-without-specifying-the-array-implementation/57251 "2021-03-16T10:58:37Z")

</div>

I’ve built some data structures on Vectors, and now realize I should be using views instead. The problem is that I need indexing operations to return another container. How do I modify my struct definitions to achieve th…

---

## [I can't add/update packages on julia 1.5.3](https://discourse.julialang.org/t/i-cant-add-update-packages-on-julia-1-5-3/50561)

<div class="topic-metadata">

**Author:** [@NotTaken](https://discourse.julialang.org/u/NotTaken)\
**Replies:** 10\
**Last updated:** [March 16, 2021, 10:29am UTC](https://discourse.julialang.org/t/i-cant-add-update-packages-on-julia-1-5-3/50561 "2021-03-16T10:29:38Z")

</div>

Hello! Yesterday I installed julia version 1.5.3 on windows 10 and I was able to install the Pluto, Plots, GR, Plotly packages. But today I can’t download any packages, nor update the previous ones. I have specifically t…

---

## [Adding payment in JuliaHub](https://discourse.julialang.org/t/adding-payment-in-juliahub/57269)

<div class="topic-metadata">

**Author:** [@SonLe](https://discourse.julialang.org/u/SonLe)\
**Replies:** 3\
**Last updated:** [March 16, 2021, 10:21am UTC](https://discourse.julialang.org/t/adding-payment-in-juliahub/57269 "2021-03-16T10:21:01Z")

</div>

Hi all, I intend to use JuliaHub. However, it is quite weird that I cannot add my credit card on the JuliaHub page. It does not show the inputting card number section, instead, it is just a blank Is there anybody her…

---

## [Flux Loss is not converging when trying to approximate a multivariate function](https://discourse.julialang.org/t/flux-loss-is-not-converging-when-trying-to-approximate-a-multivariate-function/57282)

<div class="topic-metadata">

**Author:** [@JackHuang](https://discourse.julialang.org/u/JackHuang)\
**Replies:** 0\
**Last updated:** [March 16, 2021, 9:15am UTC](https://discourse.julialang.org/t/flux-loss-is-not-converging-when-trying-to-approximate-a-multivariate-function/57282 "2021-03-16T09:15:54Z")

</div>

Hi, I am trying to using MLP to approximate a multivariate function, however, the loss gets stuck very quickly and I am not able to get a model that can approximate the function well. I have tried the same thing in pyth…

---

## [Update julia 1.53 and 1.6 Beta problem](https://discourse.julialang.org/t/update-julia-1-53-and-1-6-beta-problem/53275)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 2\
**Last updated:** [March 16, 2021, 7:15am UTC](https://discourse.julialang.org/t/update-julia-1-53-and-1-6-beta-problem/53275 "2021-03-16T07:15:39Z")

</div>

Version 1.5.3 (2020-11-09) \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release |\_\_/ | (@v1.5) pkg\> up Installing known registries into \`C:\\Users\\user\\.julia\` ERROR: SystemError: opening…

---

## [Documenter.jl does not build on tags anymore after renaming \`master\` to \`main\`](https://discourse.julialang.org/t/documenter-jl-does-not-build-on-tags-anymore-after-renaming-master-to-main/57171)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 9\
**Last updated:** [March 16, 2021, 7:03am UTC](https://discourse.julialang.org/t/documenter-jl-does-not-build-on-tags-anymore-after-renaming-master-to-main/57171 "2021-03-16T07:03:35Z")

</div>

We tried to follow GitHub’s new best practices and renamed master to main in Trixi.jl. We also changed all occurrences of master to main, e.g. in the setup of Documenter.jl and other GitHub actions. Currently, Documenter…

---

## [Julia slower than Matlab & Python? No](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 119\
**Last updated:** [March 16, 2021, 1:00am UTC](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128 "2021-03-16T01:00:51Z")

</div>

A recent paper ML Software & Hardware for Econ finds Julia is often slower than Matlab & Numpy. Code for Option Pricing is here. Code for Dynamic Programming is here. Usually, writing Julia code similarly leads to eno…

---

## [What is the difference between abstract, composite, and concrete types.](https://discourse.julialang.org/t/what-is-the-difference-between-abstract-composite-and-concrete-types/9599)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 7\
**Last updated:** [March 15, 2021, 11:48pm UTC](https://discourse.julialang.org/t/what-is-the-difference-between-abstract-composite-and-concrete-types/9599 "2021-03-15T23:48:49Z")

</div>

Can someone help me understand the difference? I understand the concept from object oriented languages, but there are a few things from the documentation I don’t understand. For example struct Point{T} x::T …

---

## [Offline package installation](https://discourse.julialang.org/t/offline-package-installation/7880)

<div class="topic-metadata">

**Author:** [@John\_Hearns](https://discourse.julialang.org/u/John_Hearns)\
**Replies:** 16\
**Last updated:** [March 15, 2021, 10:56pm UTC](https://discourse.julialang.org/t/offline-package-installation/7880 "2021-03-15T22:56:40Z")

</div>

Julia packages live on Github, and unregistered packages can be installed usign a git clone. I guess it is easy enough to make a local copy of a repo on disk. How would one tell julia to install packages from that sour…

---

## [Learning to optimize](https://discourse.julialang.org/t/learning-to-optimize/57207)

<div class="topic-metadata">

**Author:** [@lancejnelson](https://discourse.julialang.org/u/lancejnelson)\
**Replies:** 12\
**Last updated:** [March 15, 2021, 9:22pm UTC](https://discourse.julialang.org/t/learning-to-optimize/57207 "2021-03-15T21:22:06Z")

</div>

Still trying to build intuition for optimizing Julia code. Here is an MD code I translated from python. It already runs a lot faster than my python version but I feel like it could be faster. I’m more interested in le…

---

## [Type Instability in performance critical function](https://discourse.julialang.org/t/type-instability-in-performance-critical-function/57195)

<div class="topic-metadata">

**Author:** [@mroavi](https://discourse.julialang.org/u/mroavi)\
**Replies:** 17\
**Last updated:** [March 15, 2021, 6:12pm UTC](https://discourse.julialang.org/t/type-instability-in-performance-critical-function/57195 "2021-03-15T18:12:39Z")

</div>

I have a function that is critical in my code because it is called many times. I am trying to optimize it. The function takes in an N-dimensional factor and a tuple of variables. A factor consists of an N-dimensional ar…

---

## [Multithreading and random number generators](https://discourse.julialang.org/t/multithreading-and-random-number-generators/49777)

<div class="topic-metadata">

**Author:** [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Replies:** 7\
**Last updated:** [March 15, 2021, 2:41pm UTC](https://discourse.julialang.org/t/multithreading-and-random-number-generators/49777 "2021-03-15T14:41:01Z")

</div>

How one can approach multithreading simulations, which uses random numbers generators? Especially if one wants to use non Base generators, like StableRNGs.jl, RandomNumbers.jl and others. Here is a simple example of a r…

---

## [LowRankApprox.jl and sketch.jl](https://discourse.julialang.org/t/lowrankapprox-jl-and-sketch-jl/57200)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 3:06pm UTC](https://discourse.julialang.org/t/lowrankapprox-jl-and-sketch-jl/57200 "2021-03-15T15:06:18Z")

</div>

In LowRankApprox package we have access to sketching methods via sketch.jl. I only need to compute the sketching step below in pseudo-code: function f(Q::StridedMatrix{Float32}, Qv::StridedVector{Float32}, S…

---

## [Mouse events + Luxor](https://discourse.julialang.org/t/mouse-events-luxor/57184)

<div class="topic-metadata">

**Author:** [@aferref](https://discourse.julialang.org/u/aferref)\
**Replies:** 2\
**Last updated:** [March 15, 2021, 12:35pm UTC](https://discourse.julialang.org/t/mouse-events-luxor/57184 "2021-03-15T12:35:09Z")

</div>

Hello, I need to get the coordinates of the mouse using Luxor package but I have not found anything in the documentation. Is it posible?. I would like to make an animation like in Processing with @play of Luxor. Best r…

---

## [Best practice for Flux.jl: how to untrack gradient?](https://discourse.julialang.org/t/best-practice-for-flux-jl-how-to-untrack-gradient/57156)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [March 15, 2021, 12:33pm UTC](https://discourse.julialang.org/t/best-practice-for-flux-jl-how-to-untrack-gradient/57156 "2021-03-15T12:33:45Z")

</div>

This question is based on the previous question. I found that it’s hard to incorporate Convex.jl and Flux.jl. So, I tried to “approximate” the solution by untracking gradients of the solution of Convex.jl from Flux.jl …

---

## [Efficient popnfirst!?](https://discourse.julialang.org/t/efficient-popnfirst/57190)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 12\
**Last updated:** [March 15, 2021, 12:29pm UTC](https://discourse.julialang.org/t/efficient-popnfirst/57190 "2021-03-15T12:29:38Z")

</div>

Hi, I was wondering if it exists an efficient implementation of popfirst! for an array that allows a n argument to request multiple pops at once (instead of calling popfirst! n times). Like popfirst!(a::Array, n::Int =…

---

## [GAMS Display Statements in JuMP](https://discourse.julialang.org/t/gams-display-statements-in-jump/57192)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 12:03pm UTC](https://discourse.julialang.org/t/gams-display-statements-in-jump/57192 "2021-03-15T12:03:56Z")

</div>

Hello, GAMS has solver display statements that display the solver outputs for primal or dual variables. It displays them in dimensional tables with appropriate headings. How can I do the same in Julia/JuMP?

---

## [Streaming replace of file content before reading into lines](https://discourse.julialang.org/t/streaming-replace-of-file-content-before-reading-into-lines/56666)

<div class="topic-metadata">

**Author:** [@JuergenD](https://discourse.julialang.org/u/JuergenD)\
**Replies:** 3\
**Last updated:** [March 15, 2021, 11:41am UTC](https://discourse.julialang.org/t/streaming-replace-of-file-content-before-reading-into-lines/56666 "2021-03-15T11:41:12Z")

</div>

Sorry, it seems to be a simple question, but I’m not able to figure out how to do it in Julia. We receive text files, but they have ‘\\01’ or ‘\\00’ as newline. We’d like read (stream) the file content, map ‘\\01’ to ‘\\r’ a…

---

## [Access array elements in 'strided groups'](https://discourse.julialang.org/t/access-array-elements-in-strided-groups/57122)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 2\
**Last updated:** [March 15, 2021, 9:40am UTC](https://discourse.julialang.org/t/access-array-elements-in-strided-groups/57122 "2021-03-15T09:40:05Z")

</div>

Sorry for confusing terminology, MWE probably makes it clearer function viewrows(data::Vector, start, stop, ncol) datamat = reshape(data, :, ncol) dataview = @view datamat\[start:stop, :\] return reshape(datav…

---

## [Hadamard.jl and fwht()](https://discourse.julialang.org/t/hadamard-jl-and-fwht/57185)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 9:30am UTC](https://discourse.julialang.org/t/hadamard-jl-and-fwht/57185 "2021-03-15T09:30:46Z")

</div>

Hi, in order to use fwht() function from Hadamard.jl package, I have to resize the input vector A into a vector tempA of a length that can be write as a power of two. I am doing this in the srht() function below at row 2…

---

## [MethodError: no method matching similar\_array\_type](https://discourse.julialang.org/t/methoderror-no-method-matching-similar-array-type/57154)

<div class="topic-metadata">

**Author:** [@javiera\_vergara](https://discourse.julialang.org/u/javiera_vergara)\
**Replies:** 1\
**Last updated:** [March 15, 2021, 9:15am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-similar-array-type/57154 "2021-03-15T09:15:52Z")

</div>

Hi there, I am running my code and have the following error: MethodError: no method matching similar\_array\_type(::Type{JuMP.Containers.DenseAxisArray{VariableRef,1,Tuple{UnitRange{Int64}},Tuple{Dict{Int64,Int64}}}}, ::…

---

## [Orthogonalize.jl](https://discourse.julialang.org/t/orthogonalize-jl/57181)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 8:57am UTC](https://discourse.julialang.org/t/orthogonalize-jl/57181 "2021-03-15T08:57:53Z")

</div>

Hi, using orthogonalize.jl from IterativeSolvers.jl I made some performance plots (dodgeTPSbench.png attached) where “ON” tags refers to the julia internal function orthogonalize\_and\_normalize!() and MGS referst to Modif…

---

## [Input Type](https://discourse.julialang.org/t/input-type/56716)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 2\
**Last updated:** [March 15, 2021, 8:30am UTC](https://discourse.julialang.org/t/input-type/56716 "2021-03-15T08:30:49Z")

</div>

Hi, in a solver framework I am using a custom function which takes Array{\<:\*\*AbstractFloat,\*\*1} as input. In practice, This AbstractFloat can be either Float32 or Float64. In terms of performances, should I create two f…

---

## [How to use julia module as libary from Python?](https://discourse.julialang.org/t/how-to-use-julia-module-as-libary-from-python/57160)

<div class="topic-metadata">

**Author:** [@morphism](https://discourse.julialang.org/u/morphism)\
**Replies:** 2\
**Last updated:** [March 15, 2021, 8:12am UTC](https://discourse.julialang.org/t/how-to-use-julia-module-as-libary-from-python/57160 "2021-03-15T08:12:41Z")

</div>

Hello, I have my own machine learning library done using Julia language. I want my clients to use my machine learning library using Python 3.x That is, my clients want to executes Python 3.x and import my machine learn…

---

## [I got a really long error stack. I can't see the context and what the actual error](https://discourse.julialang.org/t/i-got-a-really-long-error-stack-i-cant-see-the-context-and-what-the-actual-error/57147)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 15, 2021, 12:08am UTC](https://discourse.julialang.org/t/i-got-a-really-long-error-stack-i-cant-see-the-context-and-what-the-actual-error/57147 "2021-03-15T00:08:49Z")

</div>

I got a really long error stack. I can’t see the context and what the actual error was in the REPL. How should I make the REPL “longer” so I can scroll up more to see the error and the context of the error? I’m using VSC…

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

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