Matrix containing variables is created as constant
If a matrix definition contains a variable it is defined as constant. This creates wrong results if the matrix was modified in any situation. Also ports are always passed as a constant value.
Example:
ports in Q in1,
out Q out1;
implementation Math{
Q^{3} A = [0, in1, 1];
out1 = sum(A);
}
creates C++ code:
class test_portInMatrixDefinition{
public:
double in1;
double out1;
rowvec CONSTANTCONSTANTVECTOR0;
void init()
{
CONSTANTCONSTANTVECTOR0 = rowvec(3);
CONSTANTCONSTANTVECTOR0(0,0) = 0;
CONSTANTCONSTANTVECTOR0(0,1) = in1;
CONSTANTCONSTANTVECTOR0(0,2) = 1;
}
void execute()
{
colvec A = CONSTANTCONSTANTVECTOR0;
out1 = (accu(A));
}