public void Divide() { ComplexDoubleVector a = new ComplexDoubleVector(new double[4] { 0, 1, 2, 3 }); ComplexDoubleVector c = new ComplexDoubleVector(a); ComplexDoubleVector d = new ComplexDoubleVector(a); double scal = -4; c = a / scal; d = ComplexDoubleVector.Divide(a, scal); Assert.AreEqual(c[0], a[0] / scal); Assert.AreEqual(c[1], a[1] / scal); Assert.AreEqual(c[2], a[2] / scal); Assert.AreEqual(c[3], a[3] / scal); Assert.AreEqual(d[0], a[0] / scal); Assert.AreEqual(d[1], a[1] / scal); Assert.AreEqual(d[2], a[2] / scal); Assert.AreEqual(d[3], a[3] / scal); }
public void ScalarMultiplyAndDivide() { ComplexDoubleVector a = new ComplexDoubleVector(new double[4] { 0, 1, 2, 3 }); ComplexDoubleVector c = new ComplexDoubleVector(a); ComplexDoubleVector d = new ComplexDoubleVector(a); double scal = -4; c.Multiply(scal); d.Divide(scal); Assert.AreEqual(c[0], a[0] * scal); Assert.AreEqual(c[1], a[1] * scal); Assert.AreEqual(c[2], a[2] * scal); Assert.AreEqual(c[3], a[3] * scal); Assert.AreEqual(d[0], a[0] / scal); Assert.AreEqual(d[1], a[1] / scal); Assert.AreEqual(d[2], a[2] / scal); Assert.AreEqual(d[3], a[3] / scal); c = a * scal; Assert.AreEqual(c[0], a[0] * scal); Assert.AreEqual(c[1], a[1] * scal); Assert.AreEqual(c[2], a[2] * scal); Assert.AreEqual(c[3], a[3] * scal); c = scal * a; Assert.AreEqual(c[0], a[0] * scal); Assert.AreEqual(c[1], a[1] * scal); Assert.AreEqual(c[2], a[2] * scal); Assert.AreEqual(c[3], a[3] * scal); }