예제 #1
0
void aol::Vector<_DataType>::setSum ( const aol::Vector<_DataType>& Vec1,
                                      const aol::Vector<_DataType>& Vec2, _DataType Factor ) {
  if ( Vec1.size() != _size || Vec2.size() != _size ) {
    cerr << "ERROR in add: incompatible vectorlengths...\n";
    return;
  }
  DataType *ptr = _pData;
  for ( int i = 0; i < _size; ++i ) {
    *ptr = Vec1.get ( i ) + Vec2.get ( i ) * Factor;
    ptr++;
  }
}
예제 #2
0
void aol::Vector<_DataType>::pushBackValues ( const aol::Vector<_DataType> &otherVector ) {
  const int currentSize = this->size();
  this->growBy ( otherVector.size() );
  for ( int i = 0; i < otherVector.size(); ++i ) {
    this->set ( currentSize + i, otherVector.get ( i ) );
  }
}
예제 #3
0
void aol::Vector<_DataType>::addBlock ( int start, const aol::Vector<_DataType>& block ) {
  int siz = block.size ();

  if ( start + siz > size () )
    throw aol::Exception ( "aol::Vector<T,R>::addBlock: Parameter mismatch: Block does not fit", __FILE__, __LINE__ );

  for ( int i = 0; i < siz; ++i )
    add ( start + i, block.get ( i ) );
}