This shows you the differences between two versions of the page.
change_of_basis [2017/04/19 14:15] |
change_of_basis [2017/04/19 14:15] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Change of Basis ====== | ||
+ | Change of basis is a useful transformation in a lot of aspect. This page shows how to use command CoB to apply change of basis on a program. | ||
+ | ===== Usage ===== | ||
+ | Here is the usage for CoB: | ||
+ | <sxh cs; gutter: | ||
+ | CoB(Program program, String systemName, String varName, String function) | ||
+ | </ | ||
+ | The meaning for each parameters are: | ||
+ | * program: the program you are processing. | ||
+ | * systemName: the name for the system you want to solve. | ||
+ | * varName: the name for the variable you want to apply change of basis on. | ||
+ | * function: change of basis function. | ||
+ | ===== Example ===== | ||
+ | The following example does a matrix multiplication, | ||
+ | <sxh ab; gutter: | ||
+ | affine matrix_product {P, Q, R|P>0 && Q>0 && R>0} | ||
+ | given float A {i,k| 0< | ||
+ | float B {k,j| 0< | ||
+ | returns | ||
+ | using // Using an accumulator locally | ||
+ | float temp_C {i, | ||
+ | through | ||
+ | temp_C = case | ||
+ | | ||
+ | | ||
+ | esac; | ||
+ | C = (i, | ||
+ | . | ||
+ | </ | ||
+ | Now we are going to apply change of basis on variable " | ||
+ | <sxh cs; gutter: | ||
+ | prog = ReadAlphabets(" | ||
+ | system = " | ||
+ | CoB(prog, system, " | ||
+ | </ | ||
+ | |||
+ | The result for this transformation is shown below: | ||
+ | <sxh ab; gutter: | ||
+ | affine matrix_product {P, Q, R|P>0 && Q>0 && R>0} | ||
+ | given float A {i,k| 0< | ||
+ | float B {k,j| 0< | ||
+ | returns | ||
+ | using // Using an accumulator locally | ||
+ | float temp_C {i, | ||
+ | through | ||
+ | temp_C = (i, | ||
+ | {i, | ||
+ | {i,j,k|k== 0} : (i, | ||
+ | esac; | ||
+ | C = (i, | ||
+ | . | ||
+ | </ | ||
+ | We applied the change of basis function (i, | ||
+ | <sxh ab; gutter: | ||
+ | float temp_C {i, | ||
+ | </ | ||
+ | to | ||
+ | <sxh ab; gutter: | ||
+ | float temp_C {i, | ||
+ | </ | ||
+ | And all the access functions for temp_C is composed with function (i, | ||
+ | <sxh ab; gutter: | ||
+ | C = (i, | ||
+ | </ | ||
+ | to | ||
+ | <sxh ab; gutter: | ||
+ | C = (i, | ||
+ | </ | ||