How do I use matrix (or Matrix?) inside python files which are compiled? Suppose I have a file:
def my_matrix(d): return Matrix(ZZ,d,d,[ [i+j for i in range(d)] for j in range(d)]) I include it in my favorite directory, and compile SAGE, and run: sage: my_matrix(3) --------------------------------------------------------------------------- <type 'exceptions.NameError'> Traceback (most recent call last) /home/jvoight/sage/devel/sage-main/sage/rings/number_field/<ipython console> in <module>() /home/jvoight/sage/local/lib/python2.5/site-packages/sage/rings/ number_field/hot.py in my_matrix(d) 1 def my_matrix(d): ----> 2 return Matrix(ZZ,d,d,[ [i+j for i in range(d)] for j in range(d)]) <type 'exceptions.NameError'>: global name 'Matrix' is not defined In other situations, I type ?foo to see where I need to import foo from. I can't figure that out with Matrix! I tried various combinations, but I thought I would just ask: What is the officially correct way to do this? Thanks, JV --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---