From 0198366bba7a5f2d67338633f9eb90889ffc31b2 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Fri, 21 Sep 2007 18:28:08 +0000 Subject: add examples --- examples/testmnist.m | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 examples/testmnist.m (limited to 'examples/testmnist.m') diff --git a/examples/testmnist.m b/examples/testmnist.m new file mode 100644 index 0000000..38625a7 --- /dev/null +++ b/examples/testmnist.m @@ -0,0 +1,29 @@ +#! /usr/bin/octave -qf +% measuring Octave computing times + +t0=time(); +load mnist.txt +disp("load"); +disp(time()-t0) + + +x = mnist(:,1:784); +d = mnist(:,785); + + +t0=time(); +xc = x - repmat(mean(x),rows(x),1); +disp("x - repmat(mean(x),rows(x),1)"); +disp(time()-t0) + +t0=time(); +mc = (xc'*xc)/rows(x); +disp("(xc'*xc)/rows(x)"); +disp(time()-t0) + +t0=time(); +[v,l]=eig(mc); +disp("eig"); +disp(time()-t0) + +disp(flipud(diag(l))(1:10)); \ No newline at end of file -- cgit v1.2.3