[docs]defmatmul(x1:Array,x2:Array,/)->Array:""" Matrix product of two arrays. """from.array_objectimportArrayifx1._array.ndim<2andx2._array.ndim<2:raiseValueError("matmul requires at least one array argument to have more than two dimensions")x1b,x2b,tmp_x1,tmp_x2=broadcast_if_needed(x1._array,x2._array)repMsg=generic_msg(cmd=f"matMul{len(x1b.shape)}D",args={"x1":x1b.name,"x2":x2b.name,},)iftmp_x1:delx1biftmp_x2:delx2breturnArray._new(create_pdarray(repMsg))
[docs]deftensordot():""" WARNING: not yet implemented """raiseValueError("tensordot not implemented")
[docs]defmatrix_transpose(x:Array)->Array:""" Matrix product of two arrays. """from.array_objectimportArrayifx._array.ndim<2:raiseValueError("matrix_transpose requires the array to have more than two dimensions")repMsg=generic_msg(cmd=f"transpose{x._array.ndim}D",args={"array":x._array.name,},)returnArray._new(create_pdarray(repMsg))