there's a trick you can use to replace matrixs with strings (much faster). or lists (also faster but requires more code).
try this:
if your matrix contains only numbers 0-9 then you dont need any fancy tricks, just stick them in a string and read them back with StrMid and return them to number format with strToExp(). in this way its like storing everything in a list. if you have numbers bigger than 9 you will have to turn those numbers into a character, then store that character to the list. use NumToChr for this. beware though, some numbers do not have characters associated with them, so you may put in a number and it will return a "", which will mess up your whole string. however, you only have to worry about this for numbers greater than ~50 (mabey higher), and there is a fix that allows you to store numbers up to almost 1000 in a single character in a string.
for this method i suggest you download CGF, it has with it a string containing every character in the classpad, you can use this string to store huge numbers:
//this string will be called "code"
//"a" is a string containing some unknown character
StrSrc code,a,num //looks in code for the contense of "a" and returns its numerical placement.
retrn(num) //stdlib return function, sets var RTN to the value of num
in this way you can convert a character to a number, but if you use this method you must not use NumToChr, use this instead:
//num is some number between 0 and 1000
StrMid code, num, chr, 1 //chr now contains the character at "num" in the code string
retrn(chr)
using this method both saves space (strings are smaller than anything else used for mass storage), and faster. take a look at CGF if you want examples of how to use this method.
CP Basic is slow, but its also very powerfull, remember to use # and the stdlib and you'll find you can do a great many things.