daisy
daisy copied to clipboard
ds2l function calling
Hi, I want to implement an algorithm and try it out with ds2l flags. I'd like to implement helper functions, but I am having trouble in calling a helper function in another one. I have this function:
object Minv { // alphaskew def alphaSkew(m: Real, lever: Vector): Matrix = { require(lever.size(3) && lever >= -0.12 && lever <= 0.18 && m >= 0.0 && m <= 5.0) val x: Real = lever.at(0) val y: Real = lever.at(1) val z: Real = lever.at(2) val res: Matrix = Matrix( List( List(0.0, -m * z, m * y), List(m * z, 0.0, -m * x), List(-m * y, m * x, 0.0) )) res }}
This version compiles and I can get results without problems, but when I add alphaSkewSquare function, I get the error:
daisy.DaisyFatalError: Unknown expression alphaSkew(m, lever)
def alphaSkewSquare(m: Real, lever: Vector): Matrix = { require(lever.size(3) && lever >= -0.12 && lever <= 0.18 && m >= 0.0 && m <= 4.0) val res: Matrix = alphaSkew(m, lever) * alphaSkew(m, lever) res }
Is this a problem in my code, or is this not supported in daisy?