forked from arrayfire/arrayfire-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblas.py
More file actions
41 lines (35 loc) · 1.32 KB
/
Copy pathblas.py
File metadata and controls
41 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################
from .library import *
from .array import *
def matmul(lhs, rhs, lhs_opts=AF_MAT_NONE, rhs_opts=AF_MAT_NONE):
out = array()
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
lhs_opts, rhs_opts))
return out
def matmulTN(lhs, rhs):
out = array()
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
AF_MAT_TRANS, AF_MAT_NONE))
return out
def matmulNT(lhs, rhs):
out = array()
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
AF_MAT_NONE, AF_MAT_TRANS))
return out
def matmulTT(lhs, rhs):
out = array()
safe_call(clib.af_matmul(ct.pointer(out.arr), lhs.arr, rhs.arr,\
AF_MAT_TRANS, AF_MAT_TRANS))
return out
def dot(lhs, rhs, lhs_opts=AF_MAT_NONE, rhs_opts=AF_MAT_NONE):
out = array()
safe_call(clib.af_dot(ct.pointer(out.arr), lhs.arr, rhs.arr,\
lhs_opts, rhs_opts))
return out