# psb_gedot — Dot Product

[next] [prev] [prev-tail] [tail] [up]

#### 4.2 psb_gedot — Dot Product

This function computes dot product between two vectors x and y.
If x and y are real vectors it computes dot-product as:

Else if x and y are complex vectors then it computes dot-product as:

psb_gedot(x, y, desc_a, info [,global])

dot, x, y | Function

Short Precision Real | psb_gedot
Long Precision Real | psb_gedot
Short Precision Complex | psb_gedot
Long Precision Complex | psb_gedot

Table 2: Data types

Type:
  Synchronous.
On Entry
x
  the local portion of global dense matrix x.
  Scope: local
  Type: required
  Intent: in.
  Specified as: a rank one or two array or an object of type psb_T_vect_type containing numbers of type specified in Table 2. The rank of x must be the same of y.
y
  the local portion of global dense matrix y.
  Scope: local
  Type: required
  Intent: in.
  Specified as: a rank one or two array or an object of type psb_T_vect_type containing numbers of type specified in Table 2. The rank of y must be the same of x.
desc_a
  contains data structures for communications.
  Scope: local
  Type: required
  Intent: in.
  Specified as: an object of type psb_desc_type.
global
  Specifies whether the computation should include the global reduction across all processes.
  Scope: global
  Type: optional.
  Intent: in.
  Specified as: a logical scalar. Default: global=.true.
On Return
Function value
  is the dot product of vectors x and y.
  Scope: global unless the optional variable global=.false. has been specified
  Specified as: a number of the data type indicated in Table 2.
info
  Error code.
  Scope: local
  Type: required
  Intent: out.
  An integer value; 0 means no error has been detected.

Notes

1. The computation of a global result requires a global communication, which entails a significant overhead. It may be necessary and/or advisable to compute multiple dot products at the same time; in this case, it is possible to improve the runtime efficiency by using the following scheme:
   vres(1) = psb_gedot(x1,y1,desc_a,info,global=.false.)
   vres(2) = psb_gedot(x2,y2,desc_a,info,global=.false.)
   vres(3) = psb_gedot(x3,y3,desc_a,info,global=.false.)
   call psb_sum(ctxt,vres(1:3))

   In this way the global communication, which for small sizes is a latency-bound operation, is invoked only once.

[next] [prev] [prev-tail] [front] [up]