// Übung 6 - Aufgabe C (Vektorklasse mit dynamischen Feld darin) // g++ -Wno-deprecated -Wall u6C.cc vektor.cc // icc -ansi -w2 -Wall u6C.cc vektor.cc #include #include "vektor.hh" int main(int argc, char* argv[]) { const double ALPHA = 3.5; const char file1[] = "input.6C_x.txt"; const char file2[] = "input.6C_y.txt"; const Vektor x(file1), y(file2); Vektor z( x.length() ), u; if ( x.length() != y.length() ) { cout << "Feldlaengen sind unterschiedlich" << endl; return -1; } // cout << " x: " << x << endl; // cout << " y: " << y << endl; // cout << x.Norm() << " " << InnerProd(y,x) << endl; z.daxpy( ALPHA, x, y ); cout << " = " << InnerProd(z,x) << " ||z|| = " << z.Norm() << endl; u = x * ALPHA + y; cout << " = " << InnerProd(u,x) << " ||u|| = " << u.Norm() << endl; return 0; }