Comparing Unequal Dictionaries
So after reading about everything I can find on the subject, I am going to throw in the towel and ask. I have 2 dictionaries “a” and “b” a = 4-element Array{Pair{Union{Missing, Int16},Int64},1}: 133...
View ArticleParametric constructor, promotion and splatting (...)
Hi there, I am reading the page ParametricConstructors of the manual, where a struct Point is defined as: struct Point{T<:Real} x::T y::T Point{T}(x,y) where {T<:Real} = new(x,y) end and then...
View Article'Introduction to Euclidean vector spaces with Julia' a video tutorial using...
A pleasant back to basics video tutorial entitled Introduction to Euclidean vector spaces with Julia using a Pluto notebook by Juan Klopper. A few sections are also a good reminder on how to write...
View ArticleTrouble installing/setting up Julia 1.5.3
I am a new user and am having trouble setting up Julia 1.5.3., despite following the instructions here: http://docs.junolab.org/stable/man/installation/. (I am using Windows 10 and I downloaded 64-bit...
View ArticleMethodError for function calling with an argument a parametric composite type...
Hi there I have the following code, which, if necessary I might strip down. using Parameters using Unitful @with_kw struct EosConst{T<:Real} w_0::T = -1.0 end @with_kw struct EosCPL{T<:Real}...
View ArticleLogging inside Docker container vscode
When using Julia inside the official docker container (WSL2 backend), logging does not work inside the vscode debugger. It does work when using the integrated terminal directly. Test code: @info...
View ArticleFunction with a single method acting on Union{T1, T2} or another function...
I have the following code: struct Square{T<:Real} width::T = 1 end struct Rectangle{T<:Real} width::T = 1 height::T = 2 end Quadrilateral = Union{Square, Rectangle} function...
View ArticleIs sum function broken?
Recently installed version 1.5.3 and I get this error when trying sum function: Also tried with dot (’.’) and with dims as second argument, but nothing worked. prod(A) would work for example Does...
View ArticleFlux with early stop and epochs
I’ve found that Flux provides early stop by using callbacks. Despite of the instruction, it is not compatible with @epochs in my case. For example, codes looks like the following keep run the epochs...
View ArticleRGB values of a pixel
RGB(a, b, c) gives us a pixel. How do I input a pixel and extract the RGB components? 2 posts - 2 participants Read full topic
View ArticleGeneral registry for newbies
I know this is utter newbie but can someone explain to me why Pkg.activate(mktempdir()) results in my general registry being cancelled and having to wait 10 mins for all the packages to be downloaded...
View ArticleEfficiently looping over structs in Julia
Hello, I have a dire question with regards to memory allocation of structs. I have posted it in Stackoverflow; please answer it in Stackoverflow: https://stackoverflow.com/q/65403410/14869451 Many...
View ArticleHow to use redirect_stdout in IJulia (Jupyter notebook)
The following redirect_stdout code works as expected in REPL original_stdout = stdout (rd, wr) = redirect_stdout() println("123") println("456") redirect_stdout(original_stdout) close(wr) read(rd,...
View ArticleUniftulRecipes and LaTeXStrings
Hi Is there a way to use simultaneously UnitfulRecipes and LaTeXStrings? Somewhat like (adapted from UniftulRecipes’ first example: using Unitful, UnitfulRecipes, Plots, LaTeXStrings const a =...
View ArticlePlotting using ImplicitEquations
[Updated Code] Hi everyone, I was trying to use ImplicitEquations.jl to graph some inequalities but I’m not using it properly I guess. Here is a minimal example that I am trying to plot Code using...
View ArticleSimple numerical differentiation
Hello there, I am wondering how to implement numerical differentiation in Julia simply. My MWE looks like, using ForwardDiff p = [1, 2, 3] f(x::Vector) = p[1] .+ p[2] .* x .+ p[3] .* x .^ 2 x=1:10 g =...
View ArticlePush! function changes original array
function foo(name, package) println( package, "#1 foo pack") newpackage=copy(package) println( newpackage, "#1 foo newpack") push!(newpackage[1].second, name) println( package, "#2 foo pack") println(...
View ArticleMultiple dispatch Union
I have a question and am not even sure how to phrase it correctly. In the end I am wondering if my (toy) implementation can be improved / made more idiomatic to julia. So this is a pure learning...
View ArticleSpeed up heatmap for large (2500x2500) matrices?
Hi, Trying to plot a heatmap of a distance matrix that is 2500x2500 give or take. This takes almost a minute to complete using Plots.jl and GR as the backend, and it breaks pluto/plotlyjs when i try...
View ArticleReinterpret Tuple as Struct, and vector thereof
So I am playing a bit with the Clipper.jl library, which uses a type IntPoint defined as a struct of two Int64 fields. However, it would be more convenient for me to use static vectors of fixed-point...
View Article