Julia语言

本页使用了标题或全文手工转换
维基百科,自由的百科全书
(重定向自Julia (编程语言)
Julia
编程范型多范式多分派, 过程式, 函数式, 元编程, 多阶段编程英语Multi-stage_programming
設計者Jeff Bezanson, Alan Edelman, Stefan Karpinski, Viral B. Shah
實作者Jeff Bezanson, Stefan Karpinski, Viral B. Shah等[1][2]
发行时间2012年,​12年前​(2012[3]
当前版本1.10.2[4]在维基数据编辑, 2024年3月1日, 28天前
實作語言Julia, C, C++, Scheme, LLVM[5]
系统平台x86-64, IA-32, ARM v8(64位元), CUDA, ARM (32位元), PowerPC, 网页浏览器 (JavaScriptWebAssembly)[6]
操作系统macOS, Windows, Linux, FreeBSD[7], Android[8]
許可證MIT許可證
文件扩展名.jl
網站JuliaLang.org
啟發語言

Julia是一种高级通用[13]动态编程语言,它最初是为了满足高性能数值分析计算科学的需要而设计的,不需要解释器,速度快[14][15][16][17],也可用于客户端和服务器的Web用途[18][19]、低级系統程式設計或用作规约语言[20]

Julia设计的独特之处包括,参数多态的类型系统,完全动态语言中的类型,以及它多分派的核心编程范型。它允许并发并行分布式计算,并直接调用CFortran库而不使用粘合代码

Julia拥有垃圾回收机制[21],使用及早求值,包含了用于浮点计算、线性代数随机数生成正则表达式匹配的高效库。有许多库可以使用,其中一些(如用于快速傅里叶变换的库)已经预先捆绑在Julia裡[22]

历史

一群拥有各种语言丰富编程经验的Matlab高级用户,对现有的科学计算编程工具感到不满——这些软件对自己专长的领域表现得非常棒,但在其它领域却非常糟糕。他们想要的是一个开源的软件,它要像C语言一般快速而又拥有如同Ruby动态性;要具有Lisp般真正的同像性而又有Matlab般熟悉的数学记号;要像Python般通用、像R般在统计分析上得心应手、像Perl般自然地处理字符串、像Matlab般具有强大的线性代数运算能力、像shell胶水语言的能力,易于学习而又不让真正的黑客感到无聊;还有,它应该是交互式的,同时又是编译型的。[23]

该项目大约于2009年中开始。

功能

主要用于数值计算。

特点

  • 核心语言非常小。标准库用的是Julia语言本身写的
  • 调用许多其它成熟的高性能基础代码。如线性代数随机数生成快速傅里叶变换、字符串处理。
  • 丰富的用于建立或描述对象的类型语法
  • 高性能,接近于静态编译型语言。包括用户自定义类型等
  • 为并行计算和分布式计算而设计
  • 轻量级协程
  • 优雅的可扩展的类型转换/提升
  • 支持Unicode,包括但不限于UTF-8
  • 可直接调用C函数(不需要包装或是借助特殊的API
  • 有类似shell的进程管理能力
  • 有类似Lisp以及其它元编程工具
  • 可與Jupyter notebook 一起使用

示例

生成Mandelbrot集合

function mandel(z)
    c = z
    max = 80
    for n = 1:max
        if abs(z) > 2
            return n-1
        end
        z = z^2 + c
    end
    return max
end

随机矩阵统计

using LinearAlgebra: tr
using Statistics #导入std, mean等函数

function randmatstat(t)
    n = 5
    v = zeros(t)
    w = zeros(t)
    for i = 1:t
        a = randn(n,n)
        b = randn(n,n)
        c = randn(n,n)
        d = randn(n,n)
        P = [a b c d]
        Q = [a b; c d]
        v[i] = tr((P'*P)^4)
        w[i] = tr((Q'*Q)^4)
    end
    std(v)/mean(v), std(w)/mean(w)
end

参考资料

  1. ^ LICENSE.md. GitHub. [2020-03-24]. (原始内容存档于2021-01-23). 
  2. ^ Contributors to JuliaLang/julia. GitHub. [2020-03-24]. (原始内容存档于2021-01-23). 
  3. ^ 3.0 3.1 3.2 3.3 3.4 3.5 3.6 Why We Created Julia. Julia website. February 2012 [2013-02-07]. (原始内容存档于2019-02-19). 
  4. ^ Download Julia. 
  5. ^ Julia. Julia. NumFocus project. [9 December 2016]. (原始内容存档于2017-02-21). Julia's Base library, largely written in Julia itself, also integrates mature, best-of-breed open source C and Fortran libraries for ... 
  6. ^ Fischer, Keno. Running julia on wasm. 2019-07-22 [2019-07-25]. (原始内容存档于2020-11-21). 
  7. ^ Download Julia - Currently supported platforms. Julia. [2020-03-24]. (原始内容存档于2021-01-26). 
  8. ^ The Julia Language: A fresh approach to technical computing. Termux/Android. Github. [2020-03-24]. (原始内容存档于2020-12-27). 
  9. ^ Stokel-Walker, Chris. Julia: The Goldilocks language. Increment. Stripe. [23 August 2020]. (原始内容存档于2020-11-09). 
  10. ^ 10.0 10.1 10.2 10.3 Home · The Julia Language. docs.julialang.org. [2018-08-15]. (原始内容存档于2021-01-11) (英语). 
  11. ^ Programming Language Network. GitHub. [6 December 2016]. (原始内容存档于2020-12-20). 
  12. ^ JuliaCon 2016. JuliaCon. [6 December 2016]. (原始内容存档于2021-02-03). He has co-designed the programming language Scheme, which has greatly influenced the design of Julia 
  13. ^ The Julia Language (official website). [2018-09-22]. (原始内容存档于2017-02-21). General Purpose [..] Julia lets you write UIs, statically compile your code, or even deploy it on a webserver. 
  14. ^ Bryant, Avi. Matlab, R, and Julia: Languages for data analysis. O'Reilly Strata. 15 October 2012 [2018-09-22]. (原始内容存档于2013-05-24). 
  15. ^ Singh, Vicky. Julia Programming Language – A True Python Alternative. Technotification. 23 August 2015 [2018-09-22]. (原始内容存档于2020-11-09). 
  16. ^ Krill, Paul. New Julia language seeks to be the C for scientists. InfoWorld. 18 April 2012 [2018-09-22]. (原始内容存档于2014-09-13). 
  17. ^ Finley, Klint. Out in the Open: Man Creates One Programming Language to Rule Them All. Wired. 3 February 2014 [2018-09-22]. (原始内容存档于2016-12-20). 
  18. ^ Escher : With Escher you can build beautiful Web Uls entirely in Julia. Shasi.github.io. [2017-05-31]. (原始内容存档于2016-03-04). 
  19. ^ Getting Started with Node Julia · Node Julia. Node-julia.readme.io. [2017-05-31]. (原始内容存档于2020-10-21). 
  20. ^ Moss, Robert. Using Julia as a Specification Language for the Next-Generation Airborne Collision Avoidance System. 26 June 2015 [29 June 2015]. (原始内容存档于2015-07-01). Airborne collision avoidance system 
  21. ^ Suspending Garbage Collection for Performance...good idea or bad idea?. Groups.google.com. [2017-05-31]. (原始内容存档于2011-01-22). 
  22. ^ (now available with using FFTW in current versions; that dependency is one of many moved out of the standard library to a package because it is GPL licensed, and thus is not included in Julia 1.0 by default.) Remove the FFTW bindings from Base by ararslan · Pull Request #21956 · JuliaLang/julia. GitHub. [2018-03-01]. (原始内容存档于2019-02-16) (英语). 
  23. ^ Why We Created Julia. [2012-04-19]. (原始内容存档于2016-01-18). 

參閱

外部链接