Skip to content

Commit

Permalink
fixes scalanlp#394
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwh committed May 16, 2015
1 parent 58fecfa commit 62fe9c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 0 additions & 7 deletions math/src/main/scala/breeze/linalg/Vector.scala
Expand Up @@ -183,13 +183,6 @@ object Vector extends VectorConstructors[Vector] with VectorOps {
}
}

// the canmapvalues implicit in UFunc should take care of this, but limits of scala type inference, blah blah blah
implicit def mapUFuncImpl[Tag, V, U](implicit impl: UFunc.UImpl[Tag, V, U], canMapValues: CanMapValues[Vector[V], V, U, Vector[U]]): UFunc.UImpl[Tag, Vector[V], Vector[U]] = {
new UFunc.UImpl[Tag, Vector[V], Vector[U]] {
def apply(v: Vector[V]): Vector[U] = canMapValues.map(v, impl.apply)
}
}

implicit def canMapValues[V, V2](implicit man: ClassTag[V2]):CanMapValues[Vector[V], V, V2, Vector[V2]] = {
new CanMapValues[Vector[V], V, V2, Vector[V2]] {
/**Maps all key-value pairs from the given collection. */
Expand Down
5 changes: 3 additions & 2 deletions math/src/main/scala/breeze/linalg/operators/OpType.scala
@@ -1,7 +1,8 @@
package breeze.linalg.operators

import breeze.generic.{MappingUFunc, UFunc}
import breeze.math.{Field, Semiring, Ring}
import breeze.generic.UFunc.UImpl
import breeze.math.{Field, Ring, Semiring}

/*
Copyright 2012 Daniel Ramage
Expand Down Expand Up @@ -237,7 +238,7 @@ object OpXor extends OpXor with UFunc {
*/
sealed trait OpNeg extends OpType
object OpNeg extends OpNeg with UFunc {
implicit def ringNegation[S:Ring] = new Impl[S, S] {
implicit def ringNegation[S:Ring]: UImpl[OpNeg.this.type, S, S] = new Impl[S, S] {
def apply(v: S): S = implicitly[Ring[S]].negate(v)
}
}
Expand Down
5 changes: 5 additions & 0 deletions math/src/test/scala/breeze/linalg/VectorTest.scala
Expand Up @@ -33,6 +33,11 @@ class VectorTest extends FunSuite {
assert( dvTest.reduceRight( (p1: Int, p2: Int) => 2 * p1 - p2 ) == 0 )
}

test("unary !") {
val b = Vector(true, false, false)
assert(!b == Vector(false, true, true))
}

}


Expand Down

0 comments on commit 62fe9c2

Please sign in to comment.