- Complex Normalization Function
def normalize(self, z):
rho = th.abs(z)
theta = th.atan2(th.imag(z), th.real(z))
return th.tanh(rho) * (th.cos(theta) + 1.0j * th.sin(theta))This function maps complex values onto a curved manifold by:
| import math | |
| import os | |
| import sys | |
| import numpy as np | |
| from PIL import Image | |
| ########################################################################################### | |
| # script to generate moving mnist video dataset (frame by frame) as described in |
| import numpy as np | |
| def find_closest_orthogonal_matrix(A): | |
| ''' | |
| Find closest orthogonal matrix to *A* using iterative method. | |
| Bases on the code from REMOVE_SOURCE_LEAKAGE function from OSL Matlab package. | |
| Args: | |
| A (numpy.array): array shaped k, n, where k is number of channels, n - data points |
\usepackage{tkz-euclide} % checked for version 3.02c| (ns xml.test | |
| (:require [clojure.java.io :as io] | |
| [clojure.data.xml :as xml])) | |
| ;; wget | |
| ;; download.geofabrik.de/openstreetmap/north-america/us/maryland.osm.bz2 | |
| (def xml-seq | |
| #(-> (io/file "/home/gary/dev/maryland.osm") | |
| io/input-stream |
| - certain endpoints are always blocked | |
| if nginx_uri == "/_access_token" or nginx_uri == "/_me" then | |
| ngx.exit(403) | |
| end | |
| -- import requirements | |
| local cjson = require "cjson" | |
| -- setup some app-level vars | |
| local app_id = "APP_ID" |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
| (fn [] (let [s "(fn [] (let [s %s] (format s (pr-str s))))"] (format s (pr-str s)))) |
| # Run me with: | |
| # | |
| # $ nginx -p /path/to/this/file/ -c nginx.conf | |
| # | |
| # All requests are then routed to authenticated user's index, so | |
| # | |
| # GET http://user:password@localhost:8080/_search?q=* | |
| # | |
| # is rewritten to: | |
| # |
| var fs = require('fs'); | |
| /** | |
| * Offers functionality similar to mkdir -p | |
| * | |
| * Asynchronous operation. No arguments other than a possible exception | |
| * are given to the completion callback. | |
| */ | |
| function mkdir_p(path, mode, callback, position) { | |
| mode = mode || 0777; |