# Latest

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

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

**Page:** 935

---

## [Sum of two vectors of different lengths](https://discourse.julialang.org/t/sum-of-two-vectors-of-different-lengths/86751)

<div class="topic-metadata">

**Author:** [@moataz-sabry](https://discourse.julialang.org/u/moataz-sabry)\
**Replies:** 2\
**Last updated:** [September 4, 2022, 11:50am UTC](https://discourse.julialang.org/t/sum-of-two-vectors-of-different-lengths/86751 "2022-09-04T11:50:39Z")

</div>

I’m looking for a short for loop to sum two vectors of different lengths as in the following MWE. In general y could be longer, shorter than x or equal to it in length. julia\> x = \[1, 2, 3, 4\] 4-element Vector{Int64}: …

---

## [Error with 3-args dot based on FoldsCUDA](https://discourse.julialang.org/t/error-with-3-args-dot-based-on-foldscuda/86686)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 1\
**Last updated:** [September 4, 2022, 7:45am UTC](https://discourse.julialang.org/t/error-with-3-args-dot-based-on-foldscuda/86686 "2022-09-04T07:45:20Z")

</div>

Hi, I am trying to run a 3 args dot on GPU ( in fact CUDA). I am trying FoldsCUDA for simpler development of reductions but I dont understand why it errors on GPU but ot o CPU. Can someone give me a hint please? Thanks…

---

## [Curve Fitting With Error In Variables](https://discourse.julialang.org/t/curve-fitting-with-error-in-variables/82614)

<div class="topic-metadata">

**Author:** [@vini-fda](https://discourse.julialang.org/u/vini-fda)\
**Replies:** 5\
**Last updated:** [September 4, 2022, 4:27am UTC](https://discourse.julialang.org/t/curve-fitting-with-error-in-variables/82614 "2022-09-04T04:27:19Z")

</div>

I’m looking for a way to do curve fitting where the data has error both on x and y. I’ve read up on physics forums about errors-in-variables fitting, but I’d like to know if there are already any functionalities that ju…

---

## [Macro to create struct problem](https://discourse.julialang.org/t/macro-to-create-struct-problem/86737)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 5\
**Last updated:** [September 4, 2022, 4:24am UTC](https://discourse.julialang.org/t/macro-to-create-struct-problem/86737 "2022-09-04T04:24:23Z")

</div>

Hello for compatibility with other library I need to create a struct with names of the fields supplied via list of Strings I tried sth like this structName="example\_struct" keyss= \["a","b","c"\] symbolKeys= map(key-\>Sym…

---

## [Question for shut down the simulation in DifferentialEquations.jl](https://discourse.julialang.org/t/question-for-shut-down-the-simulation-in-differentialequations-jl/86747)

<div class="topic-metadata">

**Author:** [@Funkerfish](https://discourse.julialang.org/u/Funkerfish)\
**Replies:** 7\
**Last updated:** [September 4, 2022, 3:13am UTC](https://discourse.julialang.org/t/question-for-shut-down-the-simulation-in-differentialequations-jl/86747 "2022-09-04T03:13:53Z")

</div>

Hi everyone I read the Q&A document of DifferentialEquations.jl and find the following statement: if you see these warnings during a parameter estimation process, this is likely the underlying problem. Simply check sol…

---

## [Using @lift with @sprintf for animation in Makie.jl](https://discourse.julialang.org/t/using-lift-with-sprintf-for-animation-in-makie-jl/86746)

<div class="topic-metadata">

**Author:** [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Replies:** 1\
**Last updated:** [September 4, 2022, 12:39am UTC](https://discourse.julialang.org/t/using-lift-with-sprintf-for-animation-in-makie-jl/86746 "2022-09-04T00:39:47Z")

</div>

I want to display a text box which acts as a counter in an animation. I followed the tutorial here, but the text I want to display consists of an integer and a really small number (which is visually better displayed usin…

---

## [Last function](https://discourse.julialang.org/t/last-function/86741)

<div class="topic-metadata">

**Author:** [@reewa\_malik](https://discourse.julialang.org/u/reewa_malik)\
**Replies:** 4\
**Last updated:** [September 3, 2022, 11:21pm UTC](https://discourse.julialang.org/t/last-function/86741 "2022-09-03T23:21:20Z")

</div>

x=“abcd” last(x)==“d” This is giving me false as output, can anybody explain why??

---

## [How to decompress .xz files/ How to use streams?](https://discourse.julialang.org/t/how-to-decompress-xz-files-how-to-use-streams/86307)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 6\
**Last updated:** [September 3, 2022, 11:00pm UTC](https://discourse.julialang.org/t/how-to-decompress-xz-files-how-to-use-streams/86307 "2022-09-03T23:00:32Z")

</div>

I have the following code for unpacking .xz compressed files: using CodecXz function decompress(in, out) stream = open(in) output = open(out,"w") for line in eachline(XzDecompressorStream(stream)) p…

---

## [Approaching PrettyTables v2.0](https://discourse.julialang.org/t/approaching-prettytables-v2-0/86739)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 5\
**Last updated:** [September 3, 2022, 10:26pm UTC](https://discourse.julialang.org/t/approaching-prettytables-v2-0/86739 "2022-09-03T22:26:30Z")

</div>

Hi! We are approaching PrettyTables.jl v2.0! This version will be tagged when we have everything we need to make PrettyTables.jl the HTML backend in DataFrames (Use PrettyTables.jl as HTML backend by ronisbr · Pull Requ…

---

## [StatsBase sample throws first element when probabilities are zero](https://discourse.julialang.org/t/statsbase-sample-throws-first-element-when-probabilities-are-zero/86716)

<div class="topic-metadata">

**Author:** [@mwilinski](https://discourse.julialang.org/u/mwilinski)\
**Replies:** 2\
**Last updated:** [September 3, 2022, 9:51pm UTC](https://discourse.julialang.org/t/statsbase-sample-throws-first-element-when-probabilities-are-zero/86716 "2022-09-03T21:51:42Z")

</div>

I noticed that when provided with zero probabilities, sample (from StatsBase) always throws the first element. One can see it in the following example: using StatsBase println(sample(\[2, 3, 1\], ProbabilityWeights(\[0.0,…

---

## [Is it possible to index into a set of columns of a 3D array in a single line?](https://discourse.julialang.org/t/is-it-possible-to-index-into-a-set-of-columns-of-a-3d-array-in-a-single-line/75695)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 16\
**Last updated:** [September 3, 2022, 6:11pm UTC](https://discourse.julialang.org/t/is-it-possible-to-index-into-a-set-of-columns-of-a-3d-array-in-a-single-line/75695 "2022-09-03T18:11:56Z")

</div>

if I have a 3D matrix: foo = rand(10,10,100) and i want to extract: foo\[1,2,:\] and foo\[3,4,:\] with a single index, is there a way to do that? I don’t want to use a loop as foo in my case is chunked data that lives in…

---

## [Is @evalpoly needed anymore?](https://discourse.julialang.org/t/is-evalpoly-needed-anymore/86732)

<div class="topic-metadata">

**Author:** [@shmiggles](https://discourse.julialang.org/u/shmiggles)\
**Replies:** 1\
**Last updated:** [September 3, 2022, 4:14pm UTC](https://discourse.julialang.org/t/is-evalpoly-needed-anymore/86732 "2022-09-03T16:14:45Z")

</div>

Julia provides two ways of polynomial evaluation: one as a function (evalpoly) and the other as a macro (@evalpoly). My understanding is that the macro can (sometimes) be faster than the function due to inlining. However…

---

## [LsqFit.curve\_fit not working](https://discourse.julialang.org/t/lsqfit-curve-fit-not-working/86705)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 4\
**Last updated:** [September 3, 2022, 3:58pm UTC](https://discourse.julialang.org/t/lsqfit-curve-fit-not-working/86705 "2022-09-03T15:58:37Z")

</div>

What am I doing wrong here? using LsqFit polynom(x,p) = p\[1\].+p\[2\].\*x curve\_fit(polynom, 1:100,polynom(1:100,\[10 10\]),\[0.5 0.5\]) And I get this error ERROR: MethodError: no method matching levenberg\_marquardt(::NLSolv…

---

## [What is wrong with this code?](https://discourse.julialang.org/t/what-is-wrong-with-this-code/86695)

<div class="topic-metadata">

**Author:** [@Brian1](https://discourse.julialang.org/u/Brian1)\
**Replies:** 7\
**Last updated:** [September 3, 2022, 3:37pm UTC](https://discourse.julialang.org/t/what-is-wrong-with-this-code/86695 "2022-09-03T15:37:38Z")

</div>

using PProf using Profile.Allocs PProf.Allocs.to\_pprof UndefVarError: to\_pprof not defined Stacktrace: \[1\] getproperty(x::Module, f::Symbol) @ Base .\\Base.jl:31 \[2\] top-level scope @ In\[43\]:1 \[3\] eval @ .\\…

---

## [SOLVED: Cannot Precompile OrdinaryDiffEq. Do others have problems with SciML/MTK packages at the moment?](https://discourse.julialang.org/t/solved-cannot-precompile-ordinarydiffeq-do-others-have-problems-with-sciml-mtk-packages-at-the-moment/86729)

<div class="topic-metadata">

**Author:** [@TS-CUBED](https://discourse.julialang.org/u/TS-CUBED)\
**Replies:** 0\
**Last updated:** [September 3, 2022, 1:52pm UTC](https://discourse.julialang.org/t/solved-cannot-precompile-ordinarydiffeq-do-others-have-problems-with-sciml-mtk-packages-at-the-moment/86729 "2022-09-03T13:52:46Z")

</div>

SOLVED: not sure what the problem was. But setting the environment back up from scratch, after deleting all the precompile cache helped. I guess I had a few bad bits cached. I just did an update of my Julia packages an…

---

## [Projects, environments: workflow questions](https://discourse.julialang.org/t/projects-environments-workflow-questions/86720)

<div class="topic-metadata">

**Author:** [@jdm204](https://discourse.julialang.org/u/jdm204)\
**Replies:** 4\
**Last updated:** [September 3, 2022, 3:12pm UTC](https://discourse.julialang.org/t/projects-environments-workflow-questions/86720 "2022-09-03T15:12:28Z")

</div>

Hello, I’m trying to understand the Julia ‘best practices’ around projects/environments with Pkg. First, are ‘project’ and ‘environment’ synonymous in Julia? Second, since I’ve separated my packages into environments …

---

## [NCDatasets: copy the properties of a variable](https://discourse.julialang.org/t/ncdatasets-copy-the-properties-of-a-variable/85721)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 11\
**Last updated:** [September 3, 2022, 2:13pm UTC](https://discourse.julialang.org/t/ncdatasets-copy-the-properties-of-a-variable/85721 "2022-09-03T14:13:13Z")

</div>

Is there a facility to copy a netCDF variable including its axes (dimensions) and attributes at once? A scenario: ds\_org = Dataset("original.nc", "r") org = ds\["orgvar"\] Dataset("new.nc", "c") do ds\_new defVar(ds\_new…

---

## [How do I save a plot?](https://discourse.julialang.org/t/how-do-i-save-a-plot/35370)

<div class="topic-metadata">

**Author:** [@brett\_knoss](https://discourse.julialang.org/u/brett_knoss)\
**Replies:** 7\
**Last updated:** [September 3, 2022, 1:41pm UTC](https://discourse.julialang.org/t/how-do-i-save-a-plot/35370 "2022-09-03T13:41:29Z")

</div>

julia\> out = DataFrame(Q1 = \[3,3,3\], Q2 = \[3,2,1\]) 3×2 DataFrame │ Row │ Q1 │ Q2 │ │ │ Int64 │ Int64 │ ├─────┼───────┼───────┤ │ 1 │ 3 │ 3 │ │ 2 │ 3 │ 2 │ │ 3 │ 3 │ 1 │ julia\> fig…

---

## [Package badges on JuliaHub](https://discourse.julialang.org/t/package-badges-on-juliahub/44635)

<div class="topic-metadata">

**Author:** [@avik](https://discourse.julialang.org/u/avik)\
**Replies:** 1\
**Last updated:** [September 3, 2022, 1:33pm UTC](https://discourse.julialang.org/t/package-badges-on-juliahub/44635 "2022-09-03T13:33:04Z")

</div>

Since JuliaHub collates a lot of information about packages, we thought it might be valuable to expose some of that via badges. So we’re pleased to announce that it now hosts badges for a packages latest release version …

---

## [How to add docstring to a function on an empty module?](https://discourse.julialang.org/t/how-to-add-docstring-to-a-function-on-an-empty-module/86728)

<div class="topic-metadata">

**Author:** [@uje](https://discourse.julialang.org/u/uje)\
**Replies:** 1\
**Last updated:** [September 3, 2022, 12:50pm UTC](https://discourse.julialang.org/t/how-to-add-docstring-to-a-function-on-an-empty-module/86728 "2022-09-03T12:50:47Z")

</div>

How do I add a docstring to the function add on this module that does not import Core and Base? julia\> Animal = Module(:Animal, false, false) Main.Animal julia\> @eval Animal add(x, y) = $(+)(x, y) add (generic function…

---

## [Performance with intermittent singleton dimensions](https://discourse.julialang.org/t/performance-with-intermittent-singleton-dimensions/86374)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 11\
**Last updated:** [September 3, 2022, 12:04pm UTC](https://discourse.julialang.org/t/performance-with-intermittent-singleton-dimensions/86374 "2022-09-03T12:04:00Z")

</div>

Hello performance aficionados. I was testing a bit the copy performance, to see if there may be caching issues with multidimensional array copies and am generally quite impressed. However, I found one case that may lead…

---

## [Ship custom sysimages created with PackageCompiler](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515)

<div class="topic-metadata">

**Author:** [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Replies:** 7\
**Last updated:** [September 3, 2022, 10:43am UTC](https://discourse.julialang.org/t/ship-custom-sysimages-created-with-packagecompiler/86515 "2022-09-03T10:43:14Z")

</div>

Currently I use PrecompilePlutoCourse to reduce latency of some Pluto notebooks for teaching. This is great, except that every student needs to wait quite a while for the PackageCompiler to finish. As there are at least …

---

## [Plot GPArray/ Arrayfire](https://discourse.julialang.org/t/plot-gparray-arrayfire/5423)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 4\
**Last updated:** [September 3, 2022, 7:59am UTC](https://discourse.julialang.org/t/plot-gparray-arrayfire/5423 "2022-09-03T07:59:36Z")

</div>

Hi, Is there a way to display 1d/2d arrays hosted by the GPU (aka with GPUArrays or ArrayFire)? ArrayFire has some method for that but it is a bit limited, Thank you for your help, Best regards Romain

---

## [Is there a way to check if a file is currently open somewhere?](https://discourse.julialang.org/t/is-there-a-way-to-check-if-a-file-is-currently-open-somewhere/86692)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [September 3, 2022, 6:58am UTC](https://discourse.julialang.org/t/is-there-a-way-to-check-if-a-file-is-currently-open-somewhere/86692 "2022-09-03T06:58:24Z")

</div>

I have a big simulation file being in process of written, and I need to know when it stops being written. Kind regards

---

## [Why the weird summarysize results for Rational{BigInt}](https://discourse.julialang.org/t/why-the-weird-summarysize-results-for-rational-bigint/86704)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 2\
**Last updated:** [September 3, 2022, 4:51am UTC](https://discourse.julialang.org/t/why-the-weird-summarysize-results-for-rational-bigint/86704 "2022-09-03T04:51:01Z")

</div>

julia\> n = big"3"^100000; julia\> t = (n // 1, n, Rational{BigInt}(n)); julia\> typeof(t) Tuple{Rational{BigInt}, BigInt, Rational{BigInt}} julia\> map(Base.summarysize, t) (19872, 19968, 20008) julia\> first(t) == last(…

---

## [Creating a rasterized 3D surface plots inside vectorized figure](https://discourse.julialang.org/t/creating-a-rasterized-3d-surface-plots-inside-vectorized-figure/86569)

<div class="topic-metadata">

**Author:** [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Replies:** 4\
**Last updated:** [September 3, 2022, 4:00am UTC](https://discourse.julialang.org/t/creating-a-rasterized-3d-surface-plots-inside-vectorized-figure/86569 "2022-09-03T04:00:26Z")

</div>

I need to create a multi-panel figure which consists of 3D surface plots and normal 2D plots. In order to reduce file size, I want to rasterize the 3D surface plots, while keeping everything else (axes, texts, line plots…

---

## [Flux save and load model](https://discourse.julialang.org/t/flux-save-and-load-model/86693)

<div class="topic-metadata">

**Author:** [@momo1](https://discourse.julialang.org/u/momo1)\
**Replies:** 2\
**Last updated:** [September 3, 2022, 2:41am UTC](https://discourse.julialang.org/t/flux-save-and-load-model/86693 "2022-09-03T02:41:58Z")

</div>

Hello I’m saving the UNet model as function save\_unet\_train\_state(filename::String, model::Unet, opt, loss::Function) @assert endswith(filename, ".jld2") @save filename model opt loss where opt is opt = RMSP…

---

## [Arithmetic with a specified (low) number of digits](https://discourse.julialang.org/t/arithmetic-with-a-specified-low-number-of-digits/86713)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 1\
**Last updated:** [September 3, 2022, 1:12am UTC](https://discourse.julialang.org/t/arithmetic-with-a-specified-low-number-of-digits/86713 "2022-09-03T01:12:22Z")

</div>

Is it possible to perform computations using, say, five-digit arithmetic with a given rounding mode? For example, can I easily compute x/10^{-5}, x = 0.44446, in 5-digit arithmetic with rounding to the nearest number? I …

---

## [Adapting code from Plots into PlotlyJS](https://discourse.julialang.org/t/adapting-code-from-plots-into-plotlyjs/78127)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 12\
**Last updated:** [September 3, 2022, 12:05am UTC](https://discourse.julialang.org/t/adapting-code-from-plots-into-plotlyjs/78127 "2022-09-03T00:05:24Z")

</div>

Hi, Using Plots, I have a simple old piece of code to plot a function with a parameter assuming different values. I want to plot it using PlotlyJS. I know how to do it trace-by-trace, but that is ugly and inefficient. H…

---

## [Yet another code organization question](https://discourse.julialang.org/t/yet-another-code-organization-question/86707)

<div class="topic-metadata">

**Author:** [@welahi](https://discourse.julialang.org/u/welahi)\
**Replies:** 8\
**Last updated:** [September 2, 2022, 11:23pm UTC](https://discourse.julialang.org/t/yet-another-code-organization-question/86707 "2022-09-02T23:23:04Z")

</div>

Dear all, I’m new to Julia, so first of alle hello :slight\_smile: I’ve already searched for similar question, but couldn’t find any answer that would solve my specific question. Sorry if I’ve just overlooked it. So, l…

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

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