Skip to content

Commit

Permalink
vector column added
Browse files Browse the repository at this point in the history
  • Loading branch information
gyrdym committed May 27, 2019
1 parent 80812f7 commit e685637
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/column_vector.dart
@@ -0,0 +1,27 @@
import 'package:ml_linalg/matrix.dart';
import 'package:ml_linalg/src/matrix/float32/float32_column_vector.dart';
import 'package:ml_linalg/vector.dart';

import 'dtype.dart';

abstract class ColumnVector implements Matrix {
factory ColumnVector.fromList(List<double> source,
{DType dtype = DType.float32}) {
switch (dtype) {
case DType.float32:
return Float32ColumnVector.fromList(source);
default:
throw UnimplementedError();
}
}

factory ColumnVector.fromVector(Vector source,
{DType dtype = DType.float32}) {
switch (dtype) {
case DType.float32:
return Float32ColumnVector.fromVector(source);
default:
throw UnimplementedError();
}
}
}
14 changes: 14 additions & 0 deletions lib/src/matrix/float32/float32_column_vector.dart
@@ -0,0 +1,14 @@
import 'package:ml_linalg/column_vector.dart';
import 'package:ml_linalg/vector.dart';

import 'float32_matrix.dart';

class Float32ColumnVector extends Float32Matrix implements ColumnVector {
Float32ColumnVector.fromList(List<double> source) :
super.columns([Vector.fromList(source)]);

Float32ColumnVector.fromVector(Vector source) : super.columns([source]);

@override
final int columnsNum = 1;
}

0 comments on commit e685637

Please sign in to comment.