Open echu opened 13 years ago
Using just LMS numerics, the following code emits errors:
N is of type Rep[Int] xs is of type Vector[Double]
Rep[Int]
Vector[Double]
val xbar = 1.0/N * sum(xs)
I am trying to compute the average here. 1.0 is of type Double, but 1.0/N throws an error, since it does not know how to divide a Double by Rep[Int].
1.0
Double
1.0/N
When i try unit(1.0)/N, it says it can't divide Const[Double].
unit(1.0)/N
Const[Double]
See also #22:
val a = unit(1.0) val b = unit(1) val c = a + b // c has type Rep[Double]
Maybe we should just add explicit arithmetic for all primitive types instead of relying on Numeric.
Numeric
See also #36
Using just LMS numerics, the following code emits errors:
N is of type
Rep[Int]
xs is of typeVector[Double]
val xbar = 1.0/N * sum(xs)
I am trying to compute the average here.
1.0
is of typeDouble
, but1.0/N
throws an error, since it does not know how to divide aDouble
byRep[Int]
.When i try
unit(1.0)/N
, it says it can't divideConst[Double]
.