diff options
| author | Gertjan van den Burg <burg@ese.eur.nl> | 2016-12-05 19:21:59 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <burg@ese.eur.nl> | 2016-12-05 19:21:59 +0100 |
| commit | 3713989f5ea8747c2afca4d35e5f2da746f25b24 (patch) | |
| tree | 902398c9d05c122612bcc76fdd7bc82f04800b6f /tests/aux/test_optimize.m | |
| parent | further unit tests for kernel module (diff) | |
| download | gensvm-3713989f5ea8747c2afca4d35e5f2da746f25b24.tar.gz gensvm-3713989f5ea8747c2afca4d35e5f2da746f25b24.zip | |
add octave testfiles to git
Diffstat (limited to 'tests/aux/test_optimize.m')
| -rw-r--r-- | tests/aux/test_optimize.m | 44 |
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 |
