Esempio n. 1
0
void Top_Menu::print()
{
    print_dialog_ = new QDialog;
    print_dialog_->setWindowTitle("Print in file...");
    QGridLayout *layout = new QGridLayout;
    QLabel *canvas_label = new QLabel;
    canvas_choice_ = new QComboBox;
    QLabel *quality_label = new QLabel;
    quality_spinbox_ = new QSpinBox;
    QLabel *file_label = new QLabel;
    QPushButton *browse_button = new QPushButton;
    print_button_ = new QPushButton;
    QPushButton *cancel_button = new QPushButton;
    file_name_ = new QLineEdit;
    file_name_->setText("CP.png");

    canvas_label->setText(tr("Canvas: "));
    canvas_choice_->addItem("left", 0);
    canvas_choice_->addItem("right",1);
    quality_label->setText(tr("Quality:  "));
    quality_spinbox_->setRange(0,100);
    quality_spinbox_->setValue(80);
    file_label->setText("Filename: ");
    browse_button->setText(tr("Browse..."));
    print_button_->setText(tr("Print"));
    cancel_button->setText(tr("Cancel"));
    connect(browse_button,SIGNAL(clicked()),this,SLOT(browse()));
    connect(cancel_button,SIGNAL(clicked()),print_dialog_,SLOT(close()));
    connect(print_button_,SIGNAL(clicked()),this,SLOT(print_in_file()));
    connect(file_name_,SIGNAL(textChanged(QString)),this,SLOT(print_file_name_changed(QString)));
    layout->setVerticalSpacing(15);
    layout->setRowMinimumHeight(3, 20);
    layout->setColumnMinimumWidth(4, 60);

    layout->addWidget(canvas_label,0,0,1,1);
    layout->addWidget(canvas_choice_,0,1);
    layout->addWidget(quality_label,0,5,1,1,Qt::AlignRight);
    layout->addWidget(quality_spinbox_,0,6,1,1);
    layout->addWidget(file_label,2,0,1,1);
    layout->addWidget(file_name_,2,1,1,5);
    layout->addWidget(browse_button,2,6,1,2);

    layout->addWidget(print_button_,4,6,1,2);
    layout->addWidget(cancel_button,4,5,1,1);
    print_dialog_->setLayout(layout);

    print_button_->setDefault(true);
    print_dialog_->show();
}
Esempio n. 2
0
int main(){
  char *filename = "data_F.dat";
  int n_col=2;
  int n_row = 884;
  float *file_data = load_matrix(filename, n_row);
  float *data = malloc(n_row*n_col*sizeof(float));
  float *b = malloc(n_row*sizeof(float));
  float *theta = malloc(n_row*sizeof(float));
  make_data(file_data, data, b,theta, n_row);
  float *data_traspose = traspose(data,n_row,n_col);
  float *matrix = multiply(data_traspose,data, n_col,n_row,n_row,n_col);
  float *new_b = multiply(data_traspose,b, n_col, n_row, n_row, 1);
  float *U = malloc(n_col*n_col*sizeof(float));
  float *L = malloc(n_col*n_col*sizeof(float));
  lu_decomposition(matrix,new_b,U,L,n_col);
  float a1,a2;
  solve_upper_triangular(U,new_b,&a1,&a2);
  print_in_file(a1,a2);
  return 0;
}