Task

Create a function/use an in-built function, to compute the   dot product,   also known as the   scalar product   of two vectors.

If possible, make the vectors of arbitrary length.



As an example, compute the dot product of the vectors:

     [1,  3, -5]       and 
     [4, -2, -1]   


If implementing the dot product of two vectors directly:

   each vector must be the same length
   multiply corresponding terms from each vector
   sum the products   (to produce the answer)


Related task

   Vector products


*        Dot product               03/05/2016
DOTPROD  CSECT
         USING  DOTPROD,R15
         SR     R7,R7              p=0
         LA     R6,1               i=1
LOOPI    CH     R6,=AL2((B-A)/4)   do i=1 to hbound(a)
         BH     ELOOPI
         LR     R1,R6              i
         SLA    R1,2               *4
         L      R3,A-4(R1)         a(i)
         L      R4,B-4(R1)         b(i)
         MR     R2,R4              a(i)*b(i)
         AR     R7,R3              p=p+a(i)*b(i)
         LA     R6,1(R6)           i=i+1
         B      LOOPI
ELOOPI   XDECO  R7,PG              edit p
         XPRNT  PG,80              print buffer
         XR     R15,R15            rc=0
         BR     R14                return
A        DC     F'1',F'3',F'-5'
B        DC     F'4',F'-2',F'-1'
PG       DC     CL80' '            buffer
         YREGS
         END    DOTPROD