y= PyPBLAS.pvgemv(alpha,a,x,beta,y[,trans='N'])
La función "PyPBLAS.pvgemv" implementa la siguiente operación entre
escalares (alpha,beta), vectores (x, y) y matrices
(a), todos ellos de tipo PyACTS:
Donde
depende del valor del parámetro "trans":
trans='N': No se se realiza ninguna operación sobre la matriz.
trans='T': Se realiza la transpuesta de trans='C': Se realiza la transpuesta conjugada de
Las dimensiones de los vectores x e y y de la matriz A han
de ser las adecuadas para poder realizar las operaciones correspondientes. En el
caso que las dimensiones de alguna de las entradas no sea correcta, la rutina
PyPBLASpvgemv informará de ello y no podrá finalizar la operación.
Las características de cada uno de los parámetros son las siguientes:
Parametros de Entrada
Parametros de Salida
y.
from PyACTS import *
import PyPBLAS
from RandomArray import *
from Numeric import *
#Dimension of Arrays
n=8
#Initiliaze the Grid
PyACTS.gridinit()
if PyACTS.iread==1:
print "Example of using PyPBLAS: PvGEMV"
print "N=",n,";nprow x npcol:",PyACTS.nprow,"x",PyACTS.npcol
print "Block's size:",PyACTS.mb,"*",PyACTS.nb
alpha,beta=2,3
print "alpha=",alpha,"; beta=",beta
a=identity(n,Float)
print "a=",a
x=reshape(array(range(n),Numeric.Float),[n,1])
print "x'=",transpose(x)
y=ones([n,1],Float)
print "y'=",transpose(y)
else:
a,x,y,alpha,beta=None,None,None,None,None
#We convert Numeric Array to PyACTS.Scalapack Array
ACTS_lib=1 # 1=Scalapack
a=Num2PyACTS(a,ACTS_lib)
x=Num2PyACTS(x,ACTS_lib)
y=Num2PyACTS(y,ACTS_lib)
alpha=Scal2PyACTS(alpha,ACTS_lib)
beta=Scal2PyACTS(beta,ACTS_lib)
#We call PBLAS routine
y= PyPBLAS.pvgemv(alpha,a,x,beta,y)
y_num=PyACTS2Num(y)
if PyACTS.iread==1:
print "PvGEMV'=",transpose(y_num)
PyACTS.gridexit()
[vgaliano@localhost EXAMPLES]$ mpirun -np 4 mpipython exPypvgemv.py Example of using PyPBLAS: PvGEMV N= 8 ;nprow x npcol: 2 x 2 Block's size: 2 * 2 alpha= 2 ; beta= 3 a= [[ 1. 0. 0. 0. 0. 0. 0. 0.] [ 0. 1. 0. 0. 0. 0. 0. 0.] [ 0. 0. 1. 0. 0. 0. 0. 0.] [ 0. 0. 0. 1. 0. 0. 0. 0.] [ 0. 0. 0. 0. 1. 0. 0. 0.] [ 0. 0. 0. 0. 0. 1. 0. 0.] [ 0. 0. 0. 0. 0. 0. 1. 0.] [ 0. 0. 0. 0. 0. 0. 0. 1.]] x'= [ [ 0. 1. 2. 3. 4. 5. 6. 7.]] y'= [ [ 1. 1. 1. 1. 1. 1. 1. 1.]] PvGEMV'= [ [ 3. 3. 3. 3. 3. 3. 3. 3.]]
See Sobre este documento... para sugerencias en cambios.