scaleMatrix = (matrix, ratio) => {
  const result = [];
  matrix.forEach(row => {
    const newRow = [];
    row.forEach(v => {
      newRow.push(v * ratio);
    });
    result.push(newRow);
  });
  return result;
}
scale matrix
@param matrix [ [], [], [] ]
@param ratio