1 | --- ./Packages/dotblas/dotblas/_dotblas.c.orig 2005-04-07 17:15:47.000000000 +1200 |
---|
2 | +++ ./Packages/dotblas/dotblas/_dotblas.c 2005-11-30 07:54:12.000000000 +1300 |
---|
3 | @@ -52,7 +52,7 @@ |
---|
4 | static PyObject *dotblas_matrixproduct(PyObject *dummy, PyObject *args) { |
---|
5 | PyObject *op1, *op2; |
---|
6 | PyArrayObject *ap1, *ap2, *ret; |
---|
7 | - int i, j, l, lda, ldb, matchDim = -1, otherDim = -1; |
---|
8 | + int i, j, l, lda, ldb, ldc, matchDim = -1, otherDim = -1; |
---|
9 | int typenum; |
---|
10 | int dimensions[MAX_DIMS], nd; |
---|
11 | static const float oneF[2] = {1.0, 0.0}; |
---|
12 | @@ -248,33 +248,34 @@ |
---|
13 | /* Matrix matrix multiplication -- Level 3 BLAS */ |
---|
14 | lda = (ap1->dimensions[1] > 1 ? ap1->dimensions[1] : 1); |
---|
15 | ldb = (ap2->dimensions[1] > 1 ? ap2->dimensions[1] : 1); |
---|
16 | + ldc = (ret->dimensions[1] > 1 ? ret->dimensions[1] : 1); |
---|
17 | if (typenum == PyArray_DOUBLE) { |
---|
18 | cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, |
---|
19 | ap1->dimensions[0], ap2->dimensions[1], ap2->dimensions[0], |
---|
20 | 1.0, (double *)ap1->data, lda, |
---|
21 | (double *)ap2->data, ldb, |
---|
22 | - 0.0, (double *)ret->data, ldb); |
---|
23 | + 0.0, (double *)ret->data, ldc); |
---|
24 | } |
---|
25 | else if (typenum == PyArray_FLOAT) { |
---|
26 | cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, |
---|
27 | ap1->dimensions[0], ap2->dimensions[1], ap2->dimensions[0], |
---|
28 | 1.0, (float *)ap1->data, lda, |
---|
29 | (float *)ap2->data, ldb, |
---|
30 | - 0.0, (float *)ret->data, ldb); |
---|
31 | + 0.0, (float *)ret->data, ldc); |
---|
32 | } |
---|
33 | else if (typenum == PyArray_CDOUBLE) { |
---|
34 | cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, |
---|
35 | ap1->dimensions[0], ap2->dimensions[1], ap2->dimensions[0], |
---|
36 | oneD, (double *)ap1->data, lda, |
---|
37 | (double *)ap2->data, ldb, |
---|
38 | - zeroD, (double *)ret->data, ldb); |
---|
39 | + zeroD, (double *)ret->data, ldc); |
---|
40 | } |
---|
41 | else if (typenum == PyArray_CFLOAT) { |
---|
42 | cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, |
---|
43 | ap1->dimensions[0], ap2->dimensions[1], ap2->dimensions[0], |
---|
44 | oneF, (float *)ap1->data, lda, |
---|
45 | (float *)ap2->data, ldb, |
---|
46 | - zeroF, (float *)ret->data, ldb); |
---|
47 | + zeroF, (float *)ret->data, ldc); |
---|
48 | } |
---|
49 | } |
---|
50 | else { |
---|
51 | @@ -334,7 +335,7 @@ |
---|
52 | static PyObject *dotblas_innerproduct(PyObject *dummy, PyObject *args) { |
---|
53 | PyObject *op1, *op2; |
---|
54 | PyArrayObject *ap1, *ap2, *ret; |
---|
55 | - int i, j, l, lda, ldb; |
---|
56 | + int i, j, l, lda, ldb, ldc; |
---|
57 | int typenum; |
---|
58 | int dimensions[MAX_DIMS], nd; |
---|
59 | static const float oneF[2] = {1.0, 0.0}; |
---|
60 | @@ -525,33 +526,34 @@ |
---|
61 | /* Matrix matrix multiplication -- Level 3 BLAS */ |
---|
62 | lda = (ap1->dimensions[1] > 1 ? ap1->dimensions[1] : 1); |
---|
63 | ldb = (ap2->dimensions[1] > 1 ? ap2->dimensions[1] : 1); |
---|
64 | + ldc = (ret->dimensions[1] > 1 ? ret->dimensions[1] : 1); |
---|
65 | if (typenum == PyArray_DOUBLE) { |
---|
66 | cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasTrans, |
---|
67 | ap1->dimensions[0], ap2->dimensions[0], ap1->dimensions[1], |
---|
68 | 1.0, (double *)ap1->data, lda, |
---|
69 | (double *)ap2->data, ldb, |
---|
70 | - 0.0, (double *)ret->data, ldb); |
---|
71 | + 0.0, (double *)ret->data, ldc); |
---|
72 | } |
---|
73 | else if (typenum == PyArray_FLOAT) { |
---|
74 | cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, |
---|
75 | ap1->dimensions[0], ap2->dimensions[0], ap1->dimensions[1], |
---|
76 | 1.0, (float *)ap1->data, lda, |
---|
77 | (float *)ap2->data, ldb, |
---|
78 | - 0.0, (float *)ret->data, ldb); |
---|
79 | + 0.0, (float *)ret->data, ldc); |
---|
80 | } |
---|
81 | else if (typenum == PyArray_CDOUBLE) { |
---|
82 | cblas_zgemm(CblasRowMajor, CblasNoTrans, CblasTrans, |
---|
83 | ap1->dimensions[0], ap2->dimensions[0], ap1->dimensions[1], |
---|
84 | oneD, (double *)ap1->data, lda, |
---|
85 | (double *)ap2->data, ldb, |
---|
86 | - zeroD, (double *)ret->data, ldb); |
---|
87 | + zeroD, (double *)ret->data, ldc); |
---|
88 | } |
---|
89 | else if (typenum == PyArray_CFLOAT) { |
---|
90 | cblas_cgemm(CblasRowMajor, CblasNoTrans, CblasTrans, |
---|
91 | ap1->dimensions[0], ap2->dimensions[0], ap1->dimensions[1], |
---|
92 | oneF, (float *)ap1->data, lda, |
---|
93 | (float *)ap2->data, ldb, |
---|
94 | - zeroF, (float *)ret->data, ldb); |
---|
95 | + zeroF, (float *)ret->data, ldc); |
---|
96 | } |
---|
97 | } |
---|
98 | else { |
---|
99 | @@ -703,7 +705,7 @@ |
---|
100 | /* Add some symbolic constants to the module */ |
---|
101 | d = PyModule_GetDict(m); |
---|
102 | |
---|
103 | - s = PyString_FromString("$Id: _dotblas.c,v 1.3 2005/04/06 22:40:23 dmcooke Exp $"); |
---|
104 | + s = PyString_FromString("$Id: _dotblas.c,v 1.4 2005/11/29 18:54:12 teoliphant Exp $"); |
---|
105 | PyDict_SetItemString(d, "__version__", s); |
---|
106 | Py_DECREF(s); |
---|