Questions tagged [julia]

The Julia programming language is fast, expressive and dynamic. By aggressively targeting technical computing it has become a robust general purpose language. It addresses the two-language problem by combining the ease of use of high-level languages such as R and Python with the performance of C and Fortran.

Julia is a high-level, high-performance dynamic programming language for technical computing. It addresses the two-language problem by combining the ease of use of languages such as R and Python with the performance of C and Fortran. Julia provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library. Environments such as Julia for VS Code, Jupyter, and Pluto provide a rich development environment with interactive graphics.

Community-contributed libraries continue to be added at a rapid pace. Programs written in Julia are organized around multiple dispatch - by defining and overloading functions with different combinations of argument types. Part of what makes Julia so expressive is that argument types can be user-defined, and user-defined types live in the same type hierarchy and have the same status as built-in types.

The Julia compiler includes a parser written in Scheme (femtolisp), some compiler passes and the runtime in C, code generation through LLVM using C++, and other compiler passes (type inference, inlining, etc.) as well as much of the Base library in Julia itself. For just-in-time generation of 64-bit or 32-bit optimized machine code the LLVM compiler framework is used.

Julia has foreign function interfaces for C, C++, Python, R, and Java, to name a few. Julia can also be embedded in any other software through its C API. Many of these interfaces are high performance and avoid copying data to the extent possible.

Resources for Julia:

Books

Publications

12250 questions
61
votes
5 answers

Access command line arguments in Julia

When I type in $ julia myprog.jl foo bar baz Where in my code can I go to access the strings "foo", "bar", "baz" ? I'm looking for the Python equivalent of sys.argv
MRocklin
  • 55,641
  • 23
  • 163
  • 235
61
votes
1 answer

Parallelism in Julia: Native Threading Support

In their arXiv paper, the original authors of Julia mention the following: 2.14 Parallelism. Parallel execution is provided by a message-based multi-processing system implemented in Julia in the standard library. The language design supports…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
60
votes
1 answer

In what sense are languages like Elixir and Julia homoiconic?

Homoiconicity in Lisp is easy to see: (+ 1 2) is both the function call to + with 1, 2 as arguments, as well as being a list containing +, 1, and 2. It is simultaneously both code and data. In a language like Julia, though: 1 + 2 I know we can…
user2666425
  • 1,671
  • 1
  • 15
  • 21
57
votes
1 answer

None value in Julia

What is the Julia equivalent of the None value in Python? (As shown here in built-in constants.)
haxtar
  • 1,962
  • 3
  • 20
  • 44
56
votes
4 answers

What is the recommended way to iterate a matrix over rows?

Given a matrix m = [10i+j for i=1:3, j=1:4], I can iterate over its rows by slicing the matrix: for i=1:size(m,1) print(m[i,:]) end Is this the only possibility? Is it the recommended way? And what about comprehensions? Is slicing the only…
Nico
  • 1,070
  • 1
  • 10
  • 14
53
votes
1 answer

Generating a random integer in range in Julia

I am migrating from MATLAB to Julia and I am trying to generate a random integer in range 1:n. For n < 21, rand(r[1:n]) works. However for n > 20, for example, rand(r[1:21]), I get this message: ERROR: BoundsError() in getindex at range.jl:121
user3411759
  • 541
  • 1
  • 4
  • 3
52
votes
2 answers

Is the Julia language really as fast as it claims?

Following this post I decided to benchmark Julia against GNU Octave and the results were inconsistent with the speed-ups illustrated in julialang.org. I compiled both Julia and GNU Octave with CXXFLAGS='-std=c++11 -O3', the results I got: GNU…
juliohm
  • 3,691
  • 2
  • 18
  • 22
50
votes
4 answers

Julia: append to an empty vector

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{Array{Float64,1}}, ::Array{Float64,1}) Thanks.
Anarcho-Chossid
  • 2,210
  • 4
  • 27
  • 44
48
votes
4 answers

julia create an empty dataframe and append rows to it

I am trying out the Julia DataFrames module. I am interested in it so I can use it to plot simple simulations in Gadfly. I want to be able to iteratively add rows to the dataframe and I want to initialize it as empty. The tutorials/documentation on…
cantdutchthis
  • 31,949
  • 17
  • 74
  • 114
48
votes
4 answers

How to install Julia in an anaconda environment?

One of the main features of Anaconda is that it is language agnostic as stated in their blog: You can create environments of any binary dependency tree (different versions of Python, R, Julia, etc.). Recently I switched from using virtualenv to…
r_31415
  • 8,752
  • 17
  • 74
  • 121
46
votes
5 answers

Concatenating arrays in Julia

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 5 6 julia> out2 3x2 Array{Int64,2}: 1 4 2 5 3 …
Abhijith
  • 1,158
  • 1
  • 13
  • 27
45
votes
2 answers

What's the point of firstindex in Julia?

From documentation it says firstindex() finds the first index of a collection. Why not just use 1? What could be the case when it's not 1?
Alex Craft
  • 13,598
  • 11
  • 69
  • 133
45
votes
1 answer

What does an exclamation mark mean after the name of a function?

I saw a function like this function operator!(c::Matrix, out::Matrix) ...... end What does ! mean here?
Fazeleh
  • 1,008
  • 2
  • 9
  • 24
44
votes
6 answers

Determine version of a specific package

How can I get the version number for a specific package? The obvious way is to get the dictionary with all installed packages, and then filter for the one of interest: pkgs = Pkg.installed(); pkgs["Datetime"] Getting the list of all installed…
Julian
  • 1,271
  • 2
  • 12
  • 17
43
votes
7 answers

Convert float to int in Julia Lang

Is there a way to convert a floating number to int in Julia? I'm trying to convert a floating point number to a fixed precision number with the decimal part represented as 8bit integer. In order to do this, I need to truncate just the decimal part…
JJTO
  • 847
  • 2
  • 8
  • 13