Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive


  • To: mathgroup at
  • Subject: [mg28202] ShiftLeft
  • From: "Carl K. Woll" <carlw at>
  • Date: Wed, 4 Apr 2001 04:13:25 -0400 (EDT)
  • Organization: University of Washington
  • Sender: owner-wri-mathgroup at

I recently wanted a function which shifts elements to the left, while
inserting zeros on the right. I also wanted it to be as quick as possible.
In case anyone else wanted this functionality, I thought it would be useful
to post to the newsgroup. The function I came up with only works with
rectangular matrices, and  it is about 3-6 times slower than RotateLeft
(depending on the size of the matrix), so I would guess that the speed is
pretty close to optimal. Here is the function:


Here is an example of ShiftLeft in action:


{{b, c, 0}, {e, f, 0}}

{{0, a, b}, {0, d, e}}

The second example shows that ShiftLeft can also easily shift right.

Perhaps somebody can come up with a quicker function?

Carl Woll
Physics Dept
U of Washington

  • Prev by Date: complex coefficients and rules...
  • Next by Date: Help
  • Previous by thread: Re:complex coefficients and rules...
  • Next by thread: Help