Esempio n. 1
0
        /// <summary>
        /// Checks the non-negative least squares solver by comparing the output of a simple
        /// non-negative least squares optimization solving for x in the equation Ax=b.  The expected
        /// values were generated using the lsqnonneg function in Matlab.
        /// </summary>
        private static void TestNonNegSolver()
        {
            var matrixA = DenseMatrix.OfArray(new[, ]
            {
                { 0.0372, 0.2869 }, { 0.6861, 0.7071 }, { 0.6233, 0.6245 },
                { 0.6344, 0.6170 }, { 0, -200000 }
            });
            var colB       = new DenseVector(new[] { 0.8587, 0.1781, 0.0747, 0.8405, 0.0 });
            var initialize = new DenseVector(new[] { 0.0, 0.0 });
            var matrixAt   = matrixA.Transpose();
            var vectorAx   = matrixA.Multiply(initialize);
            var vectorW    = matrixAt * (colB - vectorAx);
            var solver     = new NonNegLsSolver(2, 5, 1);

            solver.SetTolerance(2.2205E-9);
            solver.SetMaxIter(6);
            Vector <double> solution = new DenseVector(5);

            Assert.IsTrue(solver.SolveColumnTest(matrixA, colB, initialize, matrixAt, vectorAx, vectorW, ref solution));
            Assert.AreEqual(0.0, solution[0], 0.000001);
            Assert.AreEqual(2.344E-11, solution[1], 0.0001);
        }
Esempio n. 2
-1
 /// <summary>
 /// Checks the non-negative least squares solver by comparing the output of a simple 
 /// non-negative least squares optimization solving for x in the equation Ax=b.  The expected
 /// values were generated using the lsqnonneg function in Matlab.
 /// </summary>
 private static void TestNonNegSolver()
 {
     var matrixA = DenseMatrix.OfArray(new[,]
                                       {
                                           {0.0372, 0.2869}, {0.6861, 0.7071}, {0.6233, 0.6245},
                                           {0.6344, 0.6170}, {0, -200000}
                                       });
     var colB = new DenseVector(new[]{0.8587,0.1781,0.0747,0.8405,0.0});
     var initialize = new DenseVector(new[] {0.0, 0.0});
     var matrixAt = matrixA.Transpose();
     var vectorAx = matrixA.Multiply(initialize);
     var vectorW = matrixAt*(colB - vectorAx);
     var solver = new NonNegLsSolver(2, 5, 1);
     solver.SetTolerance(2.2205E-9);
     solver.SetMaxIter(6);
     Vector<double> solution = new DenseVector(5);
     Assert.IsTrue(solver.SolveColumnTest(matrixA, colB, initialize, matrixAt, vectorAx, vectorW, ref solution));
     Assert.AreEqual(0.0, solution[0], 0.000001);
     Assert.AreEqual(2.344E-11, solution[1], 0.0001);
 }
Esempio n. 3
-1
 protected override void InitializeSolver()
 {
     var maxTransInSpectrum = _spectrumProcessor.MaxTransitions(IsoWindowsPerScan);
     _deconvHandler = new MsxDeconvSolverHandler(NumDeconvRegions, NumScansBlock, maxTransInSpectrum);
     _solver = new NonNegLsSolver(NumDeconvRegions, NumScansBlock, maxTransInSpectrum, true);
 }
Esempio n. 4
-1
 protected override void InitializeSolver()
 {
     int maxOverlapComponents = _isoMapper.MaxDeconvInIsoWindow();
     var maxTransInSpectrum = _spectrumProcessor.MaxTransitions(maxOverlapComponents * IsoWindowsPerScan);
     _deconvHandler = new MsxDeconvSolverHandler(NumDeconvRegions, NumScansBlock, maxTransInSpectrum);
     _solver = new NonNegLsSolver(NumDeconvRegions, NumScansBlock, maxTransInSpectrum, true);
 }