Exemplo n.º 1
0
_DataType aol::Vector<_DataType>::operator* ( const aol::Vector<_DataType> &c ) const {
  if ( c.size() != _size ) {
    throw aol::Exception ( "Vector::operator*: Vectorlengths not equal...", __FILE__, __LINE__ );
  } else {
    return ScalarProduct<DataType> ( this->_pData, c.getData(), _size );
  }
  return 0;
}
void qc::FastUniformGridMatrix<_DataType, qc::QC_2D, BaseClass>::applyAdd ( const aol::Vector<_DataType> &Arg, aol::Vector<_DataType> &Dest ) const {
#ifdef _OPENMP
#pragma omp parallel for
#endif
  for ( int i = 0; i <= _w + 1; ++i ) {
    multCarefullyAtBoundary ( i, Arg, Dest );
  }
#if 1
  const DataType * ArgPtr  = Arg.getData();
  DataType * DestPtr = Dest.getData();
#ifdef _OPENMP
#pragma omp parallel for
#endif
  for ( int i = _w + 2; i < _size - _w - 2; ++i ) {
    for ( int k = 0; k < 3; ++k ) {
      int globos = _w * ( k - 1 ) - 1;
      int g = globos + i;
      for ( int j = 0; j < 3; ++j ) {
        DestPtr[i] += ArgPtr[g++] * _rows[k][i][j];
      }
    }
  }
#endif
#if 0
  const int seg_len = 10;
  for ( int seg = _w + 2; seg < _size - _w - 2; seg += seg_len ) {
    const int seg_end = aol::Min ( seg + seg_len, _size - _w - 2 );
    for ( int k = 0; k < 3; ++k ) {
      int globos = _w * ( k - 1 ) - 1;
      for ( int i = seg; i < seg_end; ++i ) {
        // cerr << "inner row = " << i << endl;
        int g = globos + i;
        for ( int j = 0; j < 3; ++j ) {
          Dest[i] += Arg[g++] * _rows[k][i][j];
        }
      }
    }
  }
#endif
#ifdef _OPENMP
#pragma omp parallel for
#endif
  for ( int i = aol::Max ( _w + 2, _size - _w - 2 ); i < _size; ++i ) {
    multCarefullyAtBoundary ( i, Arg, Dest );
  }
}