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
Specialize Grid for Int and Long #3428
Conversation
@@ -19,7 +19,7 @@ package geotrellis.raster | |||
import spire.math.Integral | |||
import spire.implicits._ | |||
|
|||
abstract class Grid[N: Integral] extends Serializable { | |||
abstract class Grid[@specialized(Int, Long) N: Integral] extends Serializable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[warn] geotrellis/raster/src/main/scala/geotrellis/raster/GridExtent.scala:36:7: class Grid must be a trait. Specialized version of class GridExtent will inherit generic geotrellis.raster.Grid[Int]
[warn] class GridExtent[@specialized(Int, Long) N: Integral](
[warn] ^
[warn] one warning found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scala/bug#8405 Grid should be converted into a trait.
6bff649
to
62ef656
Compare
@@ -33,13 +33,13 @@ import spire.implicits._ | |||
* The constructor will throw [[java.lang.IllegalArgumentException]] if the provided extent and cell size do not match the | |||
* provided cols and rows (dimensions). | |||
*/ | |||
class GridExtent[@specialized(Int, Long) N: Integral]( | |||
class GridExtent[N: Integral]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a specialized trait is enough!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting... That's really good to know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val extent: Extent, | ||
val cellwidth: Double, | ||
val cellheight: Double, | ||
val cols: N, | ||
val rows: N | ||
) extends Grid[N] with Serializable { | ||
) extends GridIntegral[N] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trait Grid[N] extends Serializable
62ef656
to
31a3378
Compare
31a3378
to
6a0f8f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice bit of detective work.
6a0f8f3
to
8e1bacd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for doing all this work!
Overview
Checklist
Closes #3427