Exemplo n.º 1
0
        public static MatrixR8 Identical(int dim)
        {
            MatrixR8 m = new MatrixR8(dim, dim);

            for (int i = 0; i < dim; i++)
            {
                m.vals[i, i] = Rational.One;
            }
            return(m);
        }
Exemplo n.º 2
0
        public MatrixR8 SubMatrix(int st_line, int st_column, int width, int height)
        {
            this.checkContainsRect(st_line, st_column, height, width);

            MatrixR8 m = new MatrixR8(width, height);

            for (int l = 0; l < width; l++)
            {
                for (int c = 0; c < height; c++)
                {
                    m.vals[l, c] = this.vals[st_line++, st_column++];
                }
            }
            return(m);
        }
Exemplo n.º 3
0
        //===========================================================
        //		複製
        //===========================================================
        /// <summary>
        /// Matrix のコピーコンストラクタです。
        /// </summary>
        /// <param name="matrix">複製元の Matrix を指定します。</param>
        public MatrixR8(MatrixR8 matrix)
        {
            this.vals = new Rational[
                this.height = matrix.height,
                this.width = matrix.width
                        ];

            for (int l = 0; l < this.height; l++)
            {
                for (int c = 0; c < this.width; c++)
                {
                    this.vals[l, c] = matrix.vals[l, c];
                }
            }
        }
Exemplo n.º 4
0
        //===========================================================
        //		連結・部分行列
        //===========================================================
        public static MatrixR8 Connect(MatrixR8 m1, MatrixR8 m2)
        {
            if (m1.height != m2.height)
            {
                throw new System.ArgumentException("異なる行数の行列を連結する事は出来ません。");
            }
            MatrixR8 m = new MatrixR8(m1.height, m1.width + m2.width);

            for (int l = 0; l < m1.height; l++)
            {
                int c  = 0;
                int c1 = 0;
                while (c1 < m1.width)
                {
                    m.vals[l, c++] = m1.vals[l, c1++];
                }
                c1 = 0;
                while (c1 < m2.width)
                {
                    m.vals[l, c++] = m2.vals[l, c1++];
                }
            }
            return(m);
        }
Exemplo n.º 5
0
 internal LineCollection(MatrixR8 parent)
 {
     this.parent = parent;
 }