Skip to content

#800 implement operator*( K, FieldVector< K, SIZE > )

Metadata

Property Value
Reported by Martin Nolte (nolte@mathematik.uni-freiburg.de)
Reported at Jun 10, 2010 14:22
Type Feature Request
Version Git (pre2.4) [autotools]
Operating System Unspecified / All

Description

There is an operator+( FieldVector< K, SIZE >, FieldVector< K, SIZE > ). Is there any reason that operator*( K, FieldVector< K, SIZE > ) and its variants are not implemented?

If there is none, I suggest to add the following code to fvector.hh, if expression templates are not available:

  template< class K, int SIZE >
  FieldVector< K, SIZE > operator* ( const K &k, const FieldVector< K, SIZE > &v )
  {
    FieldVector< K, SIZE > w( v );
    return w *= k;
  }

  template< class K, int SIZE >
  FieldVector< K, SIZE > operator* ( const FieldVector< K, SIZE > &v, const K &k )
  {
    FieldVector< K, SIZE > w( v );
    return w *= k;
  }

  template< class K, int SIZE >
  FieldVector< K, SIZE > operator/ ( const FieldVector< K, SIZE > &v, const K &k )
  {
    FieldVector< K, SIZE > w( v );
    return w /= k;
  }