本文整理汇总了C#中Encog.MathUtil.Matrices.Matrix.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix.Equals方法的具体用法?C# Matrix.Equals怎么用?C# Matrix.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encog.MathUtil.Matrices.Matrix
的用法示例。
在下文中一共展示了Matrix.Equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy
public void Copy()
{
double[][] data = {
new[] {1.0, 2.0},
new[] {3.0, 4.0}
};
var source = new Matrix(data);
var target = new Matrix(2, 2);
MatrixMath.Copy(source, target);
Assert.IsTrue(source.Equals(target));
}
示例2: Boolean
public void Boolean()
{
bool[][] matrixDataBoolean = {
new[] {true, false},
new[] {false, true}
};
double[][] matrixDataDouble = {
new[] {1.0, -1.0},
new[] {-1.0, 1.0},
};
var matrixBoolean = new Matrix(matrixDataBoolean);
var matrixDouble = new Matrix(matrixDataDouble);
Assert.IsTrue(matrixBoolean.Equals(matrixDouble));
}
示例3: Bipolar2Double
public void Bipolar2Double()
{
// test a 1x4
bool[] boolData1 = { true, false, true, false };
double[] checkData1 = { 1, -1, 1, -1 };
Matrix matrix1 = Matrix.CreateRowMatrix(BiPolarUtil.Bipolar2double(boolData1));
Matrix checkMatrix1 = Matrix.CreateRowMatrix(checkData1);
Assert.IsTrue(matrix1.Equals(checkMatrix1));
// test a 2x2
bool[][] boolData2 = {
new[]{ true, false },
new[]{ false, true } };
double[][] checkData2 = {
new[] { 1.0, -1.0 },
new[] { -1.0, 1.0 } };
var matrix2 = new Matrix(BiPolarUtil.Bipolar2double(boolData2));
var checkMatrix2 = new Matrix(checkData2);
Assert.IsTrue(matrix2.Equals(checkMatrix2));
}
示例4: DeleteRow
public void DeleteRow()
{
double[][] origData = {
new[] {1.0, 2.0},
new[] {3.0, 4.0}
};
double[][] checkData = {new[] {3.0, 4.0}};
var orig = new Matrix(origData);
Matrix matrix = MatrixMath.DeleteRow(orig, 0);
var check = new Matrix(checkData);
Assert.IsTrue(check.Equals(matrix));
try
{
MatrixMath.DeleteRow(orig, 10);
Assert.IsTrue(false);
}
catch (MatrixError)
{
}
}
示例5: Identity
public void Identity()
{
try
{
MatrixMath.Identity(0);
Assert.IsTrue(false);
}
catch (MatrixError)
{
}
double[][] checkData = {
new[] {1.0, 0.0},
new[] {0.0, 1.0}
};
var check = new Matrix(checkData);
Matrix matrix = MatrixMath.Identity(2);
Assert.IsTrue(check.Equals(matrix));
}
示例6: PackedArray
public void PackedArray()
{
double[][] matrixData = {
new[] {1.0, 2.0},
new[] {3.0, 4.0}
};
var matrix = new Matrix(matrixData);
double[] matrixData2 = matrix.ToPackedArray();
Assert.AreEqual(4, matrixData2.Length);
Assert.AreEqual(1.0, matrix[0, 0]);
Assert.AreEqual(2.0, matrix[0, 1]);
Assert.AreEqual(3.0, matrix[1, 0]);
Assert.AreEqual(4.0, matrix[1, 1]);
var matrix2 = new Matrix(2, 2);
matrix2.FromPackedArray(matrixData2, 0);
Assert.IsTrue(matrix.Equals(matrix2));
}
示例7: MatrixEquals
public void MatrixEquals()
{
double[][] m1 = {
new[] {1.0, 2.0},
new[] {3.0, 4.0}
};
double[][] m2 = {
new[] {0.0, 2.0},
new[] {3.0, 4.0}
};
var matrix1 = new Matrix(m1);
var matrix2 = new Matrix(m1);
Assert.IsTrue(matrix1.Equals(matrix2));
matrix2 = new Matrix(m2);
Assert.IsFalse(matrix1.Equals(matrix2));
}