# General Usage

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

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

**Page:** 708

---

## [Functor usage for Optim.jl](https://discourse.julialang.org/t/functor-usage-for-optim-jl/45778)

<div class="topic-metadata">

**Author:** [@stevengogogo](https://discourse.julialang.org/u/stevengogogo)\
**Replies:** 4\
**Last updated:** [August 31, 2020, 3:32pm UTC](https://discourse.julialang.org/t/functor-usage-for-optim-jl/45778 "2020-08-31T15:32:07Z")

</div>

Dear Community, I got a question about functor usage with Optim.jl. I’m currently writing a Julian package for biological modeling. To organize parameters of the biological process, I chose function-like object (funct…

---

## [Any touchscreen APIs for Julia?](https://discourse.julialang.org/t/any-touchscreen-apis-for-julia/45614)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 9\
**Last updated:** [August 31, 2020, 3:28pm UTC](https://discourse.julialang.org/t/any-touchscreen-apis-for-julia/45614 "2020-08-31T15:28:31Z")

</div>

Are there any packages that measure touchscreen gestures? I want to make something like this virtual piano (Virtual Piano Keyboard | Online Piano at Apronus.com) but in an offline interactive window. So far I’m imagining…

---

## [Indexing into Matrix](https://discourse.julialang.org/t/indexing-into-matrix/45806)

<div class="topic-metadata">

**Author:** [@grunst](https://discourse.julialang.org/u/grunst)\
**Replies:** 7\
**Last updated:** [August 31, 2020, 10:31am UTC](https://discourse.julialang.org/t/indexing-into-matrix/45806 "2020-08-31T10:31:40Z")

</div>

Is there a github issue or discourse post that discusses why A\[1,:\] returns a column vector instead of a row vector (Adjoint) for a matrix A? From the pattern A\[\[1\],:\] return a 1xn matrix A\[:,\[1\]\] return a nx1 matri…

---

## [Weird behavior of range with .-](https://discourse.julialang.org/t/weird-behavior-of-range-with/45804)

<div class="topic-metadata">

**Author:** [@schoersch](https://discourse.julialang.org/u/schoersch)\
**Replies:** 6\
**Last updated:** [August 31, 2020, 8:03am UTC](https://discourse.julialang.org/t/weird-behavior-of-range-with/45804 "2020-08-31T08:03:40Z")

</div>

I came around the following behavior using range I did not expect: creating the range specified below and subtracting its last element results in a range with a fairly wide difference to 0 at the last element. a = rang…

---

## [Passing on a variable to Julia run() command](https://discourse.julialang.org/t/passing-on-a-variable-to-julia-run-command/45817)

<div class="topic-metadata">

**Author:** [@Evgeniia](https://discourse.julialang.org/u/Evgeniia)\
**Replies:** 0\
**Last updated:** [August 31, 2020, 6:49am UTC](https://discourse.julialang.org/t/passing-on-a-variable-to-julia-run-command/45817 "2020-08-31T06:49:20Z")

</div>

Hi! I am new to running API calls in general but I would like to use Julia to run API calls. Here, I am trying to run the curl command from Julia using run( ): call="https://rxn.res.ibm.com/rxn/api/api/v1/predictions/…

---

## [Fed yield curve site data to in memory model need advice about Julia package selection](https://discourse.julialang.org/t/fed-yield-curve-site-data-to-in-memory-model-need-advice-about-julia-package-selection/45796)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 2\
**Last updated:** [August 30, 2020, 7:57pm UTC](https://discourse.julialang.org/t/fed-yield-curve-site-data-to-in-memory-model-need-advice-about-julia-package-selection/45796 "2020-08-30T19:57:52Z")

</div>

I’m looking at using Julia to populate an in memory data structure. My first attempt will be to gather the data from the Fed’s yield curve site. There are multiple models, different refresh rates and lashings of nice p…

---

## [Performant piecewise function evaluation](https://discourse.julialang.org/t/performant-piecewise-function-evaluation/45762)

<div class="topic-metadata">

**Author:** [@archermarx](https://discourse.julialang.org/u/archermarx)\
**Replies:** 4\
**Last updated:** [August 30, 2020, 7:31pm UTC](https://discourse.julialang.org/t/performant-piecewise-function-evaluation/45762 "2020-08-30T19:31:20Z")

</div>

I’m working on developing a solver that requires piecewise-defined polynomial functions to be evaluated very frequently. The easiest way to define such a function would be something like function piecewise\_hardcoded(x) …

---

## [Setting number of threads after launch](https://discourse.julialang.org/t/setting-number-of-threads-after-launch/45792)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 2\
**Last updated:** [August 30, 2020, 3:47pm UTC](https://discourse.julialang.org/t/setting-number-of-threads-after-launch/45792 "2020-08-30T15:47:36Z")

</div>

When I use the Distributed module, I can add/remove the number of processes after launching Julia or within a Jupyter notebook. Is there any similar functionality with Threads, or must the thread count be set at launch? …

---

## [Package dependency uninstallation](https://discourse.julialang.org/t/package-dependency-uninstallation/45788)

<div class="topic-metadata">

**Author:** [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Replies:** 1\
**Last updated:** [August 30, 2020, 1:48pm UTC](https://discourse.julialang.org/t/package-dependency-uninstallation/45788 "2020-08-30T13:48:54Z")

</div>

Let’s say package A depends on B when first installed. After a while, a new version of A no longer depends on B. If I update A, will Julia automatically uninstall B if it is not a dependency for any other packages?

---

## [Bug in floating-point range?](https://discourse.julialang.org/t/bug-in-floating-point-range/45706)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 12\
**Last updated:** [August 29, 2020, 12:58pm UTC](https://discourse.julialang.org/t/bug-in-floating-point-range/45706 "2020-08-29T12:58:42Z")

</div>

julia\> rng=range(big(1)/100, stop=big(10)/100, length=10) 10-element LinRange{BigFloat}: 0.010,0.020,0.030,0.040,0.050,0.060,0.070,0.080,0.090,0.10 julia\> Float64(maximum(abs.(angle.(exp.(im\*rng\[1:9\]))-rng\[1:9\]))) 1.07…

---

## [How can i separate between two arrays inside a parent array?](https://discourse.julialang.org/t/how-can-i-separate-between-two-arrays-inside-a-parent-array/45744)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 4\
**Last updated:** [August 30, 2020, 8:57am UTC](https://discourse.julialang.org/t/how-can-i-separate-between-two-arrays-inside-a-parent-array/45744 "2020-08-30T08:57:33Z")

</div>

this code is a small example of what i want to do, i have this small example right here: y=\[\[\[1,0\],\[0,0\],\[1,1\],\[1,0\],\[1,0\],\[0,1\]\],\[\[1,0\],\[0,0\],\[1,1\],\[0,0\]\],\[\[1,0\],\[0,0\],\[1,1\],\[1,0\],\[1,0\],\[1,0\]\]\] array=\[\] all\_array=\[\] fo…

---

## [Debugger.@enter: failed to lookup source code, showing lowered code](https://discourse.julialang.org/t/debugger-enter-failed-to-lookup-source-code-showing-lowered-code/45774)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 2\
**Last updated:** [August 30, 2020, 8:34am UTC](https://discourse.julialang.org/t/debugger-enter-failed-to-lookup-source-code-showing-lowered-code/45774 "2020-08-30T08:34:13Z")

</div>

I’m trying to use Debugger.@enter via the REPL (not via VS Code or Juno). However, I’m getting a message that says failed to lookup source code, showing lowered code: In an older thread the only recommendation was to…

---

## [Using @nospecialize on a set of subtypes](https://discourse.julialang.org/t/using-nospecialize-on-a-set-of-subtypes/45655)

<div class="topic-metadata">

**Author:** [@colintbowers](https://discourse.julialang.org/u/colintbowers)\
**Replies:** 4\
**Last updated:** [August 30, 2020, 1:09am UTC](https://discourse.julialang.org/t/using-nospecialize-on-a-set-of-subtypes/45655 "2020-08-30T01:09:51Z")

</div>

Hi all, I have a function g(a,b) with many methods based on input types of a and b. A subset of the methods have common code, eg: g(a::T1, b::T2) where {T1\<:AbstractA,T2\<:AbstractB} = (fa(a),fb(b)) where fa and fb wil…

---

## [Mapping LLVM type i1 to Julia type](https://discourse.julialang.org/t/mapping-llvm-type-i1-to-julia-type/45733)

<div class="topic-metadata">

**Author:** [@msoeken](https://discourse.julialang.org/u/msoeken)\
**Replies:** 4\
**Last updated:** [August 29, 2020, 9:29pm UTC](https://discourse.julialang.org/t/mapping-llvm-type-i1-to-julia-type/45733 "2020-08-29T21:29:55Z")

</div>

I am trying to use llvmcall and want to map a return value of LLVM type i1 to a Julia Bool value. using Base function isodd(a) Base.llvmcall("""%mod = srem i64 %0, 2\\n%cmp = icmp eq i64 %mod, 1\\nret i1 %cmp""", Boo…

---

## [Param. estimation with different initial condition, how to do it?](https://discourse.julialang.org/t/param-estimation-with-different-initial-condition-how-to-do-it/45727)

<div class="topic-metadata">

**Author:** [@Fred\_He](https://discourse.julialang.org/u/Fred_He)\
**Replies:** 3\
**Last updated:** [August 29, 2020, 8:34pm UTC](https://discourse.julialang.org/t/param-estimation-with-different-initial-condition-how-to-do-it/45727 "2020-08-29T20:34:53Z")

</div>

Hello, I am new to DiffEqParamEstimation.jl package and trying to use it. The first thing I want to solve with this package is kinetic constant estimation based on plug flow model. It can be simplified to: However, I…

---

## [Nonallocating readuntil functionality?](https://discourse.julialang.org/t/nonallocating-readuntil-functionality/45746)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [August 29, 2020, 7:56pm UTC](https://discourse.julialang.org/t/nonallocating-readuntil-functionality/45746 "2020-08-29T19:56:14Z")

</div>

Hello! Using readuntil I found that it allocates (even though I have no need for it to do so). Reading on Github I found this post mentioning skipchars https://github.com/JuliaLang/julia/pull/36160 But in my case I ne…

---

## [Arrays of structs/tuples with mutable members](https://discourse.julialang.org/t/arrays-of-structs-tuples-with-mutable-members/45754)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 4\
**Last updated:** [August 29, 2020, 7:23pm UTC](https://discourse.julialang.org/t/arrays-of-structs-tuples-with-mutable-members/45754 "2020-08-29T19:23:11Z")

</div>

I tested the performance of an array of tuples and structs in Julia 1.3.1 and 1.5.1 and am a bit confused about the results. There are eight separate times based on three choices: 1.3.1 vs 1.5.1, structs vs tuples, and …

---

## [Declaring Pair with one fixed type](https://discourse.julialang.org/t/declaring-pair-with-one-fixed-type/45756)

<div class="topic-metadata">

**Author:** [@Josiah\_Slack](https://discourse.julialang.org/u/Josiah_Slack)\
**Replies:** 2\
**Last updated:** [August 29, 2020, 6:50pm UTC](https://discourse.julialang.org/t/declaring-pair-with-one-fixed-type/45756 "2020-08-29T18:50:16Z")

</div>

Let’s say that I’d like to declare a function that takes a Pair as its argument, and that I’d like to restrict the kind of Pair that will be matched. For example: function foo(p::Pair{String,Any}) do some stuff end I…

---

## [LoopVectorization.jl: adding \`@avx\` makes code slower](https://discourse.julialang.org/t/loopvectorization-jl-adding-avx-makes-code-slower/45742)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 8\
**Last updated:** [August 29, 2020, 4:22pm UTC](https://discourse.julialang.org/t/loopvectorization-jl-adding-avx-makes-code-slower/45742 "2020-08-29T16:22:34Z")

</div>

I am given a multi-dimensional Array and have to multiply it by an SMatrix along multiple dimensions. Using a straightforward approach in 2 dimensions, adding @avx from the great package LoopVectorization.jl increases th…

---

## [What's your simple thing that you'd like to be easier than it is?](https://discourse.julialang.org/t/whats-your-simple-thing-that-youd-like-to-be-easier-than-it-is/45665)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 22\
**Last updated:** [August 29, 2020, 9:49am UTC](https://discourse.julialang.org/t/whats-your-simple-thing-that-youd-like-to-be-easier-than-it-is/45665 "2020-08-29T09:49:13Z")

</div>

I’m interested in a current overview of simple expressions often come up, but which tend to be more verbose or difficult than they could theoretically be. These things are scattered around many threads here and there but…

---

## [Computing Inverse of a stack of matrices](https://discourse.julialang.org/t/computing-inverse-of-a-stack-of-matrices/45580)

<div class="topic-metadata">

**Author:** [@bhaveshshrimali](https://discourse.julialang.org/u/bhaveshshrimali)\
**Replies:** 19\
**Last updated:** [August 29, 2020, 2:52am UTC](https://discourse.julialang.org/t/computing-inverse-of-a-stack-of-matrices/45580 "2020-08-29T02:52:59Z")

</div>

Hi everyone, Just started this morning with Julia after a long overdue-:slight\_smile: I was looking for an efficient way to invert a stack of 3x3 matrices. Coming from a python background it does seem that numpy.linalg…

---

## [Adding MORE packages can result in speedup (and other strangeness)](https://discourse.julialang.org/t/adding-more-packages-can-result-in-speedup-and-other-strangeness/45715)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [August 29, 2020, 12:18am UTC](https://discourse.julialang.org/t/adding-more-packages-can-result-in-speedup-and-other-strangeness/45715 "2020-08-29T00:18:33Z")

</div>

A. Speedup and lower memory use, adding the first package: $ julia -q julia\> @time using DataValues, CSVFiles, ExcelFiles, StatFiles, ParquetFiles, DataFrames, VegaLite 10.102168 seconds (14.07 M allocations: 842.677 …

---

## [Vscode run file in repl terminal](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656)

<div class="topic-metadata">

**Author:** [@RaulDurand](https://discourse.julialang.org/u/RaulDurand)\
**Replies:** 5\
**Last updated:** [August 28, 2020, 9:39pm UTC](https://discourse.julialang.org/t/vscode-run-file-in-repl-terminal/45656 "2020-08-28T21:39:23Z")

</div>

Is there a way to run the current file in the current REPL terminal? Something that does \> include(“$currentfile”) in the REPL. I am aware of the command Run File, but it reloads packages each time and becomes slow. …

---

## [Data copying in Distributed computing](https://discourse.julialang.org/t/data-copying-in-distributed-computing/45704)

<div class="topic-metadata">

**Author:** [@Sheemon7](https://discourse.julialang.org/u/Sheemon7)\
**Replies:** 0\
**Last updated:** [August 28, 2020, 7:25pm UTC](https://discourse.julialang.org/t/data-copying-in-distributed-computing/45704 "2020-08-28T19:25:06Z")

</div>

I have a perfectly parallelizable task, which I want to compute using several processes (threads are not applicable here). Say I want to pmap a function f, taking about 1-10 seconds over a vector A of 10M elements. The p…

---

## [Setfield redundant load/store elision fails with unions](https://discourse.julialang.org/t/setfield-redundant-load-store-elision-fails-with-unions/45703)

<div class="topic-metadata">

**Author:** [@Christian\_Rorvik](https://discourse.julialang.org/u/Christian_Rorvik)\
**Replies:** 0\
**Last updated:** [August 28, 2020, 6:33pm UTC](https://discourse.julialang.org/t/setfield-redundant-load-store-elision-fails-with-unions/45703 "2020-08-28T18:33:15Z")

</div>

Not really an issue with Setfield.jl, but this is where I’ve most encountered this. When updating immutable types (e.g., in arrays or references), we need to construct an entirely new object with the desired fields repl…

---

## [My Random Forest is very slow](https://discourse.julialang.org/t/my-random-forest-is-very-slow/45471)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 10\
**Last updated:** [August 28, 2020, 3:59pm UTC](https://discourse.julialang.org/t/my-random-forest-is-very-slow/45471 "2020-08-28T15:59:30Z")

</div>

I implemented Decision Tree and Random Forest classifiers/regressions based originally on Josh Gordon’s code in Python. The problem is that building the forest is very slow… It is said everywhere that one of the advant…

---

## [Julia on Xeon Phi](https://discourse.julialang.org/t/julia-on-xeon-phi/45682)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 2\
**Last updated:** [August 28, 2020, 2:19pm UTC](https://discourse.julialang.org/t/julia-on-xeon-phi/45682 "2020-08-28T14:19:56Z")

</div>

Hello, can I run Julia on Xeon Phi, just like on a pc?

---

## [Package names could not be resolved: \* MyPkg (91bcb2...e67b in manifest but not in project)](https://discourse.julialang.org/t/package-names-could-not-be-resolved-mypkg-91bcb2-e67b-in-manifest-but-not-in-project/45679)

<div class="topic-metadata">

**Author:** [@Luapulu](https://discourse.julialang.org/u/Luapulu)\
**Replies:** 2\
**Last updated:** [August 28, 2020, 2:04pm UTC](https://discourse.julialang.org/t/package-names-could-not-be-resolved-mypkg-91bcb2-e67b-in-manifest-but-not-in-project/45679 "2020-08-28T14:04:05Z")

</div>

Minimal Example I’m running julia1.3. I have a minimal Package called MyPkg. It contains a Project.toml file and a src folder with a MyPkg.jl file that is empty. . |-- Project.toml \`-- src \`-- MyPkg.jl The Project…

---

## [Nteract does not work](https://discourse.julialang.org/t/nteract-does-not-work/45689)

<div class="topic-metadata">

**Author:** [@Shashank\_manchester](https://discourse.julialang.org/u/Shashank_manchester)\
**Replies:** 1\
**Last updated:** [August 28, 2020, 1:43pm UTC](https://discourse.julialang.org/t/nteract-does-not-work/45689 "2020-08-28T13:43:31Z")

</div>

Hi Team, I have installed Julia 1.5 version along with nteract application, but when i launch nteract application on my windows 64 bit machine, nteract keeps loading and i do not see the white screen. Attaching the s…

---

## [Value returned from Julia function used in C cause segfault](https://discourse.julialang.org/t/value-returned-from-julia-function-used-in-c-cause-segfault/45673)

<div class="topic-metadata">

**Author:** [@Clonkk](https://discourse.julialang.org/u/Clonkk)\
**Replies:** 0\
**Last updated:** [August 28, 2020, 10:41am UTC](https://discourse.julialang.org/t/value-returned-from-julia-function-used-in-c-cause-segfault/45673 "2020-08-28T10:41:59Z")

</div>

Hello, How to properly call a Julia function from C that returns a value(could be array, tuple, POD, string). When I try to do that, the program segfault during the jl\_call(...) before I can call a jl\_gc\_push on the jl…

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

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