/*************************************************************************
        Checks whether solver results indicate singular matrix.
        Returns True on success.
        *************************************************************************/
        private static bool cmatrixchecksingular(int n,
            int info,
            ref densesolver.densesolverreport rep,
            ref AP.Complex[] xs)
        {
            bool result = new bool();
            AP.Complex[,] xsm = new AP.Complex[0,0];
            int i_ = 0;

            xsm = new AP.Complex[n, 1];
            for(i_=0; i_<=n-1;i_++)
            {
                xsm[i_,0] = xs[i_];
            }
            result = cmatrixchecksingularm(n, 1, info, ref rep, ref xsm);
            return result;
        }
        /*************************************************************************
        Checks whether solver results indicate singular matrix.
        Returns True on success.
        *************************************************************************/
        private static bool cmatrixchecksingularm(int n,
            int m,
            int info,
            ref densesolver.densesolverreport rep,
            ref AP.Complex[,] xs)
        {
            bool result = new bool();
            int i = 0;
            int j = 0;

            result = true;
            if( info!=-3 & info!=1 )
            {
                result = false;
            }
            else
            {
                result = result & !((double)(rep.r1)<(double)(0) | (double)(rep.r1)>(double)(1000*AP.Math.MachineEpsilon));
                result = result & !((double)(rep.rinf)<(double)(0) | (double)(rep.rinf)>(double)(1000*AP.Math.MachineEpsilon));
                if( info==-3 )
                {
                    for(i=0; i<=n-1; i++)
                    {
                        for(j=0; j<=m-1; j++)
                        {
                            result = result & xs[i,j]==0;
                        }
                    }
                }
            }
            return result;
        }
        /*************************************************************************
        Checks whether solver results are correct solution.
        Returns True on success.
        *************************************************************************/
        private static bool cmatrixchecksolution(ref AP.Complex[,] xe,
            int n,
            double threshold,
            int info,
            ref densesolver.densesolverreport rep,
            ref AP.Complex[] xs)
        {
            bool result = new bool();
            AP.Complex[,] xsm = new AP.Complex[0,0];
            int i_ = 0;

            xsm = new AP.Complex[n, 1];
            for(i_=0; i_<=n-1;i_++)
            {
                xsm[i_,0] = xs[i_];
            }
            result = cmatrixchecksolutionm(ref xe, n, 1, threshold, info, ref rep, ref xsm);
            return result;
        }
        /*************************************************************************
        Checks whether solver results are correct solution.
        Returns True on success.
        *************************************************************************/
        private static bool cmatrixchecksolutionm(ref AP.Complex[,] xe,
            int n,
            int m,
            double threshold,
            int info,
            ref densesolver.densesolverreport rep,
            ref AP.Complex[,] xs)
        {
            bool result = new bool();
            int i = 0;
            int j = 0;

            result = true;
            if( info<=0 )
            {
                result = false;
            }
            else
            {
                result = result & !((double)(rep.r1)<(double)(100*AP.Math.MachineEpsilon) | (double)(rep.r1)>(double)(1+1000*AP.Math.MachineEpsilon));
                result = result & !((double)(rep.rinf)<(double)(100*AP.Math.MachineEpsilon) | (double)(rep.rinf)>(double)(1+1000*AP.Math.MachineEpsilon));
                for(i=0; i<=n-1; i++)
                {
                    for(j=0; j<=m-1; j++)
                    {
                        result = result & (double)(AP.Math.AbsComplex(xe[i,j]-xs[i,j]))<=(double)(threshold);
                    }
                }
            }
            return result;
        }
 /*************************************************************************
 Unsets report
 *************************************************************************/
 private static void unsetlsrep(ref densesolver.densesolverlsreport r)
 {
     r.r2 = -1;
     r.n = -1;
     r.k = -1;
     unset2d(ref r.cx);
 }
 /*************************************************************************
 Unsets report
 *************************************************************************/
 private static void unsetrep(ref densesolver.densesolverreport r)
 {
     r.r1 = -1;
     r.rinf = -1;
 }