Vector.empty constructor

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

Creates a vector of zero length

A usage example:

import 'package:ml_linalg/vector.dart';

final vector = Vector.empty(dtype: DType.float32);

print(vector);

the output will be like that:

()

Implementation

factory Vector.empty({DType dtype = DType.float32}) {
  switch (dtype) {
    case DType.float32:
      return Float32x4Vector.empty(
        CacheManagerFactoryImpl().create(vectorCacheKeys),
        const Float32x4Helper(),
      );

    case DType.float64:
      return Float64x2Vector.empty(
        CacheManagerFactoryImpl().create(vectorCacheKeys),
        const Float64x2Helper(),
      );

    default:
      throw UnimplementedError(
          'Vector of $dtype type is not implemented yet');
  }
}