本文整理汇总了C#中MatrixF.GetRow方法的典型用法代码示例。如果您正苦于以下问题:C# MatrixF.GetRow方法的具体用法?C# MatrixF.GetRow怎么用?C# MatrixF.GetRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixF
的用法示例。
在下文中一共展示了MatrixF.GetRow方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultiplyMatrix
public void MultiplyMatrix()
{
float[] values = new float[] { 12, 23, 45, 56,
67, 89, 90, 12,
43, 65, 87, 43,
34, -12, 84, 44 };
MatrixF m = new MatrixF(4, 4, values, MatrixOrder.RowMajor);
Assert.AreEqual(new MatrixF(4, 4), MatrixF.Multiply(m, new MatrixF(4, 4)));
Assert.AreEqual(new MatrixF(4, 4), MatrixF.Multiply(new MatrixF(4, 4), m));
Assert.AreEqual(m, MatrixF.Multiply(m, MatrixF.CreateIdentity(4, 4)));
Assert.AreEqual(m, MatrixF.Multiply(MatrixF.CreateIdentity(4, 4), m));
Assert.IsTrue(MatrixF.AreNumericallyEqual(MatrixF.CreateIdentity(4, 4), MatrixF.Multiply(m, m.Inverse)));
Assert.IsTrue(MatrixF.AreNumericallyEqual(MatrixF.CreateIdentity(4, 4), MatrixF.Multiply(m.Inverse, m)));
MatrixF m1 = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);
MatrixF m2 = new MatrixF(4, 4, values, MatrixOrder.RowMajor);
MatrixF result = MatrixF.Multiply(m1, m2);
Assert.AreEqual(3, result.NumberOfRows);
Assert.AreEqual(4, result.NumberOfColumns);
for (int column = 0; column < 4; column++)
for (int row = 0; row < 3; row++)
Assert.AreEqual(VectorF.Dot(m1.GetRow(row), m2.GetColumn(column)), result[row, column]);
}
示例2: GetRowException2
public void GetRowException2()
{
MatrixF m = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);
m.GetRow(3);
}
示例3: SetRow
public void SetRow()
{
MatrixF m = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);
m.SetRow(0, new VectorF(new float[]{ 0.1f, 0.2f, 0.3f, 0.4f }));
Assert.AreEqual(new VectorF(new float[] { 0.1f, 0.2f, 0.3f, 0.4f }), m.GetRow(0));
Assert.AreEqual(new VectorF(new float[] { 5.0f, 6.0f, 7.0f, 8.0f }), m.GetRow(1));
Assert.AreEqual(new VectorF(new float[] { 9.0f, 10.0f, 11.0f, 12.0f }), m.GetRow(2));
m.SetRow(1, new VectorF(new float[] { 0.4f, 0.5f, 0.6f, 0.7f }));
Assert.AreEqual(new VectorF(new float[] { 0.1f, 0.2f, 0.3f, 0.4f }), m.GetRow(0));
Assert.AreEqual(new VectorF(new float[] { 0.4f, 0.5f, 0.6f, 0.7f }), m.GetRow(1));
Assert.AreEqual(new VectorF(new float[] { 9.0f, 10.0f, 11.0f, 12.0f }), m.GetRow(2));
m.SetRow(2, new VectorF(new float[] { 0.7f, 0.8f, 0.9f, 1.0f }));
Assert.AreEqual(new VectorF(new float[] { 0.1f, 0.2f, 0.3f, 0.4f }), m.GetRow(0));
Assert.AreEqual(new VectorF(new float[] { 0.4f, 0.5f, 0.6f, 0.7f }), m.GetRow(1));
Assert.AreEqual(new VectorF(new float[] { 0.7f, 0.8f, 0.9f, 1.0f }), m.GetRow(2));
}
示例4: GetRow
public void GetRow()
{
MatrixF m = new MatrixF(3, 4, rowMajor, MatrixOrder.RowMajor);
Assert.AreEqual(new VectorF(new float[] { 1.0f, 2.0f, 3.0f, 4.0f }), m.GetRow(0));
Assert.AreEqual(new VectorF(new float[] { 5.0f, 6.0f, 7.0f, 8.0f }), m.GetRow(1));
Assert.AreEqual(new VectorF(new float[] { 9.0f, 10.0f, 11.0f, 12.0f }), m.GetRow(2));
}
示例5: MultiplyVectorOperator
public void MultiplyVectorOperator()
{
VectorF v = new VectorF(new float[] { 2.34f, 3.45f, 4.56f, 23.4f });
Assert.AreEqual(v, MatrixF.CreateIdentity(4, 4) * v);
Assert.AreEqual(new VectorF(4), new MatrixF(4, 4) * v);
float[] values = new float[] { 12, 23, 45, 56,
67, 89, 90, 12,
43, 65, 87, 43,
34, -12, 84, 44 };
MatrixF m = new MatrixF(4, 4, values, MatrixOrder.RowMajor);
Assert.IsTrue(VectorF.AreNumericallyEqual(v, m * m.Inverse * v));
for (int i = 0; i < 4; i++)
Assert.IsTrue(Numeric.AreEqual(VectorF.Dot(m.GetRow(i), v), (m * v)[i]));
}