Julia(ジュリア)は、汎用プログラミング言語水準から高度の計算科学や数値解析水準まで対処するよう設計された高水準言語かつ仕様記述言語、及び動的プログラミング言語である[2][3][4]。並行計算、並列計算、分散コンピューティング、及びAdapter パターン不要でC言語やFORTRANへのForeign function interfaceに対応している。ガベージコレクション[5]を行い先行評価を用いるほか、浮動小数点数計算、線型代数学、高速フーリエ変換、正規表現照合のライブラリを利用できる。
LLVMコンパイラフレームワークを用いてC言語、C++、Schemeで組まれており、標準ライブラリの殆どは独自に実装された[6]。注目すべき特徴は速度であり、完全に最適化したC言語(PythonやR言語よりも桁違いに速い場合が多い)と比べて計算パフォーマンスの低下は半分程度であると知られている[6]。
一方で実行時には、JITコンパイラによって処理されるため、表面的にはPythonの様にインタプリタとして動作する。
特徴
相互運用性
Juliaには、@ccall
マクロを使用してC言語やFortranのライブラリを呼び出すための組み込みサポートがある。外部ライブラリを使用し、Python[7]、R言語[8]、C++[9]、Java[10]、SQL[11][12][13][14]などと相互運用し、関数を呼び出したり呼び出されたりすることもできる。
C言語の printf を呼び出す例。
@ccall printf("Hello, World!\n"::Cstring)::Cvoid
Python とは同じ動的型付けのプログラミング言語で似ている点も多いため、相互運用がしやすい。ただし、NumPyはC言語と同じくrow-majorで配列の添え字は0から始まるが、JuliaはFortranと同じくcolumn-majorで配列の添え字は1から始まる[15]。下記は Julia から PythonCall を使用した例。[16]
using PythonCall
np = pyimport("numpy")
print(np.array([1, 2, 3], dtype=np.float32))
同様に JuliaCall により、Python から Julia を呼び出すことも可能で、Julia は計算が高速なので、計算量が多い部分だけを Julia で計算させるということも可能である。下記は Python から JuliaCall を使用した例。Julia の多次元配列と NumPy を組み合わせて使用している。[17]
from juliacall import Main as jl
import numpy as np
np.array(jl.rand(range(10), 3, 5))
コード例
Hello world
JuliaではHello worldを次のように書く。
行列積
次のコードはJuliaで書いた行列A、Bの行列積である。
A = randn(10, 10)
B = randn(10, 10)
C = A * B
このように、MATLABや、PythonのライブラリであるNumPyなどと同様に簡潔に数学的な操作を書くことができるうえに、行列積に関しては単にBLASのライブラリ(デフォルトはOpenBLAS[18])を呼び出しているだけだが、行列積を含めて多くの機能がC言語やFortranと同程度の速度で動作する[19]。
沿革
関連項目
脚注
- ^ “Download Julia”. julialang.org. 2025年1月27日閲覧。
- ^ “The Julia Language”. 2014年1月17日閲覧。
- ^ Bryant, Avi (2012年10月). “Matlab, R, and Julia: Languages for data analysis”. O'Reilly Strata. 7 February 2013閲覧。
- ^ Krill, Paul. “New Julia language seeks to be the C for scientists”. InfoWorld. 7 February 2013閲覧。
- ^ “Suspending Garbage Collection for Performance...good idea or bad idea?”. 2017年5月25日閲覧。
- ^ a b “Julia: A Fast Dynamic Language for Technical Computing” (PDF) (2012年). 2014年1月17日閲覧。
- ^ PythonCall & JuliaCall, JuliaPy, (2023-10-29), https://github.com/JuliaPy/PythonCall.jl 2023年10月30日閲覧。
- ^ RCall.jl, JuliaInterop, (2023-10-16), https://github.com/JuliaInterop/RCall.jl 2023年10月30日閲覧。
- ^ CxxWrap, JuliaInterop, (2023-10-28), https://github.com/JuliaInterop/CxxWrap.jl 2023年10月30日閲覧。
- ^ “Julia and Spark, Better Together | juliabloggers.com”. juliabloggers.com. 9 June 2024閲覧。
- ^ Foster, Claire (2023-10-23), SQLREPL.jl, https://github.com/c42f/SQLREPL.jl 2023年10月31日閲覧。
- ^ Noh, WooKyoung (2023-10-18), Octo.jl, https://github.com/wookay/Octo.jl 2023年10月31日閲覧。
- ^ “Usage Guide · FunSQL.jl”. mechanicalrabbit.github.io. 2023年10月31日閲覧。
- ^ Hood, Doug. “Using Julia with Oracle Database”. blogs.oracle.com. 9 June 2024閲覧。
- ^ “Single- and multi-dimensional Arrays · The Julia Language”. docs.julialang.org. 14 June 2024閲覧。
- ^ “The Julia module PythonCall - Guide · PythonCall & JuliaCall”. juliapy.github.io. 9 June 2024閲覧。
- ^ “The Python module JuliaCall - Guide · PythonCall & JuliaCall”. juliapy.github.io. 9 June 2024閲覧。
- ^ “julia/deps/openblas.mk at v1.10.4 · JuliaLang/julia”. June 10, 2024閲覧。
- ^ “Basic Comparison of Various Computing Languages” (2011年1月5日). 2022年1月5日閲覧。
- ^ “Why We Created Julia” (2012年2月). 7 February 2013閲覧。
- ^ Gibbs, Mark (2013年1月9日). “Gear head”. Network World. 7 February 2013閲覧。
- ^ “Julia 1.0”. The Julia Language (2018年8月8日). 2018年8月12日閲覧。
- ^ “プログラミング言語「Julia 1.0」リリース”. OSDNマガジン (2018年8月8日). 2018年8月12日閲覧。
- ^ “MIT-created programming language Julia 1.0 debuts”. MIT News (2018年8月27日). 2018年9月1日閲覧。
- ^ “Download Julia”. julialang.org. 2020年8月10日閲覧。
- ^ “Julia language co-creators win James H. Wilkinson Prize for Numerical Software”. MIT News (2018年12月26日). 2021年12月19日閲覧。
参考文献
洋書
- Nagar, Sandeep (2017). Beginning Julia Programming-For Engineers and Scientists. Springer
- Bezanson, J; Edelman, A; Karpinski, S; Shah, V. B (2017). Julia: A fresh approach to numerical computing. 59. SIAM Review. pp. 65-98.
- Ben Lauwens and Allen B. Downey: Think Julia: How to Think Like a Computer Scientist, Oreilly & Associates Inc, ISBN 978-1492045038 (2019年5月).
- Eric Darve and Mary Wootters: Numerical Linear Algebra with Julia, SIAM, ISBN 978-1-611976-54-0 (2021).
- Tobin A Driscoll and Richard J. Braun: Fundamentals of Numerical Computation: Julia Edition, SIAM, ISBN 978-1-611977-00-4 (2022年8月).
- Noel Kalicharan: Julia - Bit by Bit: Programming for Beginners, Springer, ISBN 978-3-030-73935-5 (2021).
- C. T. Kelley: Solving Nonlinear Equations with Iterative Methods: Solvers and Examples in Julia,SIAM,ISBN 978-1-611977-26-4(2022年).
- Clemens Heitzinger: Algorithms with Julia, Springer, ISBN 978-3-031-16559-7 (2022).
和書
外部リンク
|
---|
低水準言語 | |
---|
高水準言語 |
1950年代 | |
---|
1960年代 | |
---|
1970年代 | |
---|
1980年代 | |
---|
1990年代 | |
---|
2000年代 | |
---|
2010年代 | |
---|
|
---|
架空の言語 | |
---|
|