Ejemplo n.º 1
0
VectorSpace<Type, N> VectorSpace<Type, N>::operator -(const VectorSpace<Type, N>& v2) const
{

	// Vectors should have same size
	VectorSpace<Type, N> result;

	for (int i= v2.MinIndex(); i <= v2.MaxIndex(); ++i)
	{
		result[i] = (*this)[i] - v2[i];
	}

	return result;

}
Ejemplo n.º 2
0
// Premultiplication by a field value
template <typename Type, int N, typename F> VectorSpace<Type, N> 
				operator * (const F& scalar, const VectorSpace<Type, N>& v)
{

	VectorSpace<Type, N> result;

	for (int i= v.MinIndex(); i <= v.MaxIndex(); ++i)
	{
		
		result[i]  = (scalar * v[i]);

	}

	return result;
}