[python-arrayfire] 95/250: Adding documentation for base.py and blas.py

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:35 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit cef85eefe8e34dd6f0ca121fbd56aaae08f0123b
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Tue Sep 1 19:07:10 2015 -0400

    Adding documentation for base.py and blas.py
---
 arrayfire/base.py |   8 +++
 arrayfire/blas.py | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 159 insertions(+)

diff --git a/arrayfire/base.py b/arrayfire/base.py
index 6376557..90b2205 100644
--- a/arrayfire/base.py
+++ b/arrayfire/base.py
@@ -6,9 +6,17 @@
 # The complete license agreement can be obtained at:
 # http://arrayfire.com/licenses/BSD-3-Clause
 ########################################################
+
+"""
+Implementation of BaseArray class.
+"""
+
 from .library import *
 from .util import *
 
 class BaseArray(object):
+    """
+    Base array class for arrayfire. For internal use only.
+    """
     def __init__(self):
         self.arr = ct.c_void_p(0)
diff --git a/arrayfire/blas.py b/arrayfire/blas.py
index 9c1eb3e..c476c1c 100644
--- a/arrayfire/blas.py
+++ b/arrayfire/blas.py
@@ -7,34 +7,185 @@
 # http://arrayfire.com/licenses/BSD-3-Clause
 ########################################################
 
+"""
+BLAS functions for arrayfire.
+"""
+
 from .library import *
 from .array import *
 
 def matmul(lhs, rhs, lhs_opts=MATPROP.NONE, rhs_opts=MATPROP.NONE):
+    """
+    Generalized matrix multiplication for two matrices.
+
+    Parameters
+    ----------
+
+    lhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    rhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    lhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.
+              Can be one of
+               - af.MATPROP.NONE   - If no op should be done on `lhs`.
+               - af.MATPROP.TRANS  - If `lhs` has to be transposed before multiplying.
+               - af.MATPROP.CTRANS - If `lhs` has to be hermitian transposed before multiplying.
+
+    rhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.
+              Can be one of
+               - af.MATPROP.NONE   - If no op should be done on `rhs`.
+               - af.MATPROP.TRANS  - If `rhs` has to be transposed before multiplying.
+               - af.MATPROP.CTRANS - If `rhs` has to be hermitian transposed before multiplying.
+
+    Returns
+    -------
+
+    out : af.Array
+          Output of the matrix multiplication on `lhs` and `rhs`.
+
+    Note
+    -----
+
+    - The data types of `lhs` and `rhs` should be the same.
+    - Batches are not supported.
+
+    """
     out = Array()
     safe_call(backend.get().af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
                                       lhs_opts.value, rhs_opts.value))
     return out
 
 def matmulTN(lhs, rhs):
+    """
+    Matrix multiplication after transposing the first matrix.
+
+    Parameters
+    ----------
+
+    lhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    rhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    Returns
+    -------
+
+    out : af.Array
+          Output of the matrix multiplication on `transpose(lhs)` and `rhs`.
+
+    Note
+    -----
+
+    - The data types of `lhs` and `rhs` should be the same.
+    - Batches are not supported.
+
+    """
     out = Array()
     safe_call(backend.get().af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
                                       MATPROP.TRANS.value, MATPROP.NONE.value))
     return out
 
 def matmulNT(lhs, rhs):
+    """
+    Matrix multiplication after transposing the second matrix.
+
+    Parameters
+    ----------
+
+    lhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    rhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    Returns
+    -------
+
+    out : af.Array
+          Output of the matrix multiplication on `lhs` and `transpose(rhs)`.
+
+    Note
+    -----
+
+    - The data types of `lhs` and `rhs` should be the same.
+    - Batches are not supported.
+
+    """
     out = Array()
     safe_call(backend.get().af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
                                       MATPROP.NONE.value, MATPROP.TRANS.value))
     return out
 
 def matmulTT(lhs, rhs):
+    """
+    Matrix multiplication after transposing both inputs.
+
+    Parameters
+    ----------
+
+    lhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    rhs : af.Array
+          A 2 dimensional, real or complex arrayfire array.
+
+    Returns
+    -------
+
+    out : af.Array
+          Output of the matrix multiplication on `transpose(lhs)` and `transpose(rhs)`.
+
+    Note
+    -----
+
+    - The data types of `lhs` and `rhs` should be the same.
+    - Batches are not supported.
+
+    """
     out = Array()
     safe_call(backend.get().af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,
                                       MATPROP.TRANS.value, MATPROP.TRANS.value))
     return out
 
 def dot(lhs, rhs, lhs_opts=MATPROP.NONE, rhs_opts=MATPROP.NONE):
+    """
+    Dot product of two input vectors.
+
+    Parameters
+    ----------
+
+    lhs : af.Array
+          A 1 dimensional, real or complex arrayfire array.
+
+    rhs : af.Array
+          A 1 dimensional, real or complex arrayfire array.
+
+    lhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.
+              Can be one of
+               - af.MATPROP.NONE   - If no op should be done on `lhs`.
+               - No other options are currently supported.
+
+    rhs_opts: optional: af.MATPROP. default: af.MATPROP.NONE.
+              Can be one of
+               - af.MATPROP.NONE   - If no op should be done on `rhs`.
+               - No other options are currently supported.
+
+    Returns
+    -------
+
+    out : af.Array
+          Output of dot product of `lhs` and `rhs`.
+
+    Note
+    -----
+
+    - The data types of `lhs` and `rhs` should be the same.
+    - Batches are not supported.
+
+    """
     out = Array()
     safe_call(backend.get().af_dot(ct.pointer(out.arr), lhs.arr, rhs.arr,
                                    lhs_opts.value, rhs_opts.value))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list