matrixMultiply

Geoff Canyon gcanyon at inspiredlogic.com
Sat Sep 21 19:44:00 CDT 2002


At 2:31 PM -0500 9/21/02, Brad Allen wrote:
>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

The number of rows in the first array must be the same as the number of columns in the second array. Since you're multiplying the array by itself, and it isn't square, this won't work.

Details from the documentation are available here:

<http://macitworks.com:8080/revdocs/matrixMultiplyFunction>
-- 

regards,

Geoff Canyon
gcanyon at inspiredlogic.com



More information about the use-livecode mailing list