main
Micke Nordin 2 years ago
parent 690228e9ea
commit 97a4d8e0ab
Signed by: micke
GPG Key ID: 014B273D614BE877

@ -32,15 +32,16 @@ public:
~vector() {
this->dimention = 0;
free(this->entries);
this->entries = NULL;
//this->entries = NULL;
this->err = true;
}
long long get_dimention() const { return this->dimention; }
cnumber *get_entries() const { return this->entries; }
cnumber get_entry(const long long index) const {
if (index < this->get_dimention()) {
return this->entries[index];
return this->entries[index];
}
return cnumber(0,0);
return cnumber(0, 0);
}
void set_entry(const long long index, const cnumber z) {
if (index < this->get_dimention()) {
@ -52,7 +53,8 @@ public:
return this->get_entry(index);
}
// FIXME: Figure out how to make sure you do not try to access something outside of the index
// FIXME: Figure out how to make sure you do not try to access something
// outside of the index
cnumber &operator[](const long long index) { return this->entries[index]; }
friend ostream &operator<<(ostream &os, const vector &v) {
@ -101,7 +103,7 @@ public:
return product;
}
const cnumber operator*(const vector &v) const {
cnumber res(0,0);
cnumber res(0, 0);
for (long long i = 0; i < this->get_dimention(); i++) {
res = res + this->get_entry(i) * v.get_entry(i);
}

Loading…
Cancel
Save