matrixMultiply

Brad Allen BradAllen at mac.com
Sat Sep 21 14:38:01 EDT 2002


I'm also having some difficulty with this function. Here is the error 
message I receive when I try to use it on a two-dimensional 
numerically keyed array containing only integer elements:

Message execution error:
Error description: matrixMultiply: can't multiply these arrays



Here is the text I'm putting into my function"

1 0 1 1
1 1 0 0
1 0 3 0

Here is the function I'm using (it's purpose is just to explore how 
to put data into a matrix, do matrix multiplication, and display the 
output):


function testMatrix inputText
   put the number of lines in inputText into rowLength
   put the number of words in line 1 of inputText into columnLength
   repeat with c = 1 to columnLength
     repeat with r = 1 to rowLength
       put the value of (word c of line r of inputText) into outputArray[r,c]
     end repeat
   end repeat
   put matrixMultiply(outputArray,outputArray) into productArray -- 
here is where I get the error

   --display the contents of productArray in field "array2"
   put empty into field "array2"
   repeat with c = 1 to columnLength
     repeat with r = 1 to rowLength
       put productArray[r,c] & space into word c of line r of field "array2"
     end repeat
   end repeat
   return productArray
end testMatrix


Thanks!




More information about the use-livecode mailing list