I am new to Scala and would appreciate any help regarding the following code:
var exp = (-3).to(2, 1)
var out = exp.map(i => java.lang.Float.floatToIntBits(math.pow(i, 2).toFloat))
Now, I want to write the following code:
for (i <- 0 until exp.length)
{if(exp(i) < 0)
{out(i) = out(i) >> exp(i).abs}
}
that is, I want to modify elements of the out vector depending on the elements of the exp vector by having a one-to-one mapping between the two vectors. I can't find a single online source which can help me do this. Please help.