diff options
author | siddhu8990 | 2017-02-07 16:16:31 +0530 |
---|---|---|
committer | siddhu8990 | 2017-02-07 16:16:31 +0530 |
commit | e7dba33a909e158dffc6ddb3361df10d427db631 (patch) | |
tree | d71a27ff842d6088798ce8a0db16decb1fe10853 /src/c/linearAlgebra/schur/dschura.c | |
parent | 765d9c44f94634406eeff50e20e8cdfcf1b7699c (diff) | |
download | scilab2c-e7dba33a909e158dffc6ddb3361df10d427db631.tar.gz scilab2c-e7dba33a909e158dffc6ddb3361df10d427db631.tar.bz2 scilab2c-e7dba33a909e158dffc6ddb3361df10d427db631.zip |
Support for 'lqr' and 'lqe' added
Diffstat (limited to 'src/c/linearAlgebra/schur/dschura.c')
-rw-r--r-- | src/c/linearAlgebra/schur/dschura.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/c/linearAlgebra/schur/dschura.c b/src/c/linearAlgebra/schur/dschura.c index c31ddca2..79c41976 100644 --- a/src/c/linearAlgebra/schur/dschura.c +++ b/src/c/linearAlgebra/schur/dschura.c @@ -15,14 +15,15 @@ #include "lapack.h" #include "stdlib.h" #include "string.h" - +#include <math.h> /*flag --> 0: nothing --> 1: continuous --> 2: discrete */ -lapack_logical selctg1( double* in1, double* in2); +lapack_logical selctg11( double* in1, double* in2); +lapack_logical selctg12( double* in1, double* in2); double dschura(double* in1, int size, int flag, int nout, double* out1, \ double* out2) @@ -38,9 +39,15 @@ double dschura(double* in1, int size, int flag, int nout, double* out1, \ double *buf; /*input is copied to buf, since lapack function direclty modifies the input variable*/ - /*Used incase of flag > 0*/ - LAPACK_D_SELECT2 selctg = &selctg1; + /*Used incase of flag > 0*/ + LAPACK_D_SELECT2 selctg; + + if(flag == 1 || flag == 0) + selctg = &selctg11; + else if(flag == 2) + selctg = &selctg12; + if(nout >= 2) JOBVS = 'V'; if(flag > 0) SORT = 'S'; @@ -101,7 +108,15 @@ double dschura(double* in1, int size, int flag, int nout, double* out1, \ return ret; } -lapack_logical selctg1(double* in1, double* in2) +lapack_logical selctg11(double* in1, double* in2) +{ + if(*in1 <= 0) + return 1; + else + return 0; +} + +lapack_logical selctg12(double* in1, double* in2) { if(sqrt(*in1**in1+*in2**in2) < 1) |