From 1d4130d7b62752091d9bbb9ce15fda10d4353b97 Mon Sep 17 00:00:00 2001 From: Kees van Kempen Date: Wed, 30 Mar 2022 09:19:00 +0200 Subject: [PATCH] Final: WIP: Fix comments in task 3.1 and execution numbers --- ...l - Tight-binding propagation method.ipynb | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Final/Final - Tight-binding propagation method.ipynb b/Final/Final - Tight-binding propagation method.ipynb index f476ce7..678da53 100644 --- a/Final/Final - Tight-binding propagation method.ipynb +++ b/Final/Final - Tight-binding propagation method.ipynb @@ -86,7 +86,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 1, "metadata": { "deletable": false, "nbgrader": { @@ -135,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 2, "metadata": { "deletable": false, "nbgrader": { @@ -202,7 +202,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 3, "metadata": { "deletable": false, "nbgrader": { @@ -289,7 +289,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 4, "metadata": { "deletable": false, "nbgrader": { @@ -342,7 +342,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 5, "metadata": { "deletable": false, "nbgrader": { @@ -398,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": { "deletable": false, "nbgrader": { @@ -606,7 +606,7 @@ }, { "cell_type": "code", - "execution_count": 118, + "execution_count": 7, "metadata": { "deletable": false, "nbgrader": { @@ -640,9 +640,12 @@ " for x_i in positions:\n", " ret += -1./(np.abs(x - x_i) + 0.001)\n", " return ret\n", - " # Instead of using a loop, one could vectorize the problem by calculating all sum\n", - " # elements in a len(x) by len(positions) matrix and then summing along the rows.\n", + " # Instead of using a loop, one could vectorize the problem further by calculating all sum\n", + " # terms as elements of a len(x) by len(positions) matrix and then summing along the rows.\n", " # In testing I found that this was slower than using the loop, so I commented it out.\n", + " # This might be due to the large memory overhead O(len(x)*len(positions)), and the fact that\n", + " # the len(positions) iterations already do vectorized calculations on len(x) >> len(positions)\n", + " # numbers, making the theoretical speed gain only plausible at larger len(positions). \n", " #V = lambda x: np.sum( -1/( np.abs(np.subtract.outer(x, positions)) + 0.001 ), axis=1 )\n", " \n", " integrand = lambda x: atomic_basis(x, positions[i], sigma)*V(x)*atomic_basis(x, positions[j], sigma)\n", @@ -660,7 +663,7 @@ }, { "cell_type": "code", - "execution_count": 119, + "execution_count": 8, "metadata": { "deletable": false, "nbgrader": {