Example #1
0
 public LinearModel(Matrix<double> designMatrix, Matrix<double> contrastValues, QrFactorizationCache.CacheEntry cacheEntry)
 {
     DesignMatrix = ImmutableMatrix.OfMatrix(designMatrix);
     ContrastValues = ImmutableMatrix.OfMatrix(contrastValues);
     QrFactorization = cacheEntry.QrFactorization;
     MatrixCrossproductInverse = cacheEntry.MatrixCrossproductInverse;
 }
Example #2
0
 public static LinearModel CreateModel(QrFactorizationCache cache, Matrix<double> designMatrix, Matrix<double> contrastValues, double tolerance)
 {
     if (contrastValues.ColumnCount != designMatrix.ColumnCount)
     {
         throw new ArgumentException("Wrong number of columns"); // Not L10N
     }
     var cacheEntry = cache.GetQrFactorization(designMatrix, tolerance);
     return new LinearModel(designMatrix, contrastValues, cacheEntry);
 }
Example #3
0
 public IList<LinearFitResult> PerformLinearFit(QrFactorizationCache cache)
 {
     var linearModel = LinearModel.CreateModel(cache, DenseMatrix.OfColumnArrays(_matrixColumns), DenseMatrix.OfColumnArrays(_contrastValues), 1E-7);
     return linearModel.Fit(DataSet.Abundances.ToArray());
 }