aboutsummaryrefslogtreecommitdiff
path: root/tests/aux/test_optimize.m
diff options
context:
space:
mode:
Diffstat (limited to 'tests/aux/test_optimize.m')
-rw-r--r--tests/aux/test_optimize.m44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/aux/test_optimize.m b/tests/aux/test_optimize.m
new file mode 100644
index 0000000..ecd10a3
--- /dev/null
+++ b/tests/aux/test_optimize.m
@@ -0,0 +1,44 @@
+function [V] = test_optimize()
+
+clear;
+more off;
+rand('state', 902183);
+
+n = 8;
+m = 3;
+K = 4;
+
+X = rand(n, m);
+set_matrix(X);
+
+y = [2 1 3 2 3 2 4 1];
+
+set_vector(y);
+
+p = 1.2143;
+kappa = 0.90298;
+lambda = 0.00219038;
+epsilon = 1e-15;
+
+rho = rand(n, 1);
+set_vector(rho);
+
+[W, t] = msvmmaj(X, y, rho, p, kappa, lambda, epsilon);
+
+V = [t'; W];
+
+end
+
+function set_matrix(A)
+ for i=1:size(A, 1)
+ for j=1:size(A, 2)
+ fprintf('matrix_set(A, %i, %i, %i, %.16f);\n', size(A, 2), i-1, j-1, A(i, j));
+ end
+ end
+end
+
+function set_vector(a)
+ for i=1:numel(a)
+ fprintf('A[%i] = %.16f;\n', i-1, a(i));
+ end
+end \ No newline at end of file