arrayToColumnMatrix function

Array2d arrayToColumnMatrix(
  1. Array a
)

Convert an Array to a matrix with one column

Examples

var n = Array([4.0, 4.0, 4.0]);

print(arrayToColumnMatrix(n));

/* output:
Array2d([
  Array([4.0]),
  Array([4.0]),
  Array([4.0])
])
*/

Implementation

Array2d arrayToColumnMatrix(Array a) {
  var b = Array2d.fixed(a.length, 1);
  for (var i = 0; i < a.length; i++) {
    b[i][0] = a[i];
  }
  return b;
}