Is there a direct way to apply a function to each entry of a matrix and return the resulting matrix?
A = matrix([[1,2],[3,4]])
B = matrix([[j^2 for j in i] for i in A])
Not terribly hard, but it's not ideal.
| 1 | initial version |
Is there a direct way to apply a function to each entry of a matrix and return the resulting matrix?
A = matrix([[1,2],[3,4]])
B = matrix([[j^2 for j in i] for i in A])
Not terribly hard, but it's not ideal.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.