CUDALink`
CUDALink`

CUDAFold

CUDAFold[f,x,list]

gives the last element of CUDAFoldList[f,x,list].

更多信息和选项更多信息
  • The CUDALink application must be loaded using Needs["CUDALink`"].
  • CUDAFold works only on vectors.
  • CUDAFold does not work on fixed vector structure types like "Float[2]", "Integer32[2]", .
  • CUDAFold does not work on symbolic input.
  • CUDAFold is equivalent to Fold.
  • The value for f can be either Max, Min, Plus, Minus, or Times.
  • 范例

    基本范例  (3)

    First, load the CUDALink application:

    In[1]:=
    Click for copyable input

    This folds an input list with the Plus operator and initial value 0:

    In[2]:=
    Click for copyable input
    Out[2]=

    The above is equivalent to Fold:

    In[3]:=
    Click for copyable input
    Out[3]=

    CUDAFold operates on input CUDAMemory:

    In[1]:=
    Click for copyable input
    Out[1]=

    This folds the CUDAMemory as before:

    In[2]:=
    Click for copyable input
    Out[2]=

    Note that the output type is the same as the inputthat is, if the input is a Real valued list, then the output is a real number.

    Compared to Fold, only a few operations are supported by CUDAFold:

    In[1]:=
    Click for copyable input
    Out[1]=

    参见

    Fold  CUDATotal  CUDAFoldList  CUDAMap  CUDAFunctionLoad

    教程