# General Usage

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

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

**Page:** 157

---

## [Parametric type (new struct) whose parameter is a constant of a specific type?](https://discourse.julialang.org/t/parametric-type-new-struct-whose-parameter-is-a-constant-of-a-specific-type/116049)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 4\
**Last updated:** [June 22, 2024, 9:06pm UTC](https://discourse.julialang.org/t/parametric-type-new-struct-whose-parameter-is-a-constant-of-a-specific-type/116049 "2024-06-22T21:06:15Z")

</div>

I wish to create an efficient type for integers modulo m. Yes, I do realize there are several existing ones out there, but I wish to have my own, and perhaps squeeze a bit more performance out of it. I’ve already achiev…

---

## [Correctly dispatching on a variable number of 2-tuples with mixed types](https://discourse.julialang.org/t/correctly-dispatching-on-a-variable-number-of-2-tuples-with-mixed-types/115974)

<div class="topic-metadata">

**Author:** [@alonsoC1s](https://discourse.julialang.org/u/alonsoC1s)\
**Replies:** 4\
**Last updated:** [June 22, 2024, 11:52am UTC](https://discourse.julialang.org/t/correctly-dispatching-on-a-variable-number-of-2-tuples-with-mixed-types/115974 "2024-06-22T11:52:40Z")

</div>

I am currently trying to come up with a function signature that would let me take an arbitrary number of 2-tuples where the types of the elements are not necessarily the same. I know that with the signature function f(d…

---

## [How to solve the problem of Plots.jl precompilation failure?](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964)

<div class="topic-metadata">

**Author:** [@dk-zen](https://discourse.julialang.org/u/dk-zen)\
**Replies:** 7\
**Last updated:** [June 22, 2024, 10:59am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964 "2024-06-22T10:59:13Z")

</div>

Previously, the Plots package worked fine. Don’t know what happened, running code today reported an error. How to solve this problem? Reinstall julia? \[ Info: Precompiling Plots \[91a5bcdd-55d7-5caf-9e0b-520d859cae80\] De…

---

## [Mapping to mixtures of Int64 & Float64](https://discourse.julialang.org/t/mapping-to-mixtures-of-int64-float64/115961)

<div class="topic-metadata">

**Author:** [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)\
**Replies:** 9\
**Last updated:** [June 22, 2024, 7:20am UTC](https://discourse.julialang.org/t/mapping-to-mixtures-of-int64-float64/115961 "2024-06-22T07:20:40Z")

</div>

I have a function that can produce either Int64 or Float64 and I would like to map it to an array to be summed: f(s) = parse(rand(\[Float64, Int64\]), s) a = rand(string.('0':'9'), rand(\[0,1,5\])) map(f, a) |\> sum If a is…

---

## [Converting Vector to Tuple seems not optimal](https://discourse.julialang.org/t/converting-vector-to-tuple-seems-not-optimal/115989)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 11\
**Last updated:** [June 22, 2024, 7:01am UTC](https://discourse.julialang.org/t/converting-vector-to-tuple-seems-not-optimal/115989 "2024-06-22T07:01:31Z")

</div>

Hi there, I am working on improving the memory allocation performance of my code and in learning about how to do so I came across the fact that tuples are much cheaper to store that vectors. For this reason I was trying…

---

## [PyCall @pyimport from scipy.stats import norm](https://discourse.julialang.org/t/pycall-pyimport-from-scipy-stats-import-norm/116009)

<div class="topic-metadata">

**Author:** [@VinodV](https://discourse.julialang.org/u/VinodV)\
**Replies:** 7\
**Last updated:** [June 22, 2024, 5:32am UTC](https://discourse.julialang.org/t/pycall-pyimport-from-scipy-stats-import-norm/116009 "2024-06-22T05:32:22Z")

</div>

using PyCall @pyimport from scipy.stats import norm Giving error: ERROR: LoadError: ArgumentError: usage @pyimport module \[as name\] Stacktrace: \[1\] pyimport\_name(name::Symbol, optional\_varname::Tuple{Expr, Expr}) …

---

## [Julia editor that flags anomalous code?](https://discourse.julialang.org/t/julia-editor-that-flags-anomalous-code/116001)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 0\
**Last updated:** [June 22, 2024, 1:04am UTC](https://discourse.julialang.org/t/julia-editor-that-flags-anomalous-code/116001 "2024-06-22T01:04:39Z")

</div>

Consider the following code, which contains two anomalies: function t1(n) x = n x = 5 for i = 1 : x for i = 1 : x println("i = ", i) end end end The anomalies are: the first …

---

## [What's the state of Automatic Differentiation in Julia January 2023?](https://discourse.julialang.org/t/whats-the-state-of-automatic-differentiation-in-julia-january-2023/92473)

<div class="topic-metadata">

**Author:** [@Phil\_Tomson](https://discourse.julialang.org/u/Phil_Tomson)\
**Replies:** 41\
**Last updated:** [June 21, 2024, 11:15pm UTC](https://discourse.julialang.org/t/whats-the-state-of-automatic-differentiation-in-julia-january-2023/92473 "2024-06-21T23:15:18Z")

</div>

I’ve been away from Julia for a bit and was wondering what the AD landscape looks like now. In the past Zygote was the way things were going. Then there was something about Enzyme being the new way. Where do things stand…

---

## [Can someone provide a simple example of using CxxWrap?](https://discourse.julialang.org/t/can-someone-provide-a-simple-example-of-using-cxxwrap/115908)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 7\
**Last updated:** [June 21, 2024, 2:44pm UTC](https://discourse.julialang.org/t/can-someone-provide-a-simple-example-of-using-cxxwrap/115908 "2024-06-21T14:44:27Z")

</div>

Hello, I am trying to look at CxxWrap as the super-easy Cxx.jl package seems lost :-((((( However, as my usage of CMAKE is very limited, I am unable to follow even the example in the home page (and there is no separate …

---

## [Print debug info for failed test](https://discourse.julialang.org/t/print-debug-info-for-failed-test/22311)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 5\
**Last updated:** [June 21, 2024, 10:39am UTC](https://discourse.julialang.org/t/print-debug-info-for-failed-test/22311 "2024-06-21T10:39:27Z")

</div>

I am testing some complex functionality with randomly generated values. In case the test fails, I would like to print those values so that I can isolate and debug the problem — but essentially, I am looking for way to ex…

---

## [Seamless integration of Bumper.jl](https://discourse.julialang.org/t/seamless-integration-of-bumper-jl/115916)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 13\
**Last updated:** [June 21, 2024, 12:01pm UTC](https://discourse.julialang.org/t/seamless-integration-of-bumper-jl/115916 "2024-06-21T12:01:05Z")

</div>

Hi All, I have a rather naive question. I have a function computing heuristic value of a state in planning using graph neural network. This function takes state, converts it to a graph uses network and return a single s…

---

## [Vector databases](https://discourse.julialang.org/t/vector-databases/114396)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 5\
**Last updated:** [June 20, 2024, 1:48pm UTC](https://discourse.julialang.org/t/vector-databases/114396 "2024-06-20T13:48:04Z")

</div>

Are there any vector database implementations in Julia? Looking for a data structure that stores a collection of vectors of real numbers and maps a query vector to an ordered list of the n closest vectors to the query (…

---

## [BigFloat type](https://discourse.julialang.org/t/bigfloat-type/114782)

<div class="topic-metadata">

**Author:** [@Denis\_Dardenne](https://discourse.julialang.org/u/Denis_Dardenne)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 1:09pm UTC](https://discourse.julialang.org/t/bigfloat-type/114782 "2024-06-20T13:09:11Z")

</div>

Hello, I have a variable of this type: and I would like tto ransform the format Float64 to BigFloat. How do that ? The following command doesn’t work : BigFloat.(MyVar) convert(BigFloat,MyVar) May be defining t…

---

## [Shared x axis for all subplots](https://discourse.julialang.org/t/shared-x-axis-for-all-subplots/115892)

<div class="topic-metadata">

**Author:** [@Santiago\_Lopez](https://discourse.julialang.org/u/Santiago_Lopez)\
**Replies:** 4\
**Last updated:** [June 20, 2024, 8:10pm UTC](https://discourse.julialang.org/t/shared-x-axis-for-all-subplots/115892 "2024-06-20T20:10:42Z")

</div>

Consider this plot from the EEG.jl package: All signals share the x-axis, and the y-axis is also shared with the name of each signal. How can this be achieved? Using plots(x, my\_list\_of\_signals, layout=(rows, 1)) does…

---

## [Julia documentation site down?](https://discourse.julialang.org/t/julia-documentation-site-down/115945)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 7:10pm UTC](https://discourse.julialang.org/t/julia-documentation-site-down/115945 "2024-06-20T19:10:38Z")

</div>

I seem to be unable to browse to the Julia documentation site at https://docs.julialang.org/. Is it known to be down now?

---

## [LoadError: Failed to precompile Distributions](https://discourse.julialang.org/t/loaderror-failed-to-precompile-distributions/115917)

<div class="topic-metadata">

**Author:** [@markushhh](https://discourse.julialang.org/u/markushhh)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 6:02pm UTC](https://discourse.julialang.org/t/loaderror-failed-to-precompile-distributions/115917 "2024-06-20T18:02:19Z")

</div>

Can someone point me into the right direction how to solve the error? ERROR: LoadError: Failed to precompile Distributions \[31c24e10-a181-5473-b8eb-7969acd0382f\] to "/var/home/user/.julia/compiled/v1.10/Distributions/jl…

---

## [Issue using Images.jl to open a .tif image - OpenCV required](https://discourse.julialang.org/t/issue-using-images-jl-to-open-a-tif-image-opencv-required/115940)

<div class="topic-metadata">

**Author:** [@mward19](https://discourse.julialang.org/u/mward19)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 5:36pm UTC](https://discourse.julialang.org/t/issue-using-images-jl-to-open-a-tif-image-opencv-required/115940 "2024-06-20T17:36:40Z")

</div>

I am trying to use TestImages.jl to load a .tif image, and running into an issue. The same issue occurs when I download the test image and try to open it with Images.jl and FileIO.jl. Images.jl and TestImages.jl claim th…

---

## [How to make sure a task interrupts when it takes too long](https://discourse.julialang.org/t/how-to-make-sure-a-task-interrupts-when-it-takes-too-long/115939)

<div class="topic-metadata">

**Author:** [@arnerob](https://discourse.julialang.org/u/arnerob)\
**Replies:** 1\
**Last updated:** [June 20, 2024, 4:42pm UTC](https://discourse.julialang.org/t/how-to-make-sure-a-task-interrupts-when-it-takes-too-long/115939 "2024-06-20T16:42:41Z")

</div>

So I’m trying to do some experiments on how long some algorithms take. Whenever an experiment takes longer than some set time-out I want to stop it and go to another one. The algorithms I’m trying to time are pretty in…

---

## [Optimizing \`powermod\`](https://discourse.julialang.org/t/optimizing-powermod/115936)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 12\
**Last updated:** [June 20, 2024, 3:50pm UTC](https://discourse.julialang.org/t/optimizing-powermod/115936 "2024-06-20T15:50:23Z")

</div>

Here’s how you can implement powermod from scratch in Julia and achieve better performance than the built-in version. (Maybe I need to add more safety checks?) function my\_powermod(a::Int64, b::Int64, c::Int64) @ass…

---

## [3d BarPlot with Makie.jl](https://discourse.julialang.org/t/3d-barplot-with-makie-jl/115861)

<div class="topic-metadata">

**Author:** [@PhilippA](https://discourse.julialang.org/u/PhilippA)\
**Replies:** 4\
**Last updated:** [June 20, 2024, 3:34pm UTC](https://discourse.julialang.org/t/3d-barplot-with-makie-jl/115861 "2024-06-20T15:34:11Z")

</div>

I would like to visualise a simple pdf of a bivariate discrete distribution. Is it possible to do a simple 3D bar plot in Makie.jl, similar to this solution: https://www.wolfram.com/mathematica/new-in-8/new-and-improved…

---

## [Frequency-wavenumber spectrum?](https://discourse.julialang.org/t/frequency-wavenumber-spectrum/115821)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 7\
**Last updated:** [June 20, 2024, 1:55pm UTC](https://discourse.julialang.org/t/frequency-wavenumber-spectrum/115821 "2024-06-20T13:55:06Z")

</div>

Hi everyone. I have some 2D data in time and space. I am trying to do some Frequency-wavenumber analysis. Anyone has a code to compute the proper Frequency-wavenumber spectrum? Let me know. Kind regards. M.

---

## [Python big integer vs. Julia big integer arithmetic](https://discourse.julialang.org/t/python-big-integer-vs-julia-big-integer-arithmetic/115777)

<div class="topic-metadata">

**Author:** [@oOosys](https://discourse.julialang.org/u/oOosys)\
**Replies:** 89\
**Last updated:** [June 20, 2024, 1:12pm UTC](https://discourse.julialang.org/t/python-big-integer-vs-julia-big-integer-arithmetic/115777 "2024-06-20T13:12:39Z")

</div>

Here what I am wondering about: ~ $ time python -c "print( 3^100000000000 % 102 )" 91 real 0m0.030s user 0m0.026s sys 0m0.004s ~ $ time julia -e "println( big(3)^100000000000 % 102 )" ERROR: OutOfMemoryError() Stacktra…

---

## [struct/Matrix/Vector/Assign values (structural model)](https://discourse.julialang.org/t/struct-matrix-vector-assign-values-structural-model/115910)

<div class="topic-metadata">

**Author:** [@Sihyun\_Kim](https://discourse.julialang.org/u/Sihyun_Kim)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 11:50am UTC](https://discourse.julialang.org/t/struct-matrix-vector-assign-values-structural-model/115910 "2024-06-20T11:50:49Z")

</div>

I am constructing some structural (economic) model. This requires me to write something (a simple version for illustration) like using Parameters @with\_kw struct test\_model @deftype Float64 β = 0.98 end struct test{…

---

## [Using \`similar\` with ArrayPartitions](https://discourse.julialang.org/t/using-similar-with-arraypartitions/115802)

<div class="topic-metadata">

**Author:** [@dbox](https://discourse.julialang.org/u/dbox)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 11:11am UTC](https://discourse.julialang.org/t/using-similar-with-arraypartitions/115802 "2024-06-20T11:11:18Z")

</div>

Hi, I’m trying to solve an ODE with variables of different types using an ArrayPartition. I have tried several solvers but they all get stuck on performing similar(ArrayPartition, Type). The code executed in the ODE so…

---

## [Precompilation interrupted (bug?)](https://discourse.julialang.org/t/precompilation-interrupted-bug/115853)

<div class="topic-metadata">

**Author:** [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Replies:** 2\
**Last updated:** [June 20, 2024, 11:03am UTC](https://discourse.julialang.org/t/precompilation-interrupted-bug/115853 "2024-06-20T11:03:13Z")

</div>

I started to see this consistent interruption of the precompilation stage whenever I install packages in fresh environments. For example, if I start a fresh environment and \] add GeoStats on Julia v1.10.4, I get the foll…

---

## [Which is better for traits? Subtyping vs parametric typing](https://discourse.julialang.org/t/which-is-better-for-traits-subtyping-vs-parametric-typing/115899)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 10:52am UTC](https://discourse.julialang.org/t/which-is-better-for-traits-subtyping-vs-parametric-typing/115899 "2024-06-20T10:52:36Z")

</div>

I want to define traits (I don’t know so much about traits but perhaps traits). I know 2 ways. Abstract type and subtypes: abstract type YAMLVersion end struct YAMLV1\_1 \<: YAMLVersion end struct YAMLV1\_2 \<: YAMLVersi…

---

## [Matrix vs. AbstractMatrix](https://discourse.julialang.org/t/matrix-vs-abstractmatrix/115912)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 10:17am UTC](https://discourse.julialang.org/t/matrix-vs-abstractmatrix/115912 "2024-06-20T10:17:59Z")

</div>

I am pondering to change the definition of the basic object DescriptorStateSpace used in the DescriptorSystems package from struct DescriptorStateSpace{T, ET \<: ETYPE{T}} \<: AbstractDescriptorStateSpace A::Matrix{T…

---

## [Developing interdependent, local, unregistered packages](https://discourse.julialang.org/t/developing-interdependent-local-unregistered-packages/103936)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 18\
**Last updated:** [June 20, 2024, 10:09am UTC](https://discourse.julialang.org/t/developing-interdependent-local-unregistered-packages/103936 "2024-06-20T10:09:19Z")

</div>

I’m trying to develop some local, interdependent, unregistered packages on Julia v1.9. As far as I can tell, it is still really hard to make it work. Am I doing something wrong? Is there a usable workflow on Julia v1.9? …

---

## [PyCall defaults to global python, despite ENV\["PYTHON"\] = ""](https://discourse.julialang.org/t/pycall-defaults-to-global-python-despite-env-python/115909)

<div class="topic-metadata">

**Author:** [@thomaskroi1996](https://discourse.julialang.org/u/thomaskroi1996)\
**Replies:** 0\
**Last updated:** [June 20, 2024, 8:53am UTC](https://discourse.julialang.org/t/pycall-defaults-to-global-python-despite-env-python/115909 "2024-06-20T08:53:27Z")

</div>

Hello everyone! I am currently trying to get some CGAL bindings to work on Julia v1.9. Unfourtunately CGAL.jl does not work for Julia v1.9, so i have to resort to using PyCall and the python bindings! I have used PyCal…

---

## [Error in parsing BaseModelica model](https://discourse.julialang.org/t/error-in-parsing-basemodelica-model/115851)

<div class="topic-metadata">

**Author:** [@thermal\_pro](https://discourse.julialang.org/u/thermal_pro)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 4:36am UTC](https://discourse.julialang.org/t/error-in-parsing-basemodelica-model/115851 "2024-06-20T04:36:49Z")

</div>

I have been trying to parse a model to ModelingToolkit using the parse\_basemodelica function, available in Basemodelica.jl. But encounters the following error: "Error during FSM execution at buffer position 19. Last 19 …

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

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