tutorial_subsystem

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision | ||

tutorial_subsystem [2014/07/14 11:29] guillaume [Syntax of Use Equation (without extension domain)] |
tutorial_subsystem [2014/07/14 11:59] guillaume [Transformations involving subsystems] Commands added |
||
---|---|---|---|

Line 21: | Line 21: | ||

</sxh> | </sxh> | ||

- | However, let us assume that you already have another Alpha system which computes the sum of the elements of a vector. It is possible to use this affine system (instead of rewriting its equation in the main system), by calling it through a "use equation": | + | However, let us assume that you already have another Alpha system which computes the sum of the elements of a vector. It is possible to use this affine system (instead of rewriting its equation in the main system), by calling it through a **use equation**: |

<sxh alphabets; gutter:false> | <sxh alphabets; gutter:false> | ||

affine sum {P| P>0} // Computes the sum of the elements of a vector of size P | affine sum {P| P>0} // Computes the sum of the elements of a vector of size P | ||

Line 60: | Line 60: | ||

- | Let us assume that you have a system which computes a dot product between two vectors: | + | Let us assume that you have a system which computes a dot product of two vectors: |

<sxh alphabets; gutter:false> | <sxh alphabets; gutter:false> | ||

affine dotProduct {N | N>0} | affine dotProduct {N | N>0} | ||

Line 73: | Line 73: | ||

</sxh> | </sxh> | ||

- | If you want to compute a matrix vector multiplication using this affine system, you will need to call it once per rows of the matrix. Thus, you will need a parametrised number of call to the "dotProduct" system. | + | If you want to compute a matrix vector multiplication using this affine system, you will need to instanciate it once per rows of the matrix. Thus, you will need a parametrised number of call to the "dotProduct" system. |

It is possible to do it by using an extension domain: | It is possible to do it by using an extension domain: | ||

Line 94: | Line 94: | ||

float vectRes {i | 0<=i<R}; | float vectRes {i | 0<=i<R}; | ||

let | let | ||

- | use {k | 0<=k<R} dotProduct[R] ( (k,j->k,j)@mat, (k,j->j)@vect) returns (vectRes); | + | use {k | 0<=k<R} dotProduct[R] ( mat, (k,j->j)@vect) returns (vectRes); |

. | . | ||

</sxh> | </sxh> | ||

- | The set "{k | 0<=k<R}" before the subsystem name is called an extension domain. We are calling the system "dotProduct" once, for each instance of "k" in the extension domain. We can use the indexes of the extension domain to parametrize the parameters, inputs given to the subsystem and the outputs computed by the subsystem: | + | The set "{k | 0≤k<R}" before the subsystem name is called the **extension domain**. We are calling the system "dotProduct" once, for each instance of "k" in the extension domain. We can use the indexes of the extension domain to parametrize the parameters, inputs given to the subsystem and the outputs computed by the subsystem: |

- the indexes can be used to specify the parameters (ex: "R+k") | - the indexes can be used to specify the parameters (ex: "R+k") | ||

- | - the first dimensions of the input expressions correspond to the dimensions of the extension domain. For a given subsystem call kInst, the corresponding input sent is the one where the first dimensions are set to "kInst" (ex: in the previous example, the third call to "dotProduct" will obtain "(j->3,j)@mat" and "(j->j)@vect" as inputs). | + | - the first dimensions of the input expressions correspond to the dimensions of the extension domain. For example, each row of "mat" will be sent to a different instance of the subsystem (ex: in the previous example, the third instance of "dotProduct" will receive "(j->3,j)@mat" and "(j->j)@vect" as inputs). |

- the first dimensions of the output variables correspond to the dimensions of the extension domain. All the results from every subsystem call are gathered inside common variables (ex: "vectRes[3]" is the output of the third instance of "dotProduct") | - the first dimensions of the output variables correspond to the dimensions of the extension domain. All the results from every subsystem call are gathered inside common variables (ex: "vectRes[3]" is the output of the third instance of "dotProduct") | ||

Line 110: | Line 110: | ||

**InlineSubSystem:** Inline the equations of a subsystem inside the affine system calling it. The use equation of the main system is replaced by the equations of the subsystem (which are adapted), and new local variables are added. | **InlineSubSystem:** Inline the equations of a subsystem inside the affine system calling it. The use equation of the main system is replaced by the equations of the subsystem (which are adapted), and new local variables are added. | ||

+ | |||

+ | The command is: ''void InlineSubSystem(Program program, String systemName, String label)'' where ''label'' is the label of the inlined use equation. | ||

+ | |||

**OutlineSubSystem:** Given a list of equations of an affine systemm, outline them inside a new system and replace these equation by a use equation. The current version (July 2014) do not allow to specify an extension domain, however this is a work in progress. | **OutlineSubSystem:** Given a list of equations of an affine systemm, outline them inside a new system and replace these equation by a use equation. The current version (July 2014) do not allow to specify an extension domain, however this is a work in progress. | ||

+ | |||

+ | The command is ''void OutlineSubSystem(Program program, String system, String listEquations)'' where ''listEquations'' is the list of label of the equations to be outlined. |

tutorial_subsystem.txt · Last modified: 2017/04/19 13:31 (external edit)