# General Usage

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

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

**Page:** 668

---

## ["Extendable" plot width in Gaston, in Pluto](https://discourse.julialang.org/t/extendable-plot-width-in-gaston-in-pluto/51598)

<div class="topic-metadata">

**Author:** [@ChetanVardhan](https://discourse.julialang.org/u/ChetanVardhan)\
**Replies:** 3\
**Last updated:** [December 13, 2020, 2:05pm UTC](https://discourse.julialang.org/t/extendable-plot-width-in-gaston-in-pluto/51598 "2020-12-13T14:05:38Z")

</div>

@mbaz or someone who has used Gaston with Pluto… I was wondering, how can I extend the plot window in Gaston! I mean, if the plotted image size is large then, is there any way to get something like this?

---

## [Change type from Any to actual types](https://discourse.julialang.org/t/change-type-from-any-to-actual-types/51663)

<div class="topic-metadata">

**Author:** [@cojua8](https://discourse.julialang.org/u/cojua8)\
**Replies:** 14\
**Last updated:** [December 13, 2020, 9:48am UTC](https://discourse.julialang.org/t/change-type-from-any-to-actual-types/51663 "2020-12-13T09:48:38Z")

</div>

Hi, I have an array of strings, which are replaced by ones or missings julia\> my\_array = \["a", "b"\] 2-element Array{String,1}: "a" "b" julia\> my\_replaced\_array = replace(my\_array, "a" =\> true, "b" =\> missing) 2-ele…

---

## [Pmap usage](https://discourse.julialang.org/t/pmap-usage/51718)

<div class="topic-metadata">

**Author:** [@jmurga](https://discourse.julialang.org/u/jmurga)\
**Replies:** 1\
**Last updated:** [December 13, 2020, 7:43am UTC](https://discourse.julialang.org/t/pmap-usage/51718 "2020-12-13T07:43:26Z")

</div>

Hi everyone, I am trying to execute a custom function in my own server using pmap function. The server accounts for two physical cpus and a 24 threads. The problem is at the second execution of the functions, the numbe…

---

## [Branching in loop decrease perf by ~x5](https://discourse.julialang.org/t/branching-in-loop-decrease-perf-by-x5/51387)

<div class="topic-metadata">

**Author:** [@wizebt](https://discourse.julialang.org/u/wizebt)\
**Replies:** 6\
**Last updated:** [December 13, 2020, 7:42am UTC](https://discourse.julialang.org/t/branching-in-loop-decrease-perf-by-x5/51387 "2020-12-13T07:42:11Z")

</div>

Hi, In Julia 1.3.x version extrema function use to be much slower that minimum + maximum execution. At that time I wrote my own specialized extrema function and gained ~x3 by avoiding one test out of the two in each ite…

---

## [Mul! vs SparseMatrix](https://discourse.julialang.org/t/mul-vs-sparsematrix/51720)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 2\
**Last updated:** [December 12, 2020, 10:22pm UTC](https://discourse.julialang.org/t/mul-vs-sparsematrix/51720 "2020-12-12T22:22:55Z")

</div>

I’m trying to use mul! to compute the product of a sparse matrix and a sparse diagonal matrix. My problem is that mul! allocates very litte, but takes a lot more time than a matrix multiply. Is this what’s supposed to h…

---

## [\[FAQ\]If I have big big loop, How to reduce the running time](https://discourse.julialang.org/t/faq-if-i-have-big-big-loop-how-to-reduce-the-running-time/51717)

<div class="topic-metadata">

**Author:** [@ZhouZhuofei](https://discourse.julialang.org/u/ZhouZhuofei)\
**Replies:** 8\
**Last updated:** [December 12, 2020, 5:33pm UTC](https://discourse.julialang.org/t/faq-if-i-have-big-big-loop-how-to-reduce-the-running-time/51717 "2020-12-12T17:33:17Z")

</div>

For example: if n = One trillion for \_ in 1:n ###### end in python, binary expansion can help, how to do in Julia. add more information about: import .Base: \*, + struct FieldElement Num::BigInt Prime::BigIn…

---

## [NamedTuple type is unstable, or my usage is wrong?](https://discourse.julialang.org/t/namedtuple-type-is-unstable-or-my-usage-is-wrong/51644)

<div class="topic-metadata">

**Author:** [@Zq\_F](https://discourse.julialang.org/u/Zq_F)\
**Replies:** 5\
**Last updated:** [December 12, 2020, 4:56pm UTC](https://discourse.julialang.org/t/namedtuple-type-is-unstable-or-my-usage-is-wrong/51644 "2020-12-12T16:56:45Z")

</div>

Hello everyone help me see a question, I want to define a NamedTuple type that can accept multiple parameters, but I can’t do it well. pm::NamedTuple((:b, ),Tuple(Int64)) #This definition is fast, but it can only accep…

---

## [BandedBlockBanded construction](https://discourse.julialang.org/t/bandedblockbanded-construction/51725)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 0\
**Last updated:** [December 12, 2020, 4:21pm UTC](https://discourse.julialang.org/t/bandedblockbanded-construction/51725 "2020-12-12T16:21:41Z")

</div>

Hi, I have a block tri-diagonal matrix and I would like to try the solver associated to a BandedBlockBanded matrix (see here). I can easily construct the sparse matrix Nx = 10 Ny = 10 T = spdiagm(0=\> rand(Nx\*Ny), -1=\> …

---

## [Julia nightly 1.7 vs 1.6](https://discourse.julialang.org/t/julia-nightly-1-7-vs-1-6/51721)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 1\
**Last updated:** [December 12, 2020, 4:09pm UTC](https://discourse.julialang.org/t/julia-nightly-1-7-vs-1-6/51721 "2020-12-12T16:09:02Z")

</div>

I tried building Julia 1.6 the other day on Windows but failed(only the 32bit version was successful), so I decided to give up and try the nightly build, which, surprisingly, is the 1.7 DEV version. Does the 1.7 contain …

---

## [A lot of big sparse matrices](https://discourse.julialang.org/t/a-lot-of-big-sparse-matrices/51696)

<div class="topic-metadata">

**Author:** [@Avec](https://discourse.julialang.org/u/Avec)\
**Replies:** 8\
**Last updated:** [December 12, 2020, 2:35pm UTC](https://discourse.julialang.org/t/a-lot-of-big-sparse-matrices/51696 "2020-12-12T14:35:07Z")

</div>

Hi everyone, I need to get a sum of approx 10000 matrices, that are constructed by multiplication with sparse matrices. using LinearAlgebra, SparseArrays n = 101 p = 101 m = 25 #indK = sprand(m, n^2\*p^2, 0.2) EDIT on …

---

## [Syevd is absent in LinearAlgebra.LAPACK](https://discourse.julialang.org/t/syevd-is-absent-in-linearalgebra-lapack/51714)

<div class="topic-metadata">

**Author:** [@Jae-Mo\_Lihm](https://discourse.julialang.org/u/Jae-Mo_Lihm)\
**Replies:** 0\
**Last updated:** [December 12, 2020, 12:48pm UTC](https://discourse.julialang.org/t/syevd-is-absent-in-linearalgebra-lapack/51714 "2020-12-12T12:48:35Z")

</div>

In the LinearAlgebra package, functions LAPACK.syev! and LAPACK.syevr! for solving the eigenvalue problem are present. But, LAPACK.syevd! is absent. As I understand, the ?syevd (and its Hermitian counterpart, zheevd) al…

---

## [Getting base type name in julia 1.6](https://discourse.julialang.org/t/getting-base-type-name-in-julia-1-6/51646)

<div class="topic-metadata">

**Author:** [@AsafManela](https://discourse.julialang.org/u/AsafManela)\
**Replies:** 4\
**Last updated:** [December 12, 2020, 12:38pm UTC](https://discourse.julialang.org/t/getting-base-type-name-in-julia-1-6/51646 "2020-12-12T12:38:32Z")

</div>

I am trying to get the base type name of an instance of a parametric type. In julia up to 1.5 I would use typeof(obj).name which would do what I want. But something changed in current nightlies. For example, in 1.6: …

---

## [Plots -\>Label Position](https://discourse.julialang.org/t/plots-label-position/51691)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 1\
**Last updated:** [December 12, 2020, 7:06am UTC](https://discourse.julialang.org/t/plots-label-position/51691 "2020-12-12T07:06:52Z")

</div>

Dear All, how can we define the position of the label in the figure, when “Plots” is in use? Best!

---

## [Please help understand |\> operator](https://discourse.julialang.org/t/please-help-understand-operator/51700)

<div class="topic-metadata">

**Author:** [@asyrov](https://discourse.julialang.org/u/asyrov)\
**Replies:** 1\
**Last updated:** [December 12, 2020, 2:14am UTC](https://discourse.julialang.org/t/please-help-understand-operator/51700 "2020-12-12T02:14:11Z")

</div>

I tried to locate it in documentation, but could not. Can anyone please explain how this “|\> gpu” or “|\> cpu” works? Is this |\> an operator? Here is example of the code: m = Chain( Conv((5,5), 3=\>16, relu), MaxPool…

---

## [Zygote vs Jax performance example](https://discourse.julialang.org/t/zygote-vs-jax-performance-example/51300)

<div class="topic-metadata">

**Author:** [@maxfreu](https://discourse.julialang.org/u/maxfreu)\
**Replies:** 14\
**Last updated:** [December 11, 2020, 9:02pm UTC](https://discourse.julialang.org/t/zygote-vs-jax-performance-example/51300 "2020-12-11T21:02:48Z")

</div>

Hi, it’s Saturday and I somehow had a Jax tab open in my browser, so I decided to compare it against Zygote using their third derivative of tanh example: # jax cpu v0.1.57 from jax.numpy import tanh from jax import grad…

---

## [Struct cross dependency](https://discourse.julialang.org/t/struct-cross-dependency/51680)

<div class="topic-metadata">

**Author:** [@Ronneesley](https://discourse.julialang.org/u/Ronneesley)\
**Replies:** 2\
**Last updated:** [December 11, 2020, 8:22pm UTC](https://discourse.julialang.org/t/struct-cross-dependency/51680 "2020-12-11T20:22:41Z")

</div>

Hello, There is something new about struct cross dependency? mutable struct Father child::Child end mutable struct Child father::Father end

---

## [Again on closures and type instability](https://discourse.julialang.org/t/again-on-closures-and-type-instability/51664)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 6\
**Last updated:** [December 11, 2020, 6:10pm UTC](https://discourse.julialang.org/t/again-on-closures-and-type-instability/51664 "2020-12-11T18:10:58Z")

</div>

Consider the simple functions: inner(x,a) = a\*x outer(f,x) = f(x) If one calls outer using a closure and global, non-constant parameter a , we have a type-instability: julia\> a = 5; x = 2; julia\> @code\_warntype outer…

---

## [Configure DataFrame show](https://discourse.julialang.org/t/configure-dataframe-show/51593)

<div class="topic-metadata">

**Author:** [@altre](https://discourse.julialang.org/u/altre)\
**Replies:** 5\
**Last updated:** [December 11, 2020, 2:38pm UTC](https://discourse.julialang.org/t/configure-dataframe-show/51593 "2020-12-11T14:38:15Z")

</div>

I need a way to configure the show method of DataFrames.jl. I have in the past hacked the show method for the DataFrames type using internal DataFrames API. But of course this breaks when an update comes along. What I …

---

## [Getting linear indices from two vectors containing x and y components of Cartesian coordinates (sub2ind versus LinearIndices())](https://discourse.julialang.org/t/getting-linear-indices-from-two-vectors-containing-x-and-y-components-of-cartesian-coordinates-sub2ind-versus-linearindices/51620)

<div class="topic-metadata">

**Author:** [@ajsc4](https://discourse.julialang.org/u/ajsc4)\
**Replies:** 3\
**Last updated:** [December 11, 2020, 2:25pm UTC](https://discourse.julialang.org/t/getting-linear-indices-from-two-vectors-containing-x-and-y-components-of-cartesian-coordinates-sub2ind-versus-linearindices/51620 "2020-12-11T14:25:20Z")

</div>

I have some matlab code that uses the old sub2ind way of getting the linear indices (this is a simplified version that gets at the essence of it): row = \[1, 2, 3\]; # x-component of cartesian index column = \[1, 2, 3\]; # …

---

## [Reversing order of \`prod(itr)\`](https://discourse.julialang.org/t/reversing-order-of-prod-itr/51613)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 7\
**Last updated:** [December 11, 2020, 1:23pm UTC](https://discourse.julialang.org/t/reversing-order-of-prod-itr/51613 "2020-12-11T13:23:27Z")

</div>

Is there a way to make the product built by prod(itr) from right to left instead from left to right? So I want julia\> prod("$i" for i in \[1,2,3\]) == "123" instead of julia\> prod("$i" for i in \[1,2,3\]) == "321" ? Not…

---

## [@threads for loop performance](https://discourse.julialang.org/t/threads-for-loop-performance/51641)

<div class="topic-metadata">

**Author:** [@ankit13](https://discourse.julialang.org/u/ankit13)\
**Replies:** 6\
**Last updated:** [December 11, 2020, 11:57am UTC](https://discourse.julialang.org/t/threads-for-loop-performance/51641 "2020-12-11T11:57:54Z")

</div>

Hi all, Why my code is running slower when I use more number of threads in @threads for loop? I would like to know, if this is a standard behavior for threaded parallelization? This is a sample code that will reprodu…

---

## [Understanding how to implement numbers in Julia](https://discourse.julialang.org/t/understanding-how-to-implement-numbers-in-julia/51643)

<div class="topic-metadata">

**Author:** [@minetest2048](https://discourse.julialang.org/u/minetest2048)\
**Replies:** 4\
**Last updated:** [December 11, 2020, 11:55am UTC](https://discourse.julialang.org/t/understanding-how-to-implement-numbers-in-julia/51643 "2020-12-11T11:55:38Z")

</div>

To understand how to implement a number in Julia, I tried to implement my own complex number type: struct MyComplex{T\<:Real} \<: Number real::T imag::T end MyComplex(re::Real) = MyComplex(re,zero(re)) Base.conj…

---

## [Julia hanging (/pausing indefinitely) on package build of MbedTLS and others](https://discourse.julialang.org/t/julia-hanging-pausing-indefinitely-on-package-build-of-mbedtls-and-others/11316)

<div class="topic-metadata">

**Author:** [@Ian\_Williamson](https://discourse.julialang.org/u/Ian_Williamson)\
**Replies:** 2\
**Last updated:** [December 11, 2020, 10:42am UTC](https://discourse.julialang.org/t/julia-hanging-pausing-indefinitely-on-package-build-of-mbedtls-and-others/11316 "2020-12-11T10:42:06Z")

</div>

I am having a very strange issue on Windows 10. Whenever the Julia package manager needs to build the MbedTLS package it hangs (or pauses indefinitely) at INFO: Building MbedTLS Opening task manager shows now CPU usage…

---

## [Meaning of "Overhead" column in Profile](https://discourse.julialang.org/t/meaning-of-overhead-column-in-profile/51648)

<div class="topic-metadata">

**Author:** [@ettersi](https://discourse.julialang.org/u/ettersi)\
**Replies:** 0\
**Last updated:** [December 11, 2020, 4:54am UTC](https://discourse.julialang.org/t/meaning-of-overhead-column-in-profile/51648 "2020-12-11T04:54:59Z")

</div>

The first two lines in the output of Profile.print() are Overhead ╎ \[+additional indent\] Count File:Line; Function ========================================================= \[Profiling data\] What does the Overhead colum…

---

## [Reduce vs splat with intersect() function performance](https://discourse.julialang.org/t/reduce-vs-splat-with-intersect-function-performance/51583)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 1\
**Last updated:** [December 11, 2020, 1:08am UTC](https://discourse.julialang.org/t/reduce-vs-splat-with-intersect-function-performance/51583 "2020-12-11T01:08:20Z")

</div>

Hi. Just trying to understand why the first sum is faster than the second. using BenchmarkTools const data=raw"C:\\text.txt" |\> read |\> String |\> x-\>split(x,r"\\r\\n\\r\\n|\\n\\n") .|\> y-\>split(y,r"\\r\\n|\\r|\\n") @btime sum(le…

---

## [Importing a .py file not working](https://discourse.julialang.org/t/importing-a-py-file-not-working/51366)

<div class="topic-metadata">

**Author:** [@lorrp1](https://discourse.julialang.org/u/lorrp1)\
**Replies:** 10\
**Last updated:** [December 10, 2020, 9:38pm UTC](https://discourse.julialang.org/t/importing-a-py-file-not-working/51366 "2020-12-10T21:38:24Z")

</div>

Hello, Im trying to import a file with functions and classes written in python. i have tried using this: pushfirst!(PyVector(pyimport("sys")."path"), "") x = pyimport("Models.py") or x = pyimport("Models") Models.py …

---

## [Disabling allocations](https://discourse.julialang.org/t/disabling-allocations/51028)

<div class="topic-metadata">

**Author:** [@Ginter](https://discourse.julialang.org/u/Ginter)\
**Replies:** 50\
**Last updated:** [December 10, 2020, 7:39pm UTC](https://discourse.julialang.org/t/disabling-allocations/51028 "2020-12-10T19:39:12Z")

</div>

Is there a way of disabling allocations altogether within the body of a function? I optimized my code to avoid all allocations, but they keep creeping back in with changes and are annoying to locate. I would much rather …

---

## [Plot legend with number of columns\>2](https://discourse.julialang.org/t/plot-legend-with-number-of-columns-2/51627)

<div class="topic-metadata">

**Author:** [@Manos\_Vereroudakis](https://discourse.julialang.org/u/Manos_Vereroudakis)\
**Replies:** 0\
**Last updated:** [December 10, 2020, 7:51pm UTC](https://discourse.julialang.org/t/plot-legend-with-number-of-columns-2/51627 "2020-12-10T19:51:00Z")

</div>

Hello all, New to Julia here, I was wondering if there is anything similar to matplotlib’s legend option ncol=2 for the native Plots.jl? I have seen the reply here (Plot legend with multiple columns) but I was wondering…

---

## [CNN for MNIST](https://discourse.julialang.org/t/cnn-for-mnist/51576)

<div class="topic-metadata">

**Author:** [@Tomas\_Berky](https://discourse.julialang.org/u/Tomas_Berky)\
**Replies:** 9\
**Last updated:** [December 10, 2020, 7:30pm UTC](https://discourse.julialang.org/t/cnn-for-mnist/51576 "2020-12-10T19:30:43Z")

</div>

Hello guys, i am trying to make my own CNN for MNIST classification. But i am getting a weird error. LoadError: DimensionMismatch("Rank of x and w must match! (2 vs. 4)") in expression starting at C:\\Users\\tomic\\OneDri…

---

## [Addition to Division Operator](https://discourse.julialang.org/t/addition-to-division-operator/51592)

<div class="topic-metadata">

**Author:** [@vaeli](https://discourse.julialang.org/u/vaeli)\
**Replies:** 5\
**Last updated:** [December 10, 2020, 3:50pm UTC](https://discourse.julialang.org/t/addition-to-division-operator/51592 "2020-12-10T15:50:30Z")

</div>

For my own consistency, I would like / A \* 100 to equal A / 100.

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

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