Skip to content

Instantly share code, notes, and snippets.

View GiggleLiu's full-sized avatar
🎯
Focusing

Jinguo Liu (刘金国) GiggleLiu

🎯
Focusing
View GitHub Profile
@yegortk
yegortk / L1Convex.jl
Last active January 5, 2024 02:05
Julia implementation of OWL-QN algorithm for large-scale L1-regularized sparse convex optimization
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
@wangleiphy
wangleiphy / spinglass.jl
Last active July 19, 2020 07:33
spin glass ground state energy and entropy
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))
using TaylorSeries, StaticArrays, ForwardDiff
f( (x, y) ) = x^2 + 5x*y + 2y^2
H = zeros(2, 2)
t = Taylor1(2)
@AlexanderFabisch
AlexanderFabisch / JuliaOctaveNumpy.md
Last active July 28, 2023 16:26
Comparison of Julia, NumPy and Octave

Comparison of Julia, Python and Octave

Overview

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

@qubyte
qubyte / walker.py
Created September 23, 2012 04:45
Simple quantum random walk
"""
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):
@Madsy
Madsy / gist:1088393
Created July 18, 2011 02:07
Fixedpoint versions of ln, pow, exp, sqrt and division
/*
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