# Latest

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

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

**Page:** 1245

---

## [Problem defining a Neural Network with gradient as Loss function](https://discourse.julialang.org/t/problem-defining-a-neural-network-with-gradient-as-loss-function/69164)

<div class="topic-metadata">

**Author:** [@munozariasjm](https://discourse.julialang.org/u/munozariasjm)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 9:26pm UTC](https://discourse.julialang.org/t/problem-defining-a-neural-network-with-gradient-as-loss-function/69164 "2021-10-08T21:26:52Z")

</div>

Hi, I’m trying to setup a simple network who’s Loss Function is the Laplacian of the NN with respect to the gradient. Then, the loss function is: function 𝕃1(x) f(j) = NNsolver(j) #Output of the NN ∇²(n) = Zygo…

---

## [Matrix Multiplication 10x+ Speedup](https://discourse.julialang.org/t/matrix-multiplication-10x-speedup/69452)

<div class="topic-metadata">

**Author:** [@laut](https://discourse.julialang.org/u/laut)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 9:22pm UTC](https://discourse.julialang.org/t/matrix-multiplication-10x-speedup/69452 "2021-10-08T21:22:12Z")

</div>

Researchers at MIT’s Computer Science & Artificial Intelligence Lab (CSAIL) have open-sourced Multiply-ADDitioN-lESS (MADDNESS), an algorithm that speeds up machine learning using approximate matrix multiplication (AMM).…

---

## [GPU Error in Julia 1.6 but not in Julia 1.5](https://discourse.julialang.org/t/gpu-error-in-julia-1-6-but-not-in-julia-1-5/69440)

<div class="topic-metadata">

**Author:** [@PGJulia](https://discourse.julialang.org/u/PGJulia)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 8:53pm UTC](https://discourse.julialang.org/t/gpu-error-in-julia-1-6-but-not-in-julia-1-5/69440 "2021-10-08T20:53:34Z")

</div>

Hi, The following kernel works in Julia 1.5.3 but not in Julia 1.6.3. I believe it is related to CUDA.exp but I tried directly with exp() w/o success. function vr(Nb,Ny,α,β,τ,Vr,V0,Y,B,Price0,P) ib = (blockIdx().x-1)\*…

---

## [Read multiple variables from binary file at once](https://discourse.julialang.org/t/read-multiple-variables-from-binary-file-at-once/69409)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 6\
**Last updated:** [October 8, 2021, 8:51pm UTC](https://discourse.julialang.org/t/read-multiple-variables-from-binary-file-at-once/69409 "2021-10-08T20:51:36Z")

</div>

Hi all, if a binary file contains, e.g. many intergers, how can I elegantly read them at once, Given the total number is known? The most naive way to read them: open(filename) do f a = read(f, Int32) …

---

## [How to understand interface requirements of standard library](https://discourse.julialang.org/t/how-to-understand-interface-requirements-of-standard-library/69449)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 8\
**Last updated:** [October 8, 2021, 8:03pm UTC](https://discourse.julialang.org/t/how-to-understand-interface-requirements-of-standard-library/69449 "2021-10-08T20:03:17Z")

</div>

Concrete problem: I have a ConcreteVector implementing AbstractVector with some Base. methods. Calling Base.vcat returns a Vector, but I would like it to return a ConcreteVector. So either I’m missing some necessary meth…

---

## [While loop to evaluate until conditions are false](https://discourse.julialang.org/t/while-loop-to-evaluate-until-conditions-are-false/69446)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 5\
**Last updated:** [October 8, 2021, 7:56pm UTC](https://discourse.julialang.org/t/while-loop-to-evaluate-until-conditions-are-false/69446 "2021-10-08T19:56:53Z")

</div>

Hi, I’ve been stumped for a while now and think I am overthinking this. I want to have a vector that excludes a certain value (in this case 2) AND each element is unique (no repeats). My thought is that while my two con…

---

## [Using LightGraphs to find shortest path for eikonal solution](https://discourse.julialang.org/t/using-lightgraphs-to-find-shortest-path-for-eikonal-solution/69324)

<div class="topic-metadata">

**Author:** [@apattyn](https://discourse.julialang.org/u/apattyn)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 7:18pm UTC](https://discourse.julialang.org/t/using-lightgraphs-to-find-shortest-path-for-eikonal-solution/69324 "2021-10-08T19:18:19Z")

</div>

I was using FastMarching.jl to solve the eikonal equation for a given speed image, however the built-in shortestpath(…) function doesn’t give the correct solution - e.g. in a homogeneous speed image the shortest path b/w…

---

## [How to get the cartesian indexes of the k largest elements of a matrix (2D array) efficiently?](https://discourse.julialang.org/t/how-to-get-the-cartesian-indexes-of-the-k-largest-elements-of-a-matrix-2d-array-efficiently/69419)

<div class="topic-metadata">

**Author:** [@erwanlecarpentier](https://discourse.julialang.org/u/erwanlecarpentier)\
**Replies:** 12\
**Last updated:** [October 8, 2021, 3:03pm UTC](https://discourse.julialang.org/t/how-to-get-the-cartesian-indexes-of-the-k-largest-elements-of-a-matrix-2d-array-efficiently/69419 "2021-10-08T15:03:20Z")

</div>

Hi! I would like to find a way to get the cartesian indexes of the k largest elements in a matrix (2D array). Do you have suggestions of a computationally efficient method to achieve that? Example: for k=3 with the matr…

---

## [Advice on Troubleshooting](https://discourse.julialang.org/t/advice-on-troubleshooting/69394)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 2\
**Last updated:** [October 8, 2021, 5:54pm UTC](https://discourse.julialang.org/t/advice-on-troubleshooting/69394 "2021-10-08T17:54:24Z")

</div>

What are ways to map a long function to find common errors, like not having end for an if statement, or not mapping nested if statements, whlie loops, etc?

---

## [Iterate through iterator starting and ending at a specified value](https://discourse.julialang.org/t/iterate-through-iterator-starting-and-ending-at-a-specified-value/69444)

<div class="topic-metadata">

**Author:** [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 5:25pm UTC](https://discourse.julialang.org/t/iterate-through-iterator-starting-and-ending-at-a-specified-value/69444 "2021-10-08T17:25:16Z")

</div>

I have an iterator. How do I iterator through a selection of it? E.g. it = Iterators.product(\[\[1,2,3\],\[1,2\]\]...) foreach(x-\>println(x),it) iterates through all 6 values. But say I want to iterate starting with the 2nd…

---

## [Broadcasting inconsistency between addition and multiplication](https://discourse.julialang.org/t/broadcasting-inconsistency-between-addition-and-multiplication/69435)

<div class="topic-metadata">

**Author:** [@pagalguy](https://discourse.julialang.org/u/pagalguy)\
**Replies:** 13\
**Last updated:** [October 8, 2021, 4:46pm UTC](https://discourse.julialang.org/t/broadcasting-inconsistency-between-addition-and-multiplication/69435 "2021-10-08T16:46:45Z")

</div>

There seems to be inconsistency in broadcasting. A = \[1 2 ; 3 4\] A\* 2 # Broadcasting works here A.\*2 # Broadcasting same as above A + 2 # Broadcasting fails here. If it works for \* then it should work for all oper…

---

## [How to completely remove a package](https://discourse.julialang.org/t/how-to-completely-remove-a-package/69422)

<div class="topic-metadata">

**Author:** [@Johncowk](https://discourse.julialang.org/u/Johncowk)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 4:46pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-package/69422 "2021-10-08T16:46:36Z")

</div>

I tried removing the pacakge with rm packagename, which seems to have de-installed the package, but I see that it is still there in \\.julia\\packages\\ Last time I manually remove a directory from \\.julia\\packages\\, it ca…

---

## [Parameter estimation and model inadequacy](https://discourse.julialang.org/t/parameter-estimation-and-model-inadequacy/69407)

<div class="topic-metadata">

**Author:** [@GregCoyle](https://discourse.julialang.org/u/GregCoyle)\
**Replies:** 2\
**Last updated:** [October 8, 2021, 3:51pm UTC](https://discourse.julialang.org/t/parameter-estimation-and-model-inadequacy/69407 "2021-10-08T15:51:46Z")

</div>

Are there any packages associated with Bayesian inference that provide methods to take on model inadequacy, AKA structural error, model bias, etc.? I’m particularly interested in applications to Bayesian parameter estima…

---

## [ChargedParticles Example Seems Too Boring as an Example of NBodySimulator - Am I doing something wrong?](https://discourse.julialang.org/t/chargedparticles-example-seems-too-boring-as-an-example-of-nbodysimulator-am-i-doing-something-wrong/69439)

<div class="topic-metadata">

**Author:** [@Adam\_Fleischhacker](https://discourse.julialang.org/u/Adam_Fleischhacker)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 3:43pm UTC](https://discourse.julialang.org/t/chargedparticles-example-seems-too-boring-as-an-example-of-nbodysimulator-am-i-doing-something-wrong/69439 "2021-10-08T15:43:29Z")

</div>

I am using the NBodySimulator.jl package and trying to understand it to model “blue-noise sampling” (see here if interested: Blue noise sampling using an N-body simulation-based method | SpringerLink). I am swimming ou…

---

## [Extract @formula / model formula from GLM object](https://discourse.julialang.org/t/extract-formula-model-formula-from-glm-object/66610)

<div class="topic-metadata">

**Author:** [@guysutton](https://discourse.julialang.org/u/guysutton)\
**Replies:** 2\
**Last updated:** [October 8, 2021, 3:28pm UTC](https://discourse.julialang.org/t/extract-formula-model-formula-from-glm-object/66610 "2021-10-08T15:28:56Z")

</div>

I am trying to extract the model formula from a fitted GLM object, with little success. In the dummy example below, I would like to get the following back, for example: Y ~ X \[i.e. the information stored inside @formula(…

---

## [Transpose Plot Layout](https://discourse.julialang.org/t/transpose-plot-layout/69267)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 3:19pm UTC](https://discourse.julialang.org/t/transpose-plot-layout/69267 "2021-10-08T15:19:57Z")

</div>

I am using Plots for plotting and tried out subplots today. I wanted to plot 4 rows of plots and 2 columns. The code I am using is: # plot data p = Array{Plots.Plot}(undef, 8) n = 0 for i = 1:8 …

---

## [Mutating fields of an array of structs originating from C](https://discourse.julialang.org/t/mutating-fields-of-an-array-of-structs-originating-from-c/69375)

<div class="topic-metadata">

**Author:** [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Replies:** 2\
**Last updated:** [October 8, 2021, 3:12pm UTC](https://discourse.julialang.org/t/mutating-fields-of-an-array-of-structs-originating-from-c/69375 "2021-10-08T15:12:07Z")

</div>

I am calling a C library that returns a pointer to an array of structs. My goal is to make views that are arrays of the field values, much like StructArrays does. However, StructArrays does not let to mutate the under…

---

## [Read a file separated by blank lines?](https://discourse.julialang.org/t/read-a-file-separated-by-blank-lines/69430)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 5\
**Last updated:** [October 8, 2021, 3:01pm UTC](https://discourse.julialang.org/t/read-a-file-separated-by-blank-lines/69430 "2021-10-08T15:01:21Z")

</div>

I have a file containing several multi-line blocks of text separate by blank lines. A blank line may contain just a line break or also some space. Is there something similar to readline() which allows me to read in these…

---

## [Placing variables in array makes a copy of the variables?](https://discourse.julialang.org/t/placing-variables-in-array-makes-a-copy-of-the-variables/69397)

<div class="topic-metadata">

**Author:** [@nlaws](https://discourse.julialang.org/u/nlaws)\
**Replies:** 13\
**Last updated:** [October 8, 2021, 2:43pm UTC](https://discourse.julialang.org/t/placing-variables-in-array-makes-a-copy-of-the-variables/69397 "2021-10-08T14:43:51Z")

</div>

Maybe this is a scoping issue? I am trying to define defaults in an outer constructor by looping over a list of variables and setting defaults if they are NaN as follows: julia\> struct S x::Float64 end julia\> function …

---

## [Call blocking C function](https://discourse.julialang.org/t/call-blocking-c-function/69427)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 2\
**Last updated:** [October 8, 2021, 2:43pm UTC](https://discourse.julialang.org/t/call-blocking-c-function/69427 "2021-10-08T14:43:10Z")

</div>

I am trying to create a task that asynchronously accepts connection on a TCP socket initialized by external C code, something like this (simplified): #include \<stdio.h\> #include \<sys/types.h\> #include \<sys/socket.h\> #in…

---

## [Exponentiation (\`^\`) on a non-US keyboard](https://discourse.julialang.org/t/exponentiation-on-a-non-us-keyboard/69361)

<div class="topic-metadata">

**Author:** [@met-j](https://discourse.julialang.org/u/met-j)\
**Replies:** 16\
**Last updated:** [October 8, 2021, 2:36pm UTC](https://discourse.julialang.org/t/exponentiation-on-a-non-us-keyboard/69361 "2021-10-08T14:36:05Z")

</div>

I am lost. What changed so the simple algebra like 2ˆ2 does not work anymore (Julia v1.6.3) in the REPL (on MacOS)? And how would I draw the power of a int or a float? I get julia\> 2ˆ2 ERROR: UndefVarError: ˆ2 not de…

---

## [^ vs exp for exponentiation](https://discourse.julialang.org/t/vs-exp-for-exponentiation/69437)

<div class="topic-metadata">

**Author:** [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 2:30pm UTC](https://discourse.julialang.org/t/vs-exp-for-exponentiation/69437 "2021-10-08T14:30:38Z")

</div>

One last thing to note: If you care about performance, don’t use ^ whenever possible. exp (or exp2/exp10) will be 5x to 30x faster.

---

## [Bug in StatsModels.modelmatrix()](https://discourse.julialang.org/t/bug-in-statsmodels-modelmatrix/69428)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 1:56pm UTC](https://discourse.julialang.org/t/bug-in-statsmodels-modelmatrix/69428 "2021-10-08T13:56:15Z")

</div>

as per below, modelmatrix() (also modelcols()) fails when the formula is “quadratic” rather than “linear”: using DataFrames using GLM df = DataFrame(a = 1.0:3.0, b = 2.0:4.0, y = 5.0:7.0) fml1 = @formula(y ~ 1 + a + b);…

---

## [What is the uknown rate, how to resolve it?](https://discourse.julialang.org/t/what-is-the-uknown-rate-how-to-resolve-it/68839)

<div class="topic-metadata">

**Author:** [@Lessvn](https://discourse.julialang.org/u/Lessvn)\
**Replies:** 4\
**Last updated:** [October 8, 2021, 1:28pm UTC](https://discourse.julialang.org/t/what-is-the-uknown-rate-how-to-resolve-it/68839 "2021-10-08T13:28:17Z")

</div>

Hello, I am trying to solve an optimzation problem using SCIP, it looks like every thing is fine, unless I get this warning at the onset where the solution starts. WARNING: ignore partial solution (0) because unknown …

---

## [Display Images downsized by Pluto?](https://discourse.julialang.org/t/display-images-downsized-by-pluto/69066)

<div class="topic-metadata">

**Author:** [@Jianbing\_Chen](https://discourse.julialang.org/u/Jianbing_Chen)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 1:06pm UTC](https://discourse.julialang.org/t/display-images-downsized-by-pluto/69066 "2021-10-08T13:06:35Z")

</div>

Original image 281KB, Pluto renders (using Images.load()) an image with size of 68.3KB which is of too low quality. What’s the right way to address it? Thanks, jianbing

---

## [DifferentialEquations.jl -- store intermediate variables?](https://discourse.julialang.org/t/differentialequations-jl-store-intermediate-variables/68928)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 10:15am UTC](https://discourse.julialang.org/t/differentialequations-jl-store-intermediate-variables/68928 "2021-10-08T10:15:49Z")

</div>

Is there a way to store intermediate variables in ODEs using the DifferentialEquations package? MWE: using DifferentialEquations # function sys!(dx,x,p,t) r = 1 u = 5\*(r-x\[1\]) dx\[1\] = 0.1\*(u-x\[1\]) end # x0 …

---

## [ArgumentError: Converting an instance of ReverseDiff.TrackedReal{Float64, Float32, Nothing} to Float32 is not defined](https://discourse.julialang.org/t/argumenterror-converting-an-instance-of-reversediff-trackedreal-float64-float32-nothing-to-float32-is-not-defined/69380)

<div class="topic-metadata">

**Author:** [@linkz](https://discourse.julialang.org/u/linkz)\
**Replies:** 4\
**Last updated:** [October 8, 2021, 10:07am UTC](https://discourse.julialang.org/t/argumenterror-converting-an-instance-of-reversediff-trackedreal-float64-float32-nothing-to-float32-is-not-defined/69380 "2021-10-08T10:07:15Z")

</div>

Hello all, I am very new to Julia, just started using it a week ago (was mainly a Python user). I started off with the code example at DiffEqFlux documentation and modified it bit by bit (making sure that it’s still work…

---

## [Noun chunks segmentation for text analysis](https://discourse.julialang.org/t/noun-chunks-segmentation-for-text-analysis/69424)

<div class="topic-metadata">

**Author:** [@Maxim\_Lubov](https://discourse.julialang.org/u/Maxim_Lubov)\
**Replies:** 0\
**Last updated:** [October 8, 2021, 8:44am UTC](https://discourse.julialang.org/t/noun-chunks-segmentation-for-text-analysis/69424 "2021-10-08T08:44:04Z")

</div>

Is there in Julia an analog of spaCy “noun chunks” segmentation?: https://spacy.io/usage/linguistic-features#noun-chunks

---

## [Result of a function is a 3x6 matrix](https://discourse.julialang.org/t/result-of-a-function-is-a-3x6-matrix/69102)

<div class="topic-metadata">

**Author:** [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Replies:** 3\
**Last updated:** [October 8, 2021, 8:40am UTC](https://discourse.julialang.org/t/result-of-a-function-is-a-3x6-matrix/69102 "2021-10-08T08:40:36Z")

</div>

Dear all, I started to use Julia a week ago, by porting one of my existing computational fluid dynamics solvers to Julia. A subroutine I am currently working on is creating a 3x6 matrix of Float64s. In Fortran or C++ …

---

## [Allocation due to \`@noinline\` for unsafe\_read and unsafe\_write in io.jl](https://discourse.julialang.org/t/allocation-due-to-noinline-for-unsafe-read-and-unsafe-write-in-io-jl/69421)

<div class="topic-metadata">

**Author:** [@Paul\_Depping](https://discourse.julialang.org/u/Paul_Depping)\
**Replies:** 1\
**Last updated:** [October 8, 2021, 8:27am UTC](https://discourse.julialang.org/t/allocation-due-to-noinline-for-unsafe-read-and-unsafe-write-in-io-jl/69421 "2021-10-08T08:27:29Z")

</div>

I’m currently working with a lot of File IO, and I noticed that whenever i call the function write(s::IO, x::Union{Int16,UInt16,Int32,UInt32,Int64,UInt64,Int128,UInt128,Float16,Float32,Float64}), there is an Allocation. …

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

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