# General Usage

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

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

**Page:** 443

---

## [Broadcast two vectors to form a matrix](https://discourse.julialang.org/t/broadcast-two-vectors-to-form-a-matrix/81955)

<div class="topic-metadata">

**Author:** [@lazycoder](https://discourse.julialang.org/u/lazycoder)\
**Replies:** 9\
**Last updated:** [May 31, 2022, 9:48am UTC](https://discourse.julialang.org/t/broadcast-two-vectors-to-form-a-matrix/81955 "2022-05-31T09:48:32Z")

</div>

I made a simple function: f(x,y)=x+y res=\[f.(x,1:9) for x in 1:9\] But, now it outputs a vector of vectors. I’d like instead for it to be a matrix. Actually, I’m still very new to julia and I’ve grown pretty confused o…

---

## [Need help with example; Mixture Density Networks from Site](https://discourse.julialang.org/t/need-help-with-example-mixture-density-networks-from-site/81514)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 25\
**Last updated:** [May 31, 2022, 8:41am UTC](https://discourse.julialang.org/t/need-help-with-example-mixture-density-networks-from-site/81514 "2022-05-31T08:41:00Z")

</div>

Tried to reproduce the example that you can see on the site: Mixture Density Networks But I don’t know how to update the following lines of code: # lowest-level? data = \[(y, x)\] for epoch = 1:n\_epochs # forw…

---

## [Package development tools - in environment but not dependency](https://discourse.julialang.org/t/package-development-tools-in-environment-but-not-dependency/81960)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 6\
**Last updated:** [May 31, 2022, 7:20am UTC](https://discourse.julialang.org/t/package-development-tools-in-environment-but-not-dependency/81960 "2022-05-31T07:20:44Z")

</div>

Hi, I am getting a package EspyInsideFunction.jl fairly formalized (testing, doc, registration…). But I still wonder about one thing: as part of development work I use Documenter.jl, Test.jl and ProfileView.jl, so they…

---

## [Contents of the function run well when timed alone, but not when they are in a loop inside the function](https://discourse.julialang.org/t/contents-of-the-function-run-well-when-timed-alone-but-not-when-they-are-in-a-loop-inside-the-function/76886)

<div class="topic-metadata">

**Author:** [@ayushinav](https://discourse.julialang.org/u/ayushinav)\
**Replies:** 8\
**Last updated:** [May 31, 2022, 5:02am UTC](https://discourse.julialang.org/t/contents-of-the-function-run-well-when-timed-alone-but-not-when-they-are-in-a-loop-inside-the-function/76886 "2022-05-31T05:02:21Z")

</div>

Hello all, I am new to Julia and have been making progress with implementing its performance utilities. Generally, I am able to get some results or an understanding of how things are going, but not in this case. The fol…

---

## [How to save a vector into NetCDF?](https://discourse.julialang.org/t/how-to-save-a-vector-into-netcdf/81943)

<div class="topic-metadata">

**Author:** [@Leon6](https://discourse.julialang.org/u/Leon6)\
**Replies:** 3\
**Last updated:** [May 31, 2022, 2:53am UTC](https://discourse.julialang.org/t/how-to-save-a-vector-into-netcdf/81943 "2022-05-31T02:53:07Z")

</div>

I’m trying to use NCDatasets.jl to create a NetCDF file. I wonder if anyone could show me how to save a vector into a NetCDF variable? I have a vector D as below: D = fill(2022,(18,)); Right now, the only way I could …

---

## [Using unregistered packages with Pluto](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 6\
**Last updated:** [May 31, 2022, 12:28am UTC](https://discourse.julialang.org/t/using-unregistered-packages-with-pluto/72483 "2022-05-31T00:28:12Z")

</div>

How can I use an unregistered package without breaking Pluto’s package management system? I read about the custom local registry, but I do not want to go that route.

---

## [Extra allocations/time when a function is returned from another function than defined directly](https://discourse.julialang.org/t/extra-allocations-time-when-a-function-is-returned-from-another-function-than-defined-directly/81933)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 6\
**Last updated:** [May 30, 2022, 11:18pm UTC](https://discourse.julialang.org/t/extra-allocations-time-when-a-function-is-returned-from-another-function-than-defined-directly/81933 "2022-05-30T23:18:30Z")

</div>

The code below compares the results when computing a function when it is returned from another to when it is defined directly. Why is the returned version so much slower, and require any allocations at all? I can see fro…

---

## [Taking a matrix and creating a 2Tuple with first element Row number, and second element row?](https://discourse.julialang.org/t/taking-a-matrix-and-creating-a-2tuple-with-first-element-row-number-and-second-element-row/81934)

<div class="topic-metadata">

**Author:** [@Alejandro\_Quiaro\_San](https://discourse.julialang.org/u/Alejandro_Quiaro_San)\
**Replies:** 2\
**Last updated:** [May 30, 2022, 11:05pm UTC](https://discourse.julialang.org/t/taking-a-matrix-and-creating-a-2tuple-with-first-element-row-number-and-second-element-row/81934 "2022-05-30T23:05:33Z")

</div>

Hello guys, I hope you are doing fine. I would like to take a matrix and create a Tuple, where the first element is the row number (an index) and the second element is the row (a vector). graph =\[0 2 4 0 0 0; 0 0 1 7 0…

---

## [When does the Julia compiler step in](https://discourse.julialang.org/t/when-does-the-julia-compiler-step-in/81930)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 5\
**Last updated:** [May 30, 2022, 10:07pm UTC](https://discourse.julialang.org/t/when-does-the-julia-compiler-step-in/81930 "2022-05-30T22:07:29Z")

</div>

I understand that Julia is a compiled language and that it only generates code (with the help of LLVM) and the CPU is what executes it. My question is about when/how exactly does Julia step in while the code is executin…

---

## [Bar plot with different baseline for each bar?](https://discourse.julialang.org/t/bar-plot-with-different-baseline-for-each-bar/81779)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 4\
**Last updated:** [May 30, 2022, 9:35pm UTC](https://discourse.julialang.org/t/bar-plot-with-different-baseline-for-each-bar/81779 "2022-05-30T21:35:00Z")

</div>

using Plots; bar(1:4) gets you 4 bars, each with their “base” at y = 0, and the $i$th bar has height i. Schematically, that’s |x| |x| |x| |x| |x| |x| |x| |x| |x| |x| Is there a simple way to …

---

## [What are the extra arguments of some BLAS functions?](https://discourse.julialang.org/t/what-are-the-extra-arguments-of-some-blas-functions/81931)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 1\
**Last updated:** [May 30, 2022, 9:18pm UTC](https://discourse.julialang.org/t/what-are-the-extra-arguments-of-some-blas-functions/81931 "2022-05-30T21:18:10Z")

</div>

Some BLAS functions called from the Julia standard library are passed extra arguments. For instance: ccall((@blasfunc(dtrsm\_), libblastrampoline), Cvoid, (Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, Ref{UInt8}, …

---

## [Compile Time Dictionary](https://discourse.julialang.org/t/compile-time-dictionary/81914)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 34\
**Last updated:** [May 30, 2022, 7:27pm UTC](https://discourse.julialang.org/t/compile-time-dictionary/81914 "2022-05-30T19:27:41Z")

</div>

Suppose I have a function that looks somewhat like the following: foo(x::T) where {T} = begin v1 = lookup(T) # Lookup some value specified by type T # Perform work with v1 # Return end My question is can I …

---

## [Does Manifest.toml belong in the repository?](https://discourse.julialang.org/t/does-manifest-toml-belong-in-the-repository/12029)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 16\
**Last updated:** [May 30, 2022, 6:40pm UTC](https://discourse.julialang.org/t/does-manifest-toml-belong-in-the-repository/12029 "2022-05-30T18:40:34Z")

</div>

Sorry if this is a dumb question, but I could not figure this out. It seems to be generated dynamically when missing, so should I add it to the git repo?

---

## [Workaround to Symbolics.build\_functions returning NaN](https://discourse.julialang.org/t/workaround-to-symbolics-build-functions-returning-nan/81925)

<div class="topic-metadata">

**Author:** [@Aleksandr\_Mikheev](https://discourse.julialang.org/u/Aleksandr_Mikheev)\
**Replies:** 1\
**Last updated:** [May 30, 2022, 6:20pm UTC](https://discourse.julialang.org/t/workaround-to-symbolics-build-functions-returning-nan/81925 "2022-05-30T18:20:30Z")

</div>

I am currently using build\_function from Symbolics.jl to generate Julia-type functions that I later work with (numerically integrate, etc.). Recently, I was not able to numerically integrate one of such-obtained function…

---

## [Parametric supertyping using struct field parameters](https://discourse.julialang.org/t/parametric-supertyping-using-struct-field-parameters/81920)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 3\
**Last updated:** [May 30, 2022, 5:59pm UTC](https://discourse.julialang.org/t/parametric-supertyping-using-struct-field-parameters/81920 "2022-05-30T17:59:16Z")

</div>

Hello, I’m trying to play with supertypes but I’m encountering an issue so I made this MWE: abstract type AbstractFoo{T} end struct Foo{T} \<: AbstractFoo{T} x::T end So far so good. Now I would like to define a w…

---

## [AdaptiveMCMC](https://discourse.julialang.org/t/adaptivemcmc/81399)

<div class="topic-metadata">

**Author:** [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Replies:** 9\
**Last updated:** [May 30, 2022, 5:20pm UTC](https://discourse.julialang.org/t/adaptivemcmc/81399 "2022-05-30T17:20:17Z")

</div>

I wrote a Metropolis-Hastings code manually for a problem that samples arrays from a custom distribution that can be found here https://github.com/marouanehanhasse/QComm/blob/main/distributions.jl, before i was using Kla…

---

## [Ordering Of Matrix Columns](https://discourse.julialang.org/t/ordering-of-matrix-columns/81917)

<div class="topic-metadata">

**Author:** [@xztt](https://discourse.julialang.org/u/xztt)\
**Replies:** 9\
**Last updated:** [May 30, 2022, 3:17pm UTC](https://discourse.julialang.org/t/ordering-of-matrix-columns/81917 "2022-05-30T15:17:10Z")

</div>

Hi, I have a matrix of size 9x100 9×100 Matrix{Float64}: 1.08563 1.20562 1.26562 1.14562 1.17562 1.29562 1.23562 1.11563 1.13062 … 1.15031 1.27031 1.21031 1.09031 1…

---

## [Different versions of same package in dependency graph](https://discourse.julialang.org/t/different-versions-of-same-package-in-dependency-graph/81895)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 4\
**Last updated:** [May 30, 2022, 2:30pm UTC](https://discourse.julialang.org/t/different-versions-of-same-package-in-dependency-graph/81895 "2022-05-30T14:30:24Z")

</div>

Suppose I create a project environment and add packages P1@2.0.0 and P2@2.0.0. And lets say P1@2.0.0 depends on P2@1.0.0. Does this create a conflict (like it does in Python)? Or will Julia take care of this and use P2@2…

---

## [Why julia has no clear(variable)?](https://discourse.julialang.org/t/why-julia-has-no-clear-variable/6541)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 17\
**Last updated:** [May 30, 2022, 2:05pm UTC](https://discourse.julialang.org/t/why-julia-has-no-clear-variable/6541 "2022-05-30T14:05:51Z")

</div>

Here is a quote from the documentation Julia does not have an analog of MATLAB’s clear function; once a name is defined in a Julia session (technically, in module Main), it is always present. If memory usage is your c…

---

## [\`ReadOnlyMemoryError\` in PyCall](https://discourse.julialang.org/t/readonlymemoryerror-in-pycall/81907)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 6\
**Last updated:** [May 30, 2022, 2:02pm UTC](https://discourse.julialang.org/t/readonlymemoryerror-in-pycall/81907 "2022-05-30T14:02:34Z")

</div>

Hi all :slight\_smile: I get some wired ReadOnlyMemoryError on a beefy windows machine. I’m using PyCall to fetch data from Snowflake. Any idea why this sometimes happens? Cheers ReadOnlyMemoryError() Stacktrace: \[1\]…

---

## [Error: no BLAS/LAPACK library loaded!](https://discourse.julialang.org/t/error-no-blas-lapack-library-loaded/81896)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 4\
**Last updated:** [May 30, 2022, 12:53pm UTC](https://discourse.julialang.org/t/error-no-blas-lapack-library-loaded/81896 "2022-05-30T12:53:07Z")

</div>

This error started popping up. Is there a cure?

---

## [Create uninitialised mutable struct](https://discourse.julialang.org/t/create-uninitialised-mutable-struct/81913)

<div class="topic-metadata">

**Author:** [@andrew\_s](https://discourse.julialang.org/u/andrew_s)\
**Replies:** 1\
**Last updated:** [May 30, 2022, 12:23pm UTC](https://discourse.julialang.org/t/create-uninitialised-mutable-struct/81913 "2022-05-30T12:23:25Z")

</div>

I have a mutable struct, E.g. mutable struct MyExampleStruct a::Cdouble b::Cdouble end which I wish to create with uninitialised fields. I don’t want to use an inner constructor to achieve this. This will be passed t…

---

## [Pass struct from module to distributed worker](https://discourse.julialang.org/t/pass-struct-from-module-to-distributed-worker/81905)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 0\
**Last updated:** [May 30, 2022, 8:14am UTC](https://discourse.julialang.org/t/pass-struct-from-module-to-distributed-worker/81905 "2022-05-30T08:14:38Z")

</div>

For Pluto.jl, I’m trying to pass a struct from a module on the main process to a distributed worker (Return a \`Rich\` object instead of \`Dict\` for \`show\_richest\` by rikhuijzer · Pull Request #2139 · fonsp/Pluto.jl · GitHu…

---

## [Iteration over OffsetArray](https://discourse.julialang.org/t/iteration-over-offsetarray/81893)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 16\
**Last updated:** [May 30, 2022, 11:33am UTC](https://discourse.julialang.org/t/iteration-over-offsetarray/81893 "2022-05-30T11:33:33Z")

</div>

From this comment, I learned that for i = eachindex(v) is preferred to for i = 1:length(v) when iterating over v::AbstractVector, because AbstractVector may not support 1-based indexing (e.g., OffsecArrays.jl). eachinde…

---

## [Mv() in Windows](https://discourse.julialang.org/t/mv-in-windows/81904)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 6\
**Last updated:** [May 30, 2022, 9:22am UTC](https://discourse.julialang.org/t/mv-in-windows/81904 "2022-05-30T09:22:19Z")

</div>

I have two directories A and B(preexisting, with files in them) and I want to move, or copy the files inside A to B - without loosing previous content of B. So I type mv(A\*"\\\\\*",B) but get 'B' exists. \`force=true\` i…

---

## [Define / edit sysimage attributes with julia?](https://discourse.julialang.org/t/define-edit-sysimage-attributes-with-julia/81786)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 1\
**Last updated:** [May 30, 2022, 9:14am UTC](https://discourse.julialang.org/t/define-edit-sysimage-attributes-with-julia/81786 "2022-05-30T09:14:52Z")

</div>

I’ve developed a package that is a bit heavy to load, so I compiled a sysimage using PackageCompiler to get a faster load time. As I work on a windows system, this gets me a .dll file. In order to track the metadata as…

---

## [Get integer type of specified width](https://discourse.julialang.org/t/get-integer-type-of-specified-width/81900)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 1\
**Last updated:** [May 30, 2022, 6:52am UTC](https://discourse.julialang.org/t/get-integer-type-of-specified-width/81900 "2022-05-30T06:52:46Z")

</div>

Is there a nicer way of implementing this? Perhaps without hardcoding UInts of specific sizes? # Inverse sizeof, basically. of\_exact\_size(::Val{1}) = UInt8 of\_exact\_size(::Val{2}) = UInt16 of\_exact\_size(::Val{4}) = U…

---

## [Failed to precompile DifferentialEquations v1.6.2](https://discourse.julialang.org/t/failed-to-precompile-differentialequations-v1-6-2/81447)

<div class="topic-metadata">

**Author:** [@Aminath\_Shausan](https://discourse.julialang.org/u/Aminath_Shausan)\
**Replies:** 16\
**Last updated:** [May 30, 2022, 5:50am UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations-v1-6-2/81447 "2022-05-30T05:50:46Z")

</div>

Hi I am trying to replicate the example from Turing. But I am struggling to understand why DifferentialEquations fails to precompile. I am using Julia v1.6.2 on Jupyter notebook. Here is the error msg: Failed to precom…

---

## [LAPACK function not found](https://discourse.julialang.org/t/lapack-function-not-found/81886)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 9\
**Last updated:** [May 30, 2022, 5:11am UTC](https://discourse.julialang.org/t/lapack-function-not-found/81886 "2022-05-30T05:11:24Z")

</div>

In rewriting fortran code I found it useful to call LAPACK code directly. function dgetrf!(m::IT, n::IT, A::SubArray{FT, 1, Vector{FT}, Tuple{UnitRange{IT}}, true}, lda::IT, ipiv::SubArray{IT, 1, Vector{IT}, Tuple{UnitR…

---

## [Porting from Python optimize.broyden2](https://discourse.julialang.org/t/porting-from-python-optimize-broyden2/81874)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 5\
**Last updated:** [May 30, 2022, 4:35am UTC](https://discourse.julialang.org/t/porting-from-python-optimize-broyden2/81874 "2022-05-30T04:35:23Z")

</div>

Still porting code from Python… What is a good alternative to the optimize.broyden2 solver from SciPy? https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.broyden2.html

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

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