dprod := proc(v1, v2)
     local res, n, i;
     res := 0:
     n := linalg[vectdim](v1);
     for i from 1 to n do
          res := res + v1[i]*v2[i]:
     od:
     RETURN(res):
end: