Skip to content

Commit

Permalink
updates to reflect newly added trsm routines
Browse files Browse the repository at this point in the history
  • Loading branch information
rosatamsen committed Jul 28, 2014
1 parent 989ba2f commit 04fdace
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"name": ""
"name": "",
"signature": "sha256:7f169ffa2b84ca3f9ed0b601f473c5f4a8931da522172eb74c531a4efb9ce838"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand Down Expand Up @@ -28,12 +29,16 @@
"Here is a list of laff routines that you might want to use in this notebook:\n",
"<ul>\n",
"<li> <code>laff.trsv( uplo, trans, diag, A, b )</code> Solves $Ax = b$ where $x$ and $b$ are vectors.\n",
"<li> <code>laff.trsm( uplo, trans, diag, A, B )</code> Solves $AX = B$ where $X$ and $B$ are matrices.\n",
"<li> <code>laff.trsm( side, uplo, trans, diag, A, B )</code> \n",
"<ul>\n",
"<li>\n",
"Solves $AX = B$ where $X$ and $B$ are matrices when <code> side='Left' </code> (overwriting $ B $ with $ X $). $ A $ is an upper or lower triangular matrix, as indicated by <code> uplo </code>.\n",
"<li>\n",
"Solves $XA = B$ where $X$ and $B$ are matrices when <code> side='Right' </code> (overwriting $ B $ with $ X $).\n",
"</ul>\n",
"<li> <code>laff.gemm( alpha, A, B, beta, C )</code> $C := \\alpha A B + \\beta C$\n",
"</ul>\n",
"\n",
"These three methods were added to the laff library after the course started. If you're having problems with git and are manually downloading the notebooks, check the wiki page for notebooks for help on getting updated laff routines as well.\n",
"\n",
"\n",
"And last but not least, __*copy and paste your method from 6.3 Solving A x b via LU factorization and triangular solves into the box below.*__ We'll be using it during this notebook. Recall that it overwrites $A$ with $L$ in the strictly lower triangular part and $U$ in the upper triangular part.\n",
"<font color=red> Make sure you call the routine LU_unb_var5 </font>\n",
Expand Down Expand Up @@ -175,8 +180,8 @@
" #------------------------------------------------------------#\n",
"\n",
" LU_unb_var5( A11 )\n",
" laff.trsm( 'Lower triangular', 'No transpose', 'Unit diagonal', A11, A12 )\n",
" laff.trsm( 'Upper triangular', 'Transpose', 'Nonunit diagonal', A11, A21 )\n",
" laff.trsm( 'Left', 'Lower triangular', 'No transpose', 'Unit diagonal', A11, A12 )\n",
" laff.trsm( 'Right', 'Upper triangular', 'Transpose', 'Nonunit diagonal', A11, A21 )\n",
" laff.gemm( -1.0, A21, A12, 1.0, A22 )\n",
"\n",
" #------------------------------------------------------------#\n",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"metadata": {
"name": ""
"name": "",
"signature": "sha256:7af5e8baef6f66b125b53267c12a3b0349f3261c788d063348cf353dd557cf7a"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand Down Expand Up @@ -28,12 +29,16 @@
"Here is a list of laff routines that you might want to use in this notebook:\n",
"<ul>\n",
"<li> <code>laff.trsv( uplo, trans, diag, A, b )</code> Solves $Ax = b$ where $x$ and $b$ are vectors.\n",
"<li> <code>laff.trsm( uplo, trans, diag, A, B )</code> Solves $AX = B$ where $X$ and $B$ are matrices.\n",
"<li> <code>laff.trsm( side, uplo, trans, diag, A, B )</code> \n",
"<ul>\n",
"<li>\n",
"Solves $AX = B$ where $X$ and $B$ are matrices when <code> side='Left' </code> (overwriting $ B $ with $ X $). $ A $ is an upper or lower triangular matrix, as indicated by <code> uplo </code>.\n",
"<li>\n",
"Solves $XA = B$ where $X$ and $B$ are matrices when <code> side='Right' </code> (overwriting $ B $ with $ X $).\n",
"</ul>\n",
"<li> <code>laff.gemm( alpha, A, B, beta, C )</code> $C := \\alpha A B + \\beta C$\n",
"</ul>\n",
"\n",
"These three methods were added to the laff library after the course started. If you're having problems with git and are manually downloading the notebooks, check the wiki page for notebooks for help on getting updated laff routines as well.\n",
"\n",
"\n",
"And last but not least, __*copy and paste your method from 6.3 Solving A x b via LU factorization and triangular solves into the box below.*__ We'll be using it during this notebook. Recall that it overwrites $A$ with $L$ in the strictly lower triangular part and $U$ in the upper triangular part.\n",
"<font color=red> Make sure you call the routine LU_unb_var5 </font>\n",
Expand All @@ -44,8 +49,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
"# Insert your code for LU_unb_var5 from\n",
"# 6.3 Solving A x b via LU factorization and triangular solves"
"# Copy routine here\n",
"\n"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -123,7 +128,9 @@
"cell_type": "code",
"collapsed": false,
"input": [
"# Insert code here"
"# insert code\n",
"\n",
"\n"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -218,10 +225,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
"def Solve( A, b ):\n",
" \n",
" # insert appropriate calls to routines you have written here!\n",
" # remember the variable nb holds our block size"
"# insert code here\n",
"\n"
],
"language": "python",
"metadata": {},
Expand Down Expand Up @@ -279,9 +284,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
"# insert appropriate calls here\n",
"# insert appropriate calls here.\n",
"\n",
"laff.trsv( 'Lower triangular', 'No transpose', 'Unit diagonal', A, b2 )\n",
"laff.trsv( 'Upper triangular', 'No transpose', 'Nonunit diagonal', A, b2 )\n",
"\n",
"# Test your calls\n",
"print( '2-Norm of updated b2 - original x2' )\n",
"print( np.linalg.norm(b2 - x2) )"
],
Expand Down

0 comments on commit 04fdace

Please sign in to comment.