Matrix.column constructor
Creates a matrix, consisting of just one column (aka Column matrix
)
import 'package:ml_linalg/matrix.dart';
void main() {
final matrix = Matrix.column([1, 2, 3, 4, 5]);
print(matrix);
}
The output:
Matrix 5 x 1:
(1.0)
(2.0)
(3.0)
(4.0)
(5.0)
Implementation
factory Matrix.column(List<double> source, {DType dtype = DType.float32}) {
switch (dtype) {
case DType.float32:
return Float32Matrix.fromColumns(
[Vector.fromList(source, dtype: dtype)],
);
case DType.float64:
return Float64Matrix.fromColumns(
([Vector.fromList(source, dtype: dtype)]));
default:
throw UnimplementedMatrixException(dtype);
}
}