# Latest

**URL:** https://discourse.julialang.org/latest.md?page=1953

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

**Page:** 1954

---

## [What is the best way to generate a function based on the other function definition?](https://discourse.julialang.org/t/what-is-the-best-way-to-generate-a-function-based-on-the-other-function-definition/26748)

<div class="topic-metadata">

**Author:** [@raff](https://discourse.julialang.org/u/raff)\
**Replies:** 5\
**Last updated:** [July 25, 2019, 2:00pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-generate-a-function-based-on-the-other-function-definition/26748 "2019-07-25T14:00:59Z")

</div>

Let’s say I have a function function compute(x::Vector, y::Vector) return (x' \* y) / sum(y) end Both x and y are vector with 0 or 1 values on each cell. Based on this definition, I want to automatically generate …

---

## [Lazy Loading of Modules](https://discourse.julialang.org/t/lazy-loading-of-modules/26788)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 0\
**Last updated:** [July 25, 2019, 11:21am UTC](https://discourse.julialang.org/t/lazy-loading-of-modules/26788 "2019-07-25T11:21:45Z")

</div>

This question essentially revives this older topic. I dislike long loading times for modules that I use fairly interactively. Let’s say I have a module A, and a single (or very few) function fB in A depends on another m…

---

## [How to access shared "inherited" fields without paying multiple dispatch performance price?](https://discourse.julialang.org/t/how-to-access-shared-inherited-fields-without-paying-multiple-dispatch-performance-price/26762)

<div class="topic-metadata">

**Author:** [@Russ](https://discourse.julialang.org/u/Russ)\
**Replies:** 14\
**Last updated:** [July 25, 2019, 9:46am UTC](https://discourse.julialang.org/t/how-to-access-shared-inherited-fields-without-paying-multiple-dispatch-performance-price/26762 "2019-07-25T09:46:23Z")

</div>

Hi, I’m evaluating Julia to replace some old C++ code. The code uses inheritance where there is a single base class and lots (100’s) of derived classes. There are a large number of instances, and the code needs to be abl…

---

## [DynamicHMC API rewrite](https://discourse.julialang.org/t/dynamichmc-api-rewrite/18980)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [July 25, 2019, 9:02am UTC](https://discourse.julialang.org/t/dynamichmc-api-rewrite/18980 "2019-07-25T09:02:01Z")

</div>

I will be rewriting the API of DynamicHMC.jl shortly. I started a discussion at https://github.com/tpapp/DynamicHMC.jl/issues/30 and invite users to participate there, or in this topic. In particular, if there is a fea…

---

## [\[ANN\] BitcoinPrimitives.jl](https://discourse.julialang.org/t/ann-bitcoinprimitives-jl/26784)

<div class="topic-metadata">

**Author:** [@roshii](https://discourse.julialang.org/u/roshii)\
**Replies:** 0\
**Last updated:** [July 25, 2019, 8:53am UTC](https://discourse.julialang.org/t/ann-bitcoinprimitives-jl/26784 "2019-07-25T08:53:42Z")

</div>

BitcoinPrimitves has just been released. It provides block, transaction, script and witness types as well as some basic functions.

---

## [Loading modules on remote workers in Julia 1.0/.7](https://discourse.julialang.org/t/loading-modules-on-remote-workers-in-julia-1-0-7/13312)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 7\
**Last updated:** [July 25, 2019, 8:51am UTC](https://discourse.julialang.org/t/loading-modules-on-remote-workers-in-julia-1-0-7/13312 "2019-07-25T08:51:15Z")

</div>

I’m having difficulty loading a module on remote workers. Suppose I have a file called myModule.jl in a directory assigned to variable called path. In the past, I simply added path to LOAD\_PATH and entered @everywhere us…

---

## [Passing Julia function as an parameter to a wrapped C++ class](https://discourse.julialang.org/t/passing-julia-function-as-an-parameter-to-a-wrapped-c-class/26775)

<div class="topic-metadata">

**Author:** [@DuyTran62529](https://discourse.julialang.org/u/DuyTran62529)\
**Replies:** 1\
**Last updated:** [July 25, 2019, 8:26am UTC](https://discourse.julialang.org/t/passing-julia-function-as-an-parameter-to-a-wrapped-c-class/26775 "2019-07-25T08:26:23Z")

</div>

Hello, I’m trying to pass a Julia function as a callback function to a C++ class wrapped by CxxWrap. I’m not entirely sure how to go about it but here is what I have so far: The C++ side: #include\<iostream\> #include "j…

---

## [Recursive for loop to create data frame](https://discourse.julialang.org/t/recursive-for-loop-to-create-data-frame/26747)

<div class="topic-metadata">

**Author:** [@gobs](https://discourse.julialang.org/u/gobs)\
**Replies:** 3\
**Last updated:** [July 25, 2019, 8:14am UTC](https://discourse.julialang.org/t/recursive-for-loop-to-create-data-frame/26747 "2019-07-25T08:14:30Z")

</div>

I have some JuMP (optimisation package) variables which I want to save to a data frame to then save to a .csv file. My idea is to have a data frame that would look something like this: df = DataFrame(JuMPVariable = Symb…

---

## [Distributed versions of mapslice](https://discourse.julialang.org/t/distributed-versions-of-mapslice/26783)

<div class="topic-metadata">

**Author:** [@Charlie\_He](https://discourse.julialang.org/u/Charlie_He)\
**Replies:** 1\
**Last updated:** [July 25, 2019, 7:51am UTC](https://discourse.julialang.org/t/distributed-versions-of-mapslice/26783 "2019-07-25T07:51:35Z")

</div>

I found julia awfully lacking in terms of operations among/along specific axis/axes of matrix/tensors. It has been extremely annoying that there is no “dims” argument for sum, reduce, mean, prod, etc… The only option for…

---

## [J P Morgan using Julia](https://discourse.julialang.org/t/j-p-morgan-using-julia/26738)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 3\
**Last updated:** [July 25, 2019, 6:04am UTC](https://discourse.julialang.org/t/j-p-morgan-using-julia/26738 "2019-07-25T06:04:57Z")

</div>

I saw that JP Morgan are one of the sponsors of JuliaCon. I would be interested to hear how they are using Julia. I was offered a job in their UK HPC team last year. I remember discussing Julia in passing with the head …

---

## [Why doesn't this code work? Related to Tuples and Types](https://discourse.julialang.org/t/why-doesnt-this-code-work-related-to-tuples-and-types/26772)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 3\
**Last updated:** [July 25, 2019, 6:03am UTC](https://discourse.julialang.org/t/why-doesnt-this-code-work-related-to-tuples-and-types/26772 "2019-07-25T06:03:54Z")

</div>

Here is an example: mm(::Type{Tuple{X,Y}}) where X where Y = Type\[X,Y\] julia\> mm(Tuple{Int,T} where T\<:Float64) ERROR: UndefVarError: Y not defined Stacktrace: \[1\] mm(::Type{Tuple{Int64,T} where T\<:Float64}) at ./none:…

---

## [Function Signature & Keyword arguments](https://discourse.julialang.org/t/function-signature-keyword-arguments/26771)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 0\
**Last updated:** [July 25, 2019, 2:34am UTC](https://discourse.julialang.org/t/function-signature-keyword-arguments/26771 "2019-07-25T02:34:54Z")

</div>

Hi, I have a question, why can’t we access the keyword variables in the signature of a method? Here is an example; f(x::Int,y::T;z::U = 4) where T\<:U where U\<:Real = begin println("Z : ",typeof(z)) …

---

## [A way to get the latest method of a function?](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766)

<div class="topic-metadata">

**Author:** [@Qiyamah](https://discourse.julialang.org/u/Qiyamah)\
**Replies:** 3\
**Last updated:** [July 25, 2019, 1:45am UTC](https://discourse.julialang.org/t/a-way-to-get-the-latest-method-of-a-function/26766 "2019-07-25T01:45:05Z")

</div>

Hi, everyone. Example: f(x::Int) = x+1 mt = get\_latest\_method(f) # mt -\> function f with signature Int f(x::Float64) = x\*2.0 mt = get\_latest\_method(f) # mt -\> function f with signature Float64 f(x::Int,y::Float64) = x…

---

## [System error loading custom package](https://discourse.julialang.org/t/system-error-loading-custom-package/26765)

<div class="topic-metadata">

**Author:** [@Tims\_Corbett](https://discourse.julialang.org/u/Tims_Corbett)\
**Replies:** 0\
**Last updated:** [July 25, 2019, 12:39am UTC](https://discourse.julialang.org/t/system-error-loading-custom-package/26765 "2019-07-25T00:39:02Z")

</div>

Custom is a user defined package. It is present in the directory below. From REPL, using Custom works. A script that uses it also works. If another script uses it at the same time, the following error is encountered. Sy…

---

## [Speeding up matrix multiplication with a subset of matrix's rows](https://discourse.julialang.org/t/speeding-up-matrix-multiplication-with-a-subset-of-matrixs-rows/26718)

<div class="topic-metadata">

**Author:** [@kernelmethod](https://discourse.julialang.org/u/kernelmethod)\
**Replies:** 12\
**Last updated:** [July 24, 2019, 11:23pm UTC](https://discourse.julialang.org/t/speeding-up-matrix-multiplication-with-a-subset-of-matrixs-rows/26718 "2019-07-24T23:23:52Z")

</div>

Hi all, Pretty straightforward – I’d like to write some code that performs a matvec between a matrix A and a vector x, except I know ahead of time that I don’t need all of the rows of A. In other words, instead of perf…

---

## [List of what actions can cause a task switch?](https://discourse.julialang.org/t/list-of-what-actions-can-cause-a-task-switch/26751)

<div class="topic-metadata">

**Author:** [@pixel27](https://discourse.julialang.org/u/pixel27)\
**Replies:** 2\
**Last updated:** [July 24, 2019, 6:27pm UTC](https://discourse.julialang.org/t/list-of-what-actions-can-cause-a-task-switch/26751 "2019-07-24T18:27:21Z")

</div>

What I wanted to do was run multiple external commands simultaneously and collect the results…so my first thought was to use Distributed creating N workers and have them execute the commands and return the data via a Rem…

---

## [CuArrays.jl errors with indexing / CartesianIndices](https://discourse.julialang.org/t/cuarrays-jl-errors-with-indexing-cartesianindices/26416)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 1\
**Last updated:** [July 24, 2019, 5:18pm UTC](https://discourse.julialang.org/t/cuarrays-jl-errors-with-indexing-cartesianindices/26416 "2019-07-24T17:18:31Z")

</div>

Hi, I need to record the range of a subarray in a struct in order to define a padded-array. However I have troubles using indexing in CuArrays.jl. Basically, the only solution which works is to use things like u\[1:10,1…

---

## [Is spzeros(m,n) empty?](https://discourse.julialang.org/t/is-spzeros-m-n-empty/26733)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 3\
**Last updated:** [July 24, 2019, 4:31pm UTC](https://discourse.julialang.org/t/is-spzeros-m-n-empty/26733 "2019-07-24T16:31:29Z")

</div>

Based on my understanding, spzeros(m,n) would create a sparse matrix of zeros with size m\*n. I checked and found that calling isempty with a matrix like this would return false. What I do not understand is that, based on…

---

## [Time to first plot benchmark](https://discourse.julialang.org/t/time-to-first-plot-benchmark/26726)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 11\
**Last updated:** [July 24, 2019, 3:42pm UTC](https://discourse.julialang.org/t/time-to-first-plot-benchmark/26726 "2019-07-24T15:42:55Z")

</div>

In the light of Julia survey result (i.e people complain about time to the first plot), I did a naive benchmark, as expected, PyPlot is the fastest :frowning: http://uaf-8.t2.ucsd.edu/~jling/dump/PlotBenchmark.html Bec…

---

## [Help reshaping this array more efficiently](https://discourse.julialang.org/t/help-reshaping-this-array-more-efficiently/26724)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [July 24, 2019, 2:34pm UTC](https://discourse.julialang.org/t/help-reshaping-this-array-more-efficiently/26724 "2019-07-24T14:34:41Z")

</div>

Hey guys, so I got an array like this: a\[1\] 15300-element Array{Float32,1}: 0.0 0.0 0.0 0.0 0.0 0.1 0.0 0.0 0.2 0.1 0.0 0.0 0.2 ⋮ 9.6 0.0 4.9 9.7 0.0 4.9 9.8 0.0 4.9 9.9 0.0 4.9 Where the fir…

---

## [SparseMatrixCSC in Julia?](https://discourse.julialang.org/t/sparsematrixcsc-in-julia/26731)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 1\
**Last updated:** [July 24, 2019, 12:10pm UTC](https://discourse.julialang.org/t/sparsematrixcsc-in-julia/26731 "2019-07-24T12:10:07Z")

</div>

Hi, I’m curious about this SparseMatrixCSC object in Julia. The following is the constructor. I was wondering, how to understand that “The row indices in every column need to be sorted. If your SparseMatrixCSC object co…

---

## [Recompiles and failures to load JLD2 in Atom/Juno](https://discourse.julialang.org/t/recompiles-and-failures-to-load-jld2-in-atom-juno/26734)

<div class="topic-metadata">

**Author:** [@FHell](https://discourse.julialang.org/u/FHell)\
**Replies:** 0\
**Last updated:** [July 24, 2019, 12:06pm UTC](https://discourse.julialang.org/t/recompiles-and-failures-to-load-jld2-in-atom-juno/26734 "2019-07-24T12:06:24Z")

</div>

I have a problem with a script that loads a JLD2 file. When I run it from bash it works fine, but if I run it block by block in Juno first of all I get constant recompiles due to stale cache files (which frequently fail)…

---

## [Kudos to Mary McGrath](https://discourse.julialang.org/t/kudos-to-mary-mcgrath/26728)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 0\
**Last updated:** [July 24, 2019, 10:40am UTC](https://discourse.julialang.org/t/kudos-to-mary-mcgrath/26728 "2019-07-24T10:40:14Z")

</div>

Masterful talk. Very enjoyable. Check it out: JuliaCon 2019 | Prototyping Visualizations for the Web with Vega and Julia | Mary McGrath - YouTube

---

## [Zygote gradient](https://discourse.julialang.org/t/zygote-gradient/26715)

<div class="topic-metadata">

**Author:** [@wormholestds9](https://discourse.julialang.org/u/wormholestds9)\
**Replies:** 2\
**Last updated:** [July 24, 2019, 9:58am UTC](https://discourse.julialang.org/t/zygote-gradient/26715 "2019-07-24T09:58:14Z")

</div>

Zygote gradient seems to return an odd result for a constant function. That is, f1 = (x) → 0.0 gradient(f1,0) = (nothing,) but f2 = (x) → x^2 gradient(f2, 0) = (0,) Why does the first one return “nothing” instead o…

---

## [Develop simple open source graph visualization library](https://discourse.julialang.org/t/develop-simple-open-source-graph-visualization-library/24607)

<div class="topic-metadata">

**Author:** [@keorn](https://discourse.julialang.org/u/keorn)\
**Replies:** 8\
**Last updated:** [July 24, 2019, 9:11am UTC](https://discourse.julialang.org/t/develop-simple-open-source-graph-visualization-library/24607 "2019-07-24T09:11:55Z")

</div>

Will prefer offers for payment upon completion, but can pay up to half up front. The task is to write an open source library for visualization of directed graphs in Julia. See GitHub - JuliaGraphs/GraphPlot.jl: Graph vi…

---

## [How is Number(1) allowed when Number is an abstract type?](https://discourse.julialang.org/t/how-is-number-1-allowed-when-number-is-an-abstract-type/26717)

<div class="topic-metadata">

**Author:** [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Replies:** 9\
**Last updated:** [July 24, 2019, 7:44am UTC](https://discourse.julialang.org/t/how-is-number-1-allowed-when-number-is-an-abstract-type/26717 "2019-07-24T07:44:40Z")

</div>

abstract type cannot be instantiated (no constructor). How are such expressions as Number(1), Number(1+im) possible then?

---

## [Pkg Manager Problems after an update](https://discourse.julialang.org/t/pkg-manager-problems-after-an-update/26704)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 8\
**Last updated:** [July 24, 2019, 4:56am UTC](https://discourse.julialang.org/t/pkg-manager-problems-after-an-update/26704 "2019-07-24T04:56:26Z")

</div>

I’ve recently tagged new versions of two of my packages, JuLIP.jl and NeighbourLists.jl, and all hell has broken loose now in my small package eco-system. I would be grateful for any help in unravelling this. I performed…

---

## [Some unexplained example in defining concrete type from an abstract type with multiple parameters](https://discourse.julialang.org/t/some-unexplained-example-in-defining-concrete-type-from-an-abstract-type-with-multiple-parameters/26581)

<div class="topic-metadata">

**Author:** [@Sijun](https://discourse.julialang.org/u/Sijun)\
**Replies:** 0\
**Last updated:** [July 20, 2019, 11:23am UTC](https://discourse.julialang.org/t/some-unexplained-example-in-defining-concrete-type-from-an-abstract-type-with-multiple-parameters/26581 "2019-07-20T11:23:31Z")

</div>

Suppose I have a base type, which is abstract: SuperType{T, S, T} = Tuple{T, S, T} where T \<: Real where S \<: AbstractString Indeed SuperType can be used for type assertion successfully: (1.0, "hello", 1.0)::SuperType…

---

## [How to replace macro argument with expr as being typed manually?](https://discourse.julialang.org/t/how-to-replace-macro-argument-with-expr-as-being-typed-manually/26630)

<div class="topic-metadata">

**Author:** [@Islam0mar](https://discourse.julialang.org/u/Islam0mar)\
**Replies:** 5\
**Last updated:** [July 24, 2019, 4:20am UTC](https://discourse.julialang.org/t/how-to-replace-macro-argument-with-expr-as-being-typed-manually/26630 "2019-07-24T04:20:22Z")

</div>

Given a macro @NLobjective which have the following usage example: @NLobjective(m, Min, 11 x² - 484 x + 12358) I want to write a function that returns the last expression 11 x² - 484 x + 12358. Function implementation: …

---

## [Using LabelledArrays with ArrayPartition](https://discourse.julialang.org/t/using-labelledarrays-with-arraypartition/26707)

<div class="topic-metadata">

**Author:** [@mzilhao](https://discourse.julialang.org/u/mzilhao)\
**Replies:** 1\
**Last updated:** [July 24, 2019, 2:35am UTC](https://discourse.julialang.org/t/using-labelledarrays-with-arraypartition/26707 "2019-07-24T02:35:24Z")

</div>

I was wondering if there is any way of using the functionality of LabelledArrays.jl with ArrayPartition. I’m finding ArrayPartition very convenient to group together and pass around arrays storing different variables (w…

[Previous page](https://discourse.julialang.org/latest.md?page=1952)

[Next page](https://discourse.julialang.org/latest.md?page=1954)
