Ask Your Question

Revision history [back]

1. Matrix -> type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'

from sage.matrix.all import Matrix

or

from sage.matrix.constructor import Matrix.

2. vector -> type 'sage.modules.vector_integer_dense.Vector_integer_dense'

from sage.modules.free_module_element import vector

3. ZZ -> type 'sage.rings.integer_ring.IntegerRing_class'

from sage.rings.integer_ring import ZZ

4. MixedIntegerLinearProgram -> type 'sage.numerical.mip.MixedIntegerLinearProgram'

from sage.numerical.mip import MixedIntegerLinearProgram

Once you know roughly where the class is defined, for example Matrix is defined somewhere in SAGE_ROOT/devel/sage/sage/matrix/, take a look at the file all.py in that directory. In this case you'll find a line

from constructor import matrix, Matrix, column_matrix, random_matrix, diagonal_matrix, identity_matrix, block_matrix, block_diagonal_matrix, jordan_block, zero_matrix, ones_matrix, elementary_matrix, companion_matrix


So that tells you that you can import Matrix from sage.matrix.all or from sage.matrix.constructor. Your other examples can be dealt with similarly.

1. Matrix -> type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'

from sage.matrix.all import Matrix

or

from sage.matrix.constructor import Matrix.

2. vector -> type 'sage.modules.vector_integer_dense.Vector_integer_dense'

from sage.modules.free_module_element import vector

3. ZZ -> type 'sage.rings.integer_ring.IntegerRing_class'

from sage.rings.integer_ring import ZZ

4. MixedIntegerLinearProgram -> type 'sage.numerical.mip.MixedIntegerLinearProgram'

from sage.numerical.mip import MixedIntegerLinearProgram

Once you know roughly where the class is defined, for example Matrix is defined somewhere in SAGE_ROOT/devel/sage/sage/matrix/, take a look at the file all.py in that directory. In this case you'll find a line

from constructor import matrix, Matrix, column_matrix, random_matrix, diagonal_matrix, identity_matrix, block_matrix, block_diagonal_matrix, jordan_block, zero_matrix, ones_matrix, elementary_matrix, companion_matrix


So that tells you that you can import Matrix from sage.matrix.all or from sage.matrix.constructor. Your other examples can be dealt with similarly.