Verified Commit d4c75a85 authored by Tim Gymnich's avatar Tim Gymnich
Browse files

changed span to static func

parent 3d4562ef
......@@ -126,11 +126,11 @@ public:
}
/// Linear span of the matrix ... fixme
Matrix span() const {
static Matrix<T> span(Matrix<T> matrix) {
vector<vector<T>> columns;
int rank = getRank();
int rank = matrix.getRank();
for (int col = 0; col<rank; col++) {
columns.push_back(column(col));
columns.push_back(matrix.column(col));
}
return Matrix(columns).transpose();
}
......@@ -166,7 +166,7 @@ public:
/// @param row
/// @param column
T& value(int row, int column) {
assert(row < getHeight() && column < getHeight());
assert(row < getHeight() && column < getWidth());
return vectors[row][column];
};
......@@ -174,7 +174,7 @@ public:
/// @param row
/// @param column
T const& value(int row, int column) const {
assert(row < getHeight() && column < getHeight());
assert(row < getHeight() && column < getWidth());
return vectors[row][column];
};
......
......@@ -312,7 +312,8 @@ bool MatrixTest<T>::runTestSpan1() {
};
auto matrix = Matrix(a);
auto actual = matrix.span();
auto actual = Matrix<int>::span(matrix);
result = actual == Matrix(expected);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment