Ask Your Question

Revision history [back]

  1. Maybe you don't need to transpose your column vector. If A is a matrix and v is a vector, then A * v will use v as a column vector, and v * A will use v as a row vector.

  2. If you want to make v a row vector, you can do v.row().

  3. the column method is for extracting a column of a matrix. You need to specify the index of the column (from 0 to nrows - 1).

Illustration:

    sage: m = Matrix([[1, 1, 0],[0, 2, 0], [0, 0, 3],])
    sage: v = m.column(1)
    sage: v
    (1, 2, 0)
    sage: m * v
    (3, 4, 0)
    sage: v * m
    (1, 5, 0)
    sage: u = v.row()
    sage: u
    [1 2 0]
    sage: w = u.transpose()
    sage: w
    [1]
    [2]
    [0]
    sage: u * w
    [5]
    sage: w * u
    [1 2 0]
    [2 4 0]
    [0 0 0]