Skip to main content
added 85 characters in body
Source Link
acl
  • 20k
  • 3
  • 67
  • 99

The obvious (if not most efficient) approach is Prepend: Prepend[m\[Transpose], v]\[Transpose] gives mcol while Prepend[m, v] gives mrow.

You could also obtain mrow using {v}~Join~m and mcol using ({v}~Join~m)\[Transpose]. These, though, are slower (for the specific matrices you gave).

Also

Insert[m, v, 1] 

and

Insert[m\[Transpose], v, 1]\[Transpose] 

The obvious (if not most efficient) approach is Prepend: Prepend[m\[Transpose], v]\[Transpose] gives mcol while Prepend[m, v] gives mrow.

You could also obtain mrow using {v}~Join~m and mcol using ({v}~Join~m)\[Transpose]. These, though, are slower (for the specific matrices you gave).

The obvious (if not most efficient) approach is Prepend: Prepend[m\[Transpose], v]\[Transpose] gives mcol while Prepend[m, v] gives mrow.

You could also obtain mrow using {v}~Join~m and mcol using ({v}~Join~m)\[Transpose]. These, though, are slower (for the specific matrices you gave).

Also

Insert[m, v, 1] 

and

Insert[m\[Transpose], v, 1]\[Transpose] 
Source Link
acl
  • 20k
  • 3
  • 67
  • 99

The obvious (if not most efficient) approach is Prepend: Prepend[m\[Transpose], v]\[Transpose] gives mcol while Prepend[m, v] gives mrow.

You could also obtain mrow using {v}~Join~m and mcol using ({v}~Join~m)\[Transpose]. These, though, are slower (for the specific matrices you gave).