# General Usage

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

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

**Page:** 647

---

## [Hashing of different types with same contents](https://discourse.julialang.org/t/hashing-of-different-types-with-same-contents/54839)

<div class="topic-metadata">

**Author:** [@jagot](https://discourse.julialang.org/u/jagot)\
**Replies:** 2\
**Last updated:** [February 8, 2021, 1:23pm UTC](https://discourse.julialang.org/t/hashing-of-different-types-with-same-contents/54839 "2021-02-08T13:23:47Z")

</div>

Say I have two types with hash implementations defined like this struct A{T} t::T end Base.hash(a::A, h::UInt) = hash(a.t, h) struct B{T} t::T end Base.hash(b::B, h::UInt) = hash(b.t, h) I will get their hashes to…

---

## [Index type of sparse matrix](https://discourse.julialang.org/t/index-type-of-sparse-matrix/54828)

<div class="topic-metadata">

**Author:** [@rammelmueller](https://discourse.julialang.org/u/rammelmueller)\
**Replies:** 7\
**Last updated:** [February 8, 2021, 12:37pm UTC](https://discourse.julialang.org/t/index-type-of-sparse-matrix/54828 "2021-02-08T12:37:10Z")

</div>

I’m using Arpack.jl to get the lowest few eigenvalues of relatively large N x N matrices. To achive this, I’m first cal sparse(row, col, data) to get the matrix to the appropriate form. Although the matrices I’m working …

---

## [Julia v1.6: \`using\` is faster but first call is slower](https://discourse.julialang.org/t/julia-v1-6-using-is-faster-but-first-call-is-slower/54838)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 1\
**Last updated:** [February 8, 2021, 12:30pm UTC](https://discourse.julialang.org/t/julia-v1-6-using-is-faster-but-first-call-is-slower/54838 "2021-02-08T12:30:22Z")

</div>

Thanks a lot to all contributors to reduce latency in the new release candidate of Julia v1.6 - great work! I recognized that using can be significantly faster in Julia v1.6, but the first function call becomes signific…

---

## [Error in smoothed\_aggregation](https://discourse.julialang.org/t/error-in-smoothed-aggregation/54754)

<div class="topic-metadata">

**Author:** [@mancolric](https://discourse.julialang.org/u/mancolric)\
**Replies:** 2\
**Last updated:** [February 8, 2021, 8:53am UTC](https://discourse.julialang.org/t/error-in-smoothed-aggregation/54754 "2021-02-08T08:53:12Z")

</div>

Hello, I have recently installed julia 1.5.3 and AlgebraicMultigrid package. I have previously deleted earlier versions of julia (included hidden files), so the installation is clean. When I execute ml = Al…

---

## [Saving StructArray with Arrow.jl fails](https://discourse.julialang.org/t/saving-structarray-with-arrow-jl-fails/54812)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 3\
**Last updated:** [February 8, 2021, 2:45am UTC](https://discourse.julialang.org/t/saving-structarray-with-arrow-jl-fails/54812 "2021-02-08T02:45:54Z")

</div>

I am trying to save my flight data with Arrow.jl. The code looks like this: using Rotations, StaticArrays, StructArrays, Arrow const MyFloat = Float32 const SEGMENTS = 7 # number of tether segments …

---

## [Plotting an HSV array and also saving the image as a jpeg file](https://discourse.julialang.org/t/plotting-an-hsv-array-and-also-saving-the-image-as-a-jpeg-file/54770)

<div class="topic-metadata">

**Author:** [@nelsonah](https://discourse.julialang.org/u/nelsonah)\
**Replies:** 4\
**Last updated:** [February 8, 2021, 12:31am UTC](https://discourse.julialang.org/t/plotting-an-hsv-array-and-also-saving-the-image-as-a-jpeg-file/54770 "2021-02-08T00:31:35Z")

</div>

The following code, with a small array, generates an HSV array. I have been unable to find out how to display the image represented by the array. Later I want to save the images as a jpeg file and then use FFMPEG to ma…

---

## [Is there an easy way to change the eltype of ranges?](https://discourse.julialang.org/t/is-there-an-easy-way-to-change-the-eltype-of-ranges/54791)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 6\
**Last updated:** [February 7, 2021, 6:17pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-change-the-eltype-of-ranges/54791 "2021-02-07T18:17:57Z")

</div>

For example: julia\> r = 2.0:3.0 2.0:1.0:3.0 julia\> eltype(r) Float64 julia\> Float32.(r) 2-element Array{Float32,1}: 2.0 3.0 This creates a Vector from the range. Is there a way to obtain another range (I don’t care…

---

## [Using views causes significant slowdown in simple PDE](https://discourse.julialang.org/t/using-views-causes-significant-slowdown-in-simple-pde/54803)

<div class="topic-metadata">

**Author:** [@bgroenks](https://discourse.julialang.org/u/bgroenks)\
**Replies:** 2\
**Last updated:** [February 7, 2021, 4:39pm UTC](https://discourse.julialang.org/t/using-views-causes-significant-slowdown-in-simple-pde/54803 "2021-02-07T16:39:32Z")

</div>

I have stumbled upon a frustrating performance issue with either DifferentialEquations.jl or the Julia compiler (or maybe my code?). The motivating use-case is the application of the 1-dimensional heat equation (and poss…

---

## [Parallel precompilation in Julia v1.6: Dependencies include test dependencies?](https://discourse.julialang.org/t/parallel-precompilation-in-julia-v1-6-dependencies-include-test-dependencies/54776)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 4\
**Last updated:** [February 7, 2021, 4:14pm UTC](https://discourse.julialang.org/t/parallel-precompilation-in-julia-v1-6-dependencies-include-test-dependencies/54776 "2021-02-07T16:14:13Z")

</div>

I really like parallel precompilation of projects in Julia v1.6 . That’s really nice work from everybody involved :+1: I would like to know a bit more about the dependencies used to determine whether two packages can be…

---

## [How to make Julia call C/C++ coded function](https://discourse.julialang.org/t/how-to-make-julia-call-c-c-coded-function/54780)

<div class="topic-metadata">

**Author:** [@Valery](https://discourse.julialang.org/u/Valery)\
**Replies:** 6\
**Last updated:** [February 7, 2021, 3:58pm UTC](https://discourse.julialang.org/t/how-to-make-julia-call-c-c-coded-function/54780 "2021-02-07T15:58:22Z")

</div>

Hi all, I am a complete beginner in Julia. My question is: how to make a julia script call C or C++ coded function. If it’s possible, can this enhance the performance in term of speed of execution (if we compare it wit…

---

## [ERROR: LoadError: UndefVarError: int not defined](https://discourse.julialang.org/t/error-loaderror-undefvarerror-int-not-defined/54795)

<div class="topic-metadata">

**Author:** [@Otoliths](https://discourse.julialang.org/u/Otoliths)\
**Replies:** 3\
**Last updated:** [February 7, 2021, 3:48pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-int-not-defined/54795 "2021-02-07T15:48:13Z")

</div>

Hi all, I’m new to programming with Julia, and I’m really stuck. This is the Julia version running julia\> VERSION v"1.4.1" This call\_DPM.jl only works with the Julia 0.2.1, this issue happens also with 1.4.1 version…

---

## [How to stop script execution](https://discourse.julialang.org/t/how-to-stop-script-execution/38568)

<div class="topic-metadata">

**Author:** [@hmemy](https://discourse.julialang.org/u/hmemy)\
**Replies:** 9\
**Last updated:** [February 7, 2021, 11:49am UTC](https://discourse.julialang.org/t/how-to-stop-script-execution/38568 "2021-02-07T11:49:39Z")

</div>

Hi, How can I stop script execution if certain condition is not met? exit() does not work here as it exit julia.

---

## [NearestNeighbors.jl - Can I formulate this in a way which makes it allocate less?](https://discourse.julialang.org/t/nearestneighbors-jl-can-i-formulate-this-in-a-way-which-makes-it-allocate-less/54778)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 2\
**Last updated:** [February 7, 2021, 9:54am UTC](https://discourse.julialang.org/t/nearestneighbors-jl-can-i-formulate-this-in-a-way-which-makes-it-allocate-less/54778 "2021-02-07T09:54:48Z")

</div>

Hello! I am using a library called NearestNeighbors to calculate neighbouring points. A simple script below shows the general idea of what I want to do: using NearestNeighbors using StaticArrays function help\_me\_allo…

---

## [If I have a length 6 vector, is there a way I can \`reshape\` that into a 3x3 symmet](https://discourse.julialang.org/t/if-i-have-a-length-6-vector-is-there-a-way-i-can-reshape-that-into-a-3x3-symmet/54769)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 7, 2021, 4:52am UTC](https://discourse.julialang.org/t/if-i-have-a-length-6-vector-is-there-a-way-i-can-reshape-that-into-a-3x3-symmet/54769 "2021-02-07T04:52:08Z")

</div>

If I have a length 6 vector, is there a way I can reshape that into a 3x3 symmetric matrix cleanly/efficiently? Currently I just hardcode the element places. Note that the original poster on Slack cannot see your respon…

---

## [Is there an easy way to add environment variables to the choices of downstream tes](https://discourse.julialang.org/t/is-there-an-easy-way-to-add-environment-variables-to-the-choices-of-downstream-tes/54732)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 7, 2021, 1:13am UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-add-environment-variables-to-the-choices-of-downstream-tes/54732 "2021-02-07T01:13:26Z")

</div>

Is there an easy way to add environment variables to the choices of downstream tests in https://github.com/SciML/SciMLBase.jl/blob/master/.github/workflows/Downstream.yml ? Note that the original poster on Slack cannot …

---

## [Sum of n array by recursion in Parallel threads using spawn](https://discourse.julialang.org/t/sum-of-n-array-by-recursion-in-parallel-threads-using-spawn/54751)

<div class="topic-metadata">

**Author:** [@naviinkapoor](https://discourse.julialang.org/u/naviinkapoor)\
**Replies:** 12\
**Last updated:** [February 7, 2021, 12:38am UTC](https://discourse.julialang.org/t/sum-of-n-array-by-recursion-in-parallel-threads-using-spawn/54751 "2021-02-07T00:38:11Z")

</div>

I am creating a function that will be call n number of times in recursion to sum the elements of an array in parallel using spawn to divide the array into two parts. For example Recursion(a, lo, hi) a = (1,5,6,7,8,8,8…

---

## [How to build a package?](https://discourse.julialang.org/t/how-to-build-a-package/54755)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 6\
**Last updated:** [February 7, 2021, 12:18am UTC](https://discourse.julialang.org/t/how-to-build-a-package/54755 "2021-02-07T00:18:28Z")

</div>

I need to use the following package: https://github.com/kahypar/KaHyPar.jl However, it is not compatible with macOS and it requires building it before the installation. Can you please help me to do that? I already dow…

---

## [Range of Date without a defined step (unit step supposed)](https://discourse.julialang.org/t/range-of-date-without-a-defined-step-unit-step-supposed/54734)

<div class="topic-metadata">

**Author:** [@scelles](https://discourse.julialang.org/u/scelles)\
**Replies:** 4\
**Last updated:** [February 6, 2021, 11:38pm UTC](https://discourse.julialang.org/t/range-of-date-without-a-defined-step-unit-step-supposed/54734 "2021-02-06T23:38:18Z")

</div>

Hello, The following code raises an error julia\> Date(2020,1,1):Date(2020,2,1) ERROR: MethodError: Cannot \`convert\` an object of type Int64 to an object of type Day Closest candidates are: convert(::Type{Day}, ::Week…

---

## [Type Inference Problem with \`getproperty\`](https://discourse.julialang.org/t/type-inference-problem-with-getproperty/54585)

<div class="topic-metadata">

**Author:** [@drbassett](https://discourse.julialang.org/u/drbassett)\
**Replies:** 6\
**Last updated:** [February 6, 2021, 10:19pm UTC](https://discourse.julialang.org/t/type-inference-problem-with-getproperty/54585 "2021-02-06T22:19:41Z")

</div>

I apologize in advance for the long post, but I did a good deal of my own analysis first to make sure I was understanding the situation correctly. I wanted to post my findings to save others the trouble of going through …

---

## [How to pass a random array of 2^57 as an input to a function?](https://discourse.julialang.org/t/how-to-pass-a-random-array-of-2-57-as-an-input-to-a-function/54578)

<div class="topic-metadata">

**Author:** [@naviinkapoor](https://discourse.julialang.org/u/naviinkapoor)\
**Replies:** 13\
**Last updated:** [February 6, 2021, 7:49pm UTC](https://discourse.julialang.org/t/how-to-pass-a-random-array-of-2-57-as-an-input-to-a-function/54578 "2021-02-06T19:49:01Z")

</div>

I am creating a function that needs a very large size of the array as an input. Please let me know how can I do that.

---

## [Graph algorithm for Lightgraph](https://discourse.julialang.org/t/graph-algorithm-for-lightgraph/53708)

<div class="topic-metadata">

**Author:** [@AlexanderChen](https://discourse.julialang.org/u/AlexanderChen)\
**Replies:** 15\
**Last updated:** [February 6, 2021, 7:02pm UTC](https://discourse.julialang.org/t/graph-algorithm-for-lightgraph/53708 "2021-02-06T19:02:24Z")

</div>

Hi, below is a graphical representation of 3 SQL Tables with their corresponding columns. And their intertable connections. In red circles are four columns of two different tables that are not directly connected with …

---

## [From C to Julia: Notes from a low-level port](https://discourse.julialang.org/t/from-c-to-julia-notes-from-a-low-level-port/54743)

<div class="topic-metadata">

**Author:** [@adolgert](https://discourse.julialang.org/u/adolgert)\
**Replies:** 7\
**Last updated:** [February 6, 2021, 6:49pm UTC](https://discourse.julialang.org/t/from-c-to-julia-notes-from-a-low-level-port/54743 "2021-02-06T18:49:07Z")

</div>

I ported bit-shifting math from C to Julia and thought I would share notes on gotchas. Simple changes in operators Division - The solidus character, /, becomes div in Julia, ÷. The / in Julia is floating-point division…

---

## [Pluto get the size of output pane/field/cell](https://discourse.julialang.org/t/pluto-get-the-size-of-output-pane-field-cell/54741)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 0\
**Last updated:** [February 6, 2021, 4:32pm UTC](https://discourse.julialang.org/t/pluto-get-the-size-of-output-pane-field-cell/54741 "2021-02-06T16:32:52Z")

</div>

Is there some way to programatically get the size of the output panes/field/cell (sorry, dont know the right term, hopefully it is clear from the context below) in Pluto, for example inside a show method? Use case is th…

---

## [Is this plotting time normal?](https://discourse.julialang.org/t/is-this-plotting-time-normal/54736)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [February 6, 2021, 4:16pm UTC](https://discourse.julialang.org/t/is-this-plotting-time-normal/54736 "2021-02-06T16:16:45Z")

</div>

Been using Julia for \< 1 day, so pardon any dumb questions… I installed the Plots package (using Pkg; pkg.Add("Plots")). (1) Then the first time I did using Plots, I saw "\[ Info: Precompiling Plots \[91a5bcdd-55d7-5caf-…

---

## [Binary heap type problems](https://discourse.julialang.org/t/binary-heap-type-problems/54722)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 1\
**Last updated:** [February 6, 2021, 8:54am UTC](https://discourse.julialang.org/t/binary-heap-type-problems/54722 "2021-02-06T08:54:26Z")

</div>

(A bit of a long post because error messages) i’m trying to generate a binary heap (from DataStructures) where the data item is a pair consisting of an integer and a function. The following works julia\> function f1() …

---

## [So if I have module A defining a struct, then with "using" import the struct to mo](https://discourse.julialang.org/t/so-if-i-have-module-a-defining-a-struct-then-with-using-import-the-struct-to-mo/54704)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [February 6, 2021, 4:41am UTC](https://discourse.julialang.org/t/so-if-i-have-module-a-defining-a-struct-then-with-using-import-the-struct-to-mo/54704 "2021-02-06T04:41:25Z")

</div>

So if I have module A defining a struct, then with “using” import the struct to module B, and define a function on that struct. Then in module C “using” import both module A and B. When I try to run the function on the s…

---

## [How to install PackageCompiler](https://discourse.julialang.org/t/how-to-install-packagecompiler/23824)

<div class="topic-metadata">

**Author:** [@certik](https://discourse.julialang.org/u/certik)\
**Replies:** 6\
**Last updated:** [February 6, 2021, 12:08am UTC](https://discourse.julialang.org/t/how-to-install-packagecompiler/23824 "2021-02-06T00:08:17Z")

</div>

I want to install the PackageCompiler, so that I can execute juliac.jl -vae --compile=all hello.jl. Here is how I have done it: julia\> using Pkg julia\> Pkg.add("PackageCompiler") Here is a simple script called hello.…

---

## [Combinatorial Type Explosion: Nested Parameteric Types](https://discourse.julialang.org/t/combinatorial-type-explosion-nested-parameteric-types/54652)

<div class="topic-metadata">

**Author:** [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Replies:** 12\
**Last updated:** [February 5, 2021, 10:38pm UTC](https://discourse.julialang.org/t/combinatorial-type-explosion-nested-parameteric-types/54652 "2021-02-05T22:38:02Z")

</div>

Let us say I have a bunch of functions that I want to modify based on the stream type. Different density methods for liquid streams and gas streams etc. I create an abstract type “Substance” and define the stream as foll…

---

## [Delaunay Triangulation of Points Scattered Over Triangular Domain](https://discourse.julialang.org/t/delaunay-triangulation-of-points-scattered-over-triangular-domain/54653)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 4\
**Last updated:** [February 5, 2021, 10:01pm UTC](https://discourse.julialang.org/t/delaunay-triangulation-of-points-scattered-over-triangular-domain/54653 "2021-02-05T22:01:48Z")

</div>

I want to triangulate a set of points that are scattered over a two-dimensional triangular domain. For this purpose, I have been looking into a couple of packages including VoronoiDelaunay, GeometryBasics, GeometricalPre…

---

## [Invalid redefinition of constant](https://discourse.julialang.org/t/invalid-redefinition-of-constant/54686)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 2\
**Last updated:** [February 5, 2021, 8:53pm UTC](https://discourse.julialang.org/t/invalid-redefinition-of-constant/54686 "2021-02-05T20:53:55Z")

</div>

i have a function where i define inside the following: function relay(x,y,z) block of code funcQ(v)=qrs.prob(a,v,b) return funcQ then when i want to call the inner function, this happens funcQ= relay(argument list) …

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

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