Rope constructor
Implementation
Rope(RopeSpec spec, int headDim)
: half = headDim ~/ 2,
invFreq = Float32List(headDim ~/ 2),
cos = Float32List(headDim ~/ 2),
sin = Float32List(headDim ~/ 2) {
final pairs = (spec.partialRotaryFactor * headDim).toInt() ~/ 2;
final f = Float32List(1);
for (var j = 0; j < pairs; j++) {
f[0] = 2 * j / headDim;
f[0] = math.pow(spec.theta, f[0]).toDouble();
invFreq[j] = 1.0 / f[0];
}
// Pairs past `pairs` keep frequency zero: they pass through unrotated.
}