# General Usage

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

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

**Page:** 916

---

## [Warnings about type instability as a compilation side effect?](https://discourse.julialang.org/t/warnings-about-type-instability-as-a-compilation-side-effect/17986)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 7\
**Last updated:** [November 26, 2018, 3:07am UTC](https://discourse.julialang.org/t/warnings-about-type-instability-as-a-compilation-side-effect/17986 "2018-11-26T03:07:17Z")

</div>

The compiler has I believe sufficient information about type instability when a particular method gets compiled. Would it be possible to implement an option to produce a warning message during compilation that the metho…

---

## [Get fieldnames and values of \`struct\` as NamedTuple](https://discourse.julialang.org/t/get-fieldnames-and-values-of-struct-as-namedtuple/8991)

<div class="topic-metadata">

**Author:** [@piever](https://discourse.julialang.org/u/piever)\
**Replies:** 29\
**Last updated:** [November 26, 2018, 12:44am UTC](https://discourse.julialang.org/t/get-fieldnames-and-values-of-struct-as-namedtuple/8991 "2018-11-26T00:44:23Z")

</div>

After the discussion in this thread I was wondering if there is in Julia 0.7 a way to get a NamedTuple starting from a struct. For example: julia\> struct Person age::Float64 name::String end julia\> …

---

## [SparseMatrixCSC as a general sparse container: Setindex!(...) not working for SparseMatrixCSC with vector elements (v0.7)](https://discourse.julialang.org/t/sparsematrixcsc-as-a-general-sparse-container-setindex-not-working-for-sparsematrixcsc-with-vector-elements-v0-7/14529)

<div class="topic-metadata">

**Author:** [@HTSykora](https://discourse.julialang.org/u/HTSykora)\
**Replies:** 5\
**Last updated:** [November 25, 2018, 10:01pm UTC](https://discourse.julialang.org/t/sparsematrixcsc-as-a-general-sparse-container-setindex-not-working-for-sparsematrixcsc-with-vector-elements-v0-7/14529 "2018-11-25T22:01:33Z")

</div>

In my application I have a sparse matrix, but every element of this matrix is a discretised function. If I try to use SparseMatrixCSC{Array{Float64,1},Int64} as the container, but setindex!(...) in 0.7 throws a stackover…

---

## [Behavior of worker pool in pmap](https://discourse.julialang.org/t/behavior-of-worker-pool-in-pmap/17882)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 2\
**Last updated:** [November 25, 2018, 6:39pm UTC](https://discourse.julialang.org/t/behavior-of-worker-pool-in-pmap/17882 "2018-11-25T18:39:34Z")

</div>

Hi everyone, I’ve been coding in julia for a while, but I haven’t used any of the parallelization features beyond the Distributed package. My experience with parallelization is mainly with OpenMP in Fortran. I wanted to…

---

## [Interactive use of Makie](https://discourse.julialang.org/t/interactive-use-of-makie/17980)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [November 25, 2018, 6:32pm UTC](https://discourse.julialang.org/t/interactive-use-of-makie/17980 "2018-11-25T18:32:08Z")

</div>

I am trying to use Makie interactively. This means, make a plot, change some values in the repl, make a new plot. The new plot shall only be added to the screen. This doesn’t work for me yet. Precondition: Add my tiny t…

---

## [Initialization of mutable structs with many default values](https://discourse.julialang.org/t/initialization-of-mutable-structs-with-many-default-values/17959)

<div class="topic-metadata">

**Author:** [@Faber](https://discourse.julialang.org/u/Faber)\
**Replies:** 7\
**Last updated:** [November 25, 2018, 1:48pm UTC](https://discourse.julialang.org/t/initialization-of-mutable-structs-with-many-default-values/17959 "2018-11-25T13:48:32Z")

</div>

Hey, just wondered if there is a way to overcome “duplication” in default field names in mutable structs? what do I mean. Assume I have a struct which holds 100 fields, mutable struct MyStruct param1::Int64 param2::Fl…

---

## [Compilation performance. Branching](https://discourse.julialang.org/t/compilation-performance-branching/17973)

<div class="topic-metadata">

**Author:** [@xanfus](https://discourse.julialang.org/u/xanfus)\
**Replies:** 3\
**Last updated:** [November 25, 2018, 1:13pm UTC](https://discourse.julialang.org/t/compilation-performance-branching/17973 "2018-11-25T13:13:17Z")

</div>

My physical model consists of results requested, test subjects and variable set of phenomena acting upon the subjects. It’s convenient to keep all phenomena-related function calls conditioned by if-else statements within…

---

## [Problem with Complex{Rationals}](https://discourse.julialang.org/t/problem-with-complex-rationals/9474)

<div class="topic-metadata">

**Author:** [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Replies:** 8\
**Last updated:** [November 25, 2018, 12:06pm UTC](https://discourse.julialang.org/t/problem-with-complex-rationals/9474 "2018-11-25T12:06:35Z")

</div>

Hello, I have found something which makes it difficult to work with the field Q(i) julia\> Complex{Rational{Int}}\<:Complex{Real} false Is it possible to make julia understand that this should be true?

---

## [Custom function derivative for JuMP](https://discourse.julialang.org/t/custom-function-derivative-for-jump/17966)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 1\
**Last updated:** [November 25, 2018, 2:24am UTC](https://discourse.julialang.org/t/custom-function-derivative-for-jump/17966 "2018-11-25T02:24:27Z")

</div>

I have a function not supported out of the box by autodiff, and looking for ways to specify its derivative manually. Specifically, in my case it is a fourier transform from NFFT.jl, so it is possible to differentiate eff…

---

## [Complex{Float64} \<: Complex{Real} is false. Intended or potential inconsistency?](https://discourse.julialang.org/t/complex-float64-complex-real-is-false-intended-or-potential-inconsistency/17956)

<div class="topic-metadata">

**Author:** [@merement](https://discourse.julialang.org/u/merement)\
**Replies:** 5\
**Last updated:** [November 25, 2018, 12:45am UTC](https://discourse.julialang.org/t/complex-float64-complex-real-is-false-intended-or-potential-inconsistency/17956 "2018-11-25T00:45:57Z")

</div>

On Julia 1.0.2 julia\> Float64 \<: Real true as it should be but julia\> Complex{Float64} \<: Complex{Real} false Mathematically speaking, this should be true as well but, I guess, Julia has to deal with types of a more …

---

## [Jump with Cbc](https://discourse.julialang.org/t/jump-with-cbc/17958)

<div class="topic-metadata">

**Author:** [@orhan\_abar](https://discourse.julialang.org/u/orhan_abar)\
**Replies:** 1\
**Last updated:** [November 24, 2018, 11:35pm UTC](https://discourse.julialang.org/t/jump-with-cbc/17958 "2018-11-24T23:35:03Z")

</div>

Is there any way to get more than one optimum solution for a problem when I use JuMP with Cbs solver.

---

## [New iteration protocol much slower](https://discourse.julialang.org/t/new-iteration-protocol-much-slower/12169)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 12\
**Last updated:** [November 24, 2018, 3:52pm UTC](https://discourse.julialang.org/t/new-iteration-protocol-much-slower/12169 "2018-11-24T15:52:06Z")

</div>

I want to convert an iteration protocol from 0.6 to 0.7 but I obtain a huge slowdown On julia 0.6: function f(iter) state = start(iter) i = 0 while !(done(iter, state)) & (i \< 1\_000\_000) i += 1 v, …

---

## [Weird datatype behaviour](https://discourse.julialang.org/t/weird-datatype-behaviour/17879)

<div class="topic-metadata">

**Author:** [@hackguy](https://discourse.julialang.org/u/hackguy)\
**Replies:** 2\
**Last updated:** [November 24, 2018, 2:25pm UTC](https://discourse.julialang.org/t/weird-datatype-behaviour/17879 "2018-11-24T14:25:50Z")

</div>

I’m trying to create a 24-bit datatype for a SIC/XE assembly simulator. So far I have this code: import Core.Intrinsics # defining a primitive 24-bit integer type for integer registers primitive type SICInt 24 end # o…

---

## [Changing file paths in structs](https://discourse.julialang.org/t/changing-file-paths-in-structs/17875)

<div class="topic-metadata">

**Author:** [@daniel](https://discourse.julialang.org/u/daniel)\
**Replies:** 2\
**Last updated:** [November 24, 2018, 1:20pm UTC](https://discourse.julialang.org/t/changing-file-paths-in-structs/17875 "2018-11-24T13:20:16Z")

</div>

This is probably more about how to write clean code: I have a struct containing a reference to a local file and some additional annotations (in my case sequence alignments and patient information) struct FooData \<: Abs…

---

## [Can a struct have a variable supertype?](https://discourse.julialang.org/t/can-a-struct-have-a-variable-supertype/17942)

<div class="topic-metadata">

**Author:** [@zot](https://discourse.julialang.org/u/zot)\
**Replies:** 1\
**Last updated:** [November 24, 2018, 12:57pm UTC](https://discourse.julialang.org/t/can-a-struct-have-a-variable-supertype/17942 "2018-11-24T12:57:47Z")

</div>

I’m working on beefing up JavaCall.jl and I have a proxy struct (currently called JProxy) that represents a Java object, along with an abstract type hierarchy with one type for each Java type. It would be convenient if t…

---

## [Integrity of parentheses?](https://discourse.julialang.org/t/integrity-of-parentheses/17922)

<div class="topic-metadata">

**Author:** [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Replies:** 8\
**Last updated:** [November 23, 2018, 7:19pm UTC](https://discourse.julialang.org/t/integrity-of-parentheses/17922 "2018-11-23T19:19:35Z")

</div>

Does the Julia language guarantee evaluation order where parentheses are used to isolate subexpressions? For example, if one writes d = a + (b - c) can we be sure that the subtraction is performed first? This is impo…

---

## [Changing DEPOT\_PATH in IJulia](https://discourse.julialang.org/t/changing-depot-path-in-ijulia/17920)

<div class="topic-metadata">

**Author:** [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Replies:** 2\
**Last updated:** [November 23, 2018, 6:56pm UTC](https://discourse.julialang.org/t/changing-depot-path-in-ijulia/17920 "2018-11-23T18:56:02Z")

</div>

I’m deploying an in-house application as a Jupyter notebook. Thanks to environments, I can have a “stable” environment working for the app, while my “dev” environment contains the latest code changes. Precompilation is a…

---

## [How to increase a matrix?](https://discourse.julialang.org/t/how-to-increase-a-matrix/17912)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 10\
**Last updated:** [November 23, 2018, 5:06pm UTC](https://discourse.julialang.org/t/how-to-increase-a-matrix/17912 "2018-11-23T17:06:13Z")

</div>

I need to increase a matrix inside a function. But append! works for vectors but doesn’t work for matrices arg1=\[1 2;3 4\]; julia\> append!(arg1, \[5,6\]) ERROR: MethodError: no method matching append!(::Array{Int64,2}, ::…

---

## [Add support for indexing \`SparseMatrixCSC\` by using arrays of \`CartesianIndex{N}\`](https://discourse.julialang.org/t/add-support-for-indexing-sparsematrixcsc-by-using-arrays-of-cartesianindex-n/17906)

<div class="topic-metadata">

**Author:** [@nangeschnappt](https://discourse.julialang.org/u/nangeschnappt)\
**Replies:** 0\
**Last updated:** [November 23, 2018, 2:29pm UTC](https://discourse.julialang.org/t/add-support-for-indexing-sparsematrixcsc-by-using-arrays-of-cartesianindex-n/17906 "2018-11-23T14:29:18Z")

</div>

On 0.7.0 using LinearAlgebra, SparseArrays m = 2 A = sparse(1.0I, m, m) ind = \[CartesianIndex(i, i) for i = 1:m\] julia\> A\[ind\] MethodError: no method matching isless(::CartesianIndex{2}, ::Int64) Closest candid…

---

## [How does Pkg determine the version of a package?](https://discourse.julialang.org/t/how-does-pkg-determine-the-version-of-a-package/15380)

<div class="topic-metadata">

**Author:** [@saschatimme](https://discourse.julialang.org/u/saschatimme)\
**Replies:** 5\
**Last updated:** [November 23, 2018, 2:03pm UTC](https://discourse.julialang.org/t/how-does-pkg-determine-the-version-of-a-package/15380 "2018-11-23T14:03:17Z")

</div>

I am confused by the behaviour of Pkg3. It seems that the version field in the Project.toml is ignored and instead the registries determines the latest available version. I would have expected that the local Project.toml …

---

## [Static compilation on 1.0 - DLL error due to static absolute paths](https://discourse.julialang.org/t/static-compilation-on-1-0-dll-error-due-to-static-absolute-paths/17844)

<div class="topic-metadata">

**Author:** [@phlavenk](https://discourse.julialang.org/u/phlavenk)\
**Replies:** 7\
**Last updated:** [November 23, 2018, 1:03pm UTC](https://discourse.julialang.org/t/static-compilation-on-1-0-dll-error-due-to-static-absolute-paths/17844 "2018-11-23T13:03:16Z")

</div>

Hi, I’m trying to deploy a DLL compiled with latest PackageCompiler.jl on Julia1.0 to a different computer. I’ve found a severe problem with loading of DLLs of used packages. The trouble-making DLL’s are: libopenspecf…

---

## [UnitRange behavior](https://discourse.julialang.org/t/unitrange-behavior/17887)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 10\
**Last updated:** [November 23, 2018, 10:09am UTC](https://discourse.julialang.org/t/unitrange-behavior/17887 "2018-11-23T10:09:18Z")

</div>

Can’t be right, right? julia\> 1.0:5 .- 0.5 1.0:1.0:4.0 julia\> collect(1.0:5) .- 0.5 5-element Array{Float64,1}: 0.5 1.5 2.5 3.5 4.5

---

## [Whats the difference between a regular array and an array from StaticArrays](https://discourse.julialang.org/t/whats-the-difference-between-a-regular-array-and-an-array-from-staticarrays/14454)

<div class="topic-metadata">

**Author:** [@affans](https://discourse.julialang.org/u/affans)\
**Replies:** 7\
**Last updated:** [November 22, 2018, 11:52pm UTC](https://discourse.julialang.org/t/whats-the-difference-between-a-regular-array-and-an-array-from-staticarrays/14454 "2018-11-22T23:52:17Z")

</div>

Whats the difference between a regular array and an array from StaticArrays? From the docs, it seems that the size of array is known to the compiler based on the type, but isn’t this the same for a regular array as well,…

---

## [ERROR Building MPI, already tried setting CC FC](https://discourse.julialang.org/t/error-building-mpi-already-tried-setting-cc-fc/17817)

<div class="topic-metadata">

**Author:** [@gingerale](https://discourse.julialang.org/u/gingerale)\
**Replies:** 4\
**Last updated:** [November 22, 2018, 5:49pm UTC](https://discourse.julialang.org/t/error-building-mpi-already-tried-setting-cc-fc/17817 "2018-11-22T17:49:52Z")

</div>

Hello, I am stuck on my second round of installing MPI for julia (already installed it on my bionic Ubuntu computer but I need it on the xenial Ubuntu server). I exported the CC and FC and FF and CXX variable over comma…

---

## [Plot from Julia embedded in C/C++ app](https://discourse.julialang.org/t/plot-from-julia-embedded-in-c-c-app/17853)

<div class="topic-metadata">

**Author:** [@seebk](https://discourse.julialang.org/u/seebk)\
**Replies:** 2\
**Last updated:** [November 22, 2018, 4:55pm UTC](https://discourse.julialang.org/t/plot-from-julia-embedded-in-c-c-app/17853 "2018-11-22T16:55:24Z")

</div>

Hi all, is it possible to plot from an embedded Julia from a C/C++ application? I am trying the following example, but no plot window appears. Also tried with gr() and plotlyjs() backends, no success so far… int main()…

---

## [Sluggish performance when loading in modules DataFrames, CSV](https://discourse.julialang.org/t/sluggish-performance-when-loading-in-modules-dataframes-csv/17857)

<div class="topic-metadata">

**Author:** [@thvhauwe](https://discourse.julialang.org/u/thvhauwe)\
**Replies:** 0\
**Last updated:** [November 22, 2018, 12:32pm UTC](https://discourse.julialang.org/t/sluggish-performance-when-loading-in-modules-dataframes-csv/17857 "2018-11-22T12:32:34Z")

</div>

Just loading in the modules CSV and DataFrames takes up nearly 10 seconds, are there ways to improve this? When looking for solution to this slowish load time I stumbled upon this thread, claiming Plots and DataFrame…

---

## [FFT and IntervalArithmetic](https://discourse.julialang.org/t/fft-and-intervalarithmetic/17756)

<div class="topic-metadata">

**Author:** [@OlivierHnt](https://discourse.julialang.org/u/OlivierHnt)\
**Replies:** 18\
**Last updated:** [November 22, 2018, 11:42am UTC](https://discourse.julialang.org/t/fft-and-intervalarithmetic/17756 "2018-11-22T11:42:22Z")

</div>

Good evening, I keep getting the following error message ERROR: LoadError: MethodError: no method matching plan\_bfft(::Array{Complex{IntervalArithmetic.Interval{Float64}},2}, ::UnitRange{Int64}) Does anyone know if In…

---

## [C/C++ embedding on Windows](https://discourse.julialang.org/t/c-c-embedding-on-windows/17828)

<div class="topic-metadata">

**Author:** [@seebk](https://discourse.julialang.org/u/seebk)\
**Replies:** 1\
**Last updated:** [November 22, 2018, 10:05am UTC](https://discourse.julialang.org/t/c-c-embedding-on-windows/17828 "2018-11-22T10:05:28Z")

</div>

Hi everyone, after some configuration hassle I finally found the instructions from Adding text on how to embed Julia on Windows. by NiklasGustafsson · Pull Request #28974 · JuliaLang/julia · GitHub that allow me to buil…

---

## [Asymmetric speed of in-place \`sparse\*dense\` matrix product](https://discourse.julialang.org/t/asymmetric-speed-of-in-place-sparse-dense-matrix-product/10256)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 7\
**Last updated:** [November 8, 2018, 8:35am UTC](https://discourse.julialang.org/t/asymmetric-speed-of-in-place-sparse-dense-matrix-product/10256 "2018-11-08T08:35:14Z")

</div>

(I’m on Julia 0.6.2) julia\> A = sprand(100,100,0.01); julia\> B = rand(100,100); julia\> using BenchmarkTools julia\> @btime $C = $A\*$B; 40.106 μs (2 allocations: 78.20 KiB) julia\> @btime $C = $B\*$A; # other way arou…

---

## [OnlineStats: StatLearn vs LinReg vs other options for linear regression on large datasets](https://discourse.julialang.org/t/onlinestats-statlearn-vs-linreg-vs-other-options-for-linear-regression-on-large-datasets/17830)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 7\
**Last updated:** [November 21, 2018, 11:02pm UTC](https://discourse.julialang.org/t/onlinestats-statlearn-vs-linreg-vs-other-options-for-linear-regression-on-large-datasets/17830 "2018-11-21T23:02:02Z")

</div>

Hello. What’s the difference between using StatLearn and LinReg for linear regression. fit!(StatLearn(5, MSPI()), (x, y)) fit!(LinReg(), (x,y)) both are supposed to be able to “Fit a model that is linear in the para…

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

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