Julia is a new languange for technical computing. It is a mix of R, Matlab, Python and other similar languages. Its main advantage is its speed: it is just in time (JIT) compiled and almost as fast as C. Another advantage is its type inference, i.e. you do not have to specify types (although you can), but all variables are statically typed. It is a high level language that is fast as well. Here I compare the behavior to similar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module L1Convex | |
# This is a Julia module implementing OWL-QN algorithm for large-scale L1-regularized convex optimization | |
# https://www.microsoft.com/en-us/research/wp-content/uploads/2007/01/andrew07scalable.pdf | |
# http://proceedings.mlr.press/v37/gonga15.pdf | |
# The algorithm minimizes loss of the form: f(x) + lambda * ||x||_1 | |
# where f(x) is a differentiable convex function | |
# ||x||_1 is the L1 norm of the parameter vector x | |
# lambda is the regularization strength |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Yao, LinearAlgebra | |
# define tropical numbers with the following property. | |
# x ⊕ y := max(x ,y) | |
# x ⊗ y := x + y | |
struct Tropical{T} <: Number | |
n::T | |
c::T | |
end | |
Tropical(x::Real) = Tropical(x,one(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using TaylorSeries, StaticArrays, ForwardDiff | |
f( (x, y) ) = x^2 + 5x*y + 2y^2 | |
H = zeros(2, 2) | |
t = Taylor1(2) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Requires matplotlib for plotting. Tested with python 27. If you want to try this | |
without plotting, remove the final two lines and the pylab import. The guts only | |
depends on math and will work with vanilla python. | |
""" | |
import math | |
import pylab | |
def probabilities(posn): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2011, Mads A. Elvheim | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the |