# General Usage

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

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

**Page:** 67

---

## [\`\`mod1\`\` based Periodic Indexing on GPUs](https://discourse.julialang.org/t/mod1-based-periodic-indexing-on-gpus/128657)

<div class="topic-metadata">

**Author:** [@bpsomu](https://discourse.julialang.org/u/bpsomu)\
**Replies:** 1\
**Last updated:** [May 3, 2025, 5:27pm UTC](https://discourse.julialang.org/t/mod1-based-periodic-indexing-on-gpus/128657 "2025-05-03T17:27:42Z")

</div>

I am using the following approach to apply boundary conditions using mod1 for my Simulation code, that I want to be performant on GPUs: struct DirichletArray{arr\<:AbstractArray, T} data::arr core\_boundary\_value:…

---

## [Collecting into either \`StaticArray\` or \`Array\`](https://discourse.julialang.org/t/collecting-into-either-staticarray-or-array/128669)

<div class="topic-metadata">

**Author:** [@circonflexe](https://discourse.julialang.org/u/circonflexe)\
**Replies:** 0\
**Last updated:** [May 3, 2025, 4:50pm UTC](https://discourse.julialang.org/t/collecting-into-either-staticarray-or-array/128669 "2025-05-03T16:50:43Z")

</div>

I might have missed something in StaticArrays.jl. Is there an agreed type which can contain the length/multidimensional size of an iterator, either statically or dynamically, and which can be used to collect into either …

---

## [A weird operation to optimize](https://discourse.julialang.org/t/a-weird-operation-to-optimize/128658)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 13\
**Last updated:** [May 3, 2025, 4:04pm UTC](https://discourse.julialang.org/t/a-weird-operation-to-optimize/128658 "2025-05-03T16:04:07Z")

</div>

Hey, The current culprit of my application is the following operation : function weird\_cumsum!(out,in,I,J) # This is equivalent to : # out .= cumsum(in\[I\])\[J\] # but hopefully a bit faster... # We…

---

## [SArray, but heterogeneous?](https://discourse.julialang.org/t/sarray-but-heterogeneous/84674)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 6\
**Last updated:** [May 3, 2025, 3:21pm UTC](https://discourse.julialang.org/t/sarray-but-heterogeneous/84674 "2025-05-03T15:21:12Z")

</div>

Is it possible to have a Julia type for heterogeneous arrays with compile-time-known sizes? In particular I’m thinking of a heterogeneous matrix, so it would be parameterized by number of rows, number of columns and with…

---

## [Using Julia on Android?](https://discourse.julialang.org/t/using-julia-on-android/8086)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 48\
**Last updated:** [May 3, 2025, 12:55pm UTC](https://discourse.julialang.org/t/using-julia-on-android/8086 "2025-05-03T12:55:08Z")

</div>

Found this post about using R on Android. Looks like it will work for Julia as well. Now just need a better keyboard for Julia. Any recommendations?

---

## [Contiguous Read Non-Contiguous Write vs Non-Contiguous Read Contigous Write Performance](https://discourse.julialang.org/t/contiguous-read-non-contiguous-write-vs-non-contiguous-read-contigous-write-performance/128604)

<div class="topic-metadata">

**Author:** [@mj2984](https://discourse.julialang.org/u/mj2984)\
**Replies:** 3\
**Last updated:** [May 3, 2025, 12:50am UTC](https://discourse.julialang.org/t/contiguous-read-non-contiguous-write-vs-non-contiguous-read-contigous-write-performance/128604 "2025-05-03T00:50:39Z")

</div>

function permutedims\_custom(Y,X) for idx in range(1,size(Y,2)) @simd for idy in range(1,size(Y,1)) @inbounds Y\[idy,idx\] = X\[idx,idy\] end end end function permutedims\_custom\_2(Y,X) …

---

## [Idiomatic way to create non-sticky tasks?](https://discourse.julialang.org/t/idiomatic-way-to-create-non-sticky-tasks/128250)

<div class="topic-metadata">

**Author:** [@mj2984](https://discourse.julialang.org/u/mj2984)\
**Replies:** 17\
**Last updated:** [May 3, 2025, 12:33am UTC](https://discourse.julialang.org/t/idiomatic-way-to-create-non-sticky-tasks/128250 "2025-05-03T00:33:08Z")

</div>

Hi. I have an application to create an Array of tasks and then launch them asynchronously (preferably in parallel). The time of launching is not necessarily the time of creation hence @spawn is not ideal. Is there a mac…

---

## [Compatibility issue with MultilayerGraphs.jl and CUDA.jl](https://discourse.julialang.org/t/compatibility-issue-with-multilayergraphs-jl-and-cuda-jl/128549)

<div class="topic-metadata">

**Author:** [@angushushu](https://discourse.julialang.org/u/angushushu)\
**Replies:** 2\
**Last updated:** [May 2, 2025, 8:58pm UTC](https://discourse.julialang.org/t/compatibility-issue-with-multilayergraphs-jl-and-cuda-jl/128549 "2025-05-02T20:58:16Z")

</div>

Hi, I’m trying to run the MultilayerGraphs.jl package on my Windows PC. However, dependency compatibility cannot be resolved. I got the following error. I’m not exactly sure why GPUCompiler requires this high version of …

---

## [Is there a Julia package allowing to access json objects like jqlang?](https://discourse.julialang.org/t/is-there-a-julia-package-allowing-to-access-json-objects-like-jqlang/106839)

<div class="topic-metadata">

**Author:** [@HugoTrentesaux](https://discourse.julialang.org/u/HugoTrentesaux)\
**Replies:** 6\
**Last updated:** [May 2, 2025, 8:47pm UTC](https://discourse.julialang.org/t/is-there-a-julia-package-allowing-to-access-json-objects-like-jqlang/106839 "2025-05-02T20:47:39Z")

</div>

In REPL it’s convenient to use jqlang syntax like curl 'https://\<graphql-api\>' -X POST \\ -H 'content-type: application/json' \\ --data """\<graphql-query\>""" | \\ jq '.data.blocks\[0\].number is there a way to do someth…

---

## [Why mem allocation may surge when function reads single scalar global variable?](https://discourse.julialang.org/t/why-mem-allocation-may-surge-when-function-reads-single-scalar-global-variable/128394)

<div class="topic-metadata">

**Author:** [@brownlight](https://discourse.julialang.org/u/brownlight)\
**Replies:** 4\
**Last updated:** [May 2, 2025, 7:39pm UTC](https://discourse.julialang.org/t/why-mem-allocation-may-surge-when-function-reads-single-scalar-global-variable/128394 "2025-05-02T19:39:36Z")

</div>

Two functions: pi\_1( ) sums N terms in for loop; N is defined in global scope. pi\_2(nterms) same as pi\_1( ) except that N is passed as a parameter. Output (copied from notebook cells): N = 10\_000\_000 # First run @ti…

---

## [Avoid copy when using data for Ptr{T}](https://discourse.julialang.org/t/avoid-copy-when-using-data-for-ptr-t/128602)

<div class="topic-metadata">

**Author:** [@aitzkora](https://discourse.julialang.org/u/aitzkora)\
**Replies:** 4\
**Last updated:** [May 2, 2025, 7:26pm UTC](https://discourse.julialang.org/t/avoid-copy-when-using-data-for-ptr-t/128602 "2025-05-02T19:26:25Z")

</div>

Hi, I call a fortran code which calls Julia trough a @cfunction using pointers (Ptr{T}), and I want to avoid copying data from Fortran in Julia such as in the following code using Libdl:dlopen, dlsym using Test funct…

---

## [Generic API for instantiating lazy values](https://discourse.julialang.org/t/generic-api-for-instantiating-lazy-values/128562)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 11\
**Last updated:** [May 2, 2025, 3:04pm UTC](https://discourse.julialang.org/t/generic-api-for-instantiating-lazy-values/128562 "2025-05-02T15:04:28Z")

</div>

Is there a generic API (ie a function) for requesting a deferred computation of some value? Eg if x is a Base.Generator, I want the array, etc. collect does too much, eg collect(SVector(1, 2, 3)) gives a Vector. Packa…

---

## [Tensors.jl and upper convective derivative - Oldroyd - b constitutive model](https://discourse.julialang.org/t/tensors-jl-and-upper-convective-derivative-oldroyd-b-constitutive-model/128341)

<div class="topic-metadata">

**Author:** [@ziolai](https://discourse.julialang.org/u/ziolai)\
**Replies:** 2\
**Last updated:** [May 2, 2025, 2:37pm UTC](https://discourse.julialang.org/t/tensors-jl-and-upper-convective-derivative-oldroyd-b-constitutive-model/128341 "2025-05-02T14:37:58Z")

</div>

Any experience here using Tensors.jl to implement the uppper-convective derivative? Thx.

---

## [How to set all elements in a lower triangular matrix?](https://discourse.julialang.org/t/how-to-set-all-elements-in-a-lower-triangular-matrix/128603)

<div class="topic-metadata">

**Author:** [@Abhro](https://discourse.julialang.org/u/Abhro)\
**Replies:** 6\
**Last updated:** [May 2, 2025, 2:05pm UTC](https://discourse.julialang.org/t/how-to-set-all-elements-in-a-lower-triangular-matrix/128603 "2025-05-02T14:05:46Z")

</div>

I have a lower triangular matrix which gets reused. In one of the steps, I have all of the elements (below the diagonal) set to the same value. How do I make Julia understand that I’m not trying to set values above the d…

---

## [Correct usage of type-dependent constructors](https://discourse.julialang.org/t/correct-usage-of-type-dependent-constructors/128605)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 7\
**Last updated:** [May 2, 2025, 11:33am UTC](https://discourse.julialang.org/t/correct-usage-of-type-dependent-constructors/128605 "2025-05-02T11:33:29Z")

</div>

Hello, I need to create a constructor with a parametric type to be able to dispatch. One possible way is the following abstract type MyType end # Singletons occupying 0 bytes struct Type1 \<: MyType end struct Type2 \<:…

---

## [JLHub documentation vs official, why are they different and which is source of truth?](https://discourse.julialang.org/t/jlhub-documentation-vs-official-why-are-they-different-and-which-is-source-of-truth/128606)

<div class="topic-metadata">

**Author:** [@marteaua](https://discourse.julialang.org/u/marteaua)\
**Replies:** 3\
**Last updated:** [May 2, 2025, 3:51am UTC](https://discourse.julialang.org/t/jlhub-documentation-vs-official-why-are-they-different-and-which-is-source-of-truth/128606 "2025-05-02T03:51:42Z")

</div>

I noticed that the documentation of inv is richer on Juliahub JLHub doc than the official one. In particular, it specifies that matrix inversion does throw on singular matrices, while the official doesn’t. In practice: …

---

## [Strange error in computing trace on product of symbolic matrices in Symbolics.jl](https://discourse.julialang.org/t/strange-error-in-computing-trace-on-product-of-symbolic-matrices-in-symbolics-jl/128598)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [May 2, 2025, 3:36am UTC](https://discourse.julialang.org/t/strange-error-in-computing-trace-on-product-of-symbolic-matrices-in-symbolics-jl/128598 "2025-05-02T03:36:32Z")

</div>

Dear All, I am a new user of Symbolics.jl and using it to compute trace of product of two symbolic matrices. It seems that if I do not perform a simplify. on the product of the matrices, I get a strange error when compu…

---

## [Error if lambdify target function is zero](https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587)

<div class="topic-metadata">

**Author:** [@inkie](https://discourse.julialang.org/u/inkie)\
**Replies:** 2\
**Last updated:** [May 1, 2025, 9:34pm UTC](https://discourse.julialang.org/t/error-if-lambdify-target-function-is-zero/128587 "2025-05-01T21:34:56Z")

</div>

Hi guys, im implementing the fourier functions in julia + sympy but when i have an odd function my bn is not working as expected since bn(1) for example is not working giving this error: MethodError: no method matching (…

---

## [How to create standalone applications for Windows with a \[G\]UI in Julia 1.11 or 1.12](https://discourse.julialang.org/t/how-to-create-standalone-applications-for-windows-with-a-g-ui-in-julia-1-11-or-1-12/127823)

<div class="topic-metadata">

**Author:** [@uwestoehr](https://discourse.julialang.org/u/uwestoehr)\
**Replies:** 46\
**Last updated:** [May 1, 2025, 8:31pm UTC](https://discourse.julialang.org/t/how-to-create-standalone-applications-for-windows-with-a-g-ui-in-julia-1-11-or-1-12/127823 "2025-05-01T20:31:13Z")

</div>

As a new user allow me a general question on the state of the art of Julia and how to use it for commercial but OpenSource real-life applications. We design and produce sensors of different types (humidity, temperature …

---

## [Package to do graph combinatorics](https://discourse.julialang.org/t/package-to-do-graph-combinatorics/128569)

<div class="topic-metadata">

**Author:** [@drandran12](https://discourse.julialang.org/u/drandran12)\
**Replies:** 0\
**Last updated:** [April 30, 2025, 12:27pm UTC](https://discourse.julialang.org/t/package-to-do-graph-combinatorics/128569 "2025-04-30T12:27:10Z")

</div>

Hey everyone, I am looking for a package that can do graph combinatorics. For example, suppose I have m distinguishable lines and n distinguishable edges, compute all the possible ways to make the graph. Anyone who kno…

---

## [Where on abstract type and parameters](https://discourse.julialang.org/t/where-on-abstract-type-and-parameters/128584)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 9\
**Last updated:** [May 1, 2025, 7:19pm UTC](https://discourse.julialang.org/t/where-on-abstract-type-and-parameters/128584 "2025-05-01T19:19:23Z")

</div>

Is there a way to use a type signature that imposes that two arguments are the same subtype of an abstract type and also have the same parameter for some but not necessarily all parameters? For example, the hypothetical…

---

## [Distance Correlation in Julia](https://discourse.julialang.org/t/distance-correlation-in-julia/45905)

<div class="topic-metadata">

**Author:** [@Kokora](https://discourse.julialang.org/u/Kokora)\
**Replies:** 8\
**Last updated:** [May 1, 2025, 3:54pm UTC](https://discourse.julialang.org/t/distance-correlation-in-julia/45905 "2025-05-01T15:54:56Z")

</div>

Hi all, Is there any package in Julia to compute distance correlation just like the package energy in r? Thank you,

---

## [Interoperability between Symbolics.jl and MathLink.jl](https://discourse.julialang.org/t/interoperability-between-symbolics-jl-and-mathlink-jl/128596)

<div class="topic-metadata">

**Author:** [@Shuvomoy\_Das\_Gupta](https://discourse.julialang.org/u/Shuvomoy_Das_Gupta)\
**Replies:** 2\
**Last updated:** [May 1, 2025, 3:30pm UTC](https://discourse.julialang.org/t/interoperability-between-symbolics-jl-and-mathlink-jl/128596 "2025-05-01T15:30:23Z")

</div>

Dear All, Is interoperability possible between Symbolics.jl and MathLink.jl? I would like to create a symbolic object in Julia, do part of the calculation using Symbolics.jl and then pass some intermediate symbolic obje…

---

## [Time Series Analysis in Julia resources?](https://discourse.julialang.org/t/time-series-analysis-in-julia-resources/128597)

<div class="topic-metadata">

**Author:** [@Snowy](https://discourse.julialang.org/u/Snowy)\
**Replies:** 1\
**Last updated:** [May 1, 2025, 3:04pm UTC](https://discourse.julialang.org/t/time-series-analysis-in-julia-resources/128597 "2025-05-01T15:04:59Z")

</div>

Hi all! I’m starting a new job in a few weeks doing forecasting / time series analysis. I’d like to use Julia in my new role. I know R for time series is probably the better choice, but Julia is the language that I’m mo…

---

## [Serializing a Module](https://discourse.julialang.org/t/serializing-a-module/84458)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 4\
**Last updated:** [May 1, 2025, 1:40pm UTC](https://discourse.julialang.org/t/serializing-a-module/84458 "2025-05-01T13:40:07Z")

</div>

Hi, is it possible to deserialize a Module in a new process to get that module (without defining it in the second process first)? I get the following error message when I use the Serialization library as follows Proces…

---

## [Files quota exceeded when trying to install Julia on a cluster with juliaup](https://discourse.julialang.org/t/files-quota-exceeded-when-trying-to-install-julia-on-a-cluster-with-juliaup/128469)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 2\
**Last updated:** [May 1, 2025, 5:14am UTC](https://discourse.julialang.org/t/files-quota-exceeded-when-trying-to-install-julia-on-a-cluster-with-juliaup/128469 "2025-05-01T05:14:04Z")

</div>

I’m trying to install Julia on a cluster, running this: curl -fsSL https://install.julialang.org | sh -s -- --path $JULIAUP\_DEPOT\_PATH But I get the following error: Now installing Juliaup Error: Failed to extract dow…

---

## [Why isn't SymTridiagonal simply Symmetric(Tridiagonal)](https://discourse.julialang.org/t/why-isnt-symtridiagonal-simply-symmetric-tridiagonal/23698)

<div class="topic-metadata">

**Author:** [@matthieu](https://discourse.julialang.org/u/matthieu)\
**Replies:** 5\
**Last updated:** [May 1, 2025, 1:47am UTC](https://discourse.julialang.org/t/why-isnt-symtridiagonal-simply-symmetric-tridiagonal/23698 "2025-05-01T01:47:24Z")

</div>

Julia defines not only a Tridiagonal type but also a SymTridiagonal type. Why is this type needed compared to Symmetric(Tridiagonal), that could still allow function specialization?

---

## [Performance optimization：Frequently use permutedims function](https://discourse.julialang.org/t/performance-optimization-frequently-use-permutedims-function/128474)

<div class="topic-metadata">

**Author:** [@quantumdreamer](https://discourse.julialang.org/u/quantumdreamer)\
**Replies:** 22\
**Last updated:** [May 1, 2025, 1:33am UTC](https://discourse.julialang.org/t/performance-optimization-frequently-use-permutedims-function/128474 "2025-05-01T01:33:13Z")

</div>

Here is my example： G = rand(8,256,14,288,6)+rand(8,256,14,288,6)\*1im; @elapsed begin G = permutedims(G,\[1,2,4,3,5\]); k = sqrt.(sum(abs2.(reshape(G,589824,1,1,14,6)),dims = 1)); G .\*= k; G = permutedims(…

---

## [Warning says method definition is overwritten, but the overwritten function still works](https://discourse.julialang.org/t/warning-says-method-definition-is-overwritten-but-the-overwritten-function-still-works/128547)

<div class="topic-metadata">

**Author:** [@hawahe](https://discourse.julialang.org/u/hawahe)\
**Replies:** 8\
**Last updated:** [April 30, 2025, 7:54pm UTC](https://discourse.julialang.org/t/warning-says-method-definition-is-overwritten-but-the-overwritten-function-still-works/128547 "2025-04-30T19:54:23Z")

</div>

I have a function foo which works without warning: function foo(start::Union{T, Vector{T}}) where T \<: Real f(i, x::T) = x f(i, x::Vector{T}) = x\[i\] output = rand(T, 10) for i in eachindex(output) …

---

## [How to import a file in PythonCall](https://discourse.julialang.org/t/how-to-import-a-file-in-pythoncall/128565)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 3\
**Last updated:** [April 30, 2025, 2:22pm UTC](https://discourse.julialang.org/t/how-to-import-a-file-in-pythoncall/128565 "2025-04-30T14:22:41Z")

</div>

I have some python code I’d like to call in Julia. The code is in a file in the same folder as pwd() but no matter what method I use I always get the error ERROR: Python: ModuleNotFoundError: No module named 'x' The fir…

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

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