Julia: Difference between revisions

1,285 bytes added ,  12 September 2019
no edit summary
No edit summary
No edit summary
Line 1: Line 1:
__FORCETOC__
__FORCETOC__
Julia is a numerical computation and general purpose high-level programming language.
It's standout feature is its performance which allows libraries to be written in Julia directly.
In contrast, many libraries in [[R]] and [[Python]] are written in [[C]] or [[C++]] for performance purposes and accessed using Rcpp or Cython.
If necessary, you can still interface with other languages.
See [https://en.wikibooks.org/wiki/Introducing_Julia Introducing Julia] for a comprehensive guide on how to program in Julia.




Line 105: Line 111:
{{Main|Machine Learning in Julia}}
{{Main|Machine Learning in Julia}}


===Object Oriented Programming===
Julia is a [https://en.wikipedia.org/wiki/Multiple_dispatch Multiple Dispatch] language.<br>
You can use a <code>struct</code> in place of classes and define functions which have your struct as a parameter in place of methods.<br>
For example:
<syntaxhighlight lang="julia">
using Parameters
# @with_kw allows default values
# By default, structs are immutable. Add the mutable keyword.
@with_kw mutable struct Person
  name
  age
end
# Outer constructor
function Person(name::String, age::Int)
  # Do anything here
  # Return a new Person
  Person(name = name, age = age)
end
</syntaxhighlight>
Useful functions:
<pre>
# Returns the type
typeof("str")
# Check type
"str" isa String
# Get the super type
supertype(Int64)
</pre>


==Useful Packages==
==Useful Packages==
===MeshCat.jl===
===MeshCat.jl===
[https://github.com/rdeits/MeshCat.jl Link]<br>
[https://github.com/rdeits/MeshCat.jl Link]<br>
A wrapper for graphics visualizations around three.js. This opens in a web browser but can be used for making helium apps.
A wrapper for graphics visualizations around [[three.js]]. This opens in a web browser but can be used for making helium apps.
See [[Graphics in Julia]] for more details on how to use MeshCat.jl.
See [[Graphics in Julia]] for more details on how to use MeshCat.jl.


===Flux===
===Flux===
[https://fluxml.ai Link]<br>
[https://fluxml.ai Link]<br>
Flux is the primary machine learning tool for Julia.
Flux is the largest machine learning library for Julia.
It includes convenience features including NN layers, activation functions, and an automatic differentiation system.
It includes convenience features including NN layers, activation functions, and an automatic differentiation system.
See [[Machine Learning in Julia]] for more details on how to use Flux.
See [[Machine Learning in Julia]] for more details on how to use Flux.