k = int(int(B'*D*B,r,-0.5,0.5),s,-0.5,0.5)B is a 3xn matrix of shape functions and D a 3x3 relationship of Modulus of Elasticity and Poisson's ratio. There is obviously more to this code, including the calculations of stress and strain and the writing of an output file.
Running the code using the prime ('), the code took 143.106 seconds to run. I was initally confused by how long it took because the matrices were not that large. I then heard about the function transpose() and decided to use that. In code form:
k = int(int(transpose(B)*D*B,r,-0.5,0.5),s,-0.5,0.5)This took only 19.735 seconds to run. So digging a little further, the operator ', also checks for complex conjugates of the matrix as well.
In conclusion, if you know that you are not dealing with complex numbers, you may want to use the transpose function and not its operator.
Tip: To time the running time of your code, put tic on the top line and toc on the last line.