Skip to content

Commit 43fd699

Browse files
committed
Fixed matmul implementation for vectors
1 parent 3a98f72 commit 43fd699

File tree

1 file changed

+10
-1
lines changed
  • PyGLM_lib/PyGLM/type_methods

1 file changed

+10
-1
lines changed

PyGLM_lib/PyGLM/type_methods/vec.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,10 +1166,19 @@ vec_pow(PyObject * obj1, PyObject * obj2, PyObject * obj3) {
11661166
return pack_vec<L, T>(glm::mod(glm::pow(o, o2), o3));
11671167
}
11681168

1169+
static PyObject* dot_(PyObject*, PyObject* args);
1170+
11691171
static PyObject*
11701172
vec_matmul(PyObject* obj1, PyObject* obj2)
11711173
{
1172-
PyObject* out = PyNumber_Multiply(obj1, obj2);
1174+
PyObject* args = PyTuple_New(2);
1175+
PyTuple_SET_ITEM(args, 0, PyGLM_INCREF(obj1));
1176+
PyTuple_SET_ITEM(args, 1, PyGLM_INCREF(obj2));
1177+
1178+
PyObject* out = dot_(NULL, args);
1179+
1180+
Py_DECREF(args);
1181+
11731182
if (out == NULL) {
11741183
PyGLM_TYPEERROR_2O("unsupported operand type(s) for @: ", obj1, obj2);
11751184
}

0 commit comments

Comments
 (0)