scalala / Scalala

Scalala has been superseded by dlwh/breeze. Scalala is a high performance numeric linear algebra library for Scala, with rich Matlab-like operators on vectors and matrices; a library of numerical routines; support for plotting.
http://groups.google.com/group/scalala
GNU Lesser General Public License v2.1
298 stars 30 forks source link

Ambigious implicit BinaryUpdateOp #41

Open afwlehmann opened 12 years ago

afwlehmann commented 12 years ago

Hi,

when updating vector elements by means of scalar multiplication with Double (not with Int etc.), a slight hickup occurs:

scala> val foo = DenseMatrix.eye[Double](3)
foo: scalala.tensor.dense.DenseMatrix[Double] = 
 1.00000   0.00000   0.00000  
 0.00000   1.00000   0.00000  
 0.00000   0.00000   1.00000  

scala> foo(1,::) *= 5.0
<console>:37: error: ambiguous implicit values:
 both object DenseVectorDMulDInto in object DenseVector of type object scalala.tensor.dense.DenseVector.DenseVectorDMulDInto
 and method opUpdateTensorScalar in trait TensorImplicitsLevel1 of type [K, V1, V2, Op <: scalala.operators.OpType](implicit op: scalala.operators.BinaryOp[V1,V2,Op,V1], implicit s: scalala.scalar.Scalar[V2])scalala.operators.BinaryUpdateOp[scalala.tensor.mutable.Tensor[K,V1],V2,Op]
 match expected type scalala.operators.BinaryUpdateOp[scalala.tensor.dense.DenseVectorRow[Double],Double,scalala.operators.OpMul]
              foo(1,::) *= 5.0

whereas

scala> foo(1,::) *= 5
res3: scalala.tensor.dense.DenseVectorRow[Double] = 
 0.00000   5.00000   0.00000