/// <summary> /// Computes dot product of two operands. /// </summary> /// <returns>Result of operation.</returns> public void Dot(Operand in1, Operand in2, Operand outOp) { if (in1.IsArray || !in1.Equals(in2) || !outOp.IsWritable) { throw new IncompatibleOperandsException("Addition operation requires both formats to be the same."); } PinFormat fmt; if (!PinFormatHelper.IsVector(in1.Format, out fmt) || outOp.Format != fmt) { throw new IncompatibleOperandsException("Only vector types can be used in dot product, scalars must match vector types."); } // We check if we can precache it, this is copy only op. if (in1.IsFixed && in2.IsFixed) { Operand tmp = CreateFixed(in1.Format, in1.ArraySize, Math.MathHelper.Dot(in1.Value, in2.Value)); // We must create a mem copy. compiler.Mov(tmp.Name, outOp.Name); return; } compiler.Dot(in1.Name, in2.Name, outOp.Name); }