Exemplo n.º 1
0
/// 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;
}
Exemplo n.º 2
0
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;
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
vectorc vectorc::operator-() const
{
	vectorc tot(size_m);
	gsl_vector_complex_sub(tot.v_m, v_m);
	return tot;	
}