Skip to content

Instantly share code, notes, and snippets.

@chausies
chausies / torch_cubic_spline_interp.py
Last active December 19, 2023 15:50
Simple Hermite Cubic Spline Interpolation and Integration implemented in Pytorch (with autograd support and fast runtime)
import torch as T
def h_poly_helper(tt):
A = T.tensor([
[1, 0, -3, 2],
[0, 1, -2, 1],
[0, 0, 3, -2],
[0, 0, -1, 1]
], dtype=tt[-1].dtype)
return [
@agramfort
agramfort / lasso_ista_fista.py
Created January 31, 2016 14:33
Lasso with ISTA and FISTA
#!/usr/bin/env python
#
# Solve LASSO regression problem with ISTA and FISTA
# iterative solvers.
# Author : Alexandre Gramfort, first.last@telecom-paristech.fr
# License BSD
import time
from math import sqrt