/// Subtract a vector /// @param v :: The other vector ComplexVector &ComplexVector::operator-=(const ComplexVector &v) { if (size() != v.size()) { throw std::runtime_error("ComplexVectors have different sizes."); } gsl_vector_complex_sub(gsl(), v.gsl()); return *this; }
vectorc vectorc::operator-(const vectorc& vec) const { try { if (size_m!=vec.size_m) throw("\nCan't add vectors of different sizes."); } catch(char* str) { std::cout << "Exception raised: " << str << '\n'; } vectorc tot(*this); gsl_vector_complex_sub(tot.v_m, vec.v_m); return tot; }
static CVECTOR *_sub(CVECTOR *a, CVECTOR *b, bool invert) { CVECTOR *v = VECTOR_make(a); if (COMPLEX(v) || COMPLEX(b)) { VECTOR_ensure_complex(v); VECTOR_ensure_complex(b); gsl_vector_complex_sub(CVEC(v), CVEC(b)); } else gsl_vector_sub(VEC(v), VEC(b)); return v; }
vectorc vectorc::operator-() const { vectorc tot(size_m); gsl_vector_complex_sub(tot.v_m, v_m); return tot; }