public void RowVectorArithmetic() { // addition and multiplication by a double RowVector RA = R + R; RowVector R2 = 2.0 * R; Assert.IsTrue(RA == R2); // subtraction and multiplication by a double RowVector RS = R - R; RowVector R0 = 0.0 * R; Assert.IsTrue(RS == R0); // negation and multiplication by -1 RowVector RN = -R; RowVector RD = R / (-1.0); Assert.IsTrue(RN == RD); // multiply a column by a matrix RowVector RM = R * M; Assert.IsTrue(RM.Dimension == M.ColumnCount); // dot multiply ColumnVector RT = R.Transpose(); double dot = R * RT; Assert.IsTrue(dot > 0); }
public void TransposeTest() { var rowVector = new RowVector(new double[] { 1, 2, 3, 4 }); var columnVector = rowVector.Transpose(); var expectedColumnVector = new double[] { 1, 2, 3, 4 }; Assert.IsInstanceOfType(columnVector, typeof(ColumnVector)); bool isEqual = Helpers.AreEqualVector(expectedColumnVector, columnVector); Assert.IsTrue(isEqual); }
public void VectorAsMatrix() { RowVector r = new RowVector(1.0, 2.0, 3.0); Assert.IsTrue(r[0, 1] == r[1]); r[0, 1] = 0.0; Assert.IsTrue(r[1] == 0.0); ColumnVector c = r.Transpose(); Assert.IsTrue(c[1, 0] == 0.0); c[1, 0] = 2.0; Assert.IsTrue(c[1] == 2.0); }
internal double GetEnergy(RowVector patternVector) { var energy = patternVector * this.WeightMatrix * patternVector.Transpose(); return(energy); }