# General Usage

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

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

**Page:** 199

---

## [@btime changes the result](https://discourse.julialang.org/t/btime-changes-the-result/110425)

<div class="topic-metadata">

**Author:** [@Enlil50](https://discourse.julialang.org/u/Enlil50)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 10:15pm UTC](https://discourse.julialang.org/t/btime-changes-the-result/110425 "2024-02-19T22:15:52Z")

</div>

I will write a difficult to read program because I know its analytical solution. What you just need to to is putting @btime in front of the function call, at the end. Read the last result of the 4th column: With @btim…

---

## [Tuple related error](https://discourse.julialang.org/t/tuple-related-error/107678)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 4\
**Last updated:** [February 19, 2024, 8:57pm UTC](https://discourse.julialang.org/t/tuple-related-error/107678 "2024-02-19T20:57:37Z")

</div>

Would anyone please help me with this Tuple related error? Here is my code: if A == 1 DL = 11; elseif A == 2 DL = 21; end ds3 = NCDataset("$(P0)/Input/TSO2/xxx.nc"); T = ds3\["abc"\]\[:,…

---

## [Parallel mutable reduction / mapreduce](https://discourse.julialang.org/t/parallel-mutable-reduction-mapreduce/110207)

<div class="topic-metadata">

**Author:** [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)\
**Replies:** 7\
**Last updated:** [February 19, 2024, 6:27pm UTC](https://discourse.julialang.org/t/parallel-mutable-reduction-mapreduce/110207 "2024-02-19T18:27:42Z")

</div>

Hi, I wanted to ask about recommendations for packages that offer multithreaded mapreduce-style computation. That is unfortunately not part of stdlib, so I was wondering which packages are good for that. The way I like…

---

## [Chaos compatibility testing?](https://discourse.julialang.org/t/chaos-compatibility-testing/110360)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 21\
**Last updated:** [February 19, 2024, 5:11pm UTC](https://discourse.julialang.org/t/chaos-compatibility-testing/110360 "2024-02-19T17:11:15Z")

</div>

Does anybody know if there is some package does a kind of “chaos compat engine” for deep testing, to test random versions of dependencies (and their dependencies) that fit within a library \[compat\] bounds? I’ve ran into…

---

## [ArraysOfArrays with named fields](https://discourse.julialang.org/t/arraysofarrays-with-named-fields/110281)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 7\
**Last updated:** [February 19, 2024, 4:38pm UTC](https://discourse.julialang.org/t/arraysofarrays-with-named-fields/110281 "2024-02-19T16:38:15Z")

</div>

Let’s say I have a vector a = \[x1, x2, x3, q1, q2, q3, q4\]. What’s a nice way to use it in algorithms that expect a flat vector like that, but at the same time have a nice interface like a.x, a.q to extract \[x1, x2, x3\] …

---

## [Fastest matrix multiplication](https://discourse.julialang.org/t/fastest-matrix-multiplication/110368)

<div class="topic-metadata">

**Author:** [@eveningsilverfox](https://discourse.julialang.org/u/eveningsilverfox)\
**Replies:** 20\
**Last updated:** [February 19, 2024, 2:51pm UTC](https://discourse.julialang.org/t/fastest-matrix-multiplication/110368 "2024-02-19T14:51:24Z")

</div>

The rate determining step in my code is intermediate-sized matrix multiplications, which I have to do many many (around 10⁸) times. using LinearAlgebra using MKL using BenchmarkTools aa = rand(ComplexF64, 164,164); bb …

---

## [Create excel file using data from two dataframes](https://discourse.julialang.org/t/create-excel-file-using-data-from-two-dataframes/110320)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 5\
**Last updated:** [February 19, 2024, 3:03pm UTC](https://discourse.julialang.org/t/create-excel-file-using-data-from-two-dataframes/110320 "2024-02-19T15:03:45Z")

</div>

Hello, I have two Data Frames which has headers and data in them, and I want to write data from these two Data Frames into one single excel sheet. I know we can write each data frame data into separate sheet. Any advic…

---

## [Cropping dataframe table data left or center](https://discourse.julialang.org/t/cropping-dataframe-table-data-left-or-center/110344)

<div class="topic-metadata">

**Author:** [@bertlhf](https://discourse.julialang.org/u/bertlhf)\
**Replies:** 13\
**Last updated:** [February 19, 2024, 2:39pm UTC](https://discourse.julialang.org/t/cropping-dataframe-table-data-left-or-center/110344 "2024-02-19T14:39:13Z")

</div>

Dataframe table data in Julia can easily be cropped right with the column\_width keyword of PrettyTables.jl. For some of my columns I need data cropped left or center. I used to do this in R with the str\_trunc function fr…

---

## [Static Array times scalar](https://discourse.julialang.org/t/static-array-times-scalar/110401)

<div class="topic-metadata">

**Author:** [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 2:11pm UTC](https://discourse.julialang.org/t/static-array-times-scalar/110401 "2024-02-19T14:11:33Z")

</div>

How to multiply a static array with a scalar with allocating memory ? I tried Aloc = SVector{36}(SVector(Bloc)./Scalar(area) and variants without succes. Thx!

---

## [Updating registry or instantiating project environment fails with SSL/ca-certificate issue](https://discourse.julialang.org/t/updating-registry-or-instantiating-project-environment-fails-with-ssl-ca-certificate-issue/110400)

<div class="topic-metadata">

**Author:** [@fbanning](https://discourse.julialang.org/u/fbanning)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 1:02pm UTC](https://discourse.julialang.org/t/updating-registry-or-instantiating-project-environment-fails-with-ssl-ca-certificate-issue/110400 "2024-02-19T13:02:04Z")

</div>

I’m faced with a weird issue since updating to v1.10.1: (@v1.10) pkg\> instantiate ┌ Warning: could not download https://pkg.julialang.org/registries │ exception = RequestError: Error reading ca cert file /etc/ssl/cert…

---

## ['EstimationProblem' not defined](https://discourse.julialang.org/t/estimationproblem-not-defined/110392)

<div class="topic-metadata">

**Author:** [@Aqeel\_Abbas](https://discourse.julialang.org/u/Aqeel_Abbas)\
**Replies:** 1\
**Last updated:** [February 19, 2024, 9:31am UTC](https://discourse.julialang.org/t/estimationproblem-not-defined/110392 "2024-02-19T09:31:35Z")

</div>

I am following this Example to reinterpolated on a regular grid. When I try these part of line after insatalling all required packages, including GeoStats and GeophysicalModelGenerator. Cgrid = CartesianGrid((size(Lon,1…

---

## [BoundsError -\> NaN ? (in Interpolations)](https://discourse.julialang.org/t/boundserror-nan-in-interpolations/110372)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 2\
**Last updated:** [February 19, 2024, 5:40am UTC](https://discourse.julialang.org/t/boundserror-nan-in-interpolations/110372 "2024-02-19T05:40:03Z")

</div>

I need a NaN when the target isn’t in the “interior” in linear interpolation: using Distributions using Interpolations const imax\_in = 20 const imax\_out = 20 xax\_in, v\_in = let dx = rand(Uniform(1.0, 10.0), imax\_in)…

---

## [Spinner/progress meter for slow functions](https://discourse.julialang.org/t/spinner-progress-meter-for-slow-functions/110385)

<div class="topic-metadata">

**Author:** [@math\_opt](https://discourse.julialang.org/u/math_opt)\
**Replies:** 12\
**Last updated:** [February 19, 2024, 4:04am UTC](https://discourse.julialang.org/t/spinner-progress-meter-for-slow-functions/110385 "2024-02-19T04:04:12Z")

</div>

I am aware of the package ProgressMeter.jl which works for function which process things in loops. I am looking for something that works on functions that doesn’t necessarily have loop but just takes time to complete som…

---

## ['return new'](https://discourse.julialang.org/t/return-new/110387)

<div class="topic-metadata">

**Author:** [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Replies:** 1\
**Last updated:** [February 19, 2024, 2:51am UTC](https://discourse.julialang.org/t/return-new/110387 "2024-02-19T02:51:40Z")

</div>

I saw code like return new{T}(a, b) as the last the line of some constructor function of a struct. I am wondering what is the purpose of ‘new’ here? Typically, we see return (a,b)

---

## [Is there a way to know if \`Revise\` is enabled?](https://discourse.julialang.org/t/is-there-a-way-to-know-if-revise-is-enabled/110379)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 5\
**Last updated:** [February 18, 2024, 9:51pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-know-if-revise-is-enabled/110379 "2024-02-18T21:51:07Z")

</div>

Is it possible to know if when I’m executing some code it is being tracked by Revise.jl? For example say I have a function where I want to do something different based on this condition e.g. in pseudocode: function foo…

---

## [Is it possible to get an incompletely specified type?](https://discourse.julialang.org/t/is-it-possible-to-get-an-incompletely-specified-type/110331)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 8\
**Last updated:** [February 18, 2024, 4:21pm UTC](https://discourse.julialang.org/t/is-it-possible-to-get-an-incompletely-specified-type/110331 "2024-02-18T16:21:45Z")

</div>

julia\> struct A{T}; a::T; end julia\> a1 = A(1) A{Int64}(1) julia\> a2 = A(1.0) A{Float64}(1.00000e+00) julia\> typeof(a1) === typeof(a2) false Yet, both a1 and a2 are “of type A”. Is it possible to test that?

---

## [How to write a multi-threaded reduction using Bumper.jl?](https://discourse.julialang.org/t/how-to-write-a-multi-threaded-reduction-using-bumper-jl/110314)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 10\
**Last updated:** [February 18, 2024, 12:52pm UTC](https://discourse.julialang.org/t/how-to-write-a-multi-threaded-reduction-using-bumper-jl/110314 "2024-02-18T12:52:10Z")

</div>

Hello! I am trying to see if I can get a multithreaded reduction to work using Bumper.jl but my results are a bit embaressing… I can’t seem to get it to work and I don’t think it is using all my threads… The code snippe…

---

## [Is there such a thing as an implicit conversion from a matrix view?](https://discourse.julialang.org/t/is-there-such-a-thing-as-an-implicit-conversion-from-a-matrix-view/110332)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 8\
**Last updated:** [February 18, 2024, 4:57am UTC](https://discourse.julialang.org/t/is-there-such-a-thing-as-an-implicit-conversion-from-a-matrix-view/110332 "2024-02-18T04:57:22Z")

</div>

I am trying to construct a struct that refers to a view of a vector. However, there appears to be an implicit conversion, and I end up with a copy of the “view”. mutable struct A{ IT, MBT, # matrix-entry buffer …

---

## [Why column major?](https://discourse.julialang.org/t/why-column-major/24374)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 58\
**Last updated:** [February 17, 2024, 11:31pm UTC](https://discourse.julialang.org/t/why-column-major/24374 "2024-02-17T23:31:03Z")

</div>

Why Julia arrays are stored in column-major order? Column-major vs row-major are not entirely symmetric regarding code style, because when we access the i,j’th element of an array, we write A\[i,j\] with the row index fir…

---

## [Reshape in place](https://discourse.julialang.org/t/reshape-in-place/110356)

<div class="topic-metadata">

**Author:** [@Enlil50](https://discourse.julialang.org/u/Enlil50)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 9:04pm UTC](https://discourse.julialang.org/t/reshape-in-place/110356 "2024-02-17T21:04:31Z")

</div>

I’m trying to reshape in place using: using Random Random.seed!(1) A = rand(Int8, 4) show(A) reshape(A, (2, 2)) println("\\n") show(A) println("\\n") Which should change the algorithm which maps the array into a matri…

---

## [Checking if a list of vectors are all identical](https://discourse.julialang.org/t/checking-if-a-list-of-vectors-are-all-identical/110215)

<div class="topic-metadata">

**Author:** [@Gus\_Hart](https://discourse.julialang.org/u/Gus_Hart)\
**Replies:** 23\
**Last updated:** [February 15, 2024, 10:35pm UTC](https://discourse.julialang.org/t/checking-if-a-list-of-vectors-are-all-identical/110215 "2024-02-15T22:35:06Z")

</div>

(Looking for the most idiomatic way to solve this problem. It’s inside several nested loops.) I have a situation where I have two lists of 3-vectors. Often these two lists are identical except for displacement. (One set…

---

## [Comparing Dictionaries of Dictionaries](https://discourse.julialang.org/t/comparing-dictionaries-of-dictionaries/110323)

<div class="topic-metadata">

**Author:** [@brombo](https://discourse.julialang.org/u/brombo)\
**Replies:** 16\
**Last updated:** [February 17, 2024, 6:52pm UTC](https://discourse.julialang.org/t/comparing-dictionaries-of-dictionaries/110323 "2024-02-17T18:52:54Z")

</div>

I am trying to compare two dictionaries to see if they are equal. In the code the dictionaries are S1.sdops and S2.sdops function (==)(D1::Sdop,D2::Sdop)::Bool if string(D1.s) != string(D2.s) return false end keys1 …

---

## [Lowercase and uppercase do not handle Mathematical Letters as expected](https://discourse.julialang.org/t/lowercase-and-uppercase-do-not-handle-mathematical-letters-as-expected/110348)

<div class="topic-metadata">

**Author:** [@benjwweber](https://discourse.julialang.org/u/benjwweber)\
**Replies:** 2\
**Last updated:** [February 17, 2024, 6:38pm UTC](https://discourse.julialang.org/t/lowercase-and-uppercase-do-not-handle-mathematical-letters-as-expected/110348 "2024-02-17T18:38:14Z")

</div>

I have recently noticed that lowercase('𝐴') # '𝐴': Unicode U+1D434 (category Lu: Letter, uppercase) and uppercase('𝑎') # '𝑎': Unicode U+1D44E (category Ll: Letter, lowercase) do not behave as I would have expected, a…

---

## [Best practices for single script files](https://discourse.julialang.org/t/best-practices-for-single-script-files/110258)

<div class="topic-metadata">

**Author:** [@Ved\_Mahajan](https://discourse.julialang.org/u/Ved_Mahajan)\
**Replies:** 9\
**Last updated:** [February 17, 2024, 4:38pm UTC](https://discourse.julialang.org/t/best-practices-for-single-script-files/110258 "2024-02-17T16:38:49Z")

</div>

Hey all :wave: In the future I see myself writing a lot of single script files. They will be, almost exclusively, for analysing my molecular dynamics simulations. I imagine a rough skeleton of the script to be: define …

---

## [Float64 & format](https://discourse.julialang.org/t/float64-format/110284)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 7\
**Last updated:** [February 17, 2024, 1:13pm UTC](https://discourse.julialang.org/t/float64-format/110284 "2024-02-17T13:13:51Z")

</div>

How can I make Floats appear in scientific or engineering notation? E.g., I want to display, say, 0.0001 as 1e-4. I know I can do this using the @printf macro, but that just prints the formatted number to the terminal. …

---

## [Is there a library for a generic convolution function?](https://discourse.julialang.org/t/is-there-a-library-for-a-generic-convolution-function/110329)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 2:13am UTC](https://discourse.julialang.org/t/is-there-a-library-for-a-generic-convolution-function/110329 "2024-02-17T02:13:23Z")

</div>

I need to do a convolution of BigInts and DSP says that BigFloat isn’t supported when I try.

---

## [Ignoring NaNs when calculating means of columns of a dataframe](https://discourse.julialang.org/t/ignoring-nans-when-calculating-means-of-columns-of-a-dataframe/110326)

<div class="topic-metadata">

**Author:** [@PeX](https://discourse.julialang.org/u/PeX)\
**Replies:** 1\
**Last updated:** [February 17, 2024, 12:07am UTC](https://discourse.julialang.org/t/ignoring-nans-when-calculating-means-of-columns-of-a-dataframe/110326 "2024-02-17T00:07:48Z")

</div>

Hi all, I have a dataframe with rows as dates and columns as data points. I need to calculate the mean of each column, but the problem is that some of the columns have “NaN” values. Is there an efficient way to achieve…

---

## [Permanently Increase World Age in Local Context](https://discourse.julialang.org/t/permanently-increase-world-age-in-local-context/110257)

<div class="topic-metadata">

**Author:** [@PatrickHaecker](https://discourse.julialang.org/u/PatrickHaecker)\
**Replies:** 5\
**Last updated:** [February 16, 2024, 11:25pm UTC](https://discourse.julialang.org/t/permanently-increase-world-age-in-local-context/110257 "2024-02-16T23:25:17Z")

</div>

Is there a way to permanently increase world age without going to global context? Most of the world age seems to focus on redefining functions. The problem here is different as it is about dynamically defining a type. I…

---

## [Parsing a vector of vectors with Meta.parse?](https://discourse.julialang.org/t/parsing-a-vector-of-vectors-with-meta-parse/110274)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 12\
**Last updated:** [February 16, 2024, 8:12pm UTC](https://discourse.julialang.org/t/parsing-a-vector-of-vectors-with-meta-parse/110274 "2024-02-16T20:12:44Z")

</div>

I have a concrete problem, where Meta.parse(line) is unbearably slow. My use-case is that I have a long .txt file, in which each line has the form \[x1, ..., xn\], where x1,...,xn are specific integers. I must import/con…

---

## [Normal vs broadcasted slice assignment](https://discourse.julialang.org/t/normal-vs-broadcasted-slice-assignment/110288)

<div class="topic-metadata">

**Author:** [@sijo](https://discourse.julialang.org/u/sijo)\
**Replies:** 5\
**Last updated:** [February 16, 2024, 8:10pm UTC](https://discourse.julialang.org/t/normal-vs-broadcasted-slice-assignment/110288 "2024-02-16T20:10:26Z")

</div>

This must have been discussed a dozen times but I couldn’t find a thread about this precise issue: using BenchmarkTools f1(v, x) = v\[1:length(x)\] = x f2(v, x) = v\[1:length(x)\] .= x julia\> @btime f1($(rand(1000)), $(ra…

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

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