permutedims Vs transpose
Well, don't use permutedims to transpose a 2-D matrix! The transpose function is by far more efficient in this case. Another thing to be noted is, that the returned objects by these two functions are different in type!
#Tips__JG
❤️ JuliaGeeks
Well, don't use permutedims to transpose a 2-D matrix! The transpose function is by far more efficient in this case. Another thing to be noted is, that the returned objects by these two functions are different in type!
julia> using LinearAlgebra
julia> mat = rand(2, 2);
julia> permutedims(mat) == transpose(mat)
true
julia> typeof.((permutedims(mat), transpose(mat)))
(Matrix{Float64}, LinearAlgebra.Transpose{Float64, Matrix{Float64}})
julia> LinearAlgebra.Transpose{Float64, Matrix{Float64}} <: AbstractMatrix
true
#Tips__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
Julia Geeks
I can not wait for Julia 1.11 ;( This is huuuuge. Personal optimistic eatimate: May https://github.com/JuliaLang/julia/pull/51319#event-10792647303 #News__JG ❤️ JuliaGeeks
GitHub
Release v1.11.0-alpha1 · JuliaLang/julia
This is the first alpha pre-release in the upcoming 1.11 release series. See NEWS.md for what will be new in 1.11.
Please note that the bundled and signed source tarballs, usually available as juli...
Please note that the bundled and signed source tarballs, usually available as juli...
🍾1
The following repository has been officially mentioned as a source of compatible Jupyter/Colan notebooks with Julia. It is worth checking it out.
ageron/julia_notebooks: Julia Jupyter/Colab Notebooks
https://github.com/ageron/julia_notebooks
ageron/julia_notebooks: Julia Jupyter/Colab Notebooks
https://github.com/ageron/julia_notebooks
GitHub
GitHub - ageron/julia_notebooks: Julia Jupyter/Colab Notebooks
Julia Jupyter/Colab Notebooks. Contribute to ageron/julia_notebooks development by creating an account on GitHub.
It is possible to get an interface that is similar to the IPython REPL and the Mathematica notebook with numbered input prompts and output prefixes.
Check this out (Julia v1.9+ required): https://docs.julialang.org/en/v1/stdlib/REPL/#Numbered-prompt
#Tips__JG
❤️ JuliaGeeks ❤️
Check this out (Julia v1.9+ required): https://docs.julialang.org/en/v1/stdlib/REPL/#Numbered-prompt
#Tips__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
💯2 1 1
One of the most important new methods that have been added into Julia through the latest update is
⚠️ Note that it returned
1️⃣ Don't know about the exclamation mark? Check this.
2️⃣ Don't know about Sets in Julia? Check this.
#Tips__JG |#Function__JG
❤️ JuliaGeeks
in!
which pushes a new element to an existing Set, if it isn't already in the Set:julia> S = Set([1,2,3,4]);
julia> S
Set{Int64} with 4 elements:
4
2
3
1
julia> in!(5, S)
false
julia> S
Set{Int64} with 5 elements:
5
4
2
3
1
⚠️ Note that it returned
false
since the 5 didn't exist in the Set.1️⃣ Don't know about the exclamation mark? Check this.
2️⃣ Don't know about Sets in Julia? Check this.
#Tips__JG |#Function__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
Wow, new functions such as
Return
Return true if all values from
#Tips__JG |#Function__JG
❤️ JuliaGeeks
allunique
, and allequal
that came with Julia 1.11, are super handy:allunique(itr)
[doc]Return
true
if all values from itr
are distinct compared with isequal
. Or if all of [f(x) for x itr]
are distinct, for the second method.julia> allunique([1, 2, 3])
true
julia> allunique([1, 2, 1, 2])
false
allequal(itr)
[doc]Return true if all values from
itr
are equal when compared with isequal
. Or if all of [f(x) for in itr]
are equal, for the second method.julia> allequal([1, 1])
true
julia> allequal([1, 2])
#Tips__JG |#Function__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
Julia Geeks
julia-1.9.0.pdf
Please open Telegram to view this post
VIEW IN TELEGRAM
Julia Geeks
julia-1.11.1.pdf
Memory
type
StaticArrays
play an essential role in mathematical operations and the optimization of such operations. However, Julia developers have decided to use a built-in type in spite of using a third-party package in this regard.So far, they have written dozens of lines of code to provide the optimizations as a built-in type of
Memory
. It is such a relief to announce that this type can be vastly replaced by Vector{T}
. Also, many inner specifications of arrays have been implemented based on Memory
type. Hence, performing Array operations is now more efficient and blazingly faster in Julia +1.11. Later on, I will write more details about this.
#Update__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
Suppose you want to test a package just once without getting involved with the installation and uninstallation process. What would you do?
Well, Julia devs have provided a handy flag,🤟
To activate such an env, one should enter the following command after entering into the pkg section by hitting the⌨️ :
🔗 More information in this regard is available on the official documentation.
❓ Do you know about shared environments in Julia?
#Tips__JG |#Environment__JG
❤️ JuliaGeeks
Well, Julia devs have provided a handy flag,
--temp
, to activate a temporary environment for such cases. The temporarily-created env would be deleted automatically right after deactivating it. To activate such an env, one should enter the following command after entering into the pkg section by hitting the
]
key pkg> activate --temp
#Tips__JG |#Environment__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
Sometimes, you must see all elements within a Vector or something else. The Julia REPL limits the number of elements that can be shown and truncates the output to better fit the screen. One way to do this is to use the following code to avoid the truncation:
The output of this code is exactly the same as when you call the📱 ), you should use the following code:
The output would be something like
#Tips__JG
❤️ JuliaGeeks
show(stdout, "text/plain", rand(30))
The output of this code is exactly the same as when you call the
rand(30)
code, vertically adjusted but without truncation. However, if you would like to see the elements next to each other separated using a comma (like what we have in Python show(IOContext(stdout, :limit=>false), rand(30))
The output would be something like
[0.8223948799776574, 0.01535264435200867, 0.7524808776993049, 0.8567173366672614, 0.19442069230608283, 0.5655759545291479, 0.11702055746225415]
(here I truncated the output to avoid a lengthy message)#Tips__JG
Please open Telegram to view this post
VIEW IN TELEGRAM
Julia Geeks
How do you grab elements that exist in a container but not in others? In Julia, we can utilize the setdiff function. This function returns the elements in the first container (which should be passed as the first positional argument) but not in the others.…
I wish I could post some of my old posts as a story.
HELL YEAAAA 🎉
Julia 1.10.8 currently is deployed internally by Google fucking Colab😎
Let's go baby🥳
#News__JG
❤️ JuliaGeeks
Julia 1.10.8 currently is deployed internally by Google fucking Colab
Let's go baby
#News__JG
Please open Telegram to view this post
VIEW IN TELEGRAM