75 std::cout <<
"testing Vec3D performance" << std::endl;
82 for (
unsigned int i = 0; i < n; i++)
86 std::cout <<
"passByReference clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
89 for (
unsigned int i = 0; i < n; i++)
93 std::cout <<
"passByConstReference clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
97 for (
unsigned int i = 0; i < n; i++)
101 std::cout <<
"passByPointer clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
104 for (
unsigned int i = 0; i < n; i++)
108 std::cout <<
"passByValue clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
109 std::cout << x << std::endl;
114 std::cout <<
"testing Matrix3D performance" << std::endl;
121 for (
unsigned int i = 0; i < n; i++)
125 std::cout <<
"passByReference clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
128 for (
unsigned int i = 0; i < n; i++)
132 std::cout <<
"passByConstReference clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
136 for (
unsigned int i = 0; i < n; i++)
140 std::cout <<
"passByPointer clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
143 for (
unsigned int i = 0; i < n; i++)
147 std::cout <<
"passByValue clocks: " << time.
toc()*CLOCKS_PER_SEC << std::endl;
148 std::cout << x << std::endl;
153 unsigned int n = 1e8;
Mdouble passByConstReference(const Vec3D &v)
Mdouble X
the vector components
Mdouble passByPointer(Vec3D *v)
Allows for timing the algorithms; accurate up to 0.01 sec.
Mdouble passByValue(Vec3D v)
void tic()
This is like a start button of a stopwatch. Assigns the variable start with the current number of clo...
Mdouble passByReference(Vec3D &v)
Mdouble toc()
This is like a stop button of a stopwatch. Assigns the variable finish to the current value of ticks ...
Mdouble XX
all nine matrix elements
Implementation of a 3D matrix.
Implementation of a 3D vector (by Vitaliy).
void testVec3D(unsigned int n)
void testMatrix3D(unsigned int n)