// test.cpp // (C) Copyright Sky Coyote, 1996 // Use and distribute as you see fit #include #include "array.h" #include class Test { public: virtual void run(void); }; void Test::run() { while (1) { int n; cout << "N: "; cin >> n; if (n < 1) break; array_type *a = new array_type(n, n); array_type *b = new array_type(n, n); array_type *c = new array_type(n, n); a->set_rand(); //a->print(); clock_t t = clock(); b->matinv(a); //b->print(); double t2 = (1.0 * clock() - t) / CLOCKS_PER_SEC; t = clock(); c->matmul(a, b); //c->print(); double t3 = (1.0 * clock() - t) / CLOCKS_PER_SEC; delete a; delete b; delete c; cout << "Inverse: " << t2 << " secs.\n"; cout << "Multiply: " << t3 << " secs.\n"; } } void main() { Test *app = new Test; app->run(); }