Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more heterogenous types in numeric operations #1

Open
echu opened this issue May 30, 2011 · 3 comments
Open

Allow more heterogenous types in numeric operations #1

echu opened this issue May 30, 2011 · 3 comments
Labels
Milestone

Comments

@echu
Copy link

echu commented May 30, 2011

Using just LMS numerics, the following code emits errors:

N is of type Rep[Int]
xs is of type 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].

When i try unit(1.0)/N, it says it can't divide Const[Double].

TiarkRompf pushed a commit that referenced this issue Jul 12, 2012
@TiarkRompf
Copy link
Owner

See also #22:

val a = unit(1.0)
val b = unit(1)
val c = a + b // c has type Rep[Double]

@TiarkRompf
Copy link
Owner

Maybe we should just add explicit arithmetic for all primitive types instead of relying on Numeric.

julienrf added a commit to js-scala/virtualization-lms-core that referenced this issue Oct 4, 2012
@julienrf
Copy link
Contributor

See also #36

Lewix pushed a commit to Lewix/virtualization-lms-core that referenced this issue Nov 14, 2013
@TiarkRompf TiarkRompf modified the milestones: 1.0.0, 0.8.0 Aug 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants