This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorial_lud [2015/03/02 12:05] guillaume old revision restored (2014/05/30 11:49) |
tutorial_lud [2017/04/19 13:26] waruna [Generating and Testing Alphabets] |
||
---|---|---|---|
Line 2: | Line 2: | ||
The equation for LU Decomposition, | The equation for LU Decomposition, | ||
- | < | + | |
- | $U_{i, | + | /*< |
+ | $$ | ||
+ | | ||
1=i\le j & A_{i,j}\\ | 1=i\le j & A_{i,j}\\ | ||
1<i\le j & A_{i, | 1<i\le j & A_{i, | ||
- | \end{cases} | + | \end{cases}\\ |
L_{i, | L_{i, | ||
- | 1=j\le i & \frac{A_{i, | + | 1 = i\le j & \frac{A_{i, |
- | 1<i\le j & \frac{1}{U_{j, | + | 1< i\le j & \frac{1}{U_{j, |
- | \end{cases}$ | + | \end{cases} |
- | </latex> | + | $$ |
+ | /*<\latex>*/ | ||
+ | |||
+ | |||
+ | [Temp note due to : in the last case of L, the condition is "1 < j <= i"] | ||
=====Writing Alphabets===== | =====Writing Alphabets===== | ||
Line 40: | Line 46: | ||
</ | </ | ||
Now these variable declarations need to be placed at appropriate places to specify whether they are input/ | Now these variable declarations need to be placed at appropriate places to specify whether they are input/ | ||
- | '' | + | '' |
<sxh alphabets; gutter: | <sxh alphabets; gutter: | ||
affine LUD {N|N>0} | affine LUD {N|N>0} | ||
- | given | + | input float A {i, |
- | float A {i, | + | output |
- | returns | + | |
float L {i, | float L {i, | ||
float U {i, | float U {i, | ||
Line 142: | Line 147: | ||
L = case | L = case | ||
| | ||
- | | + | |
esac; | esac; | ||
</ | </ | ||
====Final Alphabets Program==== | ====Final Alphabets Program==== | ||
- | Combine all of the above, and you will get the Alphabets program for LU decomposition. Don't forget the keyword '' | + | Combine all of the above, and you will get the Alphabets program for LU decomposition. Don't forget the keyword |
<sxh alphabets; gutter: | <sxh alphabets; gutter: | ||
affine LUD {N|N>0} | affine LUD {N|N>0} | ||
- | given | + | input |
float A {i, | float A {i, | ||
- | returns | + | output |
float L {i, | float L {i, | ||
float U {i, | float U {i, | ||
- | through | + | let |
| | ||
{|1==i} : A[i,j]; | {|1==i} : A[i,j]; | ||
Line 161: | Line 166: | ||
L = case | L = case | ||
{i,j|1==j} : A / (i, | {i,j|1==j} : A / (i, | ||
- | {i,j|1<i} : (A - reduce(+, (i, | + | {i,j|1<j} : (A - reduce(+, (i, |
esac; | esac; | ||
. | . | ||
Line 168: | Line 173: | ||
Analyses, transformations, | Analyses, transformations, | ||
Given below is an example script for that does several things using the LUD program we wrote above. | Given below is an example script for that does several things using the LUD program we wrote above. | ||
- | <sxh cs; gutter:false> | + | <sxh cs; gutter:true> |
# read program and store the internal representation in variable prog | # read program and store the internal representation in variable prog | ||
prog = ReadAlphabets(" | prog = ReadAlphabets(" |