summaryrefslogtreecommitdiff
path: root/2.3-1/src/c/linearAlgebra/schur
diff options
context:
space:
mode:
authorsiddhu89902017-02-07 16:16:31 +0530
committersiddhu89902017-02-07 16:16:31 +0530
commite59107e6bb2695fc20fd0ab229e296b9bf739fc4 (patch)
tree5bedc90e7bc88bb86b10a33839887eeb3e2f39cf /2.3-1/src/c/linearAlgebra/schur
parent1fef9b1edc2d4400e8ba6bb6fafb648963d6817d (diff)
downloadScilab2C-e59107e6bb2695fc20fd0ab229e296b9bf739fc4.tar.gz
Scilab2C-e59107e6bb2695fc20fd0ab229e296b9bf739fc4.tar.bz2
Scilab2C-e59107e6bb2695fc20fd0ab229e296b9bf739fc4.zip
Support for 'lqr' and 'lqe' added
Diffstat (limited to '2.3-1/src/c/linearAlgebra/schur')
-rw-r--r--2.3-1/src/c/linearAlgebra/schur/dgschura.c17
-rw-r--r--2.3-1/src/c/linearAlgebra/schur/dschura.c25
2 files changed, 33 insertions, 9 deletions
diff --git a/2.3-1/src/c/linearAlgebra/schur/dgschura.c b/2.3-1/src/c/linearAlgebra/schur/dgschura.c
index 56d48455..f17da8c8 100644
--- a/2.3-1/src/c/linearAlgebra/schur/dgschura.c
+++ b/2.3-1/src/c/linearAlgebra/schur/dgschura.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 selctg2( double* in1, double* in2, double* in3);
+lapack_logical selctg21( double* in1, double* in2, double* in3);
+lapack_logical selctg22( double* in1, double* in2, double* in3);
double dgschura(double* in1, int size, double* in2, int flag, int nout, \
double* out1, double* out2, double* out3, double* out4)
@@ -40,7 +41,7 @@ double dgschura(double* in1, int size, double* in2, int flag, int nout, \
modifies the input variable*/
/*Used incase of flag > 0*/
- LAPACK_D_SELECT3 selctg = &selctg2;
+ LAPACK_D_SELECT3 selctg = &selctg21;
if(nout >= 2){
JOBVSL = 'V';
@@ -143,7 +144,15 @@ double dgschura(double* in1, int size, double* in2, int flag, int nout, \
return ret;
}
-lapack_logical selctg2(double* in1, double* in2, double* in3)
+lapack_logical selctg21(double* in1, double* in2, double* in3)
+{
+ if((sqrt(*in1**in1+*in2**in2)/ *in3) < 1)
+ return 1;
+ else
+ return 0;
+}
+
+lapack_logical selctg22(double* in1, double* in2, double* in3)
{
if((sqrt(*in1**in1+*in2**in2)/ *in3) < 1)
return 1;
diff --git a/2.3-1/src/c/linearAlgebra/schur/dschura.c b/2.3-1/src/c/linearAlgebra/schur/dschura.c
index c31ddca2..79c41976 100644
--- a/2.3-1/src/c/linearAlgebra/schur/dschura.c
+++ b/2.3-1/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)