[kepler-dev] matrices and vectors

Dan Higgins higgins at nceas.ucsb.edu
Fri Nov 9 12:33:17 PST 2007


Hi Nathan,

    I eventually got around to looking back at IRC and saw your question 
about matrices and vectors. I assume by vector you mean  a 1-D matrix. 
The term 'vector' doesn't seem to get used much in the Ptolemy/Kepler 
docs. I also assume you are meaning a 1-D collection of native values 
rather than a Ptolemy array which is an array of tokens (i.e. one more 
level of indirection).

    First of all, I have almost always used arrays. Despite the 
inefficiency of tokens inside the array, Ptolemy/Kepler seems 'fast 
enough' for all cases I have run into.

    However, there is a built in function for converting arrays to 
functions (see below). So it looks like you can use a 1-row or a 
1-column matrix as a 'vector'.

from Expression Evaluator:

 >> a={1,2,3,4,5,6}
{1, 2, 3, 4, 5, 6}
 >> b=arrayToMatrix(a,2,3)
[1, 2, 3; 4, 5, 6]
 >> c=arrayToMatrix(a,1,6)
[1, 2, 3, 4, 5, 6]
 >> d=arrayToMatrix(a,6,1)
[1; 2; 3; 4; 5; 6]
 >>

-- 
*******************************************************************
Dan Higgins                                  higgins at nceas.ucsb.edu
http://www.nceas.ucsb.edu/    Ph: 805-893-5127
National Center for Ecological Analysis and Synthesis (NCEAS) Marine Science Building - Room 3405
Santa Barbara, CA 93195
*******************************************************************



More information about the Kepler-dev mailing list