private void plotGrid()
        {
            // If there is no matrix to be plotted, exit
            if (mxSize == 0) return;

            try
            {
                LockBitmap lb = new LockBitmap(bmp);
                lb.LockBits();

                uint squareSize = X / mxSize;

                // vertical and horizontal lines
                for (uint i = 0; i <= mxSize; i++)
                {
                    uint loc_x = i * squareSize;
                    for (uint loc_y = 0; loc_y < squareSize * mxSize; loc_y++)
                    {
                        lb.SetPixel(drawingOffset() + (int)loc_x, drawingOffset() + (int)loc_y, Color.FromArgb(0x22, 0x22, 0x22));
                        lb.SetPixel(drawingOffset() + (int)loc_y, drawingOffset() + (int)loc_x, Color.FromArgb(0x22, 0x22, 0x22));
                    }
                }

                lb.UnlockBits();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        private void clearPlot()
        {
            try
            {
                LockBitmap lb = new LockBitmap(bmp);
                lb.LockBits();

                for (int i = 0; i < X; i++)
                    for (int j = 0; j < X; j++)
                        lb.SetPixel(i, j, Color.Black);

                lb.UnlockBits();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
        private void plotAt_noBlack(int x, int y, double v)
        {
            uint squareSize = X / mxSize; // correction for grid

            LockBitmap lb = new LockBitmap(bmp);

            if (Math.Abs(v) > 0.00001)
            {
                try
                {
                    lb.LockBits();

                    for (int _x = (x == 0) ? 0 : 1; _x < squareSize; _x++)
                    {
                        for (int _y = (y == 0) ? 0 : 1; _y < squareSize; _y++)
                        {
                            lb.SetPixel(drawingOffset() + (int)(x * squareSize + _x), drawingOffset() + (int)(y * squareSize + _y), Color.Green);
                        }
                    }

                    lb.UnlockBits();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }