# General Usage

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

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

**Page:** 1049

---

## [\[0.6\]\[CxxWrap\] \`expected DataType, got Type\`](https://discourse.julialang.org/t/0-6-cxxwrap-expected-datatype-got-type/3833)

<div class="topic-metadata">

**Author:** [@SylvainCorlay](https://discourse.julialang.org/u/SylvainCorlay)\
**Replies:** 1\
**Last updated:** [May 22, 2017, 6:36am UTC](https://discourse.julialang.org/t/0-6-cxxwrap-expected-datatype-got-type/3833 "2017-05-22T06:36:48Z")

</div>

Testing xtensor-julia with julia 0.6.0-rc2, I am having the following issue: TypeError: arrayset: expected DataType, got Type{Array{Float64,N} where N} coming from static jl\_datatype\_t\* julia\_type() { // Array{T} …

---

## [Unroll and Vectorize EvalPoly](https://discourse.julialang.org/t/unroll-and-vectorize-evalpoly/3835)

<div class="topic-metadata">

**Author:** [@goldfita](https://discourse.julialang.org/u/goldfita)\
**Replies:** 9\
**Last updated:** [May 22, 2017, 3:43am UTC](https://discourse.julialang.org/t/unroll-and-vectorize-evalpoly/3835 "2017-05-22T03:43:06Z")

</div>

I often encounter problems like the following where I want to vectorize a short numerical algorithm but keep the code as high level as possible so I can change the precision, filter length, or other parameters. This fun…

---

## [Linear solver \\(A, B) performance vs Matlab A\\b](https://discourse.julialang.org/t/linear-solver-a-b-performance-vs-matlab-a-b/2082)

<div class="topic-metadata">

**Author:** [@Tecnezio](https://discourse.julialang.org/u/Tecnezio)\
**Replies:** 32\
**Last updated:** [May 21, 2017, 11:34pm UTC](https://discourse.julialang.org/t/linear-solver-a-b-performance-vs-matlab-a-b/2082 "2017-05-21T23:34:48Z")

</div>

I’m analyzing the performance of julia linear solver (A,B) vs the Matlab solver. Julia is fast only on the second call of the solver and only for small (A) matrix. Over size of A 500x500, julia solver is always slower t…

---

## [Generated (staged) function to avoid initializing an array multiple times for Monte Carlo simulations](https://discourse.julialang.org/t/generated-staged-function-to-avoid-initializing-an-array-multiple-times-for-monte-carlo-simulations/3726)

<div class="topic-metadata">

**Author:** [@vmh](https://discourse.julialang.org/u/vmh)\
**Replies:** 22\
**Last updated:** [May 21, 2017, 2:05pm UTC](https://discourse.julialang.org/t/generated-staged-function-to-avoid-initializing-an-array-multiple-times-for-monte-carlo-simulations/3726 "2017-05-21T14:05:27Z")

</div>

Hi everyone, I have a function that returns an array (vector) of samples from a given distribution. E.g., consider the function below: function draw\_samples(dist) samples = Array{Float64, 1}(1000) rand!(dist, s…

---

## [Fast lookup of bits types using dispatch](https://discourse.julialang.org/t/fast-lookup-of-bits-types-using-dispatch/3809)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [May 21, 2017, 9:55am UTC](https://discourse.julialang.org/t/fast-lookup-of-bits-types-using-dispatch/3809 "2017-05-21T09:55:02Z")

</div>

I am playing with this problem for my own education only, to learn more about dispatch and computations on the type system. Questions at the end. Objective: implement something like findfirst((:a, :b, :c), x) that would…

---

## [Julia v0.7 causing Travis nightly build to fail](https://discourse.julialang.org/t/julia-v0-7-causing-travis-nightly-build-to-fail/3827)

<div class="topic-metadata">

**Author:** [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Replies:** 7\
**Last updated:** [May 21, 2017, 5:09am UTC](https://discourse.julialang.org/t/julia-v0-7-causing-travis-nightly-build-to-fail/3827 "2017-05-21T05:09:03Z")

</div>

Recently my package’s nightly build on travis started to break. // i.e. not my release builds, they still pass I checked the logs and it seems to be because they now run v0.7 of Julia. What’s the best way to prevent t…

---

## [Weird memory allocation](https://discourse.julialang.org/t/weird-memory-allocation/3796)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 24\
**Last updated:** [May 20, 2017, 2:08pm UTC](https://discourse.julialang.org/t/weird-memory-allocation/3796 "2017-05-20T14:08:30Z")

</div>

Every single call of this function results in memory allocation. I have narrowed it down to the call to Jacobiansurface: if that call is eliminated, there is no memory allocation. function Jacobianvolume{T\<:FESet2Mani…

---

## [0.6 nightlies?](https://discourse.julialang.org/t/0-6-nightlies/3588)

<div class="topic-metadata">

**Author:** [@asampal](https://discourse.julialang.org/u/asampal)\
**Replies:** 10\
**Last updated:** [May 20, 2017, 6:09am UTC](https://discourse.julialang.org/t/0-6-nightlies/3588 "2017-05-20T06:09:12Z")

</div>

Now that Nightlies have gone to 0.7, would it be possible to provide frequent builds for 0.6 as it approaches release? I’m specifically interested in Windows binaries. Maybe it would make sense to have two sets of Night…

---

## [Allocations in @threads loop](https://discourse.julialang.org/t/allocations-in-threads-loop/3814)

<div class="topic-metadata">

**Author:** [@mcovalt](https://discourse.julialang.org/u/mcovalt)\
**Replies:** 3\
**Last updated:** [May 20, 2017, 2:28am UTC](https://discourse.julialang.org/t/allocations-in-threads-loop/3814 "2017-05-20T02:28:40Z")

</div>

With the following code: function thread\_test(x::Vector{Float64}, y::Vector{Float64}, z::Vector{Float64}, n::Int64) for j = 1:10000 a::Vector{Int64} = rand(1:n, 128) b::Vector{Int64} = rand(1:n, 128)…

---

## [Finding documentation for other versions of Julia](https://discourse.julialang.org/t/finding-documentation-for-other-versions-of-julia/3811)

<div class="topic-metadata">

**Author:** [@dpo](https://discourse.julialang.org/u/dpo)\
**Replies:** 2\
**Last updated:** [May 20, 2017, 1:25am UTC](https://discourse.julialang.org/t/finding-documentation-for-other-versions-of-julia/3811 "2017-05-20T01:25:06Z")

</div>

It used to be easy to browse documentation for various versions of Julia but the pull-down now seems to have disappeared. Clicking the documentation link on julialang.org presumably leads to the documentation for 0.5.2 …

---

## [Custom indexing for an AbstractVector breaks display (but not show)](https://discourse.julialang.org/t/custom-indexing-for-an-abstractvector-breaks-display-but-not-show/3813)

<div class="topic-metadata">

**Author:** [@Michael\_Eastwood](https://discourse.julialang.org/u/Michael_Eastwood)\
**Replies:** 7\
**Last updated:** [May 20, 2017, 12:27am UTC](https://discourse.julialang.org/t/custom-indexing-for-an-abstractvector-breaks-display-but-not-show/3813 "2017-05-20T00:27:56Z")

</div>

Consider the following example: julia\> struct Foo \<: AbstractVector{Int} bar :: Vector{Int} end Base.size(foo::Foo) = size(foo.bar) Base.getindex(foo::Foo, idx) = foo.bar\[idx\] Base…

---

## [Help making function faster](https://discourse.julialang.org/t/help-making-function-faster/3793)

<div class="topic-metadata">

**Author:** [@favba](https://discourse.julialang.org/u/favba)\
**Replies:** 3\
**Last updated:** [May 19, 2017, 7:29pm UTC](https://discourse.julialang.org/t/help-making-function-faster/3793 "2017-05-19T19:29:40Z")

</div>

In order to save memory in my computations I created a module with array wrappers (named TransformableFields) and in-place rfft! and irfft!. The module can be found here InPlaceRealFFT.jl. There is no dependencies, so I…

---

## [Function in type definition](https://discourse.julialang.org/t/function-in-type-definition/3790)

<div class="topic-metadata">

**Author:** [@Ferran\_Mazzanti](https://discourse.julialang.org/u/Ferran_Mazzanti)\
**Replies:** 24\
**Last updated:** [May 19, 2017, 2:04pm UTC](https://discourse.julialang.org/t/function-in-type-definition/3790 "2017-05-19T14:04:21Z")

</div>

Hi folks, this is something that has been in my mind for few days now, and that finally want to know. The question is: is it possible to include a function as part of a type definition? I mean, something of the form: t…

---

## [Applicative sequences: make, edit, store, apply](https://discourse.julialang.org/t/applicative-sequences-make-edit-store-apply/3795)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 4\
**Last updated:** [May 19, 2017, 1:21pm UTC](https://discourse.julialang.org/t/applicative-sequences-make-edit-store-apply/3795 "2017-05-19T13:21:00Z")

</div>

others have done something this well (afair) I have some .csv files with two columns: timestamp, measure and a panoply of operators (some go to timestamp, others to measures). I hope to provide a welcome and performan…

---

## [Non-deterministic behavior of eigs](https://discourse.julialang.org/t/non-deterministic-behavior-of-eigs/3801)

<div class="topic-metadata">

**Author:** [@rleegates](https://discourse.julialang.org/u/rleegates)\
**Replies:** 1\
**Last updated:** [May 19, 2017, 7:10am UTC](https://discourse.julialang.org/t/non-deterministic-behavior-of-eigs/3801 "2017-05-19T07:10:02Z")

</div>

Is this the intended behavior? I would expect the ritz vectors to be the canonical basis in R^8 and I would expect them to stay constant throughout multiple runs (eigenvalues are always ones(3) as expected). Can anyone f…

---

## [Bindings to external lib work with 0.5, but fail with 0.6-rc1](https://discourse.julialang.org/t/bindings-to-external-lib-work-with-0-5-but-fail-with-0-6-rc1/3734)

<div class="topic-metadata">

**Author:** [@jstrube](https://discourse.julialang.org/u/jstrube)\
**Replies:** 6\
**Last updated:** [May 19, 2017, 5:41am UTC](https://discourse.julialang.org/t/bindings-to-external-lib-work-with-0-5-but-fail-with-0-6-rc1/3734 "2017-05-19T05:41:07Z")

</div>

I’m trying to update my LCIO.jl package (which uses CxxWrap.jl) to julia-0.6, but I’m failing. A simple Pkg.add("LCIO") Pkg.test("LCIO") passes in julia-0.5, but fails in julia-0.6-rc1. I can’t figure out what’s goin…

---

## [Overriding cookie generation/handling in Slurm connection manager](https://discourse.julialang.org/t/overriding-cookie-generation-handling-in-slurm-connection-manager/3791)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 0\
**Last updated:** [May 18, 2017, 5:23pm UTC](https://discourse.julialang.org/t/overriding-cookie-generation-handling-in-slurm-connection-manager/3791 "2017-05-18T17:23:43Z")

</div>

(This is a cross post from Example of reading cookie from (shared) file? · Issue #69 · JuliaParallel/ClusterManagers.jl · GitHub since it hasn’t gotten any responses there.) I need to figure out how to store / retrieve …

---

## [Sparse SVD (smallest SVs)](https://discourse.julialang.org/t/sparse-svd-smallest-svs/3645)

<div class="topic-metadata">

**Author:** [@rleegates](https://discourse.julialang.org/u/rleegates)\
**Replies:** 21\
**Last updated:** [May 18, 2017, 2:30pm UTC](https://discourse.julialang.org/t/sparse-svd-smallest-svs/3645 "2017-05-18T14:30:52Z")

</div>

Is there a package which provides a singular value decomposition of a (square, numerically unsymmetric, structurally symmetric, indefinite) sparse matrix and allows for finding the n smallest singular values (instead of …

---

## [Suitability of overriding == (vs ===)?](https://discourse.julialang.org/t/suitability-of-overriding-vs/2478)

<div class="topic-metadata">

**Author:** [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Replies:** 4\
**Last updated:** [May 18, 2017, 9:18am UTC](https://discourse.julialang.org/t/suitability-of-overriding-vs/2478 "2017-05-18T09:18:27Z")

</div>

Some advice, please. Consider a structure like this: immutable Foo x::Int y::Int s::String end (In the past, this type didn’t have s so == just compared x and y.) I’d still like to have == compare x and y, but i…

---

## [Splat on a vector uses allocations and not on a tuple](https://discourse.julialang.org/t/splat-on-a-vector-uses-allocations-and-not-on-a-tuple/3776)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 1\
**Last updated:** [May 17, 2017, 7:55pm UTC](https://discourse.julialang.org/t/splat-on-a-vector-uses-allocations-and-not-on-a-tuple/3776 "2017-05-17T19:55:13Z")

</div>

In the following example, I am passing a set of subscripts i, j, k of a 3-dimensional array A in the form of vector v = \[i,j,k\] or tuple t = (i,j,k) using a splat .... I find that A\[v...\] uses 2 allocations whereas A\[t…

---

## [PlotlyJS.plot(data) using data from a Dictionary](https://discourse.julialang.org/t/plotlyjs-plot-data-using-data-from-a-dictionary/3775)

<div class="topic-metadata">

**Author:** [@PHP](https://discourse.julialang.org/u/PHP)\
**Replies:** 1\
**Last updated:** [May 17, 2017, 4:59pm UTC](https://discourse.julialang.org/t/plotlyjs-plot-data-using-data-from-a-dictionary/3775 "2017-05-17T16:59:47Z")

</div>

data = \[traceState\[“traceAlabama”\], traceState\[“traceAlaska”\], traceState\[“traceArizona”\]\] I am trying to produce the above code using for loop with the below code data = for j in state\[:Area\] data = \[data, traceS…

---

## [Assigning a macro to a variable](https://discourse.julialang.org/t/assigning-a-macro-to-a-variable/3773)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 2\
**Last updated:** [May 17, 2017, 3:34pm UTC](https://discourse.julialang.org/t/assigning-a-macro-to-a-variable/3773 "2017-05-17T15:34:42Z")

</div>

We can assign a function to a variable: julia\> f = sin sin (generic function with 10 methods) julia\> f(1) 0.8414709848078965 Can we do something similar with a macro? For example, I want to do something like this: j…

---

## [Pointer to Julia function in ccall](https://discourse.julialang.org/t/pointer-to-julia-function-in-ccall/3768)

<div class="topic-metadata">

**Author:** [@igor.cerovsky](https://discourse.julialang.org/u/igor.cerovsky)\
**Replies:** 4\
**Last updated:** [May 17, 2017, 2:01pm UTC](https://discourse.julialang.org/t/pointer-to-julia-function-in-ccall/3768 "2017-05-17T14:01:43Z")

</div>

Is there a way to use pointer to Julia function in ccall? Following the documentation https://docs.julialang.org/en/stable/manual/calling-c-and-fortran-code/ the kernel (Julia 0.5.1) crashes (and there is no alias for C v…

---

## [Macros not working as expected](https://discourse.julialang.org/t/macros-not-working-as-expected/3753)

<div class="topic-metadata">

**Author:** [@Anirudh\_Krishna](https://discourse.julialang.org/u/Anirudh_Krishna)\
**Replies:** 3\
**Last updated:** [May 17, 2017, 3:24am UTC](https://discourse.julialang.org/t/macros-not-working-as-expected/3753 "2017-05-17T03:24:24Z")

</div>

Hi everyone, I’ve just started using Julia and was trying to understand how macros work. I ran two simple tests with the macros devec and parallel and it seems to be getting slower instead of faster. Here are the two si…

---

## [Performance of functions returned from container](https://discourse.julialang.org/t/performance-of-functions-returned-from-container/3747)

<div class="topic-metadata">

**Author:** [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Replies:** 8\
**Last updated:** [May 17, 2017, 12:11am UTC](https://discourse.julialang.org/t/performance-of-functions-returned-from-container/3747 "2017-05-17T00:11:53Z")

</div>

I’m in the process of writing an NES emulator. Many of the steps of this are surprisingly performance critical, at least if you do a full simulation of the CPU, which is of course the easy way (on a semi-modern, cheap l…

---

## [Functions in an input file-- how?](https://discourse.julialang.org/t/functions-in-an-input-file-how/3707)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 35\
**Last updated:** [May 16, 2017, 9:43pm UTC](https://discourse.julialang.org/t/functions-in-an-input-file-how/3707 "2017-05-16T21:43:59Z")

</div>

In finite element software, there is a notion of an ‘input file’, that is, input to the solver program, that contains the mesh, the boundary conditions, material properties, algorithmic choices and so on. In their full …

---

## [Spurious allocation?](https://discourse.julialang.org/t/spurious-allocation/3751)

<div class="topic-metadata">

**Author:** [@jebej](https://discourse.julialang.org/u/jebej)\
**Replies:** 6\
**Last updated:** [May 16, 2017, 5:40pm UTC](https://discourse.julialang.org/t/spurious-allocation/3751 "2017-05-16T17:40:13Z")

</div>

This is a really simple problem, and I’m not sure if I’m missing anything obvious here, but why is the following operation allocating memory? B = Matrix{Float64}(10,10^5); @time for j=1:10^5,i=1:10 B\[i,j\] = 1.0 end …

---

## [Multithreading performance regressions in 0.6?](https://discourse.julialang.org/t/multithreading-performance-regressions-in-0-6/3748)

<div class="topic-metadata">

**Author:** [@ksmcreynolds](https://discourse.julialang.org/u/ksmcreynolds)\
**Replies:** 2\
**Last updated:** [May 16, 2017, 4:11pm UTC](https://discourse.julialang.org/t/multithreading-performance-regressions-in-0-6/3748 "2017-05-16T16:11:40Z")

</div>

I’ve noticed two different performance regressions using the @threads macro when running my code on 0.6.0-rc1 vs 0.5.2. The first is a more significant regression (~400x slower) with a simple solution. The second is less…

---

## [Better DOY Conversion?](https://discourse.julialang.org/t/better-doy-conversion/3744)

<div class="topic-metadata">

**Author:** [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Replies:** 3\
**Last updated:** [May 16, 2017, 2:04pm UTC](https://discourse.julialang.org/t/better-doy-conversion/3744 "2017-05-16T14:04:20Z")

</div>

Is there an easy way of converting a DateTime to a string with Day Of Year (DOY)? julia\> time = DateTime(2017,5,16,14,20) julia\> floor(convert(Float64,time - DateTime(Dates.Year(time)) + DateTime(Dates.Day(1)))/1000/60/…

---

## [Typealias gone in 1.0?](https://discourse.julialang.org/t/typealias-gone-in-1-0/3712)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 3\
**Last updated:** [May 16, 2017, 1:53pm UTC](https://discourse.julialang.org/t/typealias-gone-in-1-0/3712 "2017-05-16T13:53:08Z")

</div>

I understand typealias will be removed in 1.0. I think there was a discussion of replacing it with constants. Has someone an idea of what it will look like? Thanks, Petr

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

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