Archive

Author Archive

MATLAB Vectorization

March 19th, 2007 ken No comments

After reading up on MATLAB vectorization last week, I wrote this code to normalize each row of a N by 3 matrix. The speedup is not enourmous, but it is significant. I tried timming things this weekend on my computer at home, but MATLAB on a 1GHz G4 with 512MB of RAM is not what you would call ‘peppy’. I’ll try on a modeling workstation at the office today and see what’s what when we try a big matrix and it can stay all in memory.

function [ ] = unit_vector_rows_for( N )
%UNTITLED1 Summary of this function goes here
% Detailed explanation goes here

%make a 1×3 matrix, we will consider rows as 3-tuples
a = [1:3] ;

%repeat a so that it becomes a N by 3 matrix, so we can have a big one to
%test

a=repmat(a,N,1);

tic
for i=1:size(a,1)
a(i,:) = a(i,:) ./ norm(a(i,:)) ;
end
k=toc;
fprintf(‘For loop time is %f\n’,k);

function [ ] = unit_vector_rows_mat( N )
%UNTITLED1 Summary of this function goes here
% Detailed explanation goes here

a=[];

%make a 1×3 matrix, we will consider rows as 3-tuples
a = [1:3] ;

%repeat a so that it becomes a N by 3 matrix, so we can have a big one to
%test
a=repmat(a,N,1);
tic
a = a./repmat(sqrt(sum((a.^2)’))’,1,3);
k = toc;
fprintf(‘Vectorized time is %f\n’,k);

Categories: Tech

Laurentian Aerospace Corp.

January 30th, 2007 ken No comments

Check out the new Laurentian Aerospace Corp website, put together by yours truly!

Categories: General

Personal Finance Links

August 14th, 2006 ken No comments

Some handy personal finance links:

DaveRamsey.com
http://www.bylo.org
http://www.ndir.com

Categories: General

CSS & JS Hackery

August 3rd, 2006 ken No comments

This is a post for me to save links of neat js and css stuff:

100 CSS Examples

Categories: General

Online PDF, PS, DOC Reader

March 15th, 2005 ken No comments

http://view.samurajdata.se/

This is one handy little app. We all heard how web applications were going to take over the world, but we really haven’t seen too much, other than [Hot|G]Mail or perhaps Bloglines.

This is a handy viewer of PostScript, PDF, or Microsoft Word files. It’ll change them all automagically so that you can view them in your browser. I find this handy when I’m on the road or a public computer without Mircosoft Word or OpenOffice installed. The source is downloadable, so I might just set this up myself. Onto the YAP list it goes!

Categories: General