Anonymous user
Matrix-exponentiation operator: Difference between revisions
m
→{{header|Scheme}}: Added a note
m (→{{header|Scheme}}: Added a note) |
|||
Line 1,902:
=={{header|Scheme}}==
For simplicity, the matrix is represented as a list of lists, and no dimension checking occurs. This implementation does not work when the exponent is 0.
<lang scheme>
Line 1,926:
((even? exp) (square-matrix (matrix-expo mat (halve exp))))
(else (multiply-matrix mat (matrix-expo mat (dec exp))))))
</lang>
|