scalanlp/breeze — pull request #144 by ktakagaki (2014-02-02 15:32:57+00:00)
Title: End slicing

I studied RangeSuffix, played around with negative indexes, and came up with something.
Please take a look and tell me what you think.

The ## syntax is not quite ideal, because it conflicts with `Any.##`, and that prevents things like
`tempDV( ## )` from being done, but I couldn't think of any other available operators off the top of my head.

It works like this:

scala> import breeze._
import breeze._

scala> import breeze.linalg._
import breeze.linalg._

scala> val tempDV = DenseVector(0, 1, 2, 3, 4, 5, 6)
tempDV: breeze.linalg.DenseVector[Int] = DenseVector(0, 1, 2, 3, 4, 5, 6)

scala> tempDV( 0 ## 3 )
res1: breeze.linalg.DenseVector[Int] = DenseVector(0, 1, 2, 3)

scala> tempDV( 4 ## -1 )
res2: breeze.linalg.DenseVector[Int] = DenseVector(4, 5, 6)

scala> tempDV( -3 ## -1 )
res3: breeze.linalg.DenseVector[Int] = DenseVector(4, 5, 6)

scala> tempDV( 0 ## 4 ## 2 )
res4: breeze.linalg.DenseVector[Int] = DenseVector(0, 2, 4)

scala> tempDV( 4 ## 0 ## -2 )
res5: breeze.linalg.DenseVector[Int] = DenseVector(4, 2, 0)