# General Usage

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

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

**Page:** 928

---

## [Slowdown with StaticArrays and broadcasting](https://discourse.julialang.org/t/slowdown-with-staticarrays-and-broadcasting/16410)

<div class="topic-metadata">

**Author:** [@danielmatz](https://discourse.julialang.org/u/danielmatz)\
**Replies:** 5\
**Last updated:** [October 17, 2018, 8:55pm UTC](https://discourse.julialang.org/t/slowdown-with-staticarrays-and-broadcasting/16410 "2018-10-17T20:55:56Z")

</div>

I’ve been trying to use the master branch of StaticArrays and Julia 1.0.1. My code works fine with the normal Arrays, but when I use SArrays, there’s a noticeable slowdown. Are there still some open issues with StaticA…

---

## [Blank subplot in Plots.jl](https://discourse.julialang.org/t/blank-subplot-in-plots-jl/16453)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 2\
**Last updated:** [October 17, 2018, 6:15pm UTC](https://discourse.julialang.org/t/blank-subplot-in-plots-jl/16453 "2018-10-17T18:15:14Z")

</div>

Is there a way to have a totally blank space in a subplot “slot” using Plots.jl? i.e. instead of plot(rand(10), layout=2), which gives a set of axes, labels, etc. for the second subplot, nothing would be shown in that sp…

---

## [Pkg: "expected a name entry in project file"](https://discourse.julialang.org/t/pkg-expected-a-name-entry-in-project-file/16448)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 2\
**Last updated:** [October 17, 2018, 5:14pm UTC](https://discourse.julialang.org/t/pkg-expected-a-name-entry-in-project-file/16448 "2018-10-17T17:14:15Z")

</div>

(v0.7) pkg\> dev "\<snipped-path\>:cbinz/Tango.jl" Updating git-repo \`\<snipped-path\>:cbinz/Tango.jl\` ERROR: expected a \`name\` entry in project file at C:\\cygwin64\\tmp\\jl\_615.tmp\\Project.toml Maybe Tango’s Project.toml wa…

---

## [Union as constructor fails on nightly](https://discourse.julialang.org/t/union-as-constructor-fails-on-nightly/16301)

<div class="topic-metadata">

**Author:** [@Per](https://discourse.julialang.org/u/Per)\
**Replies:** 5\
**Last updated:** [October 17, 2018, 1:45pm UTC](https://discourse.julialang.org/t/union-as-constructor-fails-on-nightly/16301 "2018-10-17T13:45:15Z")

</div>

In a package that I’m writing, I’m using a Union as a constructor (with dispatch to select one of the types from the union). Here’s a minimal working example: struct N{X} \<: Number end struct I{X} \<: Integer end U{X} …

---

## [Warning: Package A does not have B in its dependencies](https://discourse.julialang.org/t/warning-package-a-does-not-have-b-in-its-dependencies/16424)

<div class="topic-metadata">

**Author:** [@jtackm](https://discourse.julialang.org/u/jtackm)\
**Replies:** 6\
**Last updated:** [October 17, 2018, 1:41pm UTC](https://discourse.julialang.org/t/warning-package-a-does-not-have-b-in-its-dependencies/16424 "2018-10-17T13:41:57Z")

</div>

I’m getting the following warning when precompiling a package I’m working on: julia\> using FlashWeave \[ Info: Recompiling stale cache file \<some\_path\>/.julia/compiled/v1.0/FlashWeave/PSwZf.ji for FlashWeave \[2be3f83a-79…

---

## [Dear MIT,Please give us your plan for multithreading?](https://discourse.julialang.org/t/dear-mit-please-give-us-your-plan-for-multithreading/16433)

<div class="topic-metadata">

**Author:** [@564064202](https://discourse.julialang.org/u/564064202)\
**Replies:** 1\
**Last updated:** [October 17, 2018, 12:39pm UTC](https://discourse.julialang.org/t/dear-mit-please-give-us-your-plan-for-multithreading/16433 "2018-10-17T12:39:18Z")

</div>

Dear MIT,Please give us your plan for multithreading?

---

## [When I run my proramm with large arrays, when it ends the momory remain allocated](https://discourse.julialang.org/t/when-i-run-my-proramm-with-large-arrays-when-it-ends-the-momory-remain-allocated/16393)

<div class="topic-metadata">

**Author:** [@dsHitman](https://discourse.julialang.org/u/dsHitman)\
**Replies:** 4\
**Last updated:** [October 17, 2018, 10:51am UTC](https://discourse.julialang.org/t/when-i-run-my-proramm-with-large-arrays-when-it-ends-the-momory-remain-allocated/16393 "2018-10-17T10:51:08Z")

</div>

Hi, how I can dealocate memory after I run my programm? Because when I run my ptogramm with big arrays when it ends the memory remain allocated. I try to use the gc() function but Hulia says “ERROR: LoadError: UndefVarEr…

---

## [Unitful for file size](https://discourse.julialang.org/t/unitful-for-file-size/16423)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 2\
**Last updated:** [October 17, 2018, 5:38am UTC](https://discourse.julialang.org/t/unitful-for-file-size/16423 "2018-10-17T05:38:08Z")

</div>

Just checking, is there no Unitful supplementary package for converting file sizes (i.e. bit, byte, KiB, MiB, GiB…)?

---

## [Gurobi.jl not released for 1.0 yet?](https://discourse.julialang.org/t/gurobi-jl-not-released-for-1-0-yet/16380)

<div class="topic-metadata">

**Author:** [@xiaoweiz](https://discourse.julialang.org/u/xiaoweiz)\
**Replies:** 4\
**Last updated:** [October 17, 2018, 1:58am UTC](https://discourse.julialang.org/t/gurobi-jl-not-released-for-1-0-yet/16380 "2018-10-17T01:58:57Z")

</div>

(v1.0) pkg\> add Gurobi Cloning git-repo Gurobi ERROR: Git repository not found at ‘Gurobi’

---

## [Ref expression receivers](https://discourse.julialang.org/t/ref-expression-receivers/16426)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 5\
**Last updated:** [October 16, 2018, 11:24pm UTC](https://discourse.julialang.org/t/ref-expression-receivers/16426 "2018-10-16T23:24:09Z")

</div>

In a ref expression such as a\[:x\] =5 a\[1\] = 12 what can a be? a dictionary, an array and what else? Thanks

---

## [Split iteration to head + tail](https://discourse.julialang.org/t/split-iteration-to-head-tail/16406)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [October 16, 2018, 9:21pm UTC](https://discourse.julialang.org/t/split-iteration-to-head-tail/16406 "2018-10-16T21:21:27Z")

</div>

Sometimes it is necessary to handle the first element of an iterable separately, then work with the rest. I am wondering how to code these things cleanly. To make things concrete, consider this example (calling iterate …

---

## [Diagnosing NaNs from ForwardDiff](https://discourse.julialang.org/t/diagnosing-nans-from-forwarddiff/16364)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 4\
**Last updated:** [October 16, 2018, 12:07pm UTC](https://discourse.julialang.org/t/diagnosing-nans-from-forwarddiff/16364 "2018-10-16T12:07:21Z")

</div>

I am getting a lot of NaNs from ForwardDiff.gradient on a fairly complicated function. I have an analytical function to compute the gradient that works fine (doesn’t give NaN), and coincides with ForwardDiff’s result wh…

---

## [Any idea why 10^32 = -8814407033341083648](https://discourse.julialang.org/t/any-idea-why-10-32-8814407033341083648/16394)

<div class="topic-metadata">

**Author:** [@lucabrugnolini](https://discourse.julialang.org/u/lucabrugnolini)\
**Replies:** 2\
**Last updated:** [October 16, 2018, 11:26am UTC](https://discourse.julialang.org/t/any-idea-why-10-32-8814407033341083648/16394 "2018-10-16T11:26:54Z")

</div>

As in the topic title, I have found some strange behavior in Julia by exponentiating 10^large\_number. In particular, I get negative numbers for some exponents. Also, the log function is treating these numbers as complex. …

---

## [Fastest way of doing (constant sparse) \* SVector multiplication](https://discourse.julialang.org/t/fastest-way-of-doing-constant-sparse-svector-multiplication/16365)

<div class="topic-metadata">

**Author:** [@natschil](https://discourse.julialang.org/u/natschil)\
**Replies:** 9\
**Last updated:** [October 16, 2018, 10:40am UTC](https://discourse.julialang.org/t/fastest-way-of-doing-constant-sparse-svector-multiplication/16365 "2018-10-16T10:40:03Z")

</div>

Background: I have an implementation of tricubic interpolation that works, but is ~20x slower than my implementation of trilinear interpolation despite only requiring (in theory) 8x as many memory accesses. Essentially …

---

## [var is not defined](https://discourse.julialang.org/t/var-is-not-defined/16382)

<div class="topic-metadata">

**Author:** [@lannisite110](https://discourse.julialang.org/u/lannisite110)\
**Replies:** 2\
**Last updated:** [October 16, 2018, 8:40am UTC](https://discourse.julialang.org/t/var-is-not-defined/16382 "2018-10-16T08:40:18Z")

</div>

julia\> using ArgParse julia\> @add\_arg\_table s begin (“–seed”; arg\_type=Int; default=42) (“–nbatch”; arg\_type=Int; default=100) (“–lr”; arg\_type=Float64; default=0.00001) (“–epochs”; arg\_type=Int; default=5) (“–gche…

---

## [Is the garbage collector non-compacting?](https://discourse.julialang.org/t/is-the-garbage-collector-non-compacting/16335)

<div class="topic-metadata">

**Author:** [@Steven\_Sagaert](https://discourse.julialang.org/u/Steven_Sagaert)\
**Replies:** 5\
**Last updated:** [October 16, 2018, 7:48am UTC](https://discourse.julialang.org/t/is-the-garbage-collector-non-compacting/16335 "2018-10-16T07:48:19Z")

</div>

If I serialize a model to a file and then restart julia and read in that model again, the memory usage is much lower so I get the impression that the CG is non-compacting, i.e. memory becomes fragmented and a lot of memo…

---

## [Pkg Manager, using Branches and Tags in Extra / Target?](https://discourse.julialang.org/t/pkg-manager-using-branches-and-tags-in-extra-target/16387)

<div class="topic-metadata">

**Author:** [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Replies:** 3\
**Last updated:** [October 16, 2018, 6:44am UTC](https://discourse.julialang.org/t/pkg-manager-using-branches-and-tags-in-extra-target/16387 "2018-10-16T06:44:16Z")

</div>

In the Julia v0.7/1.0 package manager, is it possible to specify a specific branch or tag for a dependency that is only used in the extra / target section?

---

## [Unique! and sorted collections](https://discourse.julialang.org/t/unique-and-sorted-collections/16352)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 5\
**Last updated:** [October 16, 2018, 6:12am UTC](https://discourse.julialang.org/t/unique-and-sorted-collections/16352 "2018-10-16T06:12:48Z")

</div>

Consider a = rand(1:10\_000\_000, 100\_000\_000) b = sort(a) c = copy(a) unique!(c) takes 6.79s. unique!(b) takes 0.35s. However, it seems to me that unique! does an issorted first. If we call \_groupedunique! first, we s…

---

## [Does @distributed have any guarantees regarding order?](https://discourse.julialang.org/t/does-distributed-have-any-guarantees-regarding-order/16381)

<div class="topic-metadata">

**Author:** [@Kenneth\_Steimel](https://discourse.julialang.org/u/Kenneth_Steimel)\
**Replies:** 0\
**Last updated:** [October 16, 2018, 2:30am UTC](https://discourse.julialang.org/t/does-distributed-have-any-guarantees-regarding-order/16381 "2018-10-16T02:30:47Z")

</div>

I’m running a parallel for loop with hcat as the reduction operation. Something like this res = @distributed hcat for i=1:1000 i end Is there any guarantee that i is in order? I saw some old pointers saying there w…

---

## [Minimizing Work in Copying/Manipulating Custom Data Structures](https://discourse.julialang.org/t/minimizing-work-in-copying-manipulating-custom-data-structures/16284)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 12\
**Last updated:** [October 16, 2018, 12:45am UTC](https://discourse.julialang.org/t/minimizing-work-in-copying-manipulating-custom-data-structures/16284 "2018-10-16T00:45:21Z")

</div>

I have a computation I want to do where I am using my own data structure (composed of two or more arrays, which, themselves, may be specialized data structures). I want to perform an operation on this data structure in …

---

## [Way to fix ImageMagick on Mac?](https://discourse.julialang.org/t/way-to-fix-imagemagick-on-mac/16369)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 1\
**Last updated:** [October 15, 2018, 11:36pm UTC](https://discourse.julialang.org/t/way-to-fix-imagemagick-on-mac/16369 "2018-10-15T23:36:39Z")

</div>

I keep getting the following error message from trying to use imagemagick: julia\> Pkg.build("ImageMagick") INFO: Building Homebrew Already up-to-date. INFO: Building FFTW INFO: Building SpecialFunctions INFO: Building …

---

## [Finding all the functions with a parametric abstract type as a argument](https://discourse.julialang.org/t/finding-all-the-functions-with-a-parametric-abstract-type-as-a-argument/16332)

<div class="topic-metadata">

**Author:** [@jlperla](https://discourse.julialang.org/u/jlperla)\
**Replies:** 4\
**Last updated:** [October 15, 2018, 9:26pm UTC](https://discourse.julialang.org/t/finding-all-the-functions-with-a-parametric-abstract-type-as-a-argument/16332 "2018-10-15T21:26:31Z")

</div>

Reflective programming/Metaprogramming challenge: I am interested in exploring which methods are defined directly for some (usually parametric) and usually abstract types. To be clear, my interest is only in those meth…

---

## [Weird allocation from SharedArrays/StaticArrays](https://discourse.julialang.org/t/weird-allocation-from-sharedarrays-staticarrays/16354)

<div class="topic-metadata">

**Author:** [@natschil](https://discourse.julialang.org/u/natschil)\
**Replies:** 2\
**Last updated:** [October 15, 2018, 6:44pm UTC](https://discourse.julialang.org/t/weird-allocation-from-sharedarrays-staticarrays/16354 "2018-10-15T18:44:49Z")

</div>

Hi, I’m getting an allocation from the following code, which results in a factor 20x slowdown in this MWE: using SharedArrays,BenchmarkTools,StaticArrays U = SharedArray{Float64}(zeros(100,100,100)) function mytestfu…

---

## [Controlling the new Logger (@debug messages)](https://discourse.julialang.org/t/controlling-the-new-logger-debug-messages/13732)

<div class="topic-metadata">

**Author:** [@Glen](https://discourse.julialang.org/u/Glen)\
**Replies:** 2\
**Last updated:** [October 15, 2018, 6:34pm UTC](https://discourse.julialang.org/t/controlling-the-new-logger-debug-messages/13732 "2018-10-15T18:34:30Z")

</div>

In 1.0 the new logging system has the @debug macro which only gets run if you turn on debug logging so no loss in performance. I can’t however figure out how to change the log level to get @debug messages to be printed.…

---

## [Performance input on my code](https://discourse.julialang.org/t/performance-input-on-my-code/16321)

<div class="topic-metadata">

**Author:** [@jarrison](https://discourse.julialang.org/u/jarrison)\
**Replies:** 8\
**Last updated:** [October 15, 2018, 5:00pm UTC](https://discourse.julialang.org/t/performance-input-on-my-code/16321 "2018-10-15T17:00:49Z")

</div>

Hey all! I have just picked up Julia as a fun language to learn and have been translating old python code both as a learning experience and to see just how much performance i can squeeze out of it. I think I have gotten …

---

## [The 2048 challenge: fastest ways to simulate games of 2048 in Julia](https://discourse.julialang.org/t/the-2048-challenge-fastest-ways-to-simulate-games-of-2048-in-julia/16331)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 8\
**Last updated:** [October 15, 2018, 4:44pm UTC](https://discourse.julialang.org/t/the-2048-challenge-fastest-ways-to-simulate-games-of-2048-in-julia/16331 "2018-10-15T16:44:56Z")

</div>

I am sure many of you have played the game 2048. I have been writing a simulation engine for 2048 in Julia which I hope to eventually contribute back to a package like Reinforce.jl as an environment. If you enjoy program…

---

## [Access logged values](https://discourse.julialang.org/t/access-logged-values/16185)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 8\
**Last updated:** [October 15, 2018, 4:26pm UTC](https://discourse.julialang.org/t/access-logged-values/16185 "2018-10-15T16:26:56Z")

</div>

I am trying to use the new Logging system. I did a @warn "a warning" x y z, where x,y,z are complicated structures that I want to analyze. I see that x,y,z get printed with the warning. Is there a way to access their val…

---

## [Typeof view](https://discourse.julialang.org/t/typeof-view/16349)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 2\
**Last updated:** [October 15, 2018, 4:15pm UTC](https://discourse.julialang.org/t/typeof-view/16349 "2018-10-15T16:15:13Z")

</div>

I am creating a struct that contains an array, and views into this array. I need to specify the type of the view when declaring the struct, but: julia\> X = rand(10,5,6); julia\> typeof(@view X\[:,:,1:4\]) SubArray{Float64…

---

## [Precompilation failure](https://discourse.julialang.org/t/precompilation-failure/16345)

<div class="topic-metadata">

**Author:** [@AsafManela](https://discourse.julialang.org/u/AsafManela)\
**Replies:** 6\
**Last updated:** [October 15, 2018, 4:10pm UTC](https://discourse.julialang.org/t/precompilation-failure/16345 "2018-10-15T16:10:40Z")

</div>

I’m encountering precompilation failures with a package that uses TextAnalysis.jl See minimal example here: https://github.com/AsafManela/TextAnalysisUser.jl As you can see below, whenever I call “using TextAnalysisUse…

---

## [\`rand((1,2))\` vs \`rand(1,2)\`?](https://discourse.julialang.org/t/rand-1-2-vs-rand-1-2/16254)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 6\
**Last updated:** [October 15, 2018, 2:54pm UTC](https://discourse.julialang.org/t/rand-1-2-vs-rand-1-2/16254 "2018-10-15T14:54:19Z")

</div>

I get the following error (Julia 1.0.1) julia\> rand((1,2)) ERROR: rand(rng, dims) is discontinued; try rand(rng, Float64, dims) Stacktrace: \[1\] error(::String) at ./error.jl:33 \[2\] rand(::Random.MersenneTwister, ::Tup…

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

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