(prev, next)
| 143 | }; |
| 144 | |
| 145 | const multiply = (prev, next) => { |
| 146 | const [rows, cols] = [2, 2]; |
| 147 | const matrix = new Array(rows).fill().map(() => new Array(cols).fill(0)); |
| 148 | |
| 149 | for (let row = 0; row < rows; row++) { |
| 150 | for (let col = 0; col < cols; col++) { |
| 151 | const left = prev[row][0] * next[0][col]; |
| 152 | const right = prev[row][1] * next[1][col]; |
| 153 | |
| 154 | matrix[row][col] = left + right; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | return matrix; |
| 159 | }; |
| 160 | |
| 161 | /** |
| 162 | * Math - Fibonacci Formula |