# General Usage

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

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

**Page:** 245

---

## [A sparse matrix cannot be indexed by a SVector](https://discourse.julialang.org/t/a-sparse-matrix-cannot-be-indexed-by-a-svector/104265)

<div class="topic-metadata">

**Author:** [@pinkie.ljz](https://discourse.julialang.org/u/pinkie.ljz)\
**Replies:** 4\
**Last updated:** [September 26, 2023, 3:18pm UTC](https://discourse.julialang.org/t/a-sparse-matrix-cannot-be-indexed-by-a-svector/104265 "2023-09-26T15:18:04Z")

</div>

As indicated by the topic, I intend to replace some small matrices with the StaticArrays but the global sparse matrix created by SparseArrays.jl cannot be indexed by a SVector. A simple example is given as follows. usi…

---

## [How to plot benchmarks](https://discourse.julialang.org/t/how-to-plot-benchmarks/104243)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 7\
**Last updated:** [September 26, 2023, 10:11am UTC](https://discourse.julialang.org/t/how-to-plot-benchmarks/104243 "2023-09-26T10:11:24Z")

</div>

Hi all, I would like to plot some benchmarks, but its not clear to me what approach to take. As a simple example, suppose I have: using BenchmarkTools using DataFrames using Statistics SUITE = BenchmarkGroup() SUITE…

---

## [Need help understanding the allocations](https://discourse.julialang.org/t/need-help-understanding-the-allocations/104225)

<div class="topic-metadata">

**Author:** [@navdeeprana](https://discourse.julialang.org/u/navdeeprana)\
**Replies:** 8\
**Last updated:** [September 26, 2023, 9:15am UTC](https://discourse.julialang.org/t/need-help-understanding-the-allocations/104225 "2023-09-26T09:15:25Z")

</div>

Consider the following code using BenchmarkTools using Random using QuadGK f(p, xm, x) = -x^2 / ((p\[1\] - xm\[1\]\*x)^2 + (p\[2\] - xm\[2\]\*x)^2) g(p, xm, x) = -x^2 / ((p\[1\] - xm\[1\])^2 + (p\[2\] - xm\[2\])^2) integralf(p, xm) = qu…

---

## [GenieBuilder unable to install package](https://discourse.julialang.org/t/geniebuilder-unable-to-install-package/104123)

<div class="topic-metadata">

**Author:** [@vtomar](https://discourse.julialang.org/u/vtomar)\
**Replies:** 4\
**Last updated:** [September 26, 2023, 7:38am UTC](https://discourse.julialang.org/t/geniebuilder-unable-to-install-package/104123 "2023-09-26T07:38:08Z")

</div>

I get the following error: Pkg.add(url = “GitHub - GenieFramework/GenieBuilder.jl”) Cloning git-repo https://github.com/GenieFramework/GenieBuilder.jl.git Updating git-repo https://github.com/GenieFramework/GenieBuil…

---

## [Julia Plots circular marker with no fill (transparent inside)](https://discourse.julialang.org/t/julia-plots-circular-marker-with-no-fill-transparent-inside/104246)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 3\
**Last updated:** [September 26, 2023, 7:12am UTC](https://discourse.julialang.org/t/julia-plots-circular-marker-with-no-fill-transparent-inside/104246 "2023-09-26T07:12:27Z")

</div>

Hi, I’d like to make a circular marker without an interior color. I tried several things including this but didn’t work yet. julia\> using Plots julia\> a, b = \[1\], \[1\] (\[1\], \[1\]) julia\> scatter(a, b; markeralpha=0, m…

---

## [Cannot push Git commits by LibGit2](https://discourse.julialang.org/t/cannot-push-git-commits-by-libgit2/104076)

<div class="topic-metadata">

**Author:** [@wsshin](https://discourse.julialang.org/u/wsshin)\
**Replies:** 7\
**Last updated:** [September 25, 2023, 4:29am UTC](https://discourse.julialang.org/t/cannot-push-git-commits-by-libgit2/104076 "2023-09-25T04:29:23Z")

</div>

I am trying to write a script that commits changes in files and pushes them to the upstream using LibGit2, but push() is not working. I am able to create a LibGit2.GitRepo, add changes to it, and commit the changes by r…

---

## [Cthulhu and setindex!](https://discourse.julialang.org/t/cthulhu-and-setindex/104238)

<div class="topic-metadata">

**Author:** [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Replies:** 2\
**Last updated:** [September 25, 2023, 7:18pm UTC](https://discourse.julialang.org/t/cthulhu-and-setindex/104238 "2023-09-25T19:18:54Z")

</div>

Hi everyone, for today a very simple question: why does Cthulhu seemingly shows this question is so basic that I feel like I must be missing something. julia\> function overwrite!(arr) arr\[1\] = zero(eltype(a…

---

## [How to predict new value corresponding to a new initial condition when using NeuralPDE](https://discourse.julialang.org/t/how-to-predict-new-value-corresponding-to-a-new-initial-condition-when-using-neuralpde/101224)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 1\
**Last updated:** [September 25, 2023, 1:42pm UTC](https://discourse.julialang.org/t/how-to-predict-new-value-corresponding-to-a-new-initial-condition-when-using-neuralpde/101224 "2023-09-25T13:42:19Z")

</div>

After using NeuralPDE to solve the ODEs system, I got the prediction for a specific system as a result of the training process by using the code in the tutorial below: ts = 0.0:0.01:10.0 minimizers\_ = \[res.u.depvar\[sym\_…

---

## [How to serialize data to, and deserialize from, postgres?](https://discourse.julialang.org/t/how-to-serialize-data-to-and-deserialize-from-postgres/103803)

<div class="topic-metadata">

**Author:** [@John\_Boik](https://discourse.julialang.org/u/John_Boik)\
**Replies:** 9\
**Last updated:** [September 25, 2023, 1:29pm UTC](https://discourse.julialang.org/t/how-to-serialize-data-to-and-deserialize-from-postgres/103803 "2023-09-25T13:29:18Z")

</div>

I would like to store some Julia data in a PostgreSQL bytea column and then query the database and convert the result back to its original form. I can store the data, but can’t seem to convert the query response correctl…

---

## [Error with NeuralPDE and OptimizationFunction](https://discourse.julialang.org/t/error-with-neuralpde-and-optimizationfunction/102164)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 1\
**Last updated:** [September 25, 2023, 12:23pm UTC](https://discourse.julialang.org/t/error-with-neuralpde-and-optimizationfunction/102164 "2023-09-25T12:23:59Z")

</div>

I tried to solve the ODE problem with NeuralPDE on Jupyter notebook, and the code ran when I used the older version of Julia and packages (version 1.9.0 and I forgot the version of packages). I updated all packages yest…

---

## [Solving ODE by PDESystem](https://discourse.julialang.org/t/solving-ode-by-pdesystem/100293)

<div class="topic-metadata">

**Author:** [@Ethan\_Tran](https://discourse.julialang.org/u/Ethan_Tran)\
**Replies:** 1\
**Last updated:** [September 25, 2023, 12:12pm UTC](https://discourse.julialang.org/t/solving-ode-by-pdesystem/100293 "2023-09-25T12:12:54Z")

</div>

I try to use NeuralPDE to solve the ODE system. the code I use below: using NeuralPDE, Lux, ModelingToolkit, Optimization, OptimizationOptimJL import ModelingToolkit: Interval, infimum, supremum @parameters t @variabl…

---

## [Create string out of substring in dataframe](https://discourse.julialang.org/t/create-string-out-of-substring-in-dataframe/104206)

<div class="topic-metadata">

**Author:** [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Replies:** 12\
**Last updated:** [September 25, 2023, 9:58am UTC](https://discourse.julialang.org/t/create-string-out-of-substring-in-dataframe/104206 "2023-09-25T09:58:38Z")

</div>

I’m trying to create a new string parsed out of a substring of a column that is delimited by a character. For example, in this dataframe df = DataFrame( id=\["1", "1", "2"\], string=\["A.B.C.D.JUNK", "A.B.C.JUNK…

---

## [Dispatch on physical quantity or creating distinct types that behave like a float](https://discourse.julialang.org/t/dispatch-on-physical-quantity-or-creating-distinct-types-that-behave-like-a-float/104098)

<div class="topic-metadata">

**Author:** [@cpf-work](https://discourse.julialang.org/u/cpf-work)\
**Replies:** 7\
**Last updated:** [September 25, 2023, 9:19am UTC](https://discourse.julialang.org/t/dispatch-on-physical-quantity-or-creating-distinct-types-that-behave-like-a-float/104098 "2023-09-25T09:19:16Z")

</div>

Let’s say I want to calculate the velocity of a free falling body in vacuum. I want to do this in dependence of gravitational constant and time or distance and time with a fixed gravitational constant. That would be eit…

---

## [Avast ne gives me an IDP.Generic Warning for gkskt.exe](https://discourse.julialang.org/t/avast-ne-gives-me-an-idp-generic-warning-for-gkskt-exe/104200)

<div class="topic-metadata">

**Author:** [@MiSch](https://discourse.julialang.org/u/MiSch)\
**Replies:** 1\
**Last updated:** [September 25, 2023, 9:04am UTC](https://discourse.julialang.org/t/avast-ne-gives-me-an-idp-generic-warning-for-gkskt-exe/104200 "2023-09-25T09:04:34Z")

</div>

Hi, I am going to learn Julia. I have a problem after importing the “Plot-library” (Julia 1.9.3. Windows 10). One of my Antivirus programs is warning me with “IDP.Generic Warning for gkskt.exe”. Are there some experienc…

---

## [Loading a trained model in Transformers.jl](https://discourse.julialang.org/t/loading-a-trained-model-in-transformers-jl/104210)

<div class="topic-metadata">

**Author:** [@kadir-gunel](https://discourse.julialang.org/u/kadir-gunel)\
**Replies:** 0\
**Last updated:** [September 25, 2023, 8:17am UTC](https://discourse.julialang.org/t/loading-a-trained-model-in-transformers-jl/104210 "2023-09-25T08:17:53Z")

</div>

Hello All, I am having a problem while trying to load a model that is trained from scratch with Transformers.jl. The model it self is a seq2seq model that is very similar to the one in the documentation. Only difference…

---

## [How to compute integral of multivariate normal with bounds defined by lines](https://discourse.julialang.org/t/how-to-compute-integral-of-multivariate-normal-with-bounds-defined-by-lines/104160)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 13\
**Last updated:** [September 25, 2023, 8:10am UTC](https://discourse.julialang.org/t/how-to-compute-integral-of-multivariate-normal-with-bounds-defined-by-lines/104160 "2023-09-25T08:10:16Z")

</div>

Hi all, I would like to use Distributions.jl and HCubature.jl (or suitable alternative) to compute an integral over part of the domain of a multivariate normal distribution. The image below provides an example. In the i…

---

## [Replace a markdown node with MarkdownAST/AbstractTrees](https://discourse.julialang.org/t/replace-a-markdown-node-with-markdownast-abstracttrees/103799)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 3\
**Last updated:** [September 24, 2023, 8:01pm UTC](https://discourse.julialang.org/t/replace-a-markdown-node-with-markdownast-abstracttrees/103799 "2023-09-24T20:01:18Z")

</div>

I’m trying to figure out a way to replace particular nodes in a markdown syntax tree with a new list of sibling sub-trees. For example, I might want to replace the node (subtree) corresponding to the markdown \[text with …

---

## [Surface plot using plots.jl](https://discourse.julialang.org/t/surface-plot-using-plots-jl/103956)

<div class="topic-metadata">

**Author:** [@yosuga](https://discourse.julialang.org/u/yosuga)\
**Replies:** 7\
**Last updated:** [September 24, 2023, 2:22pm UTC](https://discourse.julialang.org/t/surface-plot-using-plots-jl/103956 "2023-09-24T14:22:00Z")

</div>

I have two very basic questions about surface plots. One is that when I have a dataset S = \[(x1, y1, z1), (x2, y2, z2), ..., (xn, yn, zn)\], how can I create a surface plot for z? Here, (xi, yi)≠(xj, yj) for i≠j are guar…

---

## [How to improve REPL startup time OR clear the workspace](https://discourse.julialang.org/t/how-to-improve-repl-startup-time-or-clear-the-workspace/104171)

<div class="topic-metadata">

**Author:** [@mcmuffin6o](https://discourse.julialang.org/u/mcmuffin6o)\
**Replies:** 9\
**Last updated:** [September 24, 2023, 4:53am UTC](https://discourse.julialang.org/t/how-to-improve-repl-startup-time-or-clear-the-workspace/104171 "2023-09-24T04:53:41Z")

</div>

I love Julia – it’s amazing with the VS Code extension, which solves the problem of not being able to perform the simple task of plotting more than one thing at once. There’s just one thing keeping me from recommending i…

---

## [Extensions/weakdeps loading and package design](https://discourse.julialang.org/t/extensions-weakdeps-loading-and-package-design/104156)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 10\
**Last updated:** [September 24, 2023, 3:17am UTC](https://discourse.julialang.org/t/extensions-weakdeps-loading-and-package-design/104156 "2023-09-24T03:17:18Z")

</div>

I just experimented for the first time the implementation of a package extension. Everything worked, but as I did it I need to load explicitly the weak dependency for the extension module to be loaded. So my package loo…

---

## [Speeding up a nested for loop](https://discourse.julialang.org/t/speeding-up-a-nested-for-loop/104130)

<div class="topic-metadata">

**Author:** [@MarcBerliner](https://discourse.julialang.org/u/MarcBerliner)\
**Replies:** 5\
**Last updated:** [September 23, 2023, 10:06pm UTC](https://discourse.julialang.org/t/speeding-up-a-nested-for-loop/104130 "2023-09-23T22:06:18Z")

</div>

I have a nested for-loop where the length of the internal loop is dependent on the outer loop. Any ideas on how to squeeze more performance out of this? N = 500 a = rand(N) b = rand(N) c = rand(N) out = zeros(N) j\_mi…

---

## [Detect string arrays in Matrix{Any} and convert them to number](https://discourse.julialang.org/t/detect-string-arrays-in-matrix-any-and-convert-them-to-number/104155)

<div class="topic-metadata">

**Author:** [@ashefa](https://discourse.julialang.org/u/ashefa)\
**Replies:** 2\
**Last updated:** [September 23, 2023, 4:54pm UTC](https://discourse.julialang.org/t/detect-string-arrays-in-matrix-any-and-convert-them-to-number/104155 "2023-09-23T16:54:56Z")

</div>

Consider there is an m×n Matrix{Any}: where some of its arrays are decimal numbers (Float64) and some of them are strings of this type a.b.c, in which a, b, and c are integer numbers (a,b,c\>10). Now, how can we write a c…

---

## [How to load Python packages in PythonCall? They've already been installed by Conda in REPL](https://discourse.julialang.org/t/how-to-load-python-packages-in-pythoncall-theyve-already-been-installed-by-conda-in-repl/104176)

<div class="topic-metadata">

**Author:** [@MaxM](https://discourse.julialang.org/u/MaxM)\
**Replies:** 1\
**Last updated:** [September 23, 2023, 3:54pm UTC](https://discourse.julialang.org/t/how-to-load-python-packages-in-pythoncall-theyve-already-been-installed-by-conda-in-repl/104176 "2023-09-23T15:54:48Z")

</div>

In the Julia REPL, I just ran Conda.add("pandas") and it ran as Anaconda prompt usually ran, concluding with “All requested packages already installed.” However, the following code then gives me an error (in a Jupyter No…

---

## [How to speed up the calculation of Logit likelihood?](https://discourse.julialang.org/t/how-to-speed-up-the-calculation-of-logit-likelihood/104153)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 8\
**Last updated:** [September 23, 2023, 11:41am UTC](https://discourse.julialang.org/t/how-to-speed-up-the-calculation-of-logit-likelihood/104153 "2023-09-23T11:41:57Z")

</div>

Hi, I am currently using Julia to solve some econometric structural models which usually involve the calculation and optimization of Log-likelihood function. While the optimization can be done by Optim.jl, the calculatio…

---

## [Best practices to reduce allocations in Julia](https://discourse.julialang.org/t/best-practices-to-reduce-allocations-in-julia/104158)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 6\
**Last updated:** [September 23, 2023, 7:59am UTC](https://discourse.julialang.org/t/best-practices-to-reduce-allocations-in-julia/104158 "2023-09-23T07:59:42Z")

</div>

Hi all, I have a relatively big simulation function (which has 20,000 repeated loops). The @time results show more than 64.5G allocations. Are there some tips to reduce the allocations? Thank you in advance.

---

## [Reduce allocations LinearSolve](https://discourse.julialang.org/t/reduce-allocations-linearsolve/104141)

<div class="topic-metadata">

**Author:** [@Kieran\_Marray](https://discourse.julialang.org/u/Kieran_Marray)\
**Replies:** 4\
**Last updated:** [September 22, 2023, 2:34pm UTC](https://discourse.julialang.org/t/reduce-allocations-linearsolve/104141 "2023-09-22T14:34:52Z")

</div>

Hi - I am trying to solve a linear problem repeatedly using LinearSolve.jl without allocating any new memory by mutating the input and solution arrays. Here is a minimal example using LinearAlgebra, LinearSolve, Iterati…

---

## [Why is this type unstable?](https://discourse.julialang.org/t/why-is-this-type-unstable/104124)

<div class="topic-metadata">

**Author:** [@yvikhlya](https://discourse.julialang.org/u/yvikhlya)\
**Replies:** 11\
**Last updated:** [September 22, 2023, 11:25am UTC](https://discourse.julialang.org/t/why-is-this-type-unstable/104124 "2023-09-22T11:25:31Z")

</div>

using Glob, NCDatasets const colpath="path\_to\_data" ncload(ds, ::Type{Array{T,N}}) where {T,N} = ds\["T"\]\[:,:,:,:\]::Array{T,N} function foo() files=glob("\*.??????.nc4",colpath) NCDataset(files\[1\]) do ds …

---

## [REPL errors when started from VSCode (connected to a server via remote SSH)](https://discourse.julialang.org/t/repl-errors-when-started-from-vscode-connected-to-a-server-via-remote-ssh/104142)

<div class="topic-metadata">

**Author:** [@CrisCool](https://discourse.julialang.org/u/CrisCool)\
**Replies:** 1\
**Last updated:** [September 22, 2023, 11:00am UTC](https://discourse.julialang.org/t/repl-errors-when-started-from-vscode-connected-to-a-server-via-remote-ssh/104142 "2023-09-22T11:00:54Z")

</div>

Hi there julians I have VSCode on my laptop, which then connects to a server via Remote SSH extension. Julia is installed on the server. Untill yesterday, everything worked fined. However, since then I can’t start Julia…

---

## [Issues with Plots and Libtiff\_jll](https://discourse.julialang.org/t/issues-with-plots-and-libtiff-jll/104134)

<div class="topic-metadata">

**Author:** [@gzagatti](https://discourse.julialang.org/u/gzagatti)\
**Replies:** 4\
**Last updated:** [September 22, 2023, 9:49am UTC](https://discourse.julialang.org/t/issues-with-plots-and-libtiff-jll/104134 "2023-09-22T09:49:23Z")

</div>

I recently updated the Plots package in my working environment just to find that I couldn’t plot anymore as the installation was suddenly broken. \> using Plots ... WARNING: Method definition airyai(ColorTypes.Color{T, 1…

---

## [Performance issue due to function as an argument](https://discourse.julialang.org/t/performance-issue-due-to-function-as-an-argument/104093)

<div class="topic-metadata">

**Author:** [@Chong\_Wang](https://discourse.julialang.org/u/Chong_Wang)\
**Replies:** 16\
**Last updated:** [September 22, 2023, 9:33am UTC](https://discourse.julialang.org/t/performance-issue-due-to-function-as-an-argument/104093 "2023-09-22T09:33:21Z")

</div>

using LinearAlgebra, InteractiveUtils, BenchmarkTools function process\_matrix(f, matrix, vectors) N, M, L = size(matrix) #coefficients = map(f, vectors) #coefficients = \[ones(Float64, 4, 4) \* norm(v) for v i…

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

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