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
(defun prepend-to-path (&rest paths) | |
(map 'nil (lambda (path) | |
(let ((old-paths (getenv "PATH"))) | |
(if (and old-paths (not (equal old-paths ""))) | |
(if (not (member path (split-string old-paths ":"))) | |
(setenv "PATH" (concat path ":" old-paths))) | |
(setenv "PATH" path))) | |
(if (not (member path exec-path)) | |
(setq exec-path (cons path exec-path)))) | |
(reverse (prune-directory-list paths))) |
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
(require 'my-xml) | |
(add-hook 'js-mode-hook 'configure-tabs) | |
(add-hook 'nxml-mode-hook 'configure-tabs) | |
(defun configure-tabs () | |
(setq indent-tabs-mode nil)) | |
(setq indent-tabs-mode nil) |
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
x = tf.complex(tf.random.normal((2, 1)), tf.random.normal((2, 1))) | |
quantum_bit = x / tf.sqrt(tf.reduce_sum(tf.math.conj(x) * 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
# First we create a random complex vector | |
x = tf.complex(tf.random.normal((2, 1)), tf.random.normal((2, 1))) | |
# Then we normalize it | |
quantum_bit = x / tf.sqrt(tf.reduce_sum(tf.math.conj(x) * 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
@tf.function | |
def unitary_from_real(m): | |
def ihermitian_element(m, idx, jdx): | |
if idx == jdx: | |
return tf.complex(0., m[idx][jdx]) | |
elif idx < jdx: | |
return tf.complex(-m[jdx][idx], m[idx][jdx]) | |
else: | |
return tf.complex(m[idx][jdx], m[jdx][idx]) | |
N = m.shape[0] |
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
@tf.function | |
def unitary_from_real(m): | |
def ihermitian_element(m, idx, jdx): | |
if idx == jdx: | |
return tf.complex(0., m[idx][jdx]) | |
elif idx < jdx: | |
return tf.complex(-m[jdx][idx], m[idx][jdx]) | |
else: | |
return tf.complex(m[idx][jdx], m[jdx][idx]) | |
N = m.shape[0] |
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
@tf.function | |
def unitary_from_real(m): | |
"""Create a unitary matrix with dimensions equal to real matrix `m`""" | |
return tf.linalg.expm(tf.complex(tf.transpose(m) - m, tf.transpose(m) + m)) |
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
/* A simple function to test */ | |
function sum(a, b) { | |
return a + b; | |
} | |
export default sum | |
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
/* A Simple test */ | |
import sum from './sum' | |
test('adds 1 + 2 to equal 3', () => { | |
expect(sum(1, 2)).toBe(3); | |
}); | |
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
const webpack = require('webpack'); | |
const nodeExternals = require('webpack-node-externals'); | |
module.exports = { | |
entry: './sum.test.js', | |
output: { | |
filename: 'bundle.test.js' | |
}, | |
optimization: { | |
minimize: false, | |
}, |
OlderNewer