Exemplo n.º 1
0
inline typename std::enable_if<
	std::is_convertible<V, T>::value,
	Vector<T, N>
>::type operator * (V v, const Vector<T, N>& a)
{
	return Multiplied(a, T(v));
}
Exemplo n.º 2
0
inline Vector<T, N> Normalized(Vector<T, N> a)
{
	T l = Length(a);
	if(l != T(0) && l != T(1))
		a = Multiplied(a, T(1) / l);
	return a;
}
Exemplo n.º 3
0
Recording
stfio::multiply(const Recording& src, const std::vector<std::size_t>& sections,
                std::size_t channel, double factor)
{
    Channel TempChannel(sections.size(), src[channel][sections[0]].size());
    std::size_t n = 0;
    for (c_st_it cit = sections.begin(); cit != sections.end(); cit++) {
        // Multiply the valarray in Data:
        Section TempSection(stfio::vec_scal_mul(src[channel][*cit].get(),factor));
        TempSection.SetXScale(src[channel][*cit].GetXScale());
        TempSection.SetSectionDescription(
                src[channel][*cit].GetSectionDescription()+
                ", multiplied"
        );
        try {
            TempChannel.InsertSection(TempSection, n);
        }
        catch (const std::out_of_range e) {
            throw e;
        }
        n++;
    }
    if (TempChannel.size()>0) {
        Recording Multiplied(TempChannel);
        Multiplied.CopyAttributes(src);
        Multiplied[0].SetYUnits( src.at( channel ).GetYUnits() );
        return Multiplied;
    } else {
        throw std::runtime_error("Channel empty in stfio::multiply");
    }
}
Exemplo n.º 4
0
	/// Multiplication by scalar operator
	friend Quaternion operator * (T t, const Quaternion& q1)
	{
		return Multiplied(q1, t);
	}
Exemplo n.º 5
0
	/// Multiplication operator
	friend Quaternion operator * (const Quaternion& q1, const Quaternion& q2)
	{
		return Multiplied(q1, q2);
	}