21 #include "ui_transformdialog.h"    32     ui->constantLineEdit->setValidator(
new QDoubleValidator(-DBL_MAX, DBL_MAX, 5));
    41     delete matrix_selection_dialog_;
    47     ui->matrixNameLabel->setText(keys.last());
    51 void TransformDialog::on_selectPushButton_clicked()
    53     matrix_selection_dialog_->show();
    56 void TransformDialog::on_buttonBox_accepted()
    58     QString operation = ui->operationComboBox->currentText();
    60     double constant = ui->constantLineEdit->text().toDouble(&ok);
    61     if (!ok) constant = 0;
    62     mat matrix = workspace_->GetMatrix(data_keys_);
    63     mat operand = workspace_->GetMatrix(operand_keys_);
    65     QString name = ui->nameLineEdit->text();
    66     QSharedPointer<VespucciDataset> dataset = workspace_->GetDataset(data_keys_.first());
    69         if (operation == 
"Constant addition")
    70             new_matrix = matrix + constant * ones(matrix.n_rows, matrix.n_cols);
    71         else if (operation == 
"Constant subtraction")
    72             new_matrix = matrix + -1*constant*ones(matrix.n_rows, matrix.n_cols);
    73         else if (operation == 
"Constant division")
    74             new_matrix = (1.0/constant) * matrix;
    75         else if (operation == 
"Constant multiplication")
    76             new_matrix = constant * matrix;
    77         else if (operation == 
"Matrix addition")
    78            new_matrix = matrix + operand;
    79         else if (operation == 
"Matrix subtraction")
    80             new_matrix = matrix - operand;
    81         else if (operation == 
"Matrix multiplication (dot product)")
    82             new_matrix = matrix * operand;
    83         else if (operation == 
"Element-wise multiplication")
    84             new_matrix = matrix % operand;
    85         else if (operation == 
"Element-wise division")
    86             new_matrix = matrix / operand;
    87         else if (operation == 
"Minimum subtraction")
    88             new_matrix = matrix - matrix.min() * ones(matrix.n_rows, matrix.n_cols);
    89         else if (operation == 
"Maximum division")
    90             new_matrix = (1.0/matrix.max()) * matrix;
    91         else if (operation == 
"Min/Max normalization"){
    93             for (uword i = 0; i < new_matrix.n_cols; ++i){
    94                 vec column = new_matrix.col(i);
    95                 column = column - column.min() * ones(column.n_rows);
    96                 column = column / column.max();
    97                 new_matrix.col(i) = column;
   100         else if (operation == 
"SNV normalization")
   102         else if (operation == 
"Z-Score normalization")
   104         else if (operation == 
"Normalize to 1-norm")
   105             new_matrix = normalise(matrix, 1);
   106         else if (operation == 
"Normalize to 2-norm")
   107             new_matrix = normalise(matrix, 2);
   108         else if (operation == 
"Calibration")
   113         QMessageBox::warning(
this, 
"Cannot perform operation", 
"The operation could not be performed");
   117     dataset->AddAuxiliaryMatrix(name, new_matrix);
 VESPUCCI_EXPORT arma::mat StandardScoreMat(const arma::mat &X)
Vespucci::Math::Normalization::StandardScore. 
void MatrixSelected(QStringList keys)
VESPUCCI_EXPORT arma::mat SNVNorm(const arma::mat &X, const double offset, bool center)
Vespucci::Math::Normalization::SNVNorm.