# General Usage

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

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

**Page:** 737

---

## [Complex vector math performance: StructArray of CuArrays vs CuArrays](https://discourse.julialang.org/t/complex-vector-math-performance-structarray-of-cuarrays-vs-cuarrays/40576)

<div class="topic-metadata">

**Author:** [@ozmaden](https://discourse.julialang.org/u/ozmaden)\
**Replies:** 2\
**Last updated:** [June 22, 2020, 4:40pm UTC](https://discourse.julialang.org/t/complex-vector-math-performance-structarray-of-cuarrays-vs-cuarrays/40576 "2020-06-22T16:40:45Z")

</div>

Hi there! I’m benchmarking a GPU implementation of a function performing downconversion of a signal given a carrier signal replica. The original form of the function in the library looks like this: julia\> function downc…

---

## [Error messages from Gtk callbacks are not being shown](https://discourse.julialang.org/t/error-messages-from-gtk-callbacks-are-not-being-shown/38412)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 3\
**Last updated:** [June 22, 2020, 3:27pm UTC](https://discourse.julialang.org/t/error-messages-from-gtk-callbacks-are-not-being-shown/38412 "2020-06-22T15:27:26Z")

</div>

I’m developing a Gkt.jl application, and errors that happen inside a callback are not being displayed. For example, if you run this code and click the button multiple times: using Gtk w = Gtk.Window() b = Gtk.Button("h…

---

## [How to get lowered names of functions with kwargs to precompile](https://discourse.julialang.org/t/how-to-get-lowered-names-of-functions-with-kwargs-to-precompile/41861)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 1\
**Last updated:** [June 22, 2020, 2:44pm UTC](https://discourse.julialang.org/t/how-to-get-lowered-names-of-functions-with-kwargs-to-precompile/41861 "2020-06-22T14:44:59Z")

</div>

Hi! I have a lot of functions in a package that has keywords arguments and I want to precompile them. However, I am not sure how can I get the lowered name. For example: julia\> function teste(::Val{:a}; b = 1, c = 2) …

---

## [Tensor Contractions for N-dimensional tensors](https://discourse.julialang.org/t/tensor-contractions-for-n-dimensional-tensors/41810)

<div class="topic-metadata">

**Author:** [@morkip](https://discourse.julialang.org/u/morkip)\
**Replies:** 5\
**Last updated:** [June 22, 2020, 1:29pm UTC](https://discourse.julialang.org/t/tensor-contractions-for-n-dimensional-tensors/41810 "2020-06-22T13:29:10Z")

</div>

I am working with exponentially sized tensors (exponential in a given variable N, for my case to the basis 4). Up to now, I stored the tensors linearly indexed, that is in a vector from 1:4^N. Contractions where therefor…

---

## [When to return an explicit \`nothing\` from a function?](https://discourse.julialang.org/t/when-to-return-an-explicit-nothing-from-a-function/41846)

<div class="topic-metadata">

**Author:** [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Replies:** 9\
**Last updated:** [June 22, 2020, 1:15pm UTC](https://discourse.julialang.org/t/when-to-return-an-explicit-nothing-from-a-function/41846 "2020-06-22T13:15:28Z")

</div>

After making a few minor modifications to a function, I was surprised that my program went from a few hundred allocations to millions. It turns out that even though I never used the return value of the function (the las…

---

## [Activating an environment that is already active](https://discourse.julialang.org/t/activating-an-environment-that-is-already-active/41852)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 0\
**Last updated:** [June 22, 2020, 11:28am UTC](https://discourse.julialang.org/t/activating-an-environment-that-is-already-active/41852 "2020-06-22T11:28:54Z")

</div>

I was wondering why activating the environment that is already active takes a fair bit of time. See example. Wouldn’t it make sense to check if the environment is already active and then ‘do nothing’? Or does the activ…

---

## [Dynamically mutate type parameter](https://discourse.julialang.org/t/dynamically-mutate-type-parameter/41811)

<div class="topic-metadata">

**Author:** [@D\_A](https://discourse.julialang.org/u/D_A)\
**Replies:** 6\
**Last updated:** [June 22, 2020, 10:31am UTC](https://discourse.julialang.org/t/dynamically-mutate-type-parameter/41811 "2020-06-22T10:31:20Z")

</div>

Hello, I would like to know if there is a way to mutate the type parameter of an object during runtime (dynamically). MWE: mutable struct Text{Format\<:Union{Integer, AbstractString}} # For MWE, in reality it is like …

---

## [How to document this](https://discourse.julialang.org/t/how-to-document-this/39217)

<div class="topic-metadata">

**Author:** [@roble](https://discourse.julialang.org/u/roble)\
**Replies:** 6\
**Last updated:** [June 22, 2020, 9:57am UTC](https://discourse.julialang.org/t/how-to-document-this/39217 "2020-06-22T09:57:58Z")

</div>

I would like to add the documentation of a function to the official documentation page. It should have been a one liner to do this, but now I am somehow stuck… There is already a docstring available. However, I need to …

---

## [Why Bool is a Number?](https://discourse.julialang.org/t/why-bool-is-a-number/41845)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [June 22, 2020, 9:13am UTC](https://discourse.julialang.org/t/why-bool-is-a-number/41845 "2020-06-22T09:13:18Z")

</div>

just came across true + 3 == 4, and also true isa Number What is the reason why a boolean gets converted to Int automatically?

---

## [Plots small trouble](https://discourse.julialang.org/t/plots-small-trouble/41843)

<div class="topic-metadata">

**Author:** [@mitsuruk](https://discourse.julialang.org/u/mitsuruk)\
**Replies:** 2\
**Last updated:** [June 22, 2020, 7:26am UTC](https://discourse.julialang.org/t/plots-small-trouble/41843 "2020-06-22T07:26:12Z")

</div>

Hi, I am learning Julialang on Mac and Windwos. I have a small trouble in Plots.jl using Plots, Random plot(rand(50)) Yes, I can get target graph perfect. however, using Plots, Random plot(rand(50)) println(“test…

---

## [Triangulation plot triangle plot](https://discourse.julialang.org/t/triangulation-plot-triangle-plot/41665)

<div class="topic-metadata">

**Author:** [@hyacykcharel](https://discourse.julialang.org/u/hyacykcharel)\
**Replies:** 2\
**Last updated:** [June 22, 2020, 6:01am UTC](https://discourse.julialang.org/t/triangulation-plot-triangle-plot/41665 "2020-06-22T06:01:52Z")

</div>

Im trying to create a triangulation (triangle Plot) plot and dont even know how to do ist can someone help please? using VoronoiDelaunay using GeometricalPredicates using DataFrames, Plots pyplot() #mit unterer Auss…

---

## [Evaluate the value of polyvars in SOSModel](https://discourse.julialang.org/t/evaluate-the-value-of-polyvars-in-sosmodel/41836)

<div class="topic-metadata">

**Author:** [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Replies:** 0\
**Last updated:** [June 22, 2020, 3:21am UTC](https://discourse.julialang.org/t/evaluate-the-value-of-polyvars-in-sosmodel/41836 "2020-06-22T03:21:19Z")

</div>

Hi, I have a question about how to evaluate the values of polyvars in SOSModel. In the following example, there is only one regular JuMP decision variable γ and γ can be evaluated by value(γ). But when I want to check th…

---

## [Version dependent segfault using ccall](https://discourse.julialang.org/t/version-dependent-segfault-using-ccall/41795)

<div class="topic-metadata">

**Author:** [@Matt\_Davis](https://discourse.julialang.org/u/Matt_Davis)\
**Replies:** 2\
**Last updated:** [June 21, 2020, 10:55pm UTC](https://discourse.julialang.org/t/version-dependent-segfault-using-ccall/41795 "2020-06-21T22:55:58Z")

</div>

I am running into segmentation faults and/or std::bad\_alloc errors when using the TBLIS C interface. However, the error does not appear on 1.4.x, either built from source or from binaries, but does occur on 1.5.0-beta1 a…

---

## [Raise the power of polynomials in polyjump](https://discourse.julialang.org/t/raise-the-power-of-polynomials-in-polyjump/41818)

<div class="topic-metadata">

**Author:** [@aliceee](https://discourse.julialang.org/u/aliceee)\
**Replies:** 1\
**Last updated:** [June 21, 2020, 6:24pm UTC](https://discourse.julialang.org/t/raise-the-power-of-polynomials-in-polyjump/41818 "2020-06-21T18:24:39Z")

</div>

Hi, I’m writing an SOS model using PolyJump: @polyvar B\[1:k,1:pp+1\] @polyvar c0 k = transpose(p\_train\_var)\*vec(B\*vcat(x\_train0\[1,:\],1))\*gamma + c0 when I try to raise the power of polynomial k, by doing this: k^2 I …

---

## [Asynchronous Makie](https://discourse.julialang.org/t/asynchronous-makie/27127)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 17\
**Last updated:** [June 21, 2020, 11:54am UTC](https://discourse.julialang.org/t/asynchronous-makie/27127 "2020-06-21T11:54:11Z")

</div>

Hi, I wrote a toy CFD solver computing pressure and velocity fields for successive timesteps and I use Makie for plotting the result and store a movie. Although I only plot new frames every 200 timesteps, the plotting …

---

## [Free "dev"-ed packages](https://discourse.julialang.org/t/free-dev-ed-packages/41806)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 6\
**Last updated:** [June 21, 2020, 11:32am UTC](https://discourse.julialang.org/t/free-dev-ed-packages/41806 "2020-06-21T11:32:13Z")

</div>

Suppose I work on several projects that are located in ~/A/, ~/B/, ~/C/, where each folder is a julia environment and has a Project.toml. There are several my packages that are used by all these projects, and the packag…

---

## [Accessing samples in MCMCChains](https://discourse.julialang.org/t/accessing-samples-in-mcmcchains/41800)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 2\
**Last updated:** [June 21, 2020, 1:38am UTC](https://discourse.julialang.org/t/accessing-samples-in-mcmcchains/41800 "2020-06-21T01:38:31Z")

</div>

I’ve got Turing to sample my model… sort-of. It’s stuck and I’m trying to figure out what the samples look like. The model is a fit of a time-series. So there are parameters that are vectors like Ac which is a 3 vector …

---

## [Keyword arguments is causing allocations](https://discourse.julialang.org/t/keyword-arguments-is-causing-allocations/41798)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 4\
**Last updated:** [June 21, 2020, 12:03am UTC](https://discourse.julialang.org/t/keyword-arguments-is-causing-allocations/41798 "2020-06-21T00:03:23Z")

</div>

Hi! I am getting an allocation when using a keyword in the following MWE: julia\> function teste(a::AbstractVector{T}; b::Integer = 0, c::Integer = 0) where T return a\[1\] + b + c end teste (generic functio…

---

## [Matrix to array of tuples: Avoiding many small allocations](https://discourse.julialang.org/t/matrix-to-array-of-tuples-avoiding-many-small-allocations/41796)

<div class="topic-metadata">

**Author:** [@decardinb](https://discourse.julialang.org/u/decardinb)\
**Replies:** 2\
**Last updated:** [June 20, 2020, 11:35pm UTC](https://discourse.julialang.org/t/matrix-to-array-of-tuples-avoiding-many-small-allocations/41796 "2020-06-20T23:35:25Z")

</div>

How do I convert a matrix to an array of tuples while avoiding many small allocations in a loop? My current code is function matrixtotuple(x::AbstractMatrix{T}) where T r,c = size(x) pts = Vector{Tuple}(undef,r) @ti…

---

## [Compiler optimization challenge: Bayer pattern image unpacking](https://discourse.julialang.org/t/compiler-optimization-challenge-bayer-pattern-image-unpacking/41779)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 0\
**Last updated:** [June 20, 2020, 3:16pm UTC](https://discourse.julialang.org/t/compiler-optimization-challenge-bayer-pattern-image-unpacking/41779 "2020-06-20T15:16:17Z")

</div>

I’ve found an interesting example of a slightly convoluted for-loop that might be a good showcase of Julia’s ability to generate efficient code. I need help optimizing this code, though, because I’m not sure I have eithe…

---

## [Deleteat!(trues(3), \[true, false, false\]) got "ArgumentError: indices must be unique and sorted"](https://discourse.julialang.org/t/deleteat-trues-3-true-false-false-got-argumenterror-indices-must-be-unique-and-sorted/41716)

<div class="topic-metadata">

**Author:** [@Jieyi\_Xiong](https://discourse.julialang.org/u/Jieyi_Xiong)\
**Replies:** 18\
**Last updated:** [June 20, 2020, 2:00pm UTC](https://discourse.julialang.org/t/deleteat-trues-3-true-false-false-got-argumenterror-indices-must-be-unique-and-sorted/41716 "2020-06-20T14:00:14Z")

</div>

I tested it in Julia 1.4.1 julia\> deleteat!(trues(3), \[true, false, false\]) ERROR: ArgumentError: indices must be unique and sorted Stacktrace: \[1\] deleteat!(::BitArray{1}, ::Array{Bool,1}) at ./bitarray.jl:976 \[2\] to…

---

## [Histogram Equalization](https://discourse.julialang.org/t/histogram-equalization/41682)

<div class="topic-metadata">

**Author:** [@Mohammed\_Sabiya](https://discourse.julialang.org/u/Mohammed_Sabiya)\
**Replies:** 28\
**Last updated:** [June 20, 2020, 8:25am UTC](https://discourse.julialang.org/t/histogram-equalization/41682 "2020-06-20T08:25:36Z")

</div>

Hey, I’m trying a histogram equalization. I’m getting the following error. Can someone please help me with this? Thanks in advance!

---

## [Juliapackages and Juliaobserver](https://discourse.julialang.org/t/juliapackages-and-juliaobserver/41301)

<div class="topic-metadata">

**Author:** [@sbacelar](https://discourse.julialang.org/u/sbacelar)\
**Replies:** 4\
**Last updated:** [June 20, 2020, 4:35am UTC](https://discourse.julialang.org/t/juliapackages-and-juliaobserver/41301 "2020-06-20T04:35:36Z")

</div>

Are Juliapackages and Juliaobserver down?

---

## [Juliapackages.com and juliaobserver "down"/black, anyone know why?](https://discourse.julialang.org/t/juliapackages-com-and-juliaobserver-down-black-anyone-know-why/41126)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 4\
**Last updated:** [June 20, 2020, 4:34am UTC](https://discourse.julialang.org/t/juliapackages-com-and-juliaobserver-down-black-anyone-know-why/41126 "2020-06-20T04:34:45Z")

</div>

Maybe this is only happening for me, I can view source for both, but at least do not work in my Firefox on Linux.

---

## [Do you suggest using ArrayFire?](https://discourse.julialang.org/t/do-you-suggest-using-arrayfire/41766)

<div class="topic-metadata">

**Author:** [@BMval](https://discourse.julialang.org/u/BMval)\
**Replies:** 1\
**Last updated:** [June 20, 2020, 4:24am UTC](https://discourse.julialang.org/t/do-you-suggest-using-arrayfire/41766 "2020-06-20T04:24:32Z")

</div>

I am new in GPU programming. Do you suggest or not using ArrayFire?

---

## [Shared Memory with MPI.jl](https://discourse.julialang.org/t/shared-memory-with-mpi-jl/41747)

<div class="topic-metadata">

**Author:** [@aditya\_314](https://discourse.julialang.org/u/aditya_314)\
**Replies:** 1\
**Last updated:** [June 20, 2020, 1:46am UTC](https://discourse.julialang.org/t/shared-memory-with-mpi-jl/41747 "2020-06-20T01:46:48Z")

</div>

Sorry if this question is silly, I am new to parallel programming, I am using MPI.jl for writing distributed code. I want the processes to share an array. Is is possible to do this ? I know one way is to let one process …

---

## [String getindex problem?](https://discourse.julialang.org/t/string-getindex-problem/41743)

<div class="topic-metadata">

**Author:** [@Ronneesley](https://discourse.julialang.org/u/Ronneesley)\
**Replies:** 4\
**Last updated:** [June 20, 2020, 1:37am UTC](https://discourse.julialang.org/t/string-getindex-problem/41743 "2020-06-20T01:37:40Z")

</div>

Why Julia have this accentuation problem? How to deal with this? julia\> length("cão") 3 julia\> "cão"\[3\] ERROR: StringIndexError("cão", 3) Stacktrace: \[1\] string\_index\_err(::String, ::Int64) at ./strings/string.jl:12 …

---

## [Documentation "would like"](https://discourse.julialang.org/t/documentation-would-like/41683)

<div class="topic-metadata">

**Author:** [@nevermind](https://discourse.julialang.org/u/nevermind)\
**Replies:** 9\
**Last updated:** [June 19, 2020, 11:16pm UTC](https://discourse.julialang.org/t/documentation-would-like/41683 "2020-06-19T23:16:11Z")

</div>

Julia Documentation: Entering and Outputting Information In the Julia documentation section “Manual,” it would be practical if, after the subsection “Getting Started” and before the subsection “Variables,” there was a s…

---

## [Test code with multi-threading](https://discourse.julialang.org/t/test-code-with-multi-threading/41754)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 3\
**Last updated:** [June 19, 2020, 11:06pm UTC](https://discourse.julialang.org/t/test-code-with-multi-threading/41754 "2020-06-19T23:06:53Z")

</div>

Hello, I am writing a multi-threading of my code, but I would like to write unit tests to make sure I get the same results as in the serial case. I am thinking of doing: execute export JULIA\_NUM\_THREADS=6 in the bash …

---

## [Flux: Custom Training + Logging](https://discourse.julialang.org/t/flux-custom-training-logging/41688)

<div class="topic-metadata">

**Author:** [@jmurray](https://discourse.julialang.org/u/jmurray)\
**Replies:** 7\
**Last updated:** [June 19, 2020, 7:15pm UTC](https://discourse.julialang.org/t/flux-custom-training-logging/41688 "2020-06-19T19:15:58Z")

</div>

In the Flux documentation, they give an example of how to do a custom training routine and they indicate where you would place code to do logging (see below). I want to log the loss by initializing LossLog = Float64\[\] ou…

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

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