public MainWindow() { InitializeComponent(); _ploter = new Ploter(); _path1 = "C:\\avril_clean.wav"; _path2 = "C:\\avril_scolpture.wav"; _outputPath = "C:\\Output\\output.wav"; _sampleLength = 0; _density = 1; _fileStartPoint = 0; _na = 5; _nb = 5; _nd = 1; _nk = 0; _startPoint = 200; _iterations = 1; _estimationLength = 250000; _recurenceLength = 5; _armax = new Armax(); _rls = new RecursiveLeastSquares(_armax); _ls = new RecursiveLeastSquares(_armax); _command = 0; _thread1 = new Thread(Update); _thread2 = new Thread(Compute); _thread1.SetApartmentState(ApartmentState.STA); _thread1.IsBackground = false; _thread1.Start(); _thread2.SetApartmentState(ApartmentState.STA); _thread2.IsBackground = false; _thread2.Start(); _status = "Load files"; /* //CudaMultiplicator Test int len1 = 1000; int len2 = 6; int len3 = 15000; var a = new DenseMatrix(len1, len2, 1.0); var b = new DenseMatrix(len2, len3, 1.0); var c = MultiplicatorCuda.Multiply(a, b); //*/ DataContext = _ploter.MainViewModel; }
//Methods //Constructor public RecursiveLeastSquares(Armax armax) : base(armax) { _estimationStatusPercentage = 0; _lambda = 0.99; _delta = 1.0E+100; _modelArmax = armax; RecurenceLength = 1000; _fiCalculator = new FiCalculator(); }
//Methods //Constructor public LeastSquares(Armax armax) { _estimationStatusPercentage = 0; _estimationDone = false; _statusString = "Iterative LS: Initialized"; _modelArmax = armax; _numberOfIterations = 20; _acceptableError = 1.0E-12; _estimationLength = 500; _fiCalculator = new FiCalculator(); }
public void UpdateModel(Armax modelArmax) { ModeListBox.Dispatcher.BeginInvoke((new Action(delegate { ModeListBox.Items.Clear(); ModeListBox.Items.Add("\nNA parameters: "); for (int i = 0; i < modelArmax.NaParameter; i++) { ModeListBox.Items.Add("\nNA parameter " + i + ": \t" + modelArmax.Theta[i,0]); } ModeListBox.Items.Add("\nNB parameters: "); for (int i = 0; i < modelArmax.NbParameter; i++) { ModeListBox.Items.Add("\nNB parameter " + i + ": \t" + modelArmax.Theta[modelArmax.NaParameter + i, 0]); } ModeListBox.Items.Add("\nNC parameters: "); for (int i = 0; i < modelArmax.NdParameter; i++) { ModeListBox.Items.Add("\nND parameter " + i + ": \t" + modelArmax.Theta[modelArmax.NaParameter + modelArmax.NbParameter + i, 0]); } }))); }