aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/scalam/collection/DenseVectorOps.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/scalam/collection/DenseVectorOps.scala')
-rw-r--r--src/main/scala/scalam/collection/DenseVectorOps.scala26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/main/scala/scalam/collection/DenseVectorOps.scala b/src/main/scala/scalam/collection/DenseVectorOps.scala
index da33d5d..ace37a3 100644
--- a/src/main/scala/scalam/collection/DenseVectorOps.scala
+++ b/src/main/scala/scalam/collection/DenseVectorOps.scala
@@ -5,15 +5,37 @@ import scala.collection.mutable.ArrayBuffer
import scala.collection.generic.CanBuildFrom
import scala.collection.mutable.Builder
+/**
+ * This class serves as a wrapper for `breeze.linalg.DenseVector`s with all the operations found in
+ * indexed sequences. Where needed, instances of DenseVectors are implicitly converted
+ * into this class.
+ *
+ * The difference between this class and `WrappedDenseVector` is that calling transformer
+ * methods such as `filter` and `map` will yield a `DenseVector`, whereas a `WrappedDenseVector`
+ * will remain a `WrappedDenseVector`.
+ *
+ * @see [[scala.collection.mutable.ArrayOps]]
+ *
+ * @tparam Elem type of the elements contained in this DenseVector.
+ *
+ * @define Coll `DenseVector`
+ * @define orderDependent
+ * @define orderDependentFold
+ * @define mayNotTerminateInf
+ * @define willNotTerminateInf
+ */
class DenseVectorOps[Elem: ClassManifest](override val repr: DenseVector[Elem]) extends DenseVectorLike[Elem, DenseVector[Elem]] {
val self = repr
def newBuilder = DenseVectorOps.newBuilder[Elem]
-
+
override protected[this] def thisCollection = new WrappedDenseVector(self)
override protected[this] def toCollection(repr: DenseVector[Elem]): WrappedDenseVector[Elem] = new WrappedDenseVector(repr)
override def seq = thisCollection
}
+/**
+ * A companion object for DenseVectorsOps.
+ */
object DenseVectorOps {
- def newBuilder[Elem: ClassManifest] = new ArrayBuffer[Elem] mapResult (x => new DenseVector(x.toArray))
+ def newBuilder[Elem: ClassManifest] = new ArrayBuffer[Elem] mapResult (x => new DenseVector(x.toArray))
}