feSquare function

List<int?> feSquare(
  1. dynamic f
)

Implementation

List<int?> feSquare(f) {
  var f0 = f[0];
  var f1 = f[1];
  var f2 = f[2];
  var f3 = f[3];
  var f4 = f[4];
  var f5 = f[5];
  var f6 = f[6];
  var f7 = f[7];
  var f8 = f[8];
  var f9 = f[9];
  var f0_2 = 2 * f[0];
  var f1_2 = 2 * f[1];
  var f2_2 = 2 * f[2];
  var f3_2 = 2 * f[3];
  var f4_2 = 2 * f[4];
  var f5_2 = 2 * f[5];
  var f6_2 = 2 * f[6];
  var f7_2 = 2 * f[7];
  var f5_38 = 38 * f5; // 1.31*2^30
  var f6_19 = 19 * f6; // 1.31*2^30
  var f7_38 = 38 * f7; // 1.31*2^30
  var f8_19 = 19 * f8; // 1.31*2^30
  var f9_38 = 38 * f9; // 1.31*2^30

  var h0 = f0 * f0 +
      f1_2 * f9_38 +
      f2_2 * f8_19 +
      f3_2 * f7_38 +
      f4_2 * f6_19 +
      f5 * f5_38;
  var h1 = f0_2 * f1 + f2 * f9_38 + f3_2 * f8_19 + f4 * f7_38 + f5_2 * f6_19;
  var h2 = f0_2 * f2 +
      f1_2 * f1 +
      f3_2 * f9_38 +
      f4_2 * f8_19 +
      f5_2 * f7_38 +
      f6 * f6_19;
  var h3 = f0_2 * f3 + f1_2 * f2 + f4 * f9_38 + f5_2 * f8_19 + f6 * f7_38;
  var h4 = f0_2 * f4 +
      f1_2 * f3_2 +
      f2 * f2 +
      f5_2 * f9_38 +
      f6_2 * f8_19 +
      f7 * f7_38;
  var h5 = f0_2 * f5 + f1_2 * f4 + f2_2 * f3 + f6 * f9_38 + f7_2 * f8_19;
  var h6 = f0_2 * f6 +
      f1_2 * f5_2 +
      f2_2 * f4 +
      f3_2 * f3 +
      f7_2 * f9_38 +
      f8 * f8_19;
  var h7 = f0_2 * f7 + f1_2 * f6 + f2_2 * f5 + f3_2 * f4 + f8 * f9_38;
  var h8 =
      f0_2 * f8 + f1_2 * f7_2 + f2_2 * f6 + f3_2 * f5_2 + f4 * f4 + f9 * f9_38;
  var h9 = f0_2 * f9 + f1_2 * f8 + f2_2 * f7 + f3_2 * f6 + f4_2 * f5;

  return [
    h0,
    h1 as int?,
    h2 as int?,
    h3 as int?,
    h4 as int?,
    h5 as int?,
    h6 as int?,
    h7 as int?,
    h8 as int?,
    h9 as int
  ];
}