y= PyPBLAS.pvsymv(alpha,a,x,beta,y)
La función "PyPBLAS.pvsymv" implementa la siguiente operación entre
escalares (alpha,beta), vectores (x, y) y matrices
(a), todos ellos de tipo PyACTS:
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
PyPBLAS.pvgemv informará de ello y no podrá finalizar la operación.
Las características de cada uno de los parámetros ,teniendo en cuenta que son
de tipo PyACTS, son las siguientes:
Parametros de Entrada
Parametros de Salida
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: PvSYMV"
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),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.pvsymv(alpha,a,x,beta,y)
y_num=PyACTS2Num(y)
if PyACTS.iread==1:
print "PvSYMV'=alpha*A*x+beta*y=",transpose(y_num)
PyACTS.gridexit()
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.]]
PvSYMV'=alpha*A*x+beta*y= [ [ 3. -44.99245834 11. -52.99364471 95.14123535 23.30435181
69.08868408 52.08119202]]
See Sobre este documento... para sugerencias en cambios.