julia Questions
2
Solved
Let x::Vector{Vector{T}}. What is the best way to iterate over all the elements of each inner vector (that is, all elements of type T)? The best I can come up with is a double iteration using the s...
Hyperacidity asked 18/6, 2016 at 23:55
3
Solved
I have a situation where I have a process which needs to "burn-in". This means that I
Start with p values, p relatively small
For n>p, generate nth value using most recently generated...
Brandonbrandt asked 10/5, 2022 at 9:47
2
I was delighted to learn that Julia allows a beautifully succinct way to form inner products:
julia> x = [1;0]; y = [0;1];
julia> x'y
1-element Array{Int64,1}:
0
This alternative to dot(x...
Millar asked 21/6, 2015 at 15:26
1
i need to convert
2-element Vector{Matrix{Tuple{Real, Real}}}:
[(1, 2) (1.8, 2.1) (3, 2)]
[(1, 3) (2.2, 2.9) (3, 3)]
into
(Vector{Real}[[1, 1.8, 3], [1, 2.2, 3]], Vector{Real}[[2, 2.1, 2], [3, 2...
Wreckfish asked 9/5, 2022 at 13:54
1
The Julia program below takes about 6 seconds on my laptop (second test(n)). An equivalent C++ program (using Eigen) only 0.19 s. According to the results I have seen on https://programming-languag...
Rior asked 8/5, 2022 at 11:16
2
Solved
I am trying to iterate over the rows of a DataFrame in Julia to generate a new column for the data frame. I haven't come across a clear example of how to do this. In R this type of thing is vectori...
5
Solved
If the two Int arrays are, a = [1;2;3] and b = [4;5;6], how do we concatenate the two arrays in both the dimensions? The expected outputs are,
julia> out1
6-element Array{Int64,1}:
1
2
3
4...
Textualist asked 20/9, 2016 at 6:8
2
Solved
LATEST UPDATE: Shep has provided an answer that updates this question to v1+.
UPDATE: Thanks to @rickhg12s for pointing out that it appears I may have stumbled upon a bug. method_exists(<, (MyTy...
Policlinic asked 21/5, 2015 at 1:8
2
Solved
My question is quite similar to this one, but with a difference. I want to create a macro (or whatever) that behaves this way:
julia> @my-macro x + 2
:(x + 2)
(note that x + 2 is not enclosed...
3
Solved
Title says it all. How can I handle or catch a SIGINT in julia? From the docs I assumed I just wanted to catch InterruptException using a try/catch block like the following
try
while true
printl...
2
Solved
I'm interested in defining a struct that has a field which is a vector of vectors. Potentially (but not necessarily), the inner vectors would be of type SVector (defined in the StaticArrays package...
Ningsia asked 4/4, 2022 at 14:26
4
Solved
Given a generator:
myVec1 = rand(0:4, 2)
myVec2 = rand(0:4, 8)
myGen = (val1 + val2 for val1 in myVec1, val2 in myVec2)
This is basically a matrix with 2 columns. It can be seen by using collect(...
4
I am writing a package for Julia and within the package I would like to be able to print the my package current version number. I can of course do that manually but I was looking for a way to read ...
6
Solved
In Python, Numpy arrays can be reversed using the standard [::-1] i.e.
A = np.diag(np.arange(1,3))
A[::, ::-1]
A[::-1]
A[::-1, ::-1]
Julia does not support [::-1] and the reverse method only...
2
I know that block comments in Julia is officially #= ... =#. I also know that multiline strings are """ ... """.
However, I have seen a lot of source codes use "&...
Serieswound asked 29/3, 2022 at 22:33
3
Solved
I am trying to do a simple function to check the differences between factorial and Stirling's approximation:
using DataFrames
n = 24
df_res = DataFrame(i = BigInt[],
f = BigInt[],
st = BigInt[])...
3
Solved
In MATLAB, there are a pair of functions tic and toc
which can be used to start and stop a stopwatch timer.
An example taken from link:
tic
A = rand(12000, 4400);
B = rand(12000, 4400);
toc
C = A'...
Coadjutant asked 20/7, 2015 at 20:39
2
Solved
Is possible to store the time displayed with @time in a variable ?
For example the following code
for i in 1:10
@time my_function(i)
end
displays the wall time of my function my_function, but I w...
Placket asked 5/3, 2021 at 8:41
3
Solved
I am trying to figure out (in Julia) how to extract a portion of an array along a specified dimension, when the dimension itself is a variable. If the dimension is known it is straightforward to ex...
3
Solved
I would like to check if a variable is scalar in julia, such as Integer, String, Number, but not AstractArray, Tuple, type, struct, etc. Is there a simple method to do this (i.e. isscalar(x))
Ennui asked 11/12, 2017 at 22:56
3
I am trying to find out how I can pack an integer or float value in to a byte array in Julia. In Python I would just do the following:
struct.pack("<q",1)
Which would give me '\x01\x00\x00\x0...
7
I have an array X that I'd like to convert to a dataframe. Upon recommendation from the web, I tried converting to a dataframe and get the following error.
julia> y=convert(DataFrame,x)
ERROR:...
4
Solved
How can I convert a Set to an Array in Julia?
E.g. I want to transform the following Set to an Array.
x = Set([1,2,3])
x
Set{Int64} with 3 elements:
2
3
1
Paintbox asked 26/2, 2022 at 17:25
3
Solved
I couldn't find an answer in both stackoverflow and the Julia docs to the following "design problem":
Let's say I want to define the following object
struct Person
birthplace::String
age::Int
end...
Heterogamete asked 23/1, 2018 at 12:5
3
Solved
Allocating an array of Union{T, Missing} is very expensive in Julia. Is there any workaround it?
julia> @time Vector{Union{Missing, Int}}(undef, 10^7);
0.031052 seconds (2 allocations: 85.831 M...
Giovanna asked 14/1, 2022 at 10:2
© 2022 - 2024 — McMap. All rights reserved.