summaryrefslogtreecommitdiff
path: root/tests/general_tests/lsqnonneg
diff options
context:
space:
mode:
Diffstat (limited to 'tests/general_tests/lsqnonneg')
-rw-r--r--tests/general_tests/lsqnonneg/lsqnonneg_C.sce20
-rw-r--r--tests/general_tests/lsqnonneg/lsqnonneg_input1.sce19
-rw-r--r--tests/general_tests/lsqnonneg/lsqnonneg_input2.sce22
-rw-r--r--tests/general_tests/lsqnonneg/lsqnonneg_logical.sce40
-rw-r--r--tests/general_tests/lsqnonneg/lsqnonneg_param1.sce21
-rw-r--r--tests/general_tests/lsqnonneg/lsqnonneg_param2.sce21
6 files changed, 143 insertions, 0 deletions
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_C.sce b/tests/general_tests/lsqnonneg/lsqnonneg_C.sce
new file mode 100644
index 0000000..f792559
--- /dev/null
+++ b/tests/general_tests/lsqnonneg/lsqnonneg_C.sce
@@ -0,0 +1,20 @@
+// Check for the size of C and d
+C = [
+ 0.0372 0.2869
+ 0.6861 0.7071
+ 0.6233 0.6245
+ 0.6344 0.6170];
+d = [
+ 0.8587
+ 0.1781
+ 0.0747
+ 0.8405
+ 0.2356];
+
+// Error
+//lsqlin: The number of rows in C must be equal the number of elements of d
+//at line 106 of function lsqnonneg called by :
+// [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d)
+
+ [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d)
+
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce b/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce
new file mode 100644
index 0000000..eb0aafc
--- /dev/null
+++ b/tests/general_tests/lsqnonneg/lsqnonneg_input1.sce
@@ -0,0 +1,19 @@
+// Check for the input arguments
+C = [
+ 0.0372 0.2869
+ 0.6861 0.7071
+ 0.6233 0.6245
+ 0.6344 0.6170];
+d = [
+ 0.8587
+ 0.1781
+ 0.0747
+ 0.8405];
+
+// Error
+//lsqlin: Unexpected number of input arguments : 1 provided while should be in the set of [2 3]
+//at line 55 of function lsqnonneg called by :
+// [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C)
+
+ [xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C)
+
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce b/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce
new file mode 100644
index 0000000..2d2e557
--- /dev/null
+++ b/tests/general_tests/lsqnonneg/lsqnonneg_input2.sce
@@ -0,0 +1,22 @@
+// Check for the input arguments
+C = [
+ 0.0372 0.2869
+ 0.6861 0.7071
+ 0.6233 0.6245
+ 0.6344 0.6170];
+d = [
+ 0.8587
+ 0.1781
+ 0.0747
+ 0.8405];
+
+param = list();
+x0 = [0 0];
+
+//Error
+//lsqnonneg: Unexpected number of input arguments : 4 provided while should be in the set of [2 3]
+//at line 55 of function lsqnonneg called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,param,x0)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,param,x0)
+
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce b/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce
new file mode 100644
index 0000000..15106f0
--- /dev/null
+++ b/tests/general_tests/lsqnonneg/lsqnonneg_logical.sce
@@ -0,0 +1,40 @@
+// An example with C and d as input
+C = [
+ 0.0372 0.2869
+ 0.6861 0.7071
+ 0.6233 0.6245
+ 0.6344 0.6170];
+d = [
+ 0.8587
+ 0.1781
+ 0.0747
+ 0.8405];
+
+//Output
+//Optimal Solution Found.
+// lambda =
+//
+// lower: [0.1506118,1.441D-11]
+// upper: [0,0]
+// output =
+//
+// Iterations: 5
+// exitflag =
+//
+// 0
+// residual =
+//
+// 0.6598971
+// - 0.3118739
+// - 0.3580375
+// 0.4129595
+// resnorm =
+//
+// 0.8314560
+// xopt =
+//
+// 0.
+// 0.6929344
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d)
+
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce b/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce
new file mode 100644
index 0000000..d91f4b1
--- /dev/null
+++ b/tests/general_tests/lsqnonneg/lsqnonneg_param1.sce
@@ -0,0 +1,21 @@
+// Check for the parameters to be a list
+C = [
+ 0.0372 0.2869
+ 0.6861 0.7071
+ 0.6233 0.6245
+ 0.6344 0.6170];
+d = [
+ 0.8587
+ 0.1781
+ 0.0747
+ 0.8405];
+
+param = 0;
+
+//Error
+//lsqnonneg: param should be a list
+//at line 69 of function lsqnonneg called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,param)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,param)
+
diff --git a/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce b/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce
new file mode 100644
index 0000000..557a836
--- /dev/null
+++ b/tests/general_tests/lsqnonneg/lsqnonneg_param2.sce
@@ -0,0 +1,21 @@
+// Check for the size of parameters
+C = [
+ 0.0372 0.2869
+ 0.6861 0.7071
+ 0.6233 0.6245
+ 0.6344 0.6170];
+d = [
+ 0.8587
+ 0.1781
+ 0.0747
+ 0.8405];
+
+param = list("MaxIter");
+
+//Error
+//lsqlin: Size of parameters should be even
+//at line 75 of function lsqnonneg called by :
+//[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,param)
+
+[xopt,resnorm,residual,exitflag,output,lambda] = lsqnonneg(C,d,param)
+