Vector3f CMatrixFactory::MultiplyVectors( Vector3f & vec_one , Vector3f & vec_two ) { Vector3f vec_res; //Equation [A,B] = (Ay*Bz - Az*By , AzBx - Ax*Bz , AxBy - AyBx) vec_res(0) = vec_one(1)*vec_two(2) - vec_one(2)*vec_two(1); vec_res(1) = vec_one(2)*vec_two(0) - vec_one(0)*vec_two(2); vec_res(2) = vec_one(0)*vec_two(1) - vec_one(1)*vec_two(0); #ifdef JACOBIANDEBUGOUTPUT std::cout<<"k*d"<<std::endl<<vec_res<<std::endl; #endif return vec_res; }
int main() { int ia[] = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 }; vector< int, allocator >::iterator iter; vector< int, allocator > vec( ia, ia+10 ); ostream_iterator< int > ofile( cout, " " ); cout << "original element sequence:\n"; copy( vec.begin(), vec.end(), ofile ); cout << '\n'; iter = remove_if( vec.begin(), vec.end(), bind2nd(less<int>(),10) ); vec.erase( iter, vec.end() ); cout << "sequence after applying remove_if < 10:\n"; copy( vec.begin(), vec.end(), ofile ); cout << '\n'; vector< int, allocator > vec_res( 10 ); iter = remove_copy_if( ia, ia+10, vec_res.begin(), EvenValue() ); cout << "sequence after applying remove_copy_if even:\n"; copy( vec_res.begin(), iter, ofile ); cout << '\n'; }