Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public VectorXD Solve(VectorXD other, DenseSolverType denseSolverType = DenseSolverType.ColPivHouseholderQR)
        {
            double[] vout = new double[Rows];
            switch (denseSolverType)
            {
            case DenseSolverType.PartialPivLU:
                EigenDenseUtilities.SolvePartialPivLU(GetValues(), Rows, Cols, other.GetValues(), vout);
                break;

            case DenseSolverType.FullPivLU:
                EigenDenseUtilities.SolveFullPivLU(GetValues(), Rows, Cols, other.GetValues(), vout);
                break;

            case DenseSolverType.LDLT:
                EigenDenseUtilities.SolveLDLT(GetValues(), Rows, Cols, other.GetValues(), vout);
                break;

            case DenseSolverType.LLT:
                EigenDenseUtilities.SolveLLT(GetValues(), Rows, Cols, other.GetValues(), vout);
                break;

            case DenseSolverType.ColPivHouseholderQR:
            default:
                EigenDenseUtilities.SolveColPivHouseholderQr(GetValues(), Rows, Cols, other.GetValues(), vout);
                break;
            }

            return(new VectorXD(vout));
        }
Example #2
0
        private bool IsEqual(VectorXD other)
        {
            if (Length != other.Length)
            {
                return(false);
            }

            return(ArrayHelpers.ArraysEqual(_values, other._values));
        }
Example #3
0
 public VectorXD Mult(VectorXD other)
 {
     double[] outVector = new double[Rows];
     EigenDenseUtilities.Mult(GetValues(),
                              Rows,
                              Cols,
                              other.GetValues(),
                              other.Length,
                              outVector);
     return(new VectorXD(outVector));
 }
Example #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rhs"></param>
        public VectorXD LeastSquaresSVD(VectorXD rhs, SVDType svdType = SVDType.Jacobi)
        {
            double[] vout = new double[Cols];
            if (svdType == SVDType.Jacobi)
            {
                EigenDenseUtilities.SVDLeastSquares(GetValues(), Rows, Cols, rhs.GetValues(), vout);
            }
            else
            {
                EigenDenseUtilities.SVDLeastSquaresBdcSvd(GetValues(), Rows, Cols, rhs.GetValues(), vout);
            }

            return(new VectorXD(vout));
        }
Example #5
0
 /// <summary>
 /// A^TAx = A^b
 /// </summary>
 /// <param name="rhs"></param>
 /// <returns></returns>
 public VectorXD LeastSquaresNE(VectorXD rhs)
 {
     double[] vout = new double[Cols];
     EigenDenseUtilities.NormalEquationsLeastSquares(GetValues(), Rows, Cols, rhs.GetValues(), vout);
     return(new VectorXD(vout));
 }
Example #6
0
 public double RelativeError(VectorXD rhs, VectorXD x)
 {
     return(EigenDenseUtilities.RelativeError(GetValues(), Rows, Cols, rhs.GetValues(), x.GetValues()));
 }
Example #7
0
 public double Dot(VectorXD other)
 {
     return(EigenDenseUtilities.Dot(GetValues(), other.GetValues(), Length));
 }
Example #8
0
 public VectorXD Minus(VectorXD other)
 {
     return(new VectorXD(ArrayHelpers.ArraysMinus(_values, other._values)));
 }
Example #9
0
 public VectorXD Add(VectorXD other)
 {
     double[] outVector = new double[Length];
     EigenDenseUtilities.Add(GetValues(), other.GetValues(), Length, outVector);
     return(new VectorXD(outVector));
 }