コード例 #1
0
        public void Determinant()
        {
            Matrix3x3d m = new Matrix3x3d((double)1, (double)0, (double)0,
                                          (double)2, (double)2, (double)3,
                                          (double)0, (double)5, (double)3);

            Assert.AreEqual((double)-9.0, m.Determinant);
        }
コード例 #2
0
        public void Multiplication1()
        {
            Matrix3x3d m = new Matrix3x3d((double)1, (double)0, (double)0,
                                          (double)2, (double)2, (double)3,
                                          (double)0, (double)5, (double)3);

            Assert.IsTrue((m * Matrix3x3d.Identity).Equals(m));
        }
コード例 #3
0
ファイル: LinearSolver.cs プロジェクト: zigaosolin/SharpMedia
        /// <summary>
        /// Prepares system for solving many times with different data.
        /// </summary>
        /// <param name="S">The system.</param>
        /// <returns>Delegate capable of doing such work.</returns>
        public static Vector3d.Processor GetSolutionProcessorOf(Matrix3x3d S)
        {
            Matrix3x3d inverse = S.Inverse;

            return(delegate(Vector3d x)
            {
                return inverse * x;
            });
        }
コード例 #4
0
        public void Inverse()
        {
            Matrix3x3d m = new Matrix3x3d((double)1, (double)0, (double)0,
                                          (double)2, (double)2, (double)3,
                                          (double)0, (double)5, (double)3);

            m = m.Inverse;

            Assert.IsTrue(
                Matrix3x3d.NearEqual(m, new Matrix3x3d(
                                         (double)1, (double)0, (double)0,
                                         (double)2.0 / (double)3.0, -1.0 / (double)3.0, 1.0 / (double)3.0,
                                         (double)-10.0 / (double)9.0, (double)5.0 / (double)9.0, (double)-2.0 / (double)9.0)));
        }
コード例 #5
0
        public void Multiplication2()
        {
            Matrix3x3d m = new Matrix3x3d((double)1, (double)0, (double)0,
                                          (double)2, (double)2, (double)3,
                                          (double)0, (double)5, (double)3);

            Matrix3x3d m_inv = new Matrix3x3d(
                (double)1, (double)0, (double)0,
                (double)2.0 / (double)3.0, -1.0 / (double)3.0, 1.0 / (double)3.0,
                (double)-10.0 / (double)9.0, (double)5.0 / (double)9.0, (double)-2.0 / (double)9.0);

            Matrix3x3d r = m * m_inv;

            Assert.IsTrue(Matrix3x3d.NearEqual(r, Matrix3x3d.Identity));
        }
コード例 #6
0
ファイル: LinearSolver.cs プロジェクト: zigaosolin/SharpMedia
 /// <summary>
 /// We solve the system of equations, defined as:
 /// M * X = C.
 /// </summary>
 /// <param name="S">The system in matrix form.</param>
 /// <param name="C">constants</param>
 /// <returns></returns>
 public static Vector3d SolveSystem(Matrix3x3d S, Vector3d C)
 {
     return(S.Inverse * C);
 }