# General Usage

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

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

**Page:** 1032

---

## [Help subtyping with Parameters.jl](https://discourse.julialang.org/t/help-subtyping-with-parameters-jl/5483)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 2\
**Last updated:** [August 21, 2017, 4:32pm UTC](https://discourse.julialang.org/t/help-subtyping-with-parameters-jl/5483 "2017-08-21T16:32:08Z")

</div>

Could you please help me fix this subtyping error, I don’t know how Parameters.jl is interacting with the code: using Parameters: @with\_kw abstract type AbstractVariogram{T\<:Real,V} end @with\_kw struct GaussianVariogr…

---

## [How does one find a julia package for a specific use?](https://discourse.julialang.org/t/how-does-one-find-a-julia-package-for-a-specific-use/5379)

<div class="topic-metadata">

**Author:** [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Replies:** 17\
**Last updated:** [August 21, 2017, 1:10am UTC](https://discourse.julialang.org/t/how-does-one-find-a-julia-package-for-a-specific-use/5379 "2017-08-21T01:10:18Z")

</div>

I have a more general question about how people are intended to discover julia packages. pkg.julialang.org now has like 1500 packages, and though one can use browser search to search the descriptions, those are often ver…

---

## [Mapslices to tuple of vectors](https://discourse.julialang.org/t/mapslices-to-tuple-of-vectors/5460)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [August 20, 2017, 6:59am UTC](https://discourse.julialang.org/t/mapslices-to-tuple-of-vectors/5460 "2017-08-20T06:59:47Z")

</div>

I have a function that maps a vector to a tuple. I would like to apply this to a matrix by rows, and get a tuple of vectors (mapslices gives me a vector of tuples, I tried zip but I could not get it working). MWE (ineleg…

---

## [Package to concatenate sparse matrices according to a plan?](https://discourse.julialang.org/t/package-to-concatenate-sparse-matrices-according-to-a-plan/5438)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 2\
**Last updated:** [August 20, 2017, 3:32am UTC](https://discourse.julialang.org/t/package-to-concatenate-sparse-matrices-according-to-a-plan/5438 "2017-08-20T03:32:22Z")

</div>

I discovered that my application is spending quite a bit of time concatenating sparse matrices with statements occurring inside of loops of the form A = \[B C C' D\] and the like. In my application, although the n…

---

## [How to understand code availability of @spawn](https://discourse.julialang.org/t/how-to-understand-code-availability-of-spawn/5468)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 1\
**Last updated:** [August 19, 2017, 9:08pm UTC](https://discourse.julialang.org/t/how-to-understand-code-availability-of-spawn/5468 "2017-08-19T21:08:00Z")

</div>

In official documentation, two examples are used: julia\> function rand2(dims...) return 2\*rand(dims...) end julia\> rand2(2,2) 2×2 Array{Float64,2}: 0.153756 0.368514 1.15119 0.918912 julia\> …

---

## [Huge performance hit in 0.6.0 for sparse matrix concatenation](https://discourse.julialang.org/t/huge-performance-hit-in-0-6-0-for-sparse-matrix-concatenation/5419)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 8\
**Last updated:** [August 19, 2017, 7:14pm UTC](https://discourse.julialang.org/t/huge-performance-hit-in-0-6-0-for-sparse-matrix-concatenation/5419 "2017-08-19T19:14:55Z")

</div>

I finally ported my code from 0.5.2 to 0.6.0 and discovered that a test run that took 8h35min in 0.5.2 now takes 15hr in 0.6.0. I have traced the performance problem to the following statement, which takes over 7 times …

---

## [Type stable accumulator over heterogeneous collection](https://discourse.julialang.org/t/type-stable-accumulator-over-heterogeneous-collection/5448)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 3\
**Last updated:** [August 19, 2017, 3:45am UTC](https://discourse.julialang.org/t/type-stable-accumulator-over-heterogeneous-collection/5448 "2017-08-19T03:45:26Z")

</div>

I am working on a library where I cannot avoid heterogeneous collections, and I want type stable code. The MWE below is a typical (but heavily simplified) example of something I would do (transformations, accumulation), …

---

## [Modify Parameters of Type](https://discourse.julialang.org/t/modify-parameters-of-type/5431)

<div class="topic-metadata">

**Author:** [@ckfinite](https://discourse.julialang.org/u/ckfinite)\
**Replies:** 6\
**Last updated:** [August 18, 2017, 9:08pm UTC](https://discourse.julialang.org/t/modify-parameters-of-type/5431 "2017-08-18T21:08:26Z")

</div>

I’m working on a very reflective program, and need to take a type with specified type parameters (e.g. Array{Int64, 1}) and turn it back into a UnionAll (e.g. Array{T, N} where T where N), without mutating the source Dat…

---

## [Coping with \`filter\` type instability](https://discourse.julialang.org/t/coping-with-filter-type-instability/5365)

<div class="topic-metadata">

**Author:** [@gasagna](https://discourse.julialang.org/u/gasagna)\
**Replies:** 2\
**Last updated:** [August 18, 2017, 5:19pm UTC](https://discourse.julialang.org/t/coping-with-filter-type-instability/5365 "2017-08-18T17:19:25Z")

</div>

I am tracking down an annoying type instability in my code and ended up in Iterators.filter from Base. Consider: julia\> f = Iterators.filter(el-\>el==2, rand(1:3, 1000000)) Base.Iterators.Filter{##33#34,Array{Int64,1}}(#…

---

## [\#unused#::Any](https://discourse.julialang.org/t/unused-any/5452)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 1\
**Last updated:** [August 18, 2017, 5:18pm UTC](https://discourse.julialang.org/t/unused-any/5452 "2017-08-18T17:18:08Z")

</div>

Sometimes if I do code\_warntype I see a variable called #unused#::Any in my output, all variables I know about and care about, and temp variables have types correctly inferred by julia, I was just wondering what this #un…

---

## [How to use WeakKeyDict](https://discourse.julialang.org/t/how-to-use-weakkeydict/5411)

<div class="topic-metadata">

**Author:** [@usefulhyun](https://discourse.julialang.org/u/usefulhyun)\
**Replies:** 3\
**Last updated:** [August 18, 2017, 2:09pm UTC](https://discourse.julialang.org/t/how-to-use-weakkeydict/5411 "2017-08-18T14:09:00Z")

</div>

Hi, There I want to use WeakKeyDict type But, I met a error : objects of type \*\*\* cannot be finalized. The only possible type as a key is “string” in my level. Does anyone tell me how to use this? and giving an examp…

---

## [special::Type{MAGIC} where MAGIC](https://discourse.julialang.org/t/special-type-magic-where-magic/5424)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 1\
**Last updated:** [August 17, 2017, 3:15pm UTC](https://discourse.julialang.org/t/special-type-magic-where-magic/5424 "2017-08-17T15:15:33Z")

</div>

Is the foo(::Type{M}) where M trick documented anywhere in the docs? I looked around and couldn’t find anything. I keep feeling like I know what’s going on, but then I hit situations like this, on 0.6: foo1(t::Type, x)…

---

## [Error adding SymEngine ()](https://discourse.julialang.org/t/error-adding-symengine/5329)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 2\
**Last updated:** [August 17, 2017, 1:32pm UTC](https://discourse.julialang.org/t/error-adding-symengine/5329 "2017-08-17T13:32:15Z")

</div>

I have this error on one of four windows machines: SymEngine failed to install julia\> Pkg.add("SymEngine") INFO: Installing SymEngine v0.2.0 INFO: Building Conda INFO: Building SymEngine INFO: Attempting to Create dire…

---

## [Garbage collection from C / Storing jl\_value\_t \* in global C variables](https://discourse.julialang.org/t/garbage-collection-from-c-storing-jl-value-t-in-global-c-variables/3056)

<div class="topic-metadata">

**Author:** [@izaid](https://discourse.julialang.org/u/izaid)\
**Replies:** 7\
**Last updated:** [August 17, 2017, 2:34am UTC](https://discourse.julialang.org/t/garbage-collection-from-c-storing-jl-value-t-in-global-c-variables/3056 "2017-08-17T02:34:27Z")

</div>

Hi all, So, I’ve been trying to understand how to properly do memory management (i.e., preventing premature garbage collection) in Julia from the C API. I know there are posts on this topic already, but I feel like I’m …

---

## [What methods should be defined for a type to be \`\<:AbstractMatrix\`](https://discourse.julialang.org/t/what-methods-should-be-defined-for-a-type-to-be-abstractmatrix/5415)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 1\
**Last updated:** [August 16, 2017, 5:09pm UTC](https://discourse.julialang.org/t/what-methods-should-be-defined-for-a-type-to-be-abstractmatrix/5415 "2017-08-16T17:09:23Z")

</div>

I want to define a type of block diagonal matrix where the diagonal blocks are the same (usually small, always square) size. If there are k blocks, each of size m×m it seems reasonable to use a length k vector of Static…

---

## [50x speed difference in gemv for different values in vector](https://discourse.julialang.org/t/50x-speed-difference-in-gemv-for-different-values-in-vector/2755)

<div class="topic-metadata">

**Author:** [@bastikr](https://discourse.julialang.org/u/bastikr)\
**Replies:** 8\
**Last updated:** [August 16, 2017, 3:07pm UTC](https://discourse.julialang.org/t/50x-speed-difference-in-gemv-for-different-values-in-vector/2755 "2017-08-16T15:07:52Z")

</div>

I’m getting a little bit surprising benchmark results for multiplying certain matrices with vectors. Just changing the values stored in the vector changes the time needed for the multiplication by a factor of 50. The te…

---

## [SpecialFunctions has no versions that support Julia 0.4](https://discourse.julialang.org/t/specialfunctions-has-no-versions-that-support-julia-0-4/5408)

<div class="topic-metadata">

**Author:** [@denizyuret](https://discourse.julialang.org/u/denizyuret)\
**Replies:** 1\
**Last updated:** [August 16, 2017, 11:58am UTC](https://discourse.julialang.org/t/specialfunctions-has-no-versions-that-support-julia-0-4/5408 "2017-08-16T11:58:51Z")

</div>

How do we deal with packages like SpecialFunctions that are only available / needed for certain versions of Julia in the REQUIRE file of another package which support ?

---

## [Question about "type-stability" of Arrays in Julia 0.6](https://discourse.julialang.org/t/question-about-type-stability-of-arrays-in-julia-0-6/5389)

<div class="topic-metadata">

**Author:** [@machakann](https://discourse.julialang.org/u/machakann)\
**Replies:** 3\
**Last updated:** [August 16, 2017, 9:40am UTC](https://discourse.julialang.org/t/question-about-type-stability-of-arrays-in-julia-0-6/5389 "2017-08-16T09:40:19Z")

</div>

Hello! Today I’m reading the doc on performance tips and started to learning it. I’ve tested the @code\_warntype macro with some my codes and got a little weird result. The following function almost do nothing, just make…

---

## [Storing a dispatched method for later use](https://discourse.julialang.org/t/storing-a-dispatched-method-for-later-use/5404)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 1\
**Last updated:** [August 16, 2017, 4:50am UTC](https://discourse.julialang.org/t/storing-a-dispatched-method-for-later-use/5404 "2017-08-16T04:50:05Z")

</div>

Suppose I have several method definitions with the same function name. Is it possible to dispatch a method for specific arguments, store the dispatched function, and use it later? For example, suppose I have types and …

---

## [Understanding memoization.jl](https://discourse.julialang.org/t/understanding-memoization-jl/5394)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 5\
**Last updated:** [August 15, 2017, 8:17pm UTC](https://discourse.julialang.org/t/understanding-memoization-jl/5394 "2017-08-15T20:17:52Z")

</div>

I am trying to understand memoization.jl by simonster to obtain a good understanding of macros. First I tried to macroexpand the output: julia\> using Memoize julia\> macroexpand(:(@memoize function x(a) a end)) quote #…

---

## [How to create a NamedTuples from dynamic field names (for a df to dict converter)](https://discourse.julialang.org/t/how-to-create-a-namedtuples-from-dynamic-field-names-for-a-df-to-dict-converter/5359)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [August 15, 2017, 1:59pm UTC](https://discourse.julialang.org/t/how-to-create-a-namedtuples-from-dynamic-field-names-for-a-df-to-dict-converter/5359 "2017-08-15T13:59:19Z")

</div>

I am trying to write a converter from DataFrame to Dict where the key is a NamedTuples, but I am stuck on how to create the NamedTuples when the “names” are not hard coded but stored in an array: using NamedTuples dimCo…

---

## [Confusion about tasks and Channels](https://discourse.julialang.org/t/confusion-about-tasks-and-channels/5387)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 1\
**Last updated:** [August 15, 2017, 3:12pm UTC](https://discourse.julialang.org/t/confusion-about-tasks-and-channels/5387 "2017-08-15T15:12:22Z")

</div>

I’ve been trying to create code which creates a producer/consumer type process using tasks, and I’m having some trouble, if people don’t mind commenting on a somewhat verbose real world example. This is for code that wil…

---

## [Show for supertype](https://discourse.julialang.org/t/show-for-supertype/5375)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [August 14, 2017, 1:37pm UTC](https://discourse.julialang.org/t/show-for-supertype/5375 "2017-08-14T13:37:38Z")

</div>

I am trying to organize printing for a set of types the following way: a generic function returns a string representation, then show for the supertype just prints it. MWE: abstract type MyAbstractFun \<: Function end Bas…

---

## [Porting old code to Julia6](https://discourse.julialang.org/t/porting-old-code-to-julia6/5296)

<div class="topic-metadata">

**Author:** [@Foolius](https://discourse.julialang.org/u/Foolius)\
**Replies:** 6\
**Last updated:** [August 14, 2017, 12:02pm UTC](https://discourse.julialang.org/t/porting-old-code-to-julia6/5296 "2017-08-14T12:02:13Z")

</div>

I have some older julia code I want to port to julia6. Is there something that helps me with replacing deleted functions for example?

---

## [Inference for tuple of callable objects](https://discourse.julialang.org/t/inference-for-tuple-of-callable-objects/5354)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [August 14, 2017, 11:10am UTC](https://discourse.julialang.org/t/inference-for-tuple-of-callable-objects/5354 "2017-08-14T11:10:49Z")

</div>

I have some objects that are callable, each performing a certain univariate transformation. They are type stable; heavily simplified MWE: using Base.Test struct One end struct Two end (::One)(x) = x+1 (::Two)(x) = x+2…

---

## [Passing a list of arguments to a varargs C function](https://discourse.julialang.org/t/passing-a-list-of-arguments-to-a-varargs-c-function/5271)

<div class="topic-metadata">

**Author:** [@Alexander\_Belopolsky](https://discourse.julialang.org/u/Alexander_Belopolsky)\
**Replies:** 2\
**Last updated:** [August 14, 2017, 3:10am UTC](https://discourse.julialang.org/t/passing-a-list-of-arguments-to-a-varargs-c-function/5271 "2017-08-14T03:10:13Z")

</div>

I can call a varargs C function like printf as follows julia\> ccall(:printf, Int32, (Cstring, Int32...), "%d %d\\n", 42, 43) 42 43 6 However, if I try to pass a list of arguments, I get a strange error julia\> x = Int32…

---

## [Extending Base.in type-stably](https://discourse.julialang.org/t/extending-base-in-type-stably/5341)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 16\
**Last updated:** [August 13, 2017, 11:43pm UTC](https://discourse.julialang.org/t/extending-base-in-type-stably/5341 "2017-08-13T23:43:07Z")

</div>

(My original question seemed a bit convoluted, so I changed it significantly to make it succinct, but the basic questions are the same.) I’m experiencing a difficulty in extending a Base function type-stably. Not sure …

---

## [The poor state of fileformats for High Performance computing](https://discourse.julialang.org/t/the-poor-state-of-fileformats-for-high-performance-computing/5326)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 16\
**Last updated:** [August 13, 2017, 6:55pm UTC](https://discourse.julialang.org/t/the-poor-state-of-fileformats-for-high-performance-computing/5326 "2017-08-13T18:55:29Z")

</div>

About two weeks ago I have put a post asking for recommending the file-format use with high-perfomance computing. Our use-case is training of relatively simple neural networks but using terabytes of data. We do that on a…

---

## [Inplace fft convolution](https://discourse.julialang.org/t/inplace-fft-convolution/5345)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [August 13, 2017, 4:33pm UTC](https://discourse.julialang.org/t/inplace-fft-convolution/5345 "2017-08-13T16:33:30Z")

</div>

Dear all, I would like to perform an inplace fft-based convolution. But somehow my inplace convolution is slower than the regular one. Can anyone give me hint why? Thank you for your help, Best regards Jf(x) = 0.5exp…

---

## [Declaring \_\_precompile\_\_(false) is not allowed in files that are being precompiled](https://discourse.julialang.org/t/declaring---precompile---false-is-not-allowed-in-files-that-are-being-precompiled/5353)

<div class="topic-metadata">

**Author:** [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Replies:** 3\
**Last updated:** [August 13, 2017, 1:44pm UTC](https://discourse.julialang.org/t/declaring---precompile---false-is-not-allowed-in-files-that-are-being-precompiled/5353 "2017-08-13T13:44:52Z")

</div>

I got this recently: julia\> using FreeTypeAbstraction INFO: Precompiling module FreeTypeAbstraction. WARNING: Module Compat with uuid 723476325108 is missing from the cache. This may mean module Compat does not support …

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

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