# General Usage

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

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

**Page:** 364

---

## [Creating a posdef covariance matrix](https://discourse.julialang.org/t/creating-a-posdef-covariance-matrix/90833)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 8\
**Last updated:** [November 27, 2022, 2:49pm UTC](https://discourse.julialang.org/t/creating-a-posdef-covariance-matrix/90833 "2022-11-27T14:49:38Z")

</div>

I want to create a multivariate normal distribution with the exponentiated-quadratic covariance matrix. This code works. But if I make more points by replacing the step .3 with a smaller number like .1 the isposdef asser…

---

## [Help Me to Correct this Function for Special Sum with SymPy and CalculusWithJulia](https://discourse.julialang.org/t/help-me-to-correct-this-function-for-special-sum-with-sympy-and-calculuswithjulia/90893)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 8\
**Last updated:** [November 27, 2022, 2:49pm UTC](https://discourse.julialang.org/t/help-me-to-correct-this-function-for-special-sum-with-sympy-and-calculuswithjulia/90893 "2022-11-27T14:49:25Z")

</div>

Hi all, I am trying to create a function and conditional loop inside, I was creating this code: using SymPy, CalculusWithJulia @vars k n function specialsum(k) if k = i k = (n\*(n+1))/2 elseif k = i^2 k = (n\*(…

---

## [How to interpolate into the \`julia -c\` shell command](https://discourse.julialang.org/t/how-to-interpolate-into-the-julia-c-shell-command/90883)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 3\
**Last updated:** [November 27, 2022, 11:43am UTC](https://discourse.julialang.org/t/how-to-interpolate-into-the-julia-c-shell-command/90883 "2022-11-27T11:43:12Z")

</div>

I have a bit of julia code in a shell variable. I want to execute it. When I run this script code='import Pkg' echo $code julia -e $code echo pass I get this import Pkg ERROR: syntax: incomplete: premature end of inp…

---

## [ImageView not precompiling -- UndefVarError](https://discourse.julialang.org/t/imageview-not-precompiling-undefvarerror/90801)

<div class="topic-metadata">

**Author:** [@del](https://discourse.julialang.org/u/del)\
**Replies:** 4\
**Last updated:** [November 27, 2022, 9:59am UTC](https://discourse.julialang.org/t/imageview-not-precompiling-undefvarerror/90801 "2022-11-27T09:59:23Z")

</div>

I have been unable to precompile ImageView from midway in the 1.9.0 dev series to now 1.10.0-Dev.38. In all attempts there is a common error flagged: ERROR: LoadError: UndefVarError: #imshow##kw not defined It would b…

---

## [DSP.jl how to use ZeroPoleGain with specifications in Hz?](https://discourse.julialang.org/t/dsp-jl-how-to-use-zeropolegain-with-specifications-in-hz/90772)

<div class="topic-metadata">

**Author:** [@dutille](https://discourse.julialang.org/u/dutille)\
**Replies:** 8\
**Last updated:** [November 27, 2022, 7:14am UTC](https://discourse.julialang.org/t/dsp-jl-how-to-use-zeropolegain-with-specifications-in-hz/90772 "2022-11-27T07:14:06Z")

</div>

Let’s say I want to implement a digital filter that is defined by its zeros and poles to filter signals sampled at fs Hz. It seems logical to use DSP.Filters.ZeroPoleGain(z,p,k). But there is little information about the…

---

## [Why is copying using a loop is much slower than \`copy\` for large arrays?](https://discourse.julialang.org/t/why-is-copying-using-a-loop-is-much-slower-than-copy-for-large-arrays/90633)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 10\
**Last updated:** [November 27, 2022, 3:25am UTC](https://discourse.julialang.org/t/why-is-copying-using-a-loop-is-much-slower-than-copy-for-large-arrays/90633 "2022-11-27T03:25:28Z")

</div>

julia\> function copy2(A::Array) B = similar(A); @inbounds @simd for i in eachindex(A, B) B\[i\] = A\[i\] end B end copy2 (generic function with 1 method) jul…

---

## [How to make Julia exit 1 on error when run at the end of a pipe?](https://discourse.julialang.org/t/how-to-make-julia-exit-1-on-error-when-run-at-the-end-of-a-pipe/90879)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 0\
**Last updated:** [November 27, 2022, 3:10am UTC](https://discourse.julialang.org/t/how-to-make-julia-exit-1-on-error-when-run-at-the-end-of-a-pipe/90879 "2022-11-27T03:10:22Z")

</div>

When I run this at the command line, the exit code seems to be 0: % echo 'error()' | julia && echo pass ERROR: Stacktrace: \[1\] error() @ Base ./error.jl:44 \[2\] top-level scope @ none:1 pass % In contrast, gre…

---

## [AES-NI support](https://discourse.julialang.org/t/aes-ni-support/90871)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 0\
**Last updated:** [November 26, 2022, 11:36pm UTC](https://discourse.julialang.org/t/aes-ni-support/90871 "2022-11-26T23:36:37Z")

</div>

There are several packages that implement AES Do any of the packages support hardware acceleration (AES-NI)? For example, OpenSSL\_jll is built with BinaryBuilder, does BinaryBuilder support AES-NI?

---

## [How to automatically "transfer" keyword arguments from a component structure to the constructor of the wrapping object?](https://discourse.julialang.org/t/how-to-automatically-transfer-keyword-arguments-from-a-component-structure-to-the-constructor-of-the-wrapping-object/83737)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [July 4, 2022, 10:14am UTC](https://discourse.julialang.org/t/how-to-automatically-transfer-keyword-arguments-from-a-component-structure-to-the-constructor-of-the-wrapping-object/83737 "2022-07-04T10:14:11Z")

</div>

I have a struct (let’s say Model) where I would like to logically divide the fields in two different objects (lets’s say optionsa and optionsb) but I want to keep this division transparent to the user so that it can just…

---

## [How to silence a pipeline?](https://discourse.julialang.org/t/how-to-silence-a-pipeline/90726)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 4\
**Last updated:** [November 26, 2022, 8:23pm UTC](https://discourse.julialang.org/t/how-to-silence-a-pipeline/90726 "2022-11-26T20:23:45Z")

</div>

Hi all. I am running an external fortran code that reads an input file and outputs another. While the program runs it prints some lines. I am calling the program with run and pipeline: run(pipeline(cat in.love,./love)…

---

## [Having latest \`LanguageServer.jl\` version to use formatter in Julia VSCode extension](https://discourse.julialang.org/t/having-latest-languageserver-jl-version-to-use-formatter-in-julia-vscode-extension/90702)

<div class="topic-metadata">

**Author:** [@danielsoutar](https://discourse.julialang.org/u/danielsoutar)\
**Replies:** 4\
**Last updated:** [November 26, 2022, 6:11pm UTC](https://discourse.julialang.org/t/having-latest-languageserver-jl-version-to-use-formatter-in-julia-vscode-extension/90702 "2022-11-26T18:11:47Z")

</div>

I use the JuliaFormatter in VSCode as part of the Julia extension. It works OK, but it has up until recently had broken formatting when doing a selection - forcing me to have to format the entire file and pick out my cha…

---

## [Map over product](https://discourse.julialang.org/t/map-over-product/90839)

<div class="topic-metadata">

**Author:** [@jar1](https://discourse.julialang.org/u/jar1)\
**Replies:** 1\
**Last updated:** [November 26, 2022, 12:39pm UTC](https://discourse.julialang.org/t/map-over-product/90839 "2022-11-26T12:39:25Z")

</div>

Is there a shorter way to write \[f(a,b) for a in A, b in B\] or map(Base.splat(f), Iterators.product(A,B)) ? I’m looking for something like prodmap(f, A, B).

---

## [Compile script before running through code](https://discourse.julialang.org/t/compile-script-before-running-through-code/90844)

<div class="topic-metadata">

**Author:** [@Michael\_Hecht](https://discourse.julialang.org/u/Michael_Hecht)\
**Replies:** 3\
**Last updated:** [November 26, 2022, 12:07pm UTC](https://discourse.julialang.org/t/compile-script-before-running-through-code/90844 "2022-11-26T12:07:45Z")

</div>

Is it possible to compile a script before passing each line? My impression is that the code is compiled line by line. I want to start a server that does some calculations. When start the server, all code should be compi…

---

## [How to Create Multiple Plots of Animation to Estimate Pi using Julia Plots or Luxor? Not with Pluto](https://discourse.julialang.org/t/how-to-create-multiple-plots-of-animation-to-estimate-pi-using-julia-plots-or-luxor-not-with-pluto/90765)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 7\
**Last updated:** [November 26, 2022, 12:05pm UTC](https://discourse.julialang.org/t/how-to-create-multiple-plots-of-animation-to-estimate-pi-using-julia-plots-or-luxor-not-with-pluto/90765 "2022-11-26T12:05:06Z")

</div>

Hi all, I want to try this, but do not want to use Pluto, is there any nice advice for me?

---

## [Summation Formula or Package in Julia](https://discourse.julialang.org/t/summation-formula-or-package-in-julia/90843)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 0\
**Last updated:** [November 26, 2022, 10:04am UTC](https://discourse.julialang.org/t/summation-formula-or-package-in-julia/90843 "2022-11-26T10:04:42Z")

</div>

Hi all, I want to know if there is a package that can be used to obtain summation formula like this below? It must use Symbolics too. Almost like this but more general:

---

## [Permanent recompilation of libraries and performance issues](https://discourse.julialang.org/t/permanent-recompilation-of-libraries-and-performance-issues/90815)

<div class="topic-metadata">

**Author:** [@Michael\_Hecht](https://discourse.julialang.org/u/Michael_Hecht)\
**Replies:** 6\
**Last updated:** [November 26, 2022, 9:06am UTC](https://discourse.julialang.org/t/permanent-recompilation-of-libraries-and-performance-issues/90815 "2022-11-26T09:06:43Z")

</div>

I have a little test program that uses some libraries println("load libs ...") t0 = time() @time using JuMP @time using Ipopt println("run prog ...") m = Model(Ipopt.Optimizer) println("set variables ...") @variable(m…

---

## [How do I test my package while avoiding adding large alternative dependencies?](https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838)

<div class="topic-metadata">

**Author:** [@kapple](https://discourse.julialang.org/u/kapple)\
**Replies:** 2\
**Last updated:** [November 26, 2022, 6:01am UTC](https://discourse.julialang.org/t/how-do-i-test-my-package-while-avoiding-adding-large-alternative-dependencies/90838 "2022-11-26T06:01:48Z")

</div>

Two examples of lightweight packages as alternatives to a large package: RecipesBase.jl instead of Plots.jl OrdinaryDiffEq.jl instead of DifferentialEquations.jl In both cases, the former is added to a personal packag…

---

## [Interpolation into array rather than from array](https://discourse.julialang.org/t/interpolation-into-array-rather-than-from-array/60538)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 15\
**Last updated:** [November 26, 2022, 4:03am UTC](https://discourse.julialang.org/t/interpolation-into-array-rather-than-from-array/60538 "2022-11-26T04:03:57Z")

</div>

I would like to do interpolation writing into an array rather than interpolation from an array. I looked around a bit and found Interpolations.jl. Yet it seems like it only supports to interpolate on read (getindex)inste…

---

## [Meaning of non-anonymous nested/local function](https://discourse.julialang.org/t/meaning-of-non-anonymous-nested-local-function/90799)

<div class="topic-metadata">

**Author:** [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Replies:** 1\
**Last updated:** [November 25, 2022, 5:12pm UTC](https://discourse.julialang.org/t/meaning-of-non-anonymous-nested-local-function/90799 "2022-11-25T17:12:41Z")

</div>

Consider the following function function outer(capture) function foo() capture + 1 end bar = function() capture + 1 end baz = () -\> begin capture + 1 end ... end Afai…

---

## [File IO Buffers too small?](https://discourse.julialang.org/t/file-io-buffers-too-small/89931)

<div class="topic-metadata">

**Author:** [@mwlidar](https://discourse.julialang.org/u/mwlidar)\
**Replies:** 14\
**Last updated:** [November 25, 2022, 5:05pm UTC](https://discourse.julialang.org/t/file-io-buffers-too-small/89931 "2022-11-25T17:05:12Z")

</div>

I typically have the task to read and process large binary data files consisting of relatively small consecutive records (\< 30 kB). If I read each record one after the other the read performance lacks far behind of what …

---

## [Updating / adding functions together](https://discourse.julialang.org/t/updating-adding-functions-together/90817)

<div class="topic-metadata">

**Author:** [@tsojtc](https://discourse.julialang.org/u/tsojtc)\
**Replies:** 0\
**Last updated:** [November 25, 2022, 4:44pm UTC](https://discourse.julialang.org/t/updating-adding-functions-together/90817 "2022-11-25T16:44:23Z")

</div>

I am working on a problem where I have a continuous real valued function, e.g. a solution to an ODE, and I want to be able to update it multiple times by adding other continuous functions, which are calculated by code ru…

---

## [Is it possible to check if a function has been called with a keyword argument explicitly?](https://discourse.julialang.org/t/is-it-possible-to-check-if-a-function-has-been-called-with-a-keyword-argument-explicitly/90812)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 3\
**Last updated:** [November 25, 2022, 4:51pm UTC](https://discourse.julialang.org/t/is-it-possible-to-check-if-a-function-has-been-called-with-a-keyword-argument-explicitly/90812 "2022-11-25T16:51:46Z")

</div>

Is there a way to determine if a keyword argument with a default value has been explicitly given or the default has been used ? function foo(;karg1::Int64=3) # if foo has been called with karg1 explicitly then... e…

---

## [Call Python skopt package from Julia](https://discourse.julialang.org/t/call-python-skopt-package-from-julia/90816)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 0\
**Last updated:** [November 25, 2022, 4:42pm UTC](https://discourse.julialang.org/t/call-python-skopt-package-from-julia/90816 "2022-11-25T16:42:55Z")

</div>

When I try to call python skopt from Julia, I find a weird problem, here is a simple example that can reflect my question, if I define all variable range with Real, it will cause error in res = opt.tell(suggested, y) how…

---

## [Directly write logical rules](https://discourse.julialang.org/t/directly-write-logical-rules/90413)

<div class="topic-metadata">

**Author:** [@colleybrb](https://discourse.julialang.org/u/colleybrb)\
**Replies:** 3\
**Last updated:** [November 25, 2022, 4:38pm UTC](https://discourse.julialang.org/t/directly-write-logical-rules/90413 "2022-11-25T16:38:17Z")

</div>

I’ve been tinkering around with julog and it has met a course requirement of an expert system. I will work out my problem set for the class with this package, but I want to continue the project after this class, and am h…

---

## [Sort allocates twice more memory](https://discourse.julialang.org/t/sort-allocates-twice-more-memory/90756)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 1\
**Last updated:** [November 25, 2022, 3:25pm UTC](https://discourse.julialang.org/t/sort-allocates-twice-more-memory/90756 "2022-11-25T15:25:38Z")

</div>

Hi, It seems the sort function allocates twice more memory in master vs 1.8.3: using BenchmarkTools x = rand(10^8); @btime sort($x); In 1.8.3 I get 2 allocations 762 MiB vs 6 allocations 1.49GiB in master. Is that co…

---

## [Reading hdf5 file saved with nested dict from Python](https://discourse.julialang.org/t/reading-hdf5-file-saved-with-nested-dict-from-python/90767)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 5\
**Last updated:** [November 25, 2022, 2:42pm UTC](https://discourse.julialang.org/t/reading-hdf5-file-saved-with-nested-dict-from-python/90767 "2022-11-25T14:42:17Z")

</div>

Hello, I’m having problems reading hdf5 files using the ‘HDF5’ package, with nested dictionaries in them stored from Python. The data consists of a key (string) and its value (dict containing two keys for different arra…

---

## [Allocations (again...)](https://discourse.julialang.org/t/allocations-again/90780)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 15\
**Last updated:** [November 25, 2022, 2:26pm UTC](https://discourse.julialang.org/t/allocations-again/90780 "2022-11-25T14:26:34Z")

</div>

When I run using BenchmarkTools function test(x, Y) sum!(x, Y') return nothing end x = rand(Float64, 100) Y = rand(Float64, 1, 100) @btime(test(x, Y)) I get the following: 367.952 ns (2 allocations: 96 bytes…

---

## [It's All Set - LazySets Errors: Showing Types and set\_tolerance not defined](https://discourse.julialang.org/t/its-all-set-lazysets-errors-showing-types-and-set-tolerance-not-defined/85994)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [November 25, 2022, 1:59pm UTC](https://discourse.julialang.org/t/its-all-set-lazysets-errors-showing-types-and-set-tolerance-not-defined/85994 "2022-11-25T13:59:48Z")

</div>

Hi all, I get two errors on LazySets tutorial at the last section, the first one: using LazySets println("=== Concrete set types ===\\n") for S in subtypes(LazySet, true) if !isoperationtype(S) println(S) …

---

## [Speed up \`x::Bool ^ y::Float64\`](https://discourse.julialang.org/t/speed-up-x-bool-y-float64/90601)

<div class="topic-metadata">

**Author:** [@andrey2185](https://discourse.julialang.org/u/andrey2185)\
**Replies:** 9\
**Last updated:** [November 25, 2022, 1:02pm UTC](https://discourse.julialang.org/t/speed-up-x-bool-y-float64/90601 "2022-11-25T13:02:11Z")

</div>

Hello i am trying to speed up this: x::Bool ^ y::Float64, and even something come out Is there any way to avoid branching of f2() in example? How else to speed up? using BenchmarkTools, Test # simple f1(x::Bool, y:…

---

## [Can I separate unspaced data in Julia?/or round data](https://discourse.julialang.org/t/can-i-separate-unspaced-data-in-julia-or-round-data/90787)

<div class="topic-metadata">

**Author:** [@dangda](https://discourse.julialang.org/u/dangda)\
**Replies:** 4\
**Last updated:** [November 25, 2022, 11:58am UTC](https://discourse.julialang.org/t/can-i-separate-unspaced-data-in-julia-or-round-data/90787 "2022-11-25T11:58:45Z")

</div>

I got protein distance data in Julia. And it’s like 0.03.9054839648883466.8782495592992210.390223770448832 … etc(millions of data) And I can’t sort data one by one It supposed to be 0.0;3.905483964888346;6.87824955…

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

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