/// <summary> /// Dot product of two arrays. /// </summary> /// <param name="a">input array</param> /// <param name="b">input array</param> /// <returns></returns> public static ndarray dot(object a, object b) { dtype d = FindArrayType(asanyarray(a), null); d = FindArrayType(asanyarray(b), d); ndarray arr1 = np.FromAny(a, d, flags: NPYARRAYFLAGS.NPY_ALIGNED); ndarray arr2 = np.FromAny(b, d, flags: NPYARRAYFLAGS.NPY_ALIGNED); return(NpyCoreApi.MatrixProduct(arr1, arr2, d.TypeNum)); }
public static ndarray dot(object o1, object o2) { dtype d = FindArrayType(asanyarray(o1), null); d = FindArrayType(asanyarray(o2), d); ndarray a1 = np.FromAny(o1, d, flags: NPYARRAYFLAGS.NPY_ALIGNED); ndarray a2 = np.FromAny(o2, d, flags: NPYARRAYFLAGS.NPY_ALIGNED); return(NpyCoreApi.MatrixProduct(a1, a2, d.TypeNum)); }
/// <summary> /// Matrix product of two arrays. /// </summary> /// <param name="o1"></param> /// <param name="o2"></param> /// <returns></returns> public static ndarray MatrixProduct(object o1, object o2) { dtype d = FindArrayType(o1, null); d = FindArrayType(o2, d); ndarray a1 = np.FromAny(o1, d, flags: NPYARRAYFLAGS.NPY_ALIGNED); ndarray a2 = np.FromAny(o2, d, flags: NPYARRAYFLAGS.NPY_ALIGNED); if (a1.ndim == 0) { return(EnsureAnyArray((a1.item() as ndarray) * a2)); } else if (a2.ndim == 0) { return(EnsureAnyArray(a1 * (a2.item() as ndarray))); } else { return(NpyCoreApi.MatrixProduct(a1, a2, d.TypeNum)); } }