/// <summary> /// Calls VectorCrossProduct for every vector in the tensor /// </summary> public static GenTensor <T> TensorVectorCrossProduct(GenTensor <T> a, GenTensor <T> b) { #if ALLOW_EXCEPTIONS if (a.Shape != b.Shape) { throw new InvalidShapeException($"Pre-shapes of {nameof(a)} and {nameof(b)} should be equal"); } #endif var res = new GenTensor <T>(a.Shape); foreach (var index in a.IterateOverVectors()) { res.SetSubtensor( VectorCrossProduct(a.GetSubtensor(index), b.GetSubtensor(index)), index ); } return(res); }