multiplyLists method

List<num> multiplyLists(
  1. List<num> factors,
  2. List<num> x
)

Implementation

List<num> multiplyLists(List<num> factors, List<num> x) {
  if (factors.length != x.length) {
      throw "lists of different lengths";
  }
  if (factors.isEmpty)
    return [];
  List<num> ret = List.filled(factors.length,0);
  for (int i=0; i<ret.length; i++) {
    ret[i] = factors[i] * x[i];
  }
  return ret;
}