Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Arrays filling improvement and some tidy up. #50

Closed
wants to merge 16 commits into from

Conversation

jovilius
Copy link
Contributor

Hi @dlwh,

the goals of this PR are:

  • removing some boilerplate when filling arrays
  • optimizing lenght and empty check on arrays
  • doing some general tidy up

@jovilius jovilius force-pushed the loops-semplification branch 4 times, most recently from c6890e7 to 49f9bca Compare April 24, 2016 13:41
@@ -66,8 +65,8 @@ case class CachingLookupAndAffineTransformDense[FV](numOutputs: Int,

def activations(fv: Array[Int]) = {
val finalVector = DenseVector.zeros[Double](numOutputs)
for (i <- 0 until fv.size) {
// val wordPosn = fv(i) -> i
fv.indices.foreach { i =>
Copy link
Owner

@dlwh dlwh Apr 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i honestly would prefer for (i <- fv.indices) { here and elsewhere, but not enough to insist.

@dlwh
Copy link
Owner

dlwh commented Apr 24, 2016

thanks for doing this! My biggest concern is with Array.fillWith (which should just be array.tabulate, anyway). A lot of places where I used a while loop is near an inner loop.

@jovilius jovilius mentioned this pull request Apr 24, 2016
@jovilius
Copy link
Contributor Author

replaced by #51

@jovilius jovilius closed this Apr 24, 2016
@jovilius jovilius deleted the loops-semplification branch April 24, 2016 18:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants