/[escript]/trunk/esys2/escript/py_src/util.py
ViewVC logotype

Diff of /trunk/esys2/escript/py_src/util.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 141 by jgs, Fri Jul 22 03:53:08 2005 UTC revision 142 by jgs, Mon Jul 25 05:28:20 2005 UTC
# Line 1008  def inner(arg0,arg1): Line 1008  def inner(arg0,arg1):
1008      @param arg0, arg1      @param arg0, arg1
1009      """      """
1010      sum=escript.Scalar(0,arg0.getFunctionSpace())      sum=escript.Scalar(0,arg0.getFunctionSpace())
1011      if arg.getRank()==0:      if arg0.getRank()==0:
1012            return arg0*arg1            return arg0*arg1
1013      elif arg.getRank()==1:      elif arg0.getRank()==1:
1014           sum=escript.Scalar(0,arg.getFunctionSpace())           sum=escript.Scalar(0,arg0.getFunctionSpace())
1015           for i in range(arg.getShape()[0]):           for i in range(arg0.getShape()[0]):
1016              sum+=arg0[i]*arg1[i]              sum+=arg0[i]*arg1[i]
1017      elif arg.getRank()==2:      elif arg0.getRank()==2:
1018          sum=escript.Scalar(0,arg.getFunctionSpace())          sum=escript.Scalar(0,arg0.getFunctionSpace())
1019          for i in range(arg.getShape()[0]):          for i in range(arg0.getShape()[0]):
1020             for j in range(arg.getShape()[1]):             for j in range(arg0.getShape()[1]):
1021                sum+=arg0[i,j]*arg1[i,j]                sum+=arg0[i,j]*arg1[i,j]
1022      elif arg.getRank()==3:      elif arg0.getRank()==3:
1023          sum=escript.Scalar(0,arg.getFunctionSpace())          sum=escript.Scalar(0,arg0.getFunctionSpace())
1024          for i in range(arg.getShape()[0]):          for i in range(arg0.getShape()[0]):
1025              for j in range(arg.getShape()[1]):              for j in range(arg0.getShape()[1]):
1026                 for k in range(arg.getShape()[2]):                 for k in range(arg0.getShape()[2]):
1027                    sum+=arg0[i,j,k]*arg1[i,j,k]                    sum+=arg0[i,j,k]*arg1[i,j,k]
1028      elif arg.getRank()==4:      elif arg0.getRank()==4:
1029          sum=escript.Scalar(0,arg.getFunctionSpace())          sum=escript.Scalar(0,arg0.getFunctionSpace())
1030          for i in range(arg.getShape()[0]):          for i in range(arg0.getShape()[0]):
1031             for j in range(arg.getShape()[1]):             for j in range(arg0.getShape()[1]):
1032                for k in range(arg.getShape()[2]):                for k in range(arg0.getShape()[2]):
1033                   for l in range(arg.getShape()[3]):                   for l in range(arg0.getShape()[3]):
1034                      sum+=arg0[i,j,k,l]*arg1[i,j,k,l]                      sum+=arg0[i,j,k,l]*arg1[i,j,k,l]
1035      else:      else:
1036            raise SystemError,"inner is not been implemented yet"            raise SystemError,"inner is not been implemented yet"
# Line 1202  if __name__=="__main__": Line 1202  if __name__=="__main__":
1202    
1203  #  #
1204  # $Log$  # $Log$
1205    # Revision 1.14  2005/07/25 05:28:13  jgs
1206    # Merge of development branch back to main trunk on 2005-07-25
1207    #
1208  # Revision 1.13  2005/07/22 03:53:01  jgs  # Revision 1.13  2005/07/22 03:53:01  jgs
1209  # Merge of development branch back to main trunk on 2005-07-22  # Merge of development branch back to main trunk on 2005-07-22
1210  #  #
# Line 1215  if __name__=="__main__": Line 1218  if __name__=="__main__":
1218  # Revision 1.10  2005/06/09 05:37:59  jgs  # Revision 1.10  2005/06/09 05:37:59  jgs
1219  # Merge of development branch back to main trunk on 2005-06-09  # Merge of development branch back to main trunk on 2005-06-09
1220  #  #
1221    # Revision 1.2.2.20  2005/07/25 01:26:27  gross
1222    # bug in inner fixed
1223    #
1224  # Revision 1.2.2.19  2005/07/21 04:01:28  jgs  # Revision 1.2.2.19  2005/07/21 04:01:28  jgs
1225  # minor comment fixes  # minor comment fixes
1226  #  #

Legend:
Removed from v.141  
changed lines
  Added in v.142

  ViewVC Help
Powered by ViewVC 1.1.26