Matrix.empty constructor

Matrix.empty({
  1. DType dtype = DType.float32,
})

Creates a matrix of shape 0 x 0 (no rows, no columns)

A simple usage example:

import 'package:ml_linalg/matrix.dart';

void main() {
  final matrix = Matrix.empty();

  print(matrix);
}

The output:

Matrix 0 x 0

Implementation

factory Matrix.empty({DType dtype = DType.float32}) {
  switch (dtype) {
    case DType.float32:
      return Float32Matrix.fromList([]);

    case DType.float64:
      return Float64Matrix.fromList([]);

    default:
      throw UnimplementedMatrixException(dtype);
  }
}