Julia (programming language)

from Wikipedia, the free encyclopedia
Julia
Official Julia logo
Basic data
Paradigms : Multiparadigm ( procedural , functional , object-oriented , metaprogramming )
Publishing year: 2012
Designer: Jeff Bezanson, Stefan Karpinski, Viral B. Shah, Alan Edelman
Developer: Jeff Bezanson, Stefan Karpinski, Viral B. Shah u. a.
Current  version : 1.4.2   (May 23, 2020)
Typing : dynamic with type inference
Important implementations : Julia JIT compiler
Influenced by: MATLAB , Scheme , Lisp , ML , Cecil , Dylan , PyPy , Perl , R , Ruby , Lua , Fortran
Operating system : Linux , macOS , FreeBSD , Windows
License : MIT license , GPL , LGPL , BSD
The Julia Language

Julia is a high-level programming language that was developed primarily for numerical and scientific computing and can also be used as a general purpose language while maintaining a high execution speed. The syntax is very reminiscent of MATLAB , as well as other technical programming languages. The compiler was written in C , C ++, and Scheme ; the standard library is written in Julia herself. The programming language, whose development began in 2009, was released as open source in February 2012 .

The execution speed is in the range of C and Fortran , which clearly sets Julia apart from other scientific languages ​​such as MATLAB, GNU Octave or R. The design of the language is characterized by a type system that allows parameterized types, a dynamic programming environment and multi-methods as the central paradigm. Julia allows parallel and distributed execution of programs and the direct call of C and Fortran libraries. Julia comes standard with a garbage collector and efficient implementations for operations with floating point numbers and for linear algebra , for generating random numbers and for processing regular expressions .

The development took place at MIT ; Stefan Karpinski , Viral Shah and Jeff Bezanson received the JH Wilkinson Prize for Numerical Software for 2019.

properties

The official website highlights the following features as important:

Julia was heavily influenced by Lisp dialects, primarily Scheme and Common Lisp , and has similarities with languages ​​that also support multi-methods . These include Dylan , with an ALGOL- like syntax instead of the Lisp-like Polish notation , and Fortress , with an extensive parametric type system. CLOS extends Common Lisp to include multi-methods with the restriction that only functions that were previously declared as generic can be extended with multi-methods.

In Julia, Dylan and Fortress, the multi-method is the standard and the built-in functions are entirely generic and expandable. In Dylan, multimethods are treated just as fundamentally as in Julia: All user-defined functions and built-in mathematical operators such as addition with +are generic. However, Dylan's type system does not fully support parametric types, which is more likely to be found in ML- derived languages. By default, CLOS does not support parametric types for multi-methods; this has to be added by the Metaobject Protocol . Like Julia, Fortress allows parametric types for multi-methods, but in contrast to Julia, Fortress is statically typed, so that compilation and execution take place in separate phases. The table summarizes these properties:

language Type system Multi-methods Parametric types
Julia dynamic default Yes
Common Lisp dynamic as an extension partial (not for multi-methods)
Dylan dynamic default partial (not for multi-methods)
Fortress static default Yes

Version 0.4 makes it possible to create independently executable files with build_executable.jl , while Julia has to be preinstalled by default, similar to Python.

User interaction

Julia contains an interactive command line program REPL (Read – eval – print loop) by default , which can be used for experimenting and quickly testing code. An example excerpt from the REPL is:

julia> p(x) = 2x^2 + 1; f(x, y) = 1 + 2p(x)y
julia> println("Hello world!", " I’m on cloud ", f(0, 4), " as Julia supports recognizable syntax!")
Hello world! I’m on cloud 9 as Julia supports recognizable syntax!

The REPL gives the user access to the system shell and provides a help mode by entering ;or ?, in front of the command, after the prompt. REPL saves the history of commands entered and those between sessions. It also provides code examples that can be entered directly in REPL or .jlsaved in a separate file with an extension and then called up by $ julia <filename>in the system shell.

Package manager

In Julia's package manager, each package (is program library ) a Git - repository that can be stored in any publicly accessible place. The dependencies of packages are managed in METADATA.jl , which Pkg.add("PaketName")enables packages to be installed via Julia .

Usually packages are written in Julia; they can also contain source code for C, Fortran, Python or other languages ​​(through BinDeps ), as long as an appropriate compiler is installed that compiles the source code when the package is installed. Alternatively, it is possible to include machine code through WinRPM .

Use with other languages

Many packages are available to call other languages ​​within Julia. For example, the packet is Java Call available to Java by Julia from invoke Mathematica to Mathematica call, calling Rust is possible and node-julia allows JavaScript / node.js the use of asynchronous (Web) server. For PHP , Perl and other languages, Polyglot allows transparent remote calling and recursive evaluation of functions in other languages, as if they were regular Julia functions. It allows other languages ​​to use Julia functions as if they were written in the other language. With Polyglot.jl , Julia also has native and wrapper packages for symbolic math .

By default, Julia supports UTF-8, UTF-16 and UTF-32 , but the optional packages ICU , a wrapper for International Components for Unicode, and UnicodeExtras can be used for extended Unicode support. The Blink package is also available for creating and working with browser windows .

For Julia there are wrapper libraries to work with graphical user interfaces , such as the platform-independent GTK + (at least for Linux, Windows and macOS) , Qt (uses PySide ), Tk or JGUI , which hides the differences from the previous ones and uses the what is available.

There are numerous individual SQL or NoSQL database interfaces and the generic ODBC for cross-database access.

While Julia uses eager evaluation (early evaluation ) by default , the Lazy package provides the basics for functional programming - lazily evaluated lists and a large library of functions to work with .

Use for statistics and data analysis

Julia was created with the goal of being as easy for statistics as R is .

In the event that Julia lacks statistical functions that are available in R, the packages RCall and Rif are available, and in the reverse case RJulia to call Julia from R.

Gadfly enables statistical graphics to be created in Julia. The Distributions package is available for working with distributions .

Without being used in common with R, Rmath exists in Julia. Rmath is a library from R that contains simple statistical functions. Julia uses a patched version of Rmath that uses dSFMT ( double precision SIMD -oriented Fast Mersenne-Twister ) as the underlying random number generator for faster normally distributed random numbers.

In practical terms, multi- methods turn object-oriented programming on its head: Instead of encapsulating functions or methods in data structures or objects, functions are effectively overloaded for different data structures .

Display of assembly language

The compiled assembly language can be displayed for each function that has just been entered. +This is even possible for built-in functions such as the addition operator. In +Julia, operators like are just functions, which is made possible by syntactic sugar :

julia> code_native(+, (Float64, Float64))
	.text
Filename: float.jl
Source line: 120
	push	RBP
	mov	RBP, RSP
Source line: 120
	addsd	XMM0, XMM1
	pop	RBP
	ret

implementation

The core of Julia was in C and C ++ is implemented, the parser in Scheme ( femtolisp ), was also made LLVM -Compilerframework used optimized 64-bit - or 32-bit - machine code just-in-time to generate (JIT). With a few exceptions (like libuv ), the standard library was written in Julia herself. Julia's execution speed is particularly high compared to languages ​​that serve similar purposes. Optimized C code is usually twice as fast as Julia code, so Julia code runs an order of magnitude faster than Python or R code. Development of Julia started in 2009, an open source version was released in February 2012.

Julia uses a mark-and-sweep garbage collector to clean up memory. This choice is not a problem for high-performance number processing. For calculations in real time, such as audio processing, an incremental implementation of the garbage collector can deliver significantly better execution speed. A new garbage collector was implemented in version 0.4-dev, which can be up to twice as fast as that in the stable versions 0.3.x.

The 0.3 branch had a schedule of one release per month in which bugs were fixed and some new features carried over from 0.4.

In November 2015, it was announced that the Gordon and Betty Moore Foundation had donated US $ 600,000 to develop the language in order to achieve version 1.0.

Version 1.0.0 was released on August 8, 2018.

Current and planned platforms

Even if Julia-JIT uses the LLVM (MCJIT of the LLVM), native machine code is generated as soon as a function is executed for the first time. In contrast to Java or Dalvik , Julia does not generate any bytecode running in a virtual machine .

Newer x86 and older i386 processor architectures are currently well supported (Tier 1) , as well as the 64-bit ARMv8 and the 64-bit Nvidia PTX in Linux.

Some tests are known to fail and stack traces are not available with alpha support for the Raspberry Pi 1 and Pi 2, however Julia [on ARMv7] Samsung Chromebook […] starts with no problems, PowerPC is still being worked on.

Integration in other languages

The Julia-C-API allows Julia's entire runtime environment, including libraries, to be executed within C programs without having to copy data. Languages ​​that can call C are supported (as long as the CPU is supported by all three environments), such as C ++, possibly C # (version 0.4 is required for C # on Windows 8.1). Python is also supported, whereby calls, including recursive ones, are possible in both directions. For languages ​​that support exceptions , exceptions can be caught in Julia and thrown again in the target language (in C, which does not support exceptions, these must be caught and handled in Julia).

There is a library that calls C ++ directly without using C, thus avoiding name mangling . In this way, methods can also be used that rely on so-called staged functions ; However, this is only possible from version 0.4.0-dev.

A compiler based on JavaScript that allows execution in the browser is under development.

Transcompiler Julia2C

The Julia2C transcompiler , a fork of Julia created by Intel Labs , translates functions or entire programs with Julia's syntax into C code instead of native machine code in order to ensure compatibility with other CPUs. The compiler is supposed to make it possible to analyze code at a higher level than C.

Alternatives

The oldest alternative to Julia and one of the role models at the same time is MATLAB , a language and desktop environment that has been developed and sold commercially by MathWorks since 1984 .

Since the routines for linear algebra in Julia are based on the open source Fortran libraries LAPACK and BLAS , there are several alternatives to these task areas with the same numerical quality. Scilab / Xcos comes from the French INRIA (Institut National de Recherche en Informatique et en Automatique) . As part of the GNU project is GNU Octave arose. Another example is the FreeMat software package .

NumPy and Matplotlib are Python libraries that add scientific computing and analysis functions to Python. NumPy is also based on LAPACK and BLAS.

Two further alternatives are the JVM- based programming language Scala (with the program library ND4S) and ILNumerics , which is based on .NET .

The larger computer algebra systems like Maple and Mathematica are primarily intended for symbolic computation and contain numerical algorithms .

See also

Web links

Commons : Julia  - collection of images, videos and audio files

Individual evidence

  1. LICENSE.md . GitHub .
  2. Contributors to Julia Lang / julia . GitHub .
  3. github.com
  4. julia.readthedocs.org ( Memento of the original from March 21, 2017 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / julia.readthedocs.io
  5. Chambers, John M.,: Extending R . Boca Raton, FL 2016, ISBN 978-1-4987-7572-4 .
  6. ^ The Julia Language .
  7. ^ Avi Bryant: Matlab, R, and Julia: Languages ​​for data analysis . O'Reilly Strata. October 15, 2012.
  8. ^ Paul Krill: New Julia language seeks to be the C for scientists . InfoWorld. April 18, 2012.
  9. ^ Klint Finley: Out in the Open: Man Creates One Programming Language to Rule Them All . Wired. 3rd February 2014.
  10. a b dotnetpro.de: Julia suggests Python, Matlab, Octave and R. Neue Mediengesellschaft Ulm mbH, April 3, 2012, accessed on March 20, 2017 .
  11. Suspending Garbage Collection for Performance ... good idea or bad idea? .
  12. groups.google.com
  13. github.com
  14. groups.google.com
  15. build_executable.jl
  16. Interacting With Julia ( Memento of the original from February 24, 2017 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / docs.julialang.org
  17. See also: julia.readthedocs.org ( Memento of the original from March 21, 2017 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. for string interpolation @1@ 2Template: Webachiv / IABot / julia.readthedocs.io
  18. ^ Julia Documentation . Archived from the original on March 17, 2017. Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. Retrieved March 20, 2017. @1@ 2Template: Webachiv / IABot / docs.julialang.org
  19. Learn Julia in Y Minutes
  20. METADATA.jl (central package directory for Julia)
  21. BinDeps.jl
  22. WinRPM.jl
  23. ^ Julia Package Library . Retrieved November 18, 2014.
  24. JavaCall.jl
  25. ^ Mathematica, jl
  26. ↑ Call up Julia from Mathematica . Retrieved April 9, 2015.
  27. Use of Rust in Perl and Julia . Accessed on May 15, 2015: "Julia is even easier to use [than Perl, in the given example]"
  28. ^ Stefan Karpinski: Julia and the Rust Language . September 5, 2013. Retrieved May 15, 2015: “Since Rust uses the C ABI, we can already call Rust libraries just as well as C. I have no idea what Erlang's ABI is like, but if it can expose a C ABI , then we can call it. Beyond that would take some work but is certainly possible. "
  29. Polyglot, jl
  30. ICU.jl
  31. UnicodeExtras.jl
  32. Blink.jl
  33. JGUI.jl
  34. ODBC.jl
  35. Lazy.jl
  36. RCall.jl
  37. Rif.jl
  38. RJulia, jl
  39. Gadfly.jl
  40. distributionsjl.readthedocs.org
  41. dmbates.blogspot.com
  42. github.com
  43. femtolisp
  44. ^ Julia: A Fast Dynamic Language for Technical Computing (PDF) 2012.
  45. Mark Gibbs: Pure and Julia are cool languages ​​worth checking out . In: Network World . January 9, 2013. Accessed March 21, 2017.
  46. github.com WIP: Incremental GC
  47. ^ Github.com Generational behavior for the garbage collector
  48. Rainald Menge-Sonnentag: Programming languages: Cash injection should bring Julia on the release course. In: heise Developer. Heise Medien GmbH & Co. KG, November 16, 2015, accessed on November 18, 2015 .
  49. The Julia Blog Julia 1.0
  50. Support MCJIT . Retrieved May 26, 2015.
  51. Using MCJIT with the Kaleidoscope Tutorial . July 22, 2013. Retrieved May 26, 2015.
  52. github.com ( Memento of the original from November 11, 2016 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / github.com
  53. Cross-compiling for ARMv6 . Retrieved May 16, 2015: “I believe # 10917 should fix this. The CPU used there arm1176jzf-s. "
  54. ARM build failing during bootstrap on Raspberry Pi 2 . Retrieved on May 16, 2015: "I can confirm (FINALLY) that it works on the Raspberry Pi 2 [..] I guess we can announce alpha support for arm in 0.4 as well."
  55. github.com
  56. github.com  ( page no longer available , search in web archivesInfo: The link was automatically marked as defective. Please check the link according to the instructions and then remove this notice.@1@ 2Template: Dead Link / github.com  
  57. ^ Porting Julia to PowerPC . Retrieved May 9, 2015: "Wow, the latest git allows me to build to completion."
  58. Unable to use 'libjulia.dll' in a C # application on Windows 8.1 .
  59. github.com
  60. julia.readthedocs.org ( Memento of the original from June 26, 2015 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / julia.readthedocs.org
  61. Support compiling to JavaScript with Emscripts . Retrieved January 28, 2015.
  62. github.com
  63. Julia2C initial release .: "By translating Julia to C, we leverage the high-level abstractions (matrix, vector, ..), which are easier to analyze, and can potentially add the rich extensions of C (like openmp, tbb, ...). The tool may also extend Julia to new architectures where the only available tool chain is for C […]. Translation from C to Julia might be harder. "