Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [],
- "source": [
- "import clifford as cf\n",
- "import numpy as np\n",
- "import timeit\n",
- "layout,blades = cf.Cl(5)\n",
- "n_dims = len(layout.blades)+1"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "def setup(n_dims):\n",
- " a = cf.MultiVector(layout,value=np.random.rand(n_dims))\n",
- " b = cf.MultiVector(layout,value=np.random.rand(n_dims))\n",
- " return (a, b)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "5.86 µs ± 243 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
- ]
- }
- ],
- "source": [
- "%%timeit a,b = setup(n_dims)\n",
- "a*b"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [],
- "source": [
- "layout,blades = cf.Cl(4,1)\n",
- "n_dims = len(layout.blades)+1"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [],
- "source": [
- "def setup(n_dims):\n",
- " a = cf.MultiVector(layout,value=np.random.rand(n_dims))\n",
- " b = cf.MultiVector(layout,value=np.random.rand(n_dims))\n",
- " return (a, b)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "5.85 µs ± 104 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
- ]
- }
- ],
- "source": [
- "%%timeit a,b = setup(n_dims)\n",
- "a*b"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.5.2"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
Add Comment
Please, Sign In to add comment