Created
October 27, 2022 05:43
-
-
Save kyamagu/e301b61f9931da0196afe457b4f87023 to your computer and use it in GitHub Desktop.
sqrtm-benchmark.ipynb
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
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"authorship_tag": "ABX9TyNxHH+bS4/yEcMDZopPmySU", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/kyamagu/e301b61f9931da0196afe457b4f87023/sqrtm-benchmark.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 312 | |
}, | |
"id": "d62TGneO9MJp", | |
"outputId": "911fd622-ff4b-49a4-f917-202bf817088e" | |
}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"tensorflow version = 2.9.2\n" | |
] | |
}, | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
], | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCAYAAABhffzLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+WH4yJAAAgAElEQVR4nO3deXhV1dX48e/KH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VVRV5eHtdccw0Ab7zxBomJiVRXV1NZWUn37k3ytD9jTBP583vreG/1Xh64vB+X9m8fkHOEbHdOf797aw1rdx/52nKPx0N0dHSjjtmvY0se+u55J13/8MMPs3r1alasWMHcuXN59dVXWbJkCarKlVdeyYIFCzjnnHPYuHEjL730Es888wzXX389r732GrfccgsPP/wwW7duJT4+nqKiIgAeeughBg8ezOuvv84nn3zC+PHjWbFiBQBr167l008/JTExkW3btnHFFVccW/fcc88Bvp5OEydO5OOPP6Z3796MHz+eJ598kjvvvPPYtgsXLqR///7k5eVRW1vLsGHDGvX+GGOa3szPt/HMwq1MHJnJ5FGZATuP1fibwNy5c5k7dy6DBw/m/PPPZ/369WzcuBGAbt26MWjQIACGDBnCtm3bAMjKyuLmm29m1qxZxMT4vn8//fRTxo0bB8BFF11EYWEhR474vtCuvPJKEhMTTxnHxo0b6datG7179wZgwoQJLFiwgJiYGHr06MG6detYsmQJP/vZz1iwYAELFy7kggsuaPL3wxhz5j5et4+pb65hbN92/PaKfgHtXRcWNf6T1cyb6wYuVeX+++/njjvuOGH5tm3biI+PPzYfHR19rKnnnXfeYcGCBbz11lv86U9/YtWqVac8x9kO23rhhRfy3nvvERsby9ixY5k4cSIej4dHH330rI5rjDl7qwqKufPF5fTvlMrjNw4mOiqwXaqtxt9IKSkplJSUAHDJJZcwbdo0Skt9V9937drF/v37T7qv1+tl586djBkzhkceeYTi4mJKS0u54IILeOGFFwDfUK3p6em0bNmywTH16tWLbdu2sWnTJgCef/55vvnNbwJwwQUX8Le//Y0RI0bQtm1bCgsL2bBhA/37929U+Y0xTeNghZfJM/JokxTHsxOyaREX+Pp4WNT43ZCWlsaoUaPo378/l112GTfddBMjRowAIDk5mVmzZp30+oLH4+GWW26huLgYVeXuu++mVatWTJ06lcmTJ5OVlUWLFi2YMWPGGcWUkJBAbm4u1113HbW1teTk5PCDH/wAgGHDhrFv3z4uvPBCwNfUtHfvXrtZyxgXFVfU8NjSSipro3nxtmG0S0lolvOKqjbLic5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uQsNAAAAAElFTkSuQmCC\n" | |
}, | |
"metadata": { | |
"needs_background": "light" | |
} | |
} | |
], | |
"source": [ | |
"import timeit\n", | |
"\n", | |
"import matplotlib.pyplot as plt\n", | |
"import scipy.linalg\n", | |
"import tensorflow as tf\n", | |
"\n", | |
"print(\"tensorflow version = {}\".format(tf.__version__))\n", | |
"\n", | |
"sizes = 2 ** tf.range(1, 10) # Matrix size.\n", | |
"functions = [tf.linalg.sqrtm, scipy.linalg.sqrtm] # TF and scipy impl.\n", | |
"\n", | |
"# Measure time.\n", | |
"result = dict()\n", | |
"for size in sizes:\n", | |
" X = tf.eye(size, dtype=tf.float64) + 1e-2 * tf.random.normal((size, size), dtype=tf.float64)\n", | |
" X = tf.cast(X, tf.complex128)\n", | |
" for func in functions:\n", | |
" elapsed = timeit.timeit(lambda: func(X), number=3)\n", | |
" result.setdefault(func.__module__, []).append(elapsed)\n", | |
"\n", | |
"# Plot results.\n", | |
"for key in result:\n", | |
" plt.plot(sizes, result[key])\n", | |
"plt.legend([key.split(\".\")[0] for key in result.keys()])\n", | |
"plt.title(\"execution time\")\n", | |
"plt.ylabel(\"seconds\")\n", | |
"plt.xlabel(\"matrix size\")\n", | |
"plt.grid(True)\n", | |
"plt.show()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [], | |
"metadata": { | |
"id": "Bf5Cyspq9Yqz" | |
}, | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment