Du befindest dich hier: FSI Informatik » Prüfungsfragen und Altklausuren » Prüfungen im Bachelor-Studium (1. - 5. Semester) » algoks » Forendiskussionen

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung
Nächste ÜberarbeitungBeide Seiten, nächste Überarbeitung
pruefungen:bachelor:algoks:loesungws12 [21.07.2014 21:36] ellipruefungen:bachelor:algoks:loesungws12 [23.07.2014 09:37] – colP ist ein sinnvollerer Name für die Einträge des Arrays _colPtr izibi
Zeile 239: Zeile 239:
 <code cpp> <code cpp>
 float CCSMatrix::getEntry(unsigned int i, unsigned int j) { float CCSMatrix::getEntry(unsigned int i, unsigned int j) {
- for(int rowP = _colPtr[j]; rowP < _colPtr[j+1]; rowP++) { + for(int colP = _colPtr[j]; colP < _colPtr[j+1]; colP++) { 
- if(_rowIndices[rowP] == i) + if(_rowIndices[colP] == i) 
- return _values[rowP];+ return _values[colP];
  }  }
   
Zeile 286: Zeile 286:
   
  float sum = 0.0f;  float sum = 0.0f;
- for(int rowP = other._colPtr[c]; rowP < other._colPtr[c+1]; rowP++) { + for(int colP = other._colPtr[c]; colP < other._colPtr[c+1]; colP++) { 
- float v = other._values[rowP]; + float v = other._values[colP]; 
- sum += v * getEntry(r, other._rowIndices[rowP]);+ sum += v * getEntry(r, other._rowIndices[colP]);
  }  }
  result.setEntry(r, c, sum);  result.setEntry(r, c, sum);