Skip to content

Instantly share code, notes, and snippets.

@galchinsky
galchinsky / gist:d3509bd488de8d8a44efe8067676d62d
Created September 19, 2022 08:14
approximate unit complex exp: pade + normalization
import numpy as np
def taylor_asin(x):
return x + (x**3)/6 + 3*(x**5)/40
def pade_sin(x):
return (166320*x - 22260*x**3 + 551*x**5)/(166320 + 5460*x**2 + 75*x**4)
def pade_cos(x):
return (15120 - 6900*x**2 + 313*x**4)/(15120 + 660*x**2 + 13*x**4)
import numpy as np
def fastmul(u, m, u_order, phi_order=None):
q = np.imag(u)
if phi_order == 1:
phi = q
elif phi_order == 3:
phi = q + q**3/6
elif phi_order == 5:
phi = q + q**3/6 + 3*q**5/40
import vapoursynth as vs
core = vs.get_core()
ret = core.imwri.Read('jpg-50/%04d.jpg', firstnum=1, alpha=False)
ret = core.fmtc.matrix (clip=ret, mat="601", col_fam=vs.YUV, bits=16)
ret = core.fmtc.resample (clip=ret, css="444")
input = core.fmtc.bitdepth (clip=ret, bits=8)
superF1 = core.fft3dfilter.FFT3DFilter(input,sigma=100.5, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=0.1)
addpath /home/dmitry/caffe/matlab
addpath /home/dmitry/caf
addpath /home/dmitry/caf/TVGP.v2.0/
%model = '/home/dmitry/caffe/models/bvlc_reference_caffenet/deploy.prototxt';
%weights = '/home/dmitry/caffe/models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel';
model = '/home/dmitry/caffe/models/bvlc_googlenet/deploy.prototxt';
weights = '/home/dmitry/caffe/models/bvlc_googlenet/bvlc_googlenet.caffemodel';
import libc;
[T]
Z?(#T) {
var t = libc.getchar();
var z = libc.fopen("/etc/passwd","r");
libc.putchar(t);
libc.fclose(z);
return true;
}
#include "thinCore.h"
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <assert.h>
MatchResultPtr matchInvoke(OverloadPtr overload,
ObjectPtr callable,
llvm::ArrayRef<TypePtr> argsKey)
{
initializePatterns(overload);
PatternReseter reseter(overload);
if (!unifyPatternObj(overload->callablePattern, callable))
return new MatchCallableError(overload->target, callable);
void initializeLambda(LambdaPtr x, EnvPtr env)
{
assert(!x->initialized);
x->initialized = true;
string lname = lambdaName(x);
llvm::SmallString<128> buf;
llvm::raw_svector_ostream ostr(buf);
@galchinsky
galchinsky / gist:3969841
Created October 28, 2012 20:42
failed tests
[lib-clay/printing/lambdas]
Failure: out.txt mismatch
Diff-Stdout:
--- out.txt
+++ stdout
@@ -1,8 +1,8 @@
(x -> x)
-(x -> x + a)
+Lambda[(x -> x + a), Tuple[Pointer[Int32]]]([0x7fff4d1fe0ec])
import core.values;
import vectors;
import sequences;
import sequences.operators;
import algorithms;
define fmap(f, a);
functor?(A) = CallDefined(fmap, f, A);
[S when Sequence?(S)]