# Latest

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

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

**Page:** 1587

---

## [Why did I use \`local\`?](https://discourse.julialang.org/t/why-did-i-use-local/49381)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 2\
**Last updated:** [October 31, 2020, 8:46pm UTC](https://discourse.julialang.org/t/why-did-i-use-local/49381 "2020-10-31T20:46:51Z")

</div>

Hello, I’m trying to refresh an old code of mine, about 5 years old. I found this function: ## sort array M with respect to colon j function sortbycol(M,j) local col, perm col = M\[:,j\] perm = sortperm(col)\[2\] r…

---

## [Using a function in PyJulia](https://discourse.julialang.org/t/using-a-function-in-pyjulia/49330)

<div class="topic-metadata">

**Author:** [@Rita\_Paz](https://discourse.julialang.org/u/Rita_Paz)\
**Replies:** 4\
**Last updated:** [October 31, 2020, 8:09pm UTC](https://discourse.julialang.org/t/using-a-function-in-pyjulia/49330 "2020-10-31T20:09:25Z")

</div>

I want to use a function defined in a Julia file with PyJulia. Running the code gives the following error: RuntimeError: \<PyCall.jlwrap (in a Julia function called from Python) JULIA: UndefVarError: pqrfact not define…

---

## [\`svd\` function: difference between the show instance and the output](https://discourse.julialang.org/t/svd-function-difference-between-the-show-instance-and-the-output/49382)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 1\
**Last updated:** [October 31, 2020, 7:58pm UTC](https://discourse.julialang.org/t/svd-function-difference-between-the-show-instance-and-the-output/49382 "2020-10-31T19:58:24Z")

</div>

Hello, Look at Vt here: julia\> (U, SV, Vt) = svd(a) SVD{Float64,Float64,Array{Float64,2}} U factor: 2×2 Array{Float64,2}: -0.357373 -0.933962 -0.933962 0.357373 singular values: 2-element Array{Float64,1}: 6.2429…

---

## [Calling a function](https://discourse.julialang.org/t/calling-a-function/48875)

<div class="topic-metadata">

**Author:** [@Hrishikesh\_Das](https://discourse.julialang.org/u/Hrishikesh_Das)\
**Replies:** 4\
**Last updated:** [October 31, 2020, 7:19pm UTC](https://discourse.julialang.org/t/calling-a-function/48875 "2020-10-31T19:19:36Z")

</div>

I am trying to call a function. I have installed the package JuAFEM. The function file is already there. https://github.com/KristofferC/JuAFEM.jl/blob/master/src/Grid/grid\_generators.jl My code using JuAFEM generate\_…

---

## [Julia equivalent of the R function \`model.matrix\`](https://discourse.julialang.org/t/julia-equivalent-of-the-r-function-model-matrix/49325)

<div class="topic-metadata">

**Author:** [@stla](https://discourse.julialang.org/u/stla)\
**Replies:** 2\
**Last updated:** [October 31, 2020, 7:08pm UTC](https://discourse.julialang.org/t/julia-equivalent-of-the-r-function-model-matrix/49325 "2020-10-31T19:08:16Z")

</div>

Hello, Is there a Julia function equivalent to the R function model.matrix? This R function returns the design matrix of a linear regression model. For example model.matrix(~ group + treatment + group:treatment, data = …

---

## [Run test subsets with \`Pkg.test\`](https://discourse.julialang.org/t/run-test-subsets-with-pkg-test/7050)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 15\
**Last updated:** [October 31, 2020, 6:52pm UTC](https://discourse.julialang.org/t/run-test-subsets-with-pkg-test/7050 "2020-10-31T18:52:52Z")

</div>

It doesn’t seem to be possible to define groups of tests and then run only a given group of tests with Pkg.test. Is there an alternative recommended mechanism to achieve this goal? Here is the use-case. I have a large p…

---

## [Second derivative of custom neural network - gradient error](https://discourse.julialang.org/t/second-derivative-of-custom-neural-network-gradient-error/49311)

<div class="topic-metadata">

**Author:** [@Andreas\_Schlaginhauf](https://discourse.julialang.org/u/Andreas_Schlaginhauf)\
**Replies:** 3\
**Last updated:** [October 31, 2020, 6:10pm UTC](https://discourse.julialang.org/t/second-derivative-of-custom-neural-network-gradient-error/49311 "2020-10-31T18:10:14Z")

</div>

I am trying to take the second derivative of a custom neural network like this, icnn = ICNN(1, \[32, 32\], soft\_relu(0.1)) function df(x) gradient(y-\>sum(icnn(y)), x)\[1\] end df(\[1\]) gradient(y-\>sum(df(y)), \[1\]) This …

---

## [How to sum array of tuples](https://discourse.julialang.org/t/how-to-sum-array-of-tuples/49378)

<div class="topic-metadata">

**Author:** [@derikk](https://discourse.julialang.org/u/derikk)\
**Replies:** 5\
**Last updated:** [October 31, 2020, 6:39pm UTC](https://discourse.julialang.org/t/how-to-sum-array-of-tuples/49378 "2020-10-31T18:39:52Z")

</div>

I have an array of tuples of weight and bias gradients for my neural network (so, an array of matrix-vector tuples). How can I sum over them, ideally without an explicit loop? As a small example, let arr = \[(rand(2,2),…

---

## [How to vectorize a SIR Model to add age-stratification with the DifferentialEquations.jl package?](https://discourse.julialang.org/t/how-to-vectorize-a-sir-model-to-add-age-stratification-with-the-differentialequations-jl-package/49375)

<div class="topic-metadata">

**Author:** [@PietroMonticone](https://discourse.julialang.org/u/PietroMonticone)\
**Replies:** 3\
**Last updated:** [October 31, 2020, 6:07pm UTC](https://discourse.julialang.org/t/how-to-vectorize-a-sir-model-to-add-age-stratification-with-the-differentialequations-jl-package/49375 "2020-10-31T18:07:31Z")

</div>

Consider the following simple SIR model I’ve written in the DifferentialEquations.jl framework: # Import using DifferentialEquations # Parameter 𝒫 = \[0.1,0.2\] # Model Parameters ℬ = \[0.8,0.1, 0.0\] # Initial …

---

## [RandomForest with out of bag prediction](https://discourse.julialang.org/t/randomforest-with-out-of-bag-prediction/49377)

<div class="topic-metadata">

**Author:** [@lubo](https://discourse.julialang.org/u/lubo)\
**Replies:** 0\
**Last updated:** [October 31, 2020, 5:50pm UTC](https://discourse.julialang.org/t/randomforest-with-out-of-bag-prediction/49377 "2020-10-31T17:50:09Z")

</div>

Hi, please, is there any implementation of RandomForest with Out of bag predictions? Seems to the reference RF package DecisionTree.jl has still this only as TODO (long time). Another package with OOB RandomForests.jl …

---

## [Unexpected Tullio behavior](https://discourse.julialang.org/t/unexpected-tullio-behavior/49371)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 6\
**Last updated:** [October 31, 2020, 5:17pm UTC](https://discourse.julialang.org/t/unexpected-tullio-behavior/49371 "2020-10-31T17:17:35Z")

</div>

In the program below, I had expected a, a2 to produce the same result, but they don’t. It appears that Tullio (which I like!) does not deal with vectors of matrices in the way that I had expected. The output is: \[ Inf…

---

## [A modest \`missing\`s 2.0 proposal](https://discourse.julialang.org/t/a-modest-missing-s-2-0-proposal/49266)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 20\
**Last updated:** [October 31, 2020, 5:08pm UTC](https://discourse.julialang.org/t/a-modest-missing-s-2-0-proposal/49266 "2020-10-31T17:08:55Z")

</div>

This came up on Slack the other day and I want to formalize a little proposal here. This is not possible, in terms of SemVer or by the compiler, currently. Problem 1: names = \["Roger", missing\] names\[2\] + 5 The second…

---

## [Generalizing functions to accept inputs with 1 or 2 (or with 2 or 3) dimensions](https://discourse.julialang.org/t/generalizing-functions-to-accept-inputs-with-1-or-2-or-with-2-or-3-dimensions/49317)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 21\
**Last updated:** [October 31, 2020, 3:36pm UTC](https://discourse.julialang.org/t/generalizing-functions-to-accept-inputs-with-1-or-2-or-with-2-or-3-dimensions/49317 "2020-10-31T15:36:41Z")

</div>

I wish to create a function which can accept one input and perform calculations, or can accept multiple inputs, choose the best one, and then perform calculations. I’m not sure how to approach it. I originally thought th…

---

## [How to use dataloader](https://discourse.julialang.org/t/how-to-use-dataloader/49370)

<div class="topic-metadata">

**Author:** [@Rahul\_Kusuma](https://discourse.julialang.org/u/Rahul_Kusuma)\
**Replies:** 0\
**Last updated:** [October 31, 2020, 3:03pm UTC](https://discourse.julialang.org/t/how-to-use-dataloader/49370 "2020-10-31T15:03:45Z")

</div>

how to use dataloader like the one in pytorch in julia to load imagefolder

---

## [Why doesn't first(Array, Int64) work?](https://discourse.julialang.org/t/why-doesnt-first-array-int64-work/49355)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 6\
**Last updated:** [October 31, 2020, 10:08am UTC](https://discourse.julialang.org/t/why-doesnt-first-array-int64-work/49355 "2020-10-31T10:08:26Z")

</div>

Why don’t these do the same thing? julia\> \[1,2,3\]\[1:2\] 2-element Array{Int64,1}: 1 2 julia\> first(\[1,2,3\], 2) ERROR: MethodError: no method matching first(::Array{Int64,1}, ::Int64) Closest candidates are: first(::…

---

## [GPU-friendly one-hot encoding](https://discourse.julialang.org/t/gpu-friendly-one-hot-encoding/49312)

<div class="topic-metadata">

**Author:** [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Replies:** 12\
**Last updated:** [October 31, 2020, 9:14am UTC](https://discourse.julialang.org/t/gpu-friendly-one-hot-encoding/49312 "2020-10-31T09:14:03Z")

</div>

Given a vector of indices I want to get a matrix where only one element with corresponding index is one and others are zeros. On CPU it’s pretty easy, e.g.: function onehot(s::AbstractVector, n\_dims::Int=maximum(s)) …

---

## [Inplace conversion of a (m,n)-array into an m-element array](https://discourse.julialang.org/t/inplace-conversion-of-a-m-n-array-into-an-m-element-array/49319)

<div class="topic-metadata">

**Author:** [@empet](https://discourse.julialang.org/u/empet)\
**Replies:** 6\
**Last updated:** [October 31, 2020, 9:04am UTC](https://discourse.julialang.org/t/inplace-conversion-of-a-m-n-array-into-an-m-element-array/49319 "2020-10-31T09:04:43Z")

</div>

Hi everyone, I’m new to Julia, comming from Python. I was a bit confused when defining an array as a list of lists in Python, I noticed that it isn’t an array of size(m,n). I searched the WEB and here, for an inplace …

---

## [\`undef\` for \`isbits\` types with custom constructors](https://discourse.julialang.org/t/undef-for-isbits-types-with-custom-constructors/49203)

<div class="topic-metadata">

**Author:** [@Vasily\_Pisarev](https://discourse.julialang.org/u/Vasily_Pisarev)\
**Replies:** 17\
**Last updated:** [October 31, 2020, 8:46am UTC](https://discourse.julialang.org/t/undef-for-isbits-types-with-custom-constructors/49203 "2020-10-31T08:46:26Z")

</div>

Let’s say one defines a type with an inner constructor which keeps some invariant: struct OrdPair{T} lesser::T greater::T OrdPair(x::T, y::T) where T = new{T}(minmax(x, y)...) end Now, if one creates an uni…

---

## [Combining 2 ternary conditions, how to?](https://discourse.julialang.org/t/combining-2-ternary-conditions-how-to/49358)

<div class="topic-metadata">

**Author:** [@teriiju](https://discourse.julialang.org/u/teriiju)\
**Replies:** 10\
**Last updated:** [October 31, 2020, 8:39am UTC](https://discourse.julialang.org/t/combining-2-ternary-conditions-how-to/49358 "2020-10-31T08:39:37Z")

</div>

Hi, newbie, wonderings :slightly\_smiling\_face: 1: if it is safe to combine 2 (or more) ternary conditions. as in this way : (e\>f) ? “e” : (f\<g) ? “f” : “g” - with : e=2, f=4, g=8 ? or if that is not recomended. …

---

## [Detect lines with Hough transform](https://discourse.julialang.org/t/detect-lines-with-hough-transform/49307)

<div class="topic-metadata">

**Author:** [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Replies:** 10\
**Last updated:** [October 31, 2020, 8:17am UTC](https://discourse.julialang.org/t/detect-lines-with-hough-transform/49307 "2020-10-31T08:17:44Z")

</div>

I have an image with 3 lines in it: For each of the three lines, I’d like to find the coordinates of their ends (i.e. where in the image are the start and end of each line). I thought that the best tool for the job wo…

---

## [Why doesn't indexing syntax broadcast?](https://discourse.julialang.org/t/why-doesnt-indexing-syntax-broadcast/49353)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [October 31, 2020, 7:34am UTC](https://discourse.julialang.org/t/why-doesnt-indexing-syntax-broadcast/49353 "2020-10-31T07:34:00Z")

</div>

Why don’t these do the same thing? julia\> getindex.(\[\[1,2\], \[3,4\]\], 1) 2-element Array{Int64,1}: 1 3 julia\> \[\[1,2\], \[3,4\]\].\[1\] ERROR: syntax: invalid syntax "\[\[1, 2\], \[3, 4\]\].\[1\]"

---

## [Minimizing allocations from memoized functions](https://discourse.julialang.org/t/minimizing-allocations-from-memoized-functions/49221)

<div class="topic-metadata">

**Author:** [@ash](https://discourse.julialang.org/u/ash)\
**Replies:** 10\
**Last updated:** [October 31, 2020, 7:05am UTC](https://discourse.julialang.org/t/minimizing-allocations-from-memoized-functions/49221 "2020-10-31T07:05:17Z")

</div>

I have the following MWE using a memoized function: using Memoization using FFTW struct Operators{F} K::F # More operators end function run(N, α) M = 512 ω = rand(M) # Cache the kinetic factor …

---

## [CPLEX.jl Quadratic Expression symmetric matrix bug?](https://discourse.julialang.org/t/cplex-jl-quadratic-expression-symmetric-matrix-bug/49315)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 9\
**Last updated:** [October 31, 2020, 6:17am UTC](https://discourse.julialang.org/t/cplex-jl-quadratic-expression-symmetric-matrix-bug/49315 "2020-10-31T06:17:01Z")

</div>

I have a optimization procedure that used to work but now I’m getting an error. Is it related to the new CPLEX.jl package? A simple working example that produces the error is: m = Model(CPLEX.Optimizer) @variable m x\[1:…

---

## [Nonlinear optimization help. Optim, JuMP, something else?](https://discourse.julialang.org/t/nonlinear-optimization-help-optim-jump-something-else/47163)

<div class="topic-metadata">

**Author:** [@dweb](https://discourse.julialang.org/u/dweb)\
**Replies:** 5\
**Last updated:** [October 31, 2020, 5:19am UTC](https://discourse.julialang.org/t/nonlinear-optimization-help-optim-jump-something-else/47163 "2020-10-31T05:19:16Z")

</div>

I have a nonlinear optimization problem that I’ve tried solving with scipy. For small scale it (the ‘TNC’ option in scipy minimize, specifically) works well, but it’s too slow when I get to thousands of variables. I’m le…

---

## [ANN: MPI.jl v0.10.0: new build process and CUDA-aware support](https://discourse.julialang.org/t/ann-mpi-jl-v0-10-0-new-build-process-and-cuda-aware-support/27601)

<div class="topic-metadata">

**Author:** [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Replies:** 26\
**Last updated:** [October 31, 2020, 5:16am UTC](https://discourse.julialang.org/t/ann-mpi-jl-v0-10-0-new-build-process-and-cuda-aware-support/27601 "2020-10-31T05:16:06Z")

</div>

I have just tagged a new version of MPI.jl. Though the user-facing interface is largely the same, there has been extensive work underneath to internally use the C API (instead of the Fortran one). As a result, the build …

---

## [A working physics engine package?](https://discourse.julialang.org/t/a-working-physics-engine-package/48184)

<div class="topic-metadata">

**Author:** [@mlg556](https://discourse.julialang.org/u/mlg556)\
**Replies:** 8\
**Last updated:** [October 31, 2020, 3:20am UTC](https://discourse.julialang.org/t/a-working-physics-engine-package/48184 "2020-10-31T03:20:09Z")

</div>

I’ve been trying to find a working physics engine library, but it seems that the ports of Box2D and Chipmunk are out of date. There is RigidBodyDynamics, but as far as I can tell it doesn’t support collisions and contact…

---

## [Moving grid lines to foreground with contour](https://discourse.julialang.org/t/moving-grid-lines-to-foreground-with-contour/49275)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 3\
**Last updated:** [October 30, 2020, 11:30pm UTC](https://discourse.julialang.org/t/moving-grid-lines-to-foreground-with-contour/49275 "2020-10-30T23:30:18Z")

</div>

When using contourf, I’d like to move the grid lines to the foreground, but I can’t quite see how to do that. Thanks.

---

## [\`jlpkg\` -- a command line interface to Pkg](https://discourse.julialang.org/t/jlpkg-a-command-line-interface-to-pkg/24077)

<div class="topic-metadata">

**Author:** [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Replies:** 1\
**Last updated:** [October 30, 2020, 1:05pm UTC](https://discourse.julialang.org/t/jlpkg-a-command-line-interface-to-pkg/24077 "2020-10-30T13:05:21Z")

</div>

Hello everyone! I’d like to announce jlpkg, a command line interface (CLI) to Julia’s package manager Pkg. jlpkg is essentially a wrapper around the Pkg REPL mode so all of you are probably familiar with the commands al…

---

## [Distributed Dimensional Arrays](https://discourse.julialang.org/t/distributed-dimensional-arrays/49343)

<div class="topic-metadata">

**Author:** [@hyacykcharel](https://discourse.julialang.org/u/hyacykcharel)\
**Replies:** 0\
**Last updated:** [October 30, 2020, 11:14pm UTC](https://discourse.julialang.org/t/distributed-dimensional-arrays/49343 "2020-10-30T23:14:56Z")

</div>

Hello, I’m trying to run this in parallel but the result is not what I want, and I need My DArray to be synchronized. #2D Heat Equation. using Distributed addprocs(2) @everywhere using DistributedArrays @everywhere usin…

---

## [Calling a Fortran routine from a library which uses LAPACK](https://discourse.julialang.org/t/calling-a-fortran-routine-from-a-library-which-uses-lapack/49124)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 9\
**Last updated:** [October 30, 2020, 11:07pm UTC](https://discourse.julialang.org/t/calling-a-fortran-routine-from-a-library-which-uses-lapack/49124 "2020-10-30T23:07:02Z")

</div>

I made several wrappers to LAPACK, so I am basically familiar with the mechanism of calling Fortran based LAPACK programs from Julia. I would like to call now subroutines from another Fortran library (called SLICOT), whi…

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

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