Reworking vector class with core funtionality
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
#ifndef _matrix_n_
|
||||
#define _matrix_n_
|
||||
|
||||
#include "iostream"
|
||||
#include <vector>
|
||||
//#include <random>
|
||||
|
||||
#include "./utils/vector.h"
|
||||
|
||||
|
||||
@@ -16,6 +12,8 @@ namespace utils{
|
||||
struct Matrix{
|
||||
utils::Vector<T> m;
|
||||
|
||||
T& operator[](uint64_t idx) { return m[idx]; } // Makes it able to do matr[1][1]
|
||||
const T& operator[](uint64_t idx) const { return m[idx]; } // Makes it able to do matr[1][1]
|
||||
|
||||
using vector_type = typename decltype(std::declval<T>().v)::value_type;
|
||||
|
||||
@@ -26,8 +24,7 @@ namespace utils{
|
||||
|
||||
Matrix() = default; // Default constructor
|
||||
|
||||
T& operator[](uint64_t idx) { return m[idx]; } // Makes it able to do matr[1][1]
|
||||
const T& operator[](uint64_t idx) const { return m[idx]; } // Makes it able to do matr[1][1]
|
||||
|
||||
|
||||
|
||||
void fill(uint64_t rows, uint64_t cols, const vector_type num=0){
|
||||
|
||||
Reference in New Issue
Block a user