G

#### Gerry Ford

product of two double-width four-vectors.

Larry thinks I'm well started with the following source to populate a

vector:

#include <vector>

#include <algorithm>

#include <iterator>

#include <iostream>

#include <math.h>

int main() {

std::vector<double> four_vector;

for (double i=0.0; i<4.0; i++)

four_vector.push_back(sqrt(i));

std::cout.precision(16);

std::copy(four_vector.begin(), four_vector.end(),

std:stream_iterator<double>(std::cout, "\n"));

return 0;

}

How do I imitate the following fortran source:

program vector2

implicit none

integer index, i

integer, parameter :: some_kind_number = selected_real_kind (p=16)

real (kind = some_kind_number), dimension(4):: vec_a, vec_b

real (kind = some_kind_number) :: res

index = 4

do i = 1, index

vec_a(i)= i**.5

vec_b(i)= (-1)*(i**2)

end do

res = dot_product(vec_a, vec_b)

write (*,*) vec_a, vec_b

write (*,*) res

end program vector2

! gfortran2 -o vector2 vector2.f95

! vector2 >text55.txt 2>text56.txt

//end source continue comment

, except making the inner product calculated externally. I have zero chance

of getting it correct, so I'll spare you the flailing attempt. Screenshot

here: http://zaxfuuq.net/c++5.jpg

To imitate it, I believe the appropriate c++ inner product would be around

negative 25.