julia Questions
2
Solved
In Julia, what is difference between defining a variable as const and defining a variable as const global? Considering the following example, what is the difference if I change const global to cons...
Frodeen asked 14/2, 2018 at 7:4
2
Solved
I'd like to convert binary to decimal in Julia. It looks like parseint() became deprecated.
Is the below method the best way to do this?
julia> parse(Int,"111",2)
7
Noelyn asked 27/9, 2017 at 15:30
1
Exploring the Oxygen package to build APIs I found this I haven't been able to solve
When I run this API (with a 150 ms sleep to simulate the time taken by a model):
using Oxygen
@get "/mod...
Risible asked 1/3 at 19:36
3
I am currently porting an algorithm from Java to Julia and now I have come across a part where I have to continue an outer loop from an inner loop when some condition is met:
loopC: for(int x : Y...
Eph asked 7/11, 2016 at 15:39
2
Solved
I've read that global variables have a sensible impact on performance.
In order to avoid them I've put everything inside a init function, as I read here.
Simple example, integer.jl:
function __...
Slayton asked 13/2, 2016 at 22:49
7
Solved
Julia appears to have a lot of Matlab like features. I'd like to select from an array using a predicate. In Matlab I can do this like:
>> a = 2:7 ;
>> a > 4
ans =
0 0 0 1 1 1
&g...
3
I'm implementing Newton's method for finding roots in a precompiled library. The common case will be to work with functions from Float64 to Float64, and I want an optimized compiled version of it t...
2
Solved
How do I get the minimum value of an Array, Vector, or Matrix in Julia?
The code min([1, 2, 3]) doesn't work.
Artur asked 30/3, 2016 at 9:5
4
I'm trying to find functionality in Julia similar to MATLAB's meshgrid or ndgrid. I know Julia has defined ndgrid in the examples but when I try to use it I get the following error.
UndefVarErro...
Pronunciamento asked 16/6, 2017 at 4:50
5
Solved
I would like to create an empty vector and append to it an array in Julia. How do I do that?
x = Vector{Float64}
append!(x, rand(10))
results in
`append!` has no method matching append!(::Type{...
3
Solved
How can I use several different versions or branches of the same module in a single script in Julia?
e.g. If I wanted to benchmark each of the tagged releases.
(Someone asked a similar question r...
Bourges asked 30/8, 2016 at 10:30
8
Solved
Suppose I have an array of tuples:
arr = [(1,2), (3,4), (5,6)]
With python I can do zip(*arr) == [(1, 3, 5), (2, 4, 6)]
What is the equivalent of this in julia?
Aman asked 1/4, 2016 at 23:39
8
Solved
I want to obtain the number of cores available in Julia. Currently I am doing the following:
using PyCall
@pyimport psutil
nCores = psutil.cpu_count()
This calls a Python function. I would like,...
Blindfish asked 13/1, 2015 at 20:35
3
Solved
Background and Existing Solutions
I am porting some Python code into Julia (v1.3.1), and I have run into an issue with trying to reproduce the code into as easily readable code in Julia.
In Pytho...
2
Solved
I have created a heatmap plot using in Julia by using the Plotly with the Plots package. I generate the heatmap with the following command heatmap(10^9 .* (height + deformation)). Then, I get a plo...
2
I'm a Julia newbie. When I was testing out the language, I got this error.
First of all, I'm defining String b to "he§y".
Julia seems behaving strangely when I have "special" characters in a Stri...
5
Solved
The project root directory of a file located in PROJECT_ROOT/lib/code.jl can be accessed with this code:
root = dirname(dirname(@__FILE__))
Using dirname() twice seems pretty ugly. Is there a be...
Bryonbryony asked 17/2, 2016 at 20:1
7
Solved
If I have a dictionary such as
my_dict = Dict(
"A" => "one",
"B" => "two",
"C" => "three"
)
What's the best way to reverse the key/value mappings?
Rabkin asked 19/11, 2016 at 14:43
1
I am not much experienced in parallel programming. But, I encounter an interesting situation when trying to run my Julia code in parallel.
@threads for i in 1:THREADS
run(parameters[i], tm)
end
p...
Fullmouthed asked 26/12, 2023 at 15:58
4
Solved
In Julia, using CSV.jl, it is possible to read a DataFrame from a .csv file:
using CSV
df = CSV.read("data.csv", delim=",")
However, how can I instead read a CSV file into an ...
4
Solved
The shortest way I can think of to test whether all the elements in an array arr are equal is all(arr[1] .== arr). While this is certainly short, it seems a bit inelegant. Is there a built-in funct...
1
I'm trying to solve a simple optimisation problem, we want to have a complex valued Hermitian matrix as its variable (topic is quantum mechanics).
using Convex #load the optimization solvers
using ...
Claudeclaudel asked 5/3, 2016 at 10:42
4
Solved
I already know how to load a single CSV into a DataFrame:
using CSV
using DataFrames
df = DataFrame(CSV.File("C:\\Users\\username\\Table_01.csv"))
How would I do this when I have several CSV fi...
Dander asked 16/6, 2020 at 12:18
4
Solved
Assume I have the following matrix (defined here in Julia language):
mat = [1 1 0 0 0 ; 1 1 0 0 0 ; 0 0 0 0 1 ; 0 0 0 1 1]
Considering as a "component" a group of neighbour elements that have v...
3
Solved
refer to julia-lang documentations :
hist(v[, n]) → e, counts
Compute the histogram of v, optionally using approximately n bins. The return values are a range e, which correspond to the edges ...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.