Exemplo n.º 1
0
        void GetImageData()
        {
            BitmapData SrcBmpData = SrcBmp.LockBits(new Rectangle(0, 0, SrcBmp.Width, SrcBmp.Height), ImageLockMode.ReadWrite, SrcBmp.PixelFormat);
            BitmapData DstBmpData = DstBmp.LockBits(new Rectangle(0, 0, DstBmp.Width, DstBmp.Height), ImageLockMode.ReadWrite, DstBmp.PixelFormat);

            int   ImgWidth  = SrcBmp.Width;
            int   ImgHeight = SrcBmp.Height;
            int   ImgStride = SrcBmpData.Stride;
            byte *Src       = (byte *)SrcBmpData.Scan0;
            byte *Dest      = (byte *)DstBmpData.Scan0;

            if (SrcBmpData.PixelFormat == PixelFormat.Format8bppIndexed)
            {
                SrcImg  = new TMatrix(ImgWidth, ImgHeight, ImgStride, (int)IP_DEPTH.IP_DEPTH_8U, 1, Src);
                DestImg = new TMatrix(ImgWidth, ImgHeight, ImgStride, (int)IP_DEPTH.IP_DEPTH_8U, 1, Dest);
            }
            else if (SrcBmpData.PixelFormat == PixelFormat.Format24bppRgb)
            {
                SrcImg  = new TMatrix(ImgWidth, ImgHeight, ImgStride, (int)IP_DEPTH.IP_DEPTH_8U, 3, Src);
                DestImg = new TMatrix(ImgWidth, ImgHeight, ImgStride, (int)IP_DEPTH.IP_DEPTH_8U, 3, Dest);
            }
            else if (SrcBmpData.PixelFormat == PixelFormat.Format32bppArgb && DstBmpData.PixelFormat == PixelFormat.Format32bppArgb)
            {
                SrcImg  = new TMatrix(ImgWidth, ImgHeight, ImgStride, (int)IP_DEPTH.IP_DEPTH_8U, 4, Src);
                DestImg = new TMatrix(ImgWidth, ImgHeight, ImgStride, (int)IP_DEPTH.IP_DEPTH_8U, 4, Dest);
            }
            SrcBmp.UnlockBits(SrcBmpData);
            DstBmp.UnlockBits(DstBmpData);
        }
Exemplo n.º 2
0
        private void CmdProcess_Click(object sender, EventArgs e)
        {
            int Min_PosX = 0, Min_PosY = 0, Max_PosX = 0, Max_PosY = 0;

            BitmapData SrcBmpData = SrcBmp.LockBits(new Rectangle(0, 0, SrcBmp.Width, SrcBmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            BitmapData DstBmpData = DstBmp.LockBits(new Rectangle(0, 0, DstBmp.Width, DstBmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            Stopwatch Sw = new Stopwatch();

            Sw.Start();

            SrcImg  = new TMatrix(SrcBmp.Width, SrcBmp.Height, SrcBmpData.Stride, (int)IP_DEPTH.IP_DEPTH_8U, 3, (byte *)SrcBmpData.Scan0);
            DestImg = new TMatrix(DstBmp.Width, DstBmp.Height, DstBmpData.Stride, (int)IP_DEPTH.IP_DEPTH_8U, 3, (byte *)DstBmpData.Scan0);

            TMatrix *Dest = null;

            MatchTemplate(ref DestImg, ref SrcImg, ref Dest);
            MinMaxLoc(ref *Dest, ref Min_PosX, ref Min_PosY, ref Max_PosX, ref Max_PosY);
            IP_FreeMatrix(&Dest);
            SrcBmp.UnlockBits(SrcBmpData);
            DstBmp.UnlockBits(DstBmpData);

            Pen      P = new Pen(Color.Red);
            Graphics G = Graphics.FromImage(DstBmp);

            G.DrawRectangle(P, new Rectangle(Min_PosX, Min_PosY, SrcImg.Width, SrcImg.Height));
            P.Dispose();
            G.Dispose();

            LblInfo.Text = "Image size: " + PicSrc.Image.Width.ToString() + " X " + PicSrc.Image.Height.ToString() + "\nAlgorithm processing time " + Sw.ElapsedMilliseconds.ToString() + " ms";
            PicDest.Refresh();
        }
Exemplo n.º 3
0
        public void testInputTMatrix()
        {
            matrix = new TMatrix(matrix_col, matrix_row);

            matrix.InputMatrix(mass);

            Assert.AreEqual(mass, matrix.Mass);
        }
 /// <summary>
 /// Copies the member variables from another coordinate system.
 /// </summary>
 /// <param name="fromb">The coordinate system to copy from.</param>
 public override void CopyFrom(G2DCoordinateSystem fromb)
 {
   base.CopyFrom(fromb);
   if (fromb is G3DCartesicCoordinateSystem)
   {
     G3DCartesicCoordinateSystem from = (G3DCartesicCoordinateSystem)fromb;
     this._projectionMatrix = from._projectionMatrix;
   }
 }
 /// <summary>
 /// Copies the member variables from another coordinate system.
 /// </summary>
 /// <param name="fromb">The coordinate system to copy from.</param>
 public override void CopyFrom(G2DCoordinateSystem fromb)
 {
     base.CopyFrom(fromb);
     if (fromb is G3DCartesicCoordinateSystem)
     {
         G3DCartesicCoordinateSystem from = (G3DCartesicCoordinateSystem)fromb;
         this._projectionMatrix = from._projectionMatrix;
     }
 }
Exemplo n.º 6
0
		/// <summary>
		/// Copies the member variables from another coordinate system.
		/// </summary>
		/// <param name="fromb">The coordinate system to copy from.</param>
		public override void CopyFrom(G2DCoordinateSystem fromb)
		{
			if (object.ReferenceEquals(this, fromb))
				return;

			base.CopyFrom(fromb);
			if (fromb is G3DCartesicCoordinateSystem)
			{
				G3DCartesicCoordinateSystem from = (G3DCartesicCoordinateSystem)fromb;
				this._projectionMatrix = from._projectionMatrix;
			}
		}
Exemplo n.º 7
0
        public void testOutputTMatrix()
        {
            matrix = new TMatrix(matrix_col, matrix_row);

            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);

                matrix.Show();

                Assert.AreEqual("0 0  \r\n0 0  \r\n0 0  \r\n", sw.ToString());
            }
        }
Exemplo n.º 8
0
        internal static TMatrix MatrixLToTMatrix(MatrixL <TNumber> src)
        {
            TMatrix res = new TMatrix(new TNumber[src.R, src.C]);

            for (int i = 0; i < src.R; i++)
            {
                for (int j = 0; j < src.C; j++)
                {
                    res[i, j] = src[i, j];
                }
            }
            return(res);
        }
Exemplo n.º 9
0
        public Window(string Title, int Width, int Height) : base(Title, Width, Height)
        {
            IsVisible = true;

            presenter = new Present(Handle, true);

            vertexShader = new VertexShader(Properties.Resources.shader, "vs_main");
            pixelShader  = new PixelShader(Properties.Resources.shader, "ps_main");

            inputLayout = new InputLayout(
                new InputLayout.Element[] {
                new InputLayout.Element("POSITION", ElementSize.eFloat3),
                new InputLayout.Element("COLOR", ElementSize.eFlaot4)
            });

            resourceLayout = new ResourceLayout(
                new ResourceLayout.Element[]
            {
                new ResourceLayout.Element(ResourceType.ConstantBufferView, 0),
                new ResourceLayout.Element(ResourceType.ConstantBufferView, 1)
            });

            graphicsPipelineState = new GraphicsPipelineState(vertexShader, pixelShader, inputLayout,
                                                              resourceLayout, new RasterizerState()
            {
                FillMode = FillMode.Wireframe
            }, new DepthStencilState(true), new BlendState());

            Micos.Camera = new Camera();
            Micos.Camera.Transform.Position = new Vector3(0, 0, -100);

            Micos.Camera.Project = TMatrix.CreatePerspectiveFieldOfViewLH((float)Math.PI * 0.55f,
                                                                          (float)Width / Height, 1.0f, 2000.0f);

            for (int i = 0; i < EventThing.ObjectCount; i++)
            {
                Cube cube = new Cube(10, 10, 10);
                cube.Transform.Position = new Vector3(EventThing.INT, EventThing.INT, EventThing.INT);
                cube.Forward            = Vector3.Normalize(new Vector3(EventThing.INT, EventThing.INT, 0));
                cube.RotateSpeed        = new Vector3(EventThing.FLOAT, EventThing.FLOAT, 0);
                Micos.Add(cube);
            }

            Micos.Add(fpsCounter = new FpsCounter());

            Resource.cameraBuffer.view   = Micos.Camera;
            Resource.cameraBuffer.proj   = Micos.Camera.Project;
            Resource.cameraBuffer.eyePos = new Vector4(Micos.Camera.Transform.Position, 1);

            CameraBuffer.View.Update(ref Resource.cameraBuffer);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Copies the member variables from another coordinate system.
        /// </summary>
        /// <param name="fromb">The coordinate system to copy from.</param>
        public override void CopyFrom(G2DCoordinateSystem fromb)
        {
            if (object.ReferenceEquals(this, fromb))
            {
                return;
            }

            base.CopyFrom(fromb);
            if (fromb is G3DCartesicCoordinateSystem)
            {
                var from = (G3DCartesicCoordinateSystem)fromb;
                _projectionMatrix = from._projectionMatrix;
            }
        }
Exemplo n.º 11
0
        public Shape(EnShapeType type, TMatrix data)
        {
            Type = type;
            Data = data;

            IsLineColorManual = false;
            IsLineWidthManual = false;
            IsFillColorManual = false;

            LineStyle = DashStyle.Solid;
            LineWidth = 1;
            LineColor = Color.Black;

            FillColor = Color.Transparent;
        }
Exemplo n.º 12
0
        public void testSumTMatrix()
        {
            matrix = new TMatrix(matrix_col, matrix_row);
            var matrix2 = new TMatrix(matrix_col, matrix_row);

            matrix.InputMatrix(mass);

            matrix2.InputMatrix(mass);

            matrix.Sum(matrix2);

            Assert.AreEqual(new int[, ] {
                { 2, 2 }, { 4, 4 }, { 6, 6 }
            }, matrix.Mass);
        }
Exemplo n.º 13
0
        internal static string[] EntryMatrix2ArrStr(BaseEntry matrix)
        {
            TMatrix mt = matrix as TMatrix;
            //int n = mt.unit.GetLength(0);
            //int m = mt.unit.GetLength(0);
            List <string> mts = new List <string>(mt.Length());

            foreach (var item in mt.unit)
            {
                mts.Add(item.obj.ToString());
            }
            //string source = matrix.ToString();
            //source = source.Trim(new char[] { 'm', 'a', 't', '(', ')' });
            //return source.Split(',','\n');
            return(mts.ToArray());
        }
Exemplo n.º 14
0
        void ShowResult()
        {
            BitmapData SrcBmpData = SrcBmp.LockBits(new Rectangle(0, 0, SrcBmp.Width, SrcBmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            BitmapData DstBmpData = DstBmp.LockBits(new Rectangle(0, 0, DstBmp.Width, DstBmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            SrcImg  = new TMatrix(SrcBmp.Width, SrcBmp.Height, SrcBmpData.Stride, (int)IP_DEPTH.IP_DEPTH_8U, 3, (byte *)SrcBmpData.Scan0);
            DestImg = new TMatrix(SrcBmp.Width, SrcBmp.Height, SrcBmpData.Stride, (int)IP_DEPTH.IP_DEPTH_8U, 3, (byte *)DstBmpData.Scan0);

            Stopwatch Sw = new Stopwatch();

            Sw.Start();

            SelectiveBlur(ref SrcImg, ref DestImg, Radius.Value, Threshold.Value, EdgeMode.Tile);

            LblInfo.Text = "Image size: " + PicSrc.Image.Width.ToString() + " X " + PicSrc.Image.Height.ToString() + "\nAlgorithm processing time " + Sw.ElapsedMilliseconds.ToString() + " ms";

            SrcBmp.UnlockBits(SrcBmpData);
            DstBmp.UnlockBits(DstBmpData);
            PicDest.Refresh();
        }
Exemplo n.º 15
0
        internal static MatrixL <TNumber> TMatrixToMatrixL(TNumber src)
        {
            if (src.obj.Type != BaseEntryType.Matrix)
            {
                return(null);
            }
            int r = src.Rows().ToInt32();
            int c = src.Cols().ToInt32();
            MatrixL <TNumber> res    = new MatrixL <TNumber>(r, c, new TNumber(0, 1));
            TMatrix           matrix = (TMatrix)src.obj;

            for (int i = 0; i < r; i++)
            {
                for (int j = 0; j < c; j++)
                {
                    res[i, j] = matrix[i, j];
                }
            }

            return(res);
        }
Exemplo n.º 16
0
        private void CmdDeal_Click(object sender, EventArgs e)
        {
            BitmapData SrcBmpData = SrcBmp.LockBits(new Rectangle(0, 0, SrcBmp.Width, SrcBmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            BitmapData DstBmpData = DstBmp.LockBits(new Rectangle(0, 0, DstBmp.Width, DstBmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            Stopwatch Sw = new Stopwatch();

            Sw.Start();


            SrcImg  = new TMatrix(SrcBmp.Width, SrcBmp.Height, SrcBmpData.Stride, (int)IP_DEPTH.IP_DEPTH_8U, 3, (byte *)SrcBmpData.Scan0);
            DestImg = new TMatrix(DstBmp.Width, DstBmp.Height, DstBmpData.Stride, (int)IP_DEPTH.IP_DEPTH_8U, 3, (byte *)DstBmpData.Scan0);

            ImageQuilting(ref SrcImg, ref DestImg, TileSize.Value, TileSize.Value, Overlap.Value, Overlap.Value);



            SrcBmp.UnlockBits(SrcBmpData);
            DstBmp.UnlockBits(DstBmpData);
            LblInfo.Text = "Image size: " + PicSrc.Image.Width.ToString() + " X " + PicSrc.Image.Height.ToString() + "\nAlgorithm processing time " + Sw.ElapsedMilliseconds.ToString() + " ms";
            PicDest.Refresh();
        }
Exemplo n.º 17
0
 private static extern IP_RET MinMaxLoc(ref TMatrix Src, ref int Min_PosX, ref int Min_PosY, ref int Max_PosX, ref int Max_PosY);
Exemplo n.º 18
0
 private static extern IP_RET DCT_Denoising(ref TMatrix Src, ref TMatrix Dest, float Sigma_C);
Exemplo n.º 19
0
        static void Main()
        {
            try
            {
                var           mi1 = new TMatrix <int>(2, 2, 9, 5, 1, 6);
                var           mi2 = new TMatrix <int>((int[, ])null);
                TMatrix <int> mi3 = null;

                Console.WriteLine(TMatrix <int> .CheckSum(mi1, mi1));
                Console.WriteLine(TMatrix <int> .CheckSum(mi1, mi2));
                Console.WriteLine(TMatrix <int> .CheckSum(mi1, mi3));
                Console.WriteLine(TMatrix <int> .CheckSum(mi2, mi3));

                //string s = "int";

                //Console.WriteLine(typeof(s.GetType())).ToString());

                //Fraction f = new Fraction();

                //Console.WriteLine(f.denominator);
                //f.AutoReduce = true;
                //Fraction f = new Fraction(7, 31), f1 = new Fraction(5, 7);
                //Console.WriteLine(typeof(int).GetInterfaces().Contains(typeof(ICloneable)));
                //Fraction[,] fm = new Fraction[2, 2] { { f, f }, { f1, f1 } };
                //Console.WriteLine("{0:X}", f);
                //var fmf = new TMatrix<Fraction>(fm);
                //
                //Console.WriteLine(f<Fraction>(f, f1));


                //int[,] i = new int[2, 2] { { 71, 22 }, { 83, 4 } };
                //double[,] d = new double[2, 2] { { 7.1, 2 }, { 8.3, 4.6 } };

                //var mi = new TMatrix<int>(i);
                //var mi1 = new TMatrix<int>(2, 2, 9, 5, 1, 6);

                //Console.WriteLine(TMatrix<int>.CheckSum(null, null));
                //Console.WriteLine(null < mi1);
                //Console.WriteLine(null == null);

                //var md = new TMatrix<double>(d);
                //var md1 = new TMatrix<double>(2, 2, 9, 5, 1, 6);

                //Console.WriteLine(mi1.CompareTo(md1));

                //var mf = new TMatrix<Fraction>(2, 2, new Fraction(5, 7), new Fraction(6), new Fraction(7, 31), new Fraction(7, 1));
                //var mf1 = new TMatrix<Fraction>(2, 2, new Fraction(56, 7), new Fraction(6), new Fraction(7, 31), new Fraction(7, 1));

                //var mm = new TMatrix<TMatrix<int>>(2, 2, new TMatrix<int>(mi), new TMatrix<int>(2, 3, 9, 5, 1, 6), new TMatrix<int>(2, 2, 9, 9, 11, 6), new TMatrix<int>(2, 2, 29, 5, 81, 66));
                //var mm1 = new TMatrix<TMatrix<int>>(2, 2, new TMatrix<int>(mi1), new TMatrix<int>(2, 2, 59, 55, 51, 56), new TMatrix<int>(2, 2, 98, 89, 11, 6), new TMatrix<int>(2, 2, 2229, 55, 781, 66));

                //Console.WriteLine("{0:5}", mi);
                //Console.WriteLine("{0:5}", mi1);

                //Console.WriteLine("{0:5}", md);
                //Console.WriteLine("{0:5}", md1);

                //Console.WriteLine("{0:5}", mf);
                //Console.WriteLine("{0:5}", mf1);

                //Console.WriteLine("{0:5}", mm);
                //Console.WriteLine("{0:5}", mm1);

                //Console.WriteLine("{0:5}", mi + mi1);
                //Console.WriteLine("{0:5}", mi - mi1);
                //Console.WriteLine("{0:5}", mi * mi1);

                //Console.WriteLine("{0:15}", md + md1);
                //Console.WriteLine("{0:15}", md - md1);
                //Console.WriteLine("{0:15}", md * md1);

                //Console.WriteLine("{0:15}", mf + mf1);
                //Console.WriteLine("{0:15}", mf - mf1);
                //Console.WriteLine("{0:15}", mf * mf1);

                //Console.WriteLine("{0:15}", mm + mm1);
                //Console.WriteLine("{0:15}", mm - mm1);
                //Console.WriteLine("{0:15}", mm * mm1);

                //Console.WriteLine(mi.CompareTo(mm));

                //Console.WriteLine("{0}", mm.Max());

                //foreach (var q in md1)
                //{
                //}
            }

            catch (Exception ex)
            {
                Console.WriteLine("{0}", ex.GetType());
                Console.WriteLine("{0}", ex.Message);
                Console.WriteLine("{0}", ex.TargetSite);
            }
            //int[] t = new int[7];

            //Fraction ff = new Fraction();
            //Console.WriteLine("{0}", ff);

            //Fraction[] f = new Fraction[3] { new Fraction(5,7), new Fraction(6) , new Fraction(7,31) };
            //Console.WriteLine(f.Max());
            //double d = (double)f[0];
            //var m = new TMatrix<Fraction>(2, 2);
            //var m1 = new TMatrix<Fraction>(m);
            //TMatrix<Fraction>.CheckSum(m, m1);
            //foreach (var el in f)
            //	Console.WriteLine(el.ToString("f"));

            Console.ReadKey();
        }
Exemplo n.º 20
0
        private static void Main()
        {
            TMatrix<int> defoultArrayOfNumbers = new TMatrix<int>(); //// initiate default array 8,8
            TMatrix<int> arrayOfNumbers = new TMatrix<int>(8, 8);

            for (int i = 0; i < arrayOfNumbers.Rows; i++)
            {
                for (int j = 0; j < arrayOfNumbers.Cols; j++)
                {
                    arrayOfNumbers[i, j] = (i + j) % 10;
                    Console.Write("{0} ", arrayOfNumbers[i, j]);
                }

                Console.Write("\t->\t");
                for (int j = 0; j < arrayOfNumbers.Cols; j++)
                {
                    defoultArrayOfNumbers[i, j] = (i + j) % 5;
                    Console.Write("{0} ", defoultArrayOfNumbers[i, j]);
                }

                Console.WriteLine();
            }

            Console.WriteLine();

            TMatrix<int> sum = new TMatrix<int>();
            TMatrix<int> difference = new TMatrix<int>();
            TMatrix<int> product = new TMatrix<int>();

            sum = arrayOfNumbers + defoultArrayOfNumbers;
            difference = arrayOfNumbers - defoultArrayOfNumbers;
            product = arrayOfNumbers * defoultArrayOfNumbers;

            for (int row = 0; row < sum.Rows; row++)
            {
                Console.Write("(a+b)->  ");
                for (int col = 0; col < sum.Cols; col++)
                {
                    Console.Write("{0,2} ", sum[row, col]);
                }

                Console.Write("  (a-b)->  ");
                for (int col = 0; col < sum.Cols; col++)
                {
                    Console.Write("{0,1} ", difference[row, col]);
                }

                Console.Write("  (a*b)->  ");
                for (int col = 0; col < sum.Cols; col++)
                {
                    Console.Write("{0,2} ", product[row, col]);
                }

                Console.WriteLine();
            }

            Console.WriteLine();

            // testing the bool operator for zero elements
            if (product)
            {
                Console.WriteLine("True Product");
            }
            else
            {
                Console.WriteLine("False Product");
            }

            if (sum)
            {
                Console.WriteLine("true Sum");
            }
            else
            {
                Console.WriteLine("False Sum");
            }
        }
Exemplo n.º 21
0
 private static extern IP_RET ImageQuilting(ref TMatrix Src, ref TMatrix Dest, int TileSizeX, int TileSizeY, int OverlapX, int OverlapY);
        public bool TryEvaluateExpression(Entry value, Store context, out Entry result)
        {
            //list
            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "list")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp = Computation.NumericCalculation(arg1, context);
                TDouble n   = (TDouble)tmp.obj;
                //List<string> vector = new List<string>(Utilites.EntryMatrix2ArrStr(tmp.obj));
                //vector.RemoveAt(vector.Count - 1);
                //vector.RemoveAt(vector.Count - 1);
                //List<string> distinct = vector.Distinct().ToList();

                List <Term> answer = new List <Term>();
                if (n.D <= 0)
                {
                    answer.AddRange(TermsConverter.ToTerms(0.ToString()));
                }
                else
                {
                    for (int i = 0; i < n.D; i++)
                    {
                        answer.AddRange(TermsConverter.ToTerms("0"));
                    }

                    answer.AddRange(TermsConverter.ToTerms(n.D.ToString()));
                }

                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + (int)n.D));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            //listLength
            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "listLength")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(arg1));

                List <Term> answer = new List <Term>();

                if (vector.Count <= 2)
                {
                    answer.AddRange(TermsConverter.ToTerms("0"));
                }
                else
                {
                    answer.AddRange(TermsConverter.ToTerms(vector[vector.Count - 2]));
                }

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            //listDistinct
            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "listDistinct")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp = Computation.NumericCalculation(arg1, context);

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(tmp.obj));
                //vector.RemoveAt(vector.Count - 1);
                //vector.RemoveAt(vector.Count - 1);
                List <string> distinct = vector.Distinct().ToList();

                List <Term> answer = new List <Term>();
                foreach (string item in distinct)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(distinct.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + distinct.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            //listSortAsText
            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "listSortAsText")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp = Computation.NumericCalculation(arg1, context);

                BaseEntry be  = tmp.obj;
                Term[]    res = be.ToTerms(16, 16, FractionsType.Decimal, true);

                tmp = Computation.NumericCalculation(Entry.Create(res), context);

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(tmp.obj));
                if (be.Type == BaseEntryType.Matrix)
                {
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveAt(vector.Count - 1);
                    vector.Sort();
                }

                List <Term> answer = new List <Term>();
                foreach (string item in vector)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            //listAdd
            if (value.Type == TermType.Function && value.ArgsCount == 2 && value.Text == "listAdd")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);

                TNumber tmp, tmp1;
                TMatrix m;
                try
                {
                    tmp  = Computation.NumericCalculation(arg1, context);
                    tmp1 = Computation.NumericCalculation(arg2, context);
                    TNumber count = tmp.Rows();
                    m = tmp.Stack(new TNumber[] { new TNumber(0, 1) });
                    m[count.ToInt32(), 0] = tmp1;
                }
                catch
                {
                    tmp1    = Computation.NumericCalculation(arg2, context);
                    m       = new TMatrix(new TNumber[, ] {
                    });
                    m[0, 0] = tmp1;
                }

                result = Entry.Create(m.ToTerms());

                return(true);
            }

            //listNonZeros
            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "listNonZeros")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp = Computation.NumericCalculation(arg1, context);

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(tmp.obj));
                vector.RemoveAt(vector.Count - 1);
                vector.RemoveAt(vector.Count - 1);
                IEnumerable <string> select = from t in vector // определяем каждый объект из teams как t
                                              where t != "0"   //фильтрация по критерию
                                              select t;        // выбираем объект
                List <string> nonZeros = new List <string>(select);
                List <Term>   answer   = new List <Term>();
                foreach (string item in nonZeros)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(nonZeros.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + nonZeros.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            //if (value.Type == TermType.Function && value.ArgsCount == 2 && value.Text == "listDistinct")
            //{
            //   Entry arg1 = Computation.Preprocessing(value.Items[0], context);
            //   Entry arg2 = Computation.Preprocessing(value.Items[1], context);

            //   int dir = Utilites.Entry2Int(arg2);
            //   TNumber tmp = Computation.NumericCalculation(arg1, context);

            //   List<string> vector = new List<string>(Utilites.EntryMatrix2ArrStr(tmp.obj));
            //   vector.RemoveAt(vector.Count - 1);
            //   vector.RemoveAt(vector.Count - 1);
            //   List<string> distinct = vector.Distinct().ToList();

            //   //string res = "null";

            //   List<Term> answer = new List<Term>();
            //   foreach (string item in distinct)
            //   {
            //      answer.AddRange(TermsConverter.ToTerms(item));
            //   }

            //   if (dir==0)
            //   {
            //      answer.AddRange(TermsConverter.ToTerms(distinct.Count.ToString()));
            //      answer.AddRange(TermsConverter.ToTerms(1.ToString()));
            //      answer.Add(new Term(Functions.Mat, TermType.Function, 2 + distinct.Count));
            //   }
            //   else
            //   {
            //      answer.AddRange(TermsConverter.ToTerms(1.ToString()));
            //      answer.AddRange(TermsConverter.ToTerms(distinct.Count.ToString()));
            //      answer.Add(new Term(Functions.Mat, TermType.Function, 2 + distinct.Count));
            //   }

            //   result = Entry.Create(answer.ToArray());
            //   return true;
            //}

            if (value.Type == TermType.Function && value.ArgsCount == 2 && value.Text == "listRemoveAt")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);

                BaseEntry be1 = tmp1.obj;
                BaseEntry be2 = tmp2.obj;

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(be1));
                if (be1.Type == BaseEntryType.Matrix)
                {
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveAt((int)be2.ToDouble() - 1);
                }

                List <Term> answer = new List <Term>();
                foreach (string item in vector)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "listRemoveRange")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                BaseEntry be1 = tmp1.obj;
                BaseEntry be2 = tmp2.obj;
                BaseEntry be3 = tmp3.obj;

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(be1));
                if (be1.Type == BaseEntryType.Matrix)
                {
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveRange((int)be2.ToDouble() - 1, (int)be3.ToDouble());
                }

                List <Term> answer = new List <Term>();
                foreach (string item in vector)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "listInsert")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                BaseEntry be1 = tmp1.obj;
                BaseEntry be2 = tmp2.obj;
                BaseEntry be3 = tmp3.obj;

                List <string> vector = new List <string>(Utilites.EntryMatrix2ArrStr(be1));

                if (be1.Type == BaseEntryType.Matrix)
                {
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveAt(vector.Count - 1);
                    vector.Insert((int)be2.ToDouble() - 1, be3.ToString());
                }

                List <Term> answer = new List <Term>();
                foreach (string item in vector)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "listInsertRange")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                BaseEntry be1 = tmp1.obj;
                BaseEntry be2 = tmp2.obj;
                BaseEntry be3 = tmp3.obj;

                List <string> vector  = new List <string>(Utilites.EntryMatrix2ArrStr(be1));
                List <string> vector1 = new List <string>(Utilites.EntryMatrix2ArrStr(be3));
                if (be1.Type == BaseEntryType.Matrix)
                {
                    vector.RemoveAt(vector.Count - 1);
                    vector.RemoveAt(vector.Count - 1);
                    vector1.RemoveAt(vector.Count - 1);
                    vector1.RemoveAt(vector.Count - 1);
                    vector.InsertRange((int)be2.ToDouble() - 1, vector1);
                }

                List <Term> answer = new List <Term>();
                foreach (string item in vector)
                {
                    answer.AddRange(TermsConverter.ToTerms(item));
                }

                answer.AddRange(TermsConverter.ToTerms(vector.Count.ToString()));
                answer.AddRange(TermsConverter.ToTerms(1.ToString()));
                answer.Add(new Term(Functions.Mat, TermType.Function, 2 + vector.Count));

                result = Entry.Create(answer.ToArray());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "insertRows")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                for (int i = 0; i < tmp3.ToInt32(); i++)
                {
                    matrixL.InsertRow(tmp2.ToInt32() - 1);
                }

                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "insertRow")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                List <TNumber>    vectorL = Utilites.TMatrixToMatrixL(tmp3).ToList();
                matrixL.InsertRow(tmp2.ToInt32() - 1, vectorL);
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "insertCols")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                for (int i = 0; i < tmp3.ToInt32(); i++)
                {
                    matrixL.InsertCol(tmp2.ToInt32() - 1);
                }
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "insertCol")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                List <TNumber>    vectorL = Utilites.TMatrixToMatrixL(tmp3).ToList();
                matrixL.InsertCol(tmp2.ToInt32() - 1, vectorL);
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }


            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "removeRows")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                for (int i = 0; i < tmp3.ToInt32(); i++)
                {
                    matrixL.RemoveRowAt(tmp2.ToInt32() - 1);
                }
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }


            if (value.Type == TermType.Function && value.ArgsCount == 3 && value.Text == "removeCols")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                for (int i = 0; i < tmp3.ToInt32(); i++)
                {
                    matrixL.RemoveColAt(tmp2.ToInt32() - 1);
                }
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }


            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "nonZerosRows")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                List <int>        indexes = new List <int>(matrixL.R);
                List <TNumber>    row;
                List <double>     rowD;
                int j = 0;
                for (int i = 0; i < matrixL.R; i++)
                {
                    row  = matrixL.Row(i);
                    rowD = new List <double>(matrixL.C);
                    foreach (TNumber item in row)
                    {
                        if (item.obj.Type != BaseEntryType.Double)
                        {
                            break;
                        }
                        //if (item.obj.ToDouble() != 0) break;
                        try
                        {
                            rowD.Add(item.obj.ToDouble());
                        }
                        catch
                        {
                            break;
                        }
                    }
                    rowD = rowD.Distinct().ToList();
                    if (rowD.Count == 1 && rowD[0] == 0)
                    {
                        indexes.Add(i - j);
                        j++;
                    }
                }
                if (indexes.Count > 0)
                {
                    foreach (int item in indexes)
                    {
                        matrixL.RemoveRowAt(item);
                    }
                }
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "nonZerosRowsCols")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                List <int>        indexes = new List <int>(matrixL.R);
                List <TNumber>    row;
                List <double>     rowD;
                int j = 0;
                for (int i = 0; i < matrixL.R; i++)
                {
                    row  = matrixL.Row(i);
                    rowD = new List <double>(matrixL.C);
                    foreach (TNumber item in row)
                    {
                        if (item.obj.Type != BaseEntryType.Double)
                        {
                            break;
                        }
                        //if (item.obj.ToDouble() != 0) break;
                        try
                        {
                            rowD.Add(item.obj.ToDouble());
                        }
                        catch
                        {
                            break;
                        }
                    }
                    rowD = rowD.Distinct().ToList();
                    if (rowD.Count == 1 && rowD[0] == 0)
                    {
                        indexes.Add(i - j);
                        j++;
                    }
                }
                if (indexes.Count > 0)
                {
                    foreach (int item in indexes)
                    {
                        matrixL.RemoveRowAt(item);
                    }
                }

                indexes = new List <int>(matrixL.C);
                List <TNumber> col;
                List <double>  colD;
                j = 0;
                for (int i = 0; i < matrixL.C; i++)
                {
                    col  = matrixL.Col(i);
                    colD = new List <double>(matrixL.R);
                    foreach (TNumber item in col)
                    {
                        if (item.obj.Type != BaseEntryType.Double)
                        {
                            break;
                        }
                        //if (item.obj.ToDouble() != 0) break;
                        try
                        {
                            colD.Add(item.obj.ToDouble());
                        }
                        catch
                        {
                            break;
                        }
                    }
                    colD = colD.Distinct().ToList();
                    if (colD.Count == 1 && colD[0] == 0)
                    {
                        indexes.Add(i - j);
                        j++;
                    }
                }
                if (indexes.Count > 0)
                {
                    foreach (int item in indexes)
                    {
                        matrixL.RemoveColAt(item);
                    }
                }
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }

            if (value.Type == TermType.Function && value.ArgsCount == 1 && value.Text == "nonZerosCols")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);

                MatrixL <TNumber> matrixL = Utilites.TMatrixToMatrixL(tmp1);
                List <int>        indexes = new List <int>(matrixL.C);
                List <TNumber>    col;
                List <double>     colD;
                int j = 0;
                for (int i = 0; i < matrixL.C; i++)
                {
                    col  = matrixL.Col(i);
                    colD = new List <double>(matrixL.R);
                    foreach (TNumber item in col)
                    {
                        if (item.obj.Type != BaseEntryType.Double)
                        {
                            break;
                        }
                        //if (item.obj.ToDouble() != 0) break;
                        try
                        {
                            colD.Add(item.obj.ToDouble());
                        }
                        catch
                        {
                            break;
                        }
                    }
                    colD = colD.Distinct().ToList();
                    if (colD.Count == 1 && colD[0] == 0)
                    {
                        indexes.Add(i - j);
                        j++;
                    }
                }
                if (indexes.Count > 0)
                {
                    foreach (int item in indexes)
                    {
                        matrixL.RemoveColAt(item);
                    }
                }
                TMatrix m = Utilites.MatrixLToTMatrix(matrixL);

                result = Entry.Create(m.ToTerms());
                return(true);
            }


            if (value.Type == TermType.Function && value.ArgsCount == 4 && value.Text == "putMatrix")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);
                Entry arg4 = Computation.Preprocessing(value.Items[3], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);
                TNumber tmp4 = Computation.NumericCalculation(arg4, context);

                if (tmp3.ToInt32() < 1 || tmp4.ToInt32() < 1)
                {
                    throw new ArgumentException("Неверно задана индексация");
                }

                int adressR = tmp3.ToInt32() - 1;
                int adressC = tmp4.ToInt32() - 1;

                MatrixL <TNumber> matrixL1 = Utilites.TMatrixToMatrixL(tmp1);
                MatrixL <TNumber> matrixL2 = Utilites.TMatrixToMatrixL(tmp2);

                int n = matrixL1.R - adressR;
                int m = matrixL1.C - adressC;
                if (n > matrixL2.R)
                {
                    n = matrixL2.R;
                }
                if (m > matrixL2.C)
                {
                    m = matrixL2.C;
                }

                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        matrixL1[adressR + i, adressC + j] = matrixL2[i, j];
                    }
                }

                TMatrix mat = Utilites.MatrixLToTMatrix(matrixL1);

                result = Entry.Create(mat.ToTerms());
                return(true);
            }


            if (value.Type == TermType.Function && value.ArgsCount == 4 && value.Text == "insertMatrix")
            {
                Entry arg1 = Computation.Preprocessing(value.Items[0], context);
                Entry arg2 = Computation.Preprocessing(value.Items[1], context);
                Entry arg3 = Computation.Preprocessing(value.Items[2], context);
                Entry arg4 = Computation.Preprocessing(value.Items[3], context);

                TNumber tmp1 = Computation.NumericCalculation(arg1, context);
                TNumber tmp2 = Computation.NumericCalculation(arg2, context);
                TNumber tmp3 = Computation.NumericCalculation(arg3, context);
                TNumber tmp4 = Computation.NumericCalculation(arg4, context);

                if (tmp3.ToInt32() < 1 || tmp4.ToInt32() < 1)
                {
                    throw new ArgumentException("Неверно задана индексация");
                }

                int adressR = tmp3.ToInt32() - 1;
                int adressC = tmp4.ToInt32() - 1;

                MatrixL <TNumber> matrixL1 = Utilites.TMatrixToMatrixL(tmp1);
                MatrixL <TNumber> matrixL2 = Utilites.TMatrixToMatrixL(tmp2);

                for (int i = 0; i < matrixL2.R; i++)
                {
                    matrixL1.InsertRow(adressR);
                }
                for (int i = 0; i < matrixL2.C; i++)
                {
                    matrixL1.InsertCol(adressC);
                }

                int n = matrixL1.R - adressR;
                int m = matrixL1.C - adressC;
                if (n > matrixL2.R)
                {
                    n = matrixL2.R;
                }
                if (m > matrixL2.C)
                {
                    m = matrixL2.C;
                }

                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < m; j++)
                    {
                        matrixL1[adressR + i, adressC + j] = matrixL2[i, j];
                    }
                }

                TMatrix mat = Utilites.MatrixLToTMatrix(matrixL1);

                result = Entry.Create(mat.ToTerms());
                return(true);
            }


            result = null;
            return(false);
        }
Exemplo n.º 23
0
 internal static extern IP_RET SelectiveBlur(ref TMatrix Src, ref TMatrix Dest, int Radius, int Threshold, EdgeMode Edge);
Exemplo n.º 24
0
 private static extern IP_RET MatchTemplate(ref TMatrix Src, ref TMatrix Template, ref TMatrix *Dest);
Exemplo n.º 25
0
        public void testTMatrix()
        {
            matrix = new TMatrix(matrix_col, matrix_row);

            Assert.NotNull(matrix);
        }