EMFTrans.maxdiff = GetKeyDouble( keys, "DIFF", EMFTrans.maxdiff );
EMFTrans.mulcoeff = GetKeyDouble( keys, "COEFF", EMFTrans.mulcoeff );
EMFTrans.bettacoeff = GetKeyDouble( keys, "B", EMFTrans.bettacoeff );
EMFTrans.grouplevel = GetKeyDouble( keys, "G", EMFTrans.grouplevel );
EMFTrans.maxinc = GetKeyDouble( keys, "INC", EMFTrans.maxinc );
EMFTrans.MaxIter = GetKeyDouble( keys, "IT", EMFTrans.MaxIter );
EMFTrans.ProgressFunc = OnProgress;
int res;
HT = new double[n+1];
HEds = new double[n+1];
if( RegMode == 1 )
res = EMFTrans.RestHvsLinReg( HT, HEds, n );else
if( RegMode == 2 )
{
if( argc <= 3 )
{
cout << "Error! Needed file." << endl;
getch();
}
double *DEds = new double[n+1];
edsifs.open( argv[3] );
edsifs.ignore( 40, '\n' );
edsifs.ignore( 40, '\n' );
for( i = 0; i <= n; i++ )
edsifs >> t >> DEds[i];
edsifs.getline( MediaInfo, sizeof(MediaInfo), EOF );
edsifs.close();
res = EMFTrans.RestHvsLinRegDiff( DEds, HT, HEds, n );
delete[] DEds;
}else res = EMFTrans.RestHvsLin( HT, HEds, n );
if( res == errOk && Smoothed )
res = EMFTrans.Smooth( HT, HEds, n, HEds );
if( res == errOk )
{
ofstream ofs;
if( RegMode == 2 )
{
if( argc >= 5 )ofs.open( argv[4] );else ofs.open( "solve.dat" );
}else if( argc >= 4 )ofs.open( argv[3] );else ofs.open( "solve.dat" );
ofs.precision( 10 );
ofs << Line1 << endl << Line2 << endl;
for( i = 0; i < n; i++ )
ofs << HT[i] << ' ' << HEds[i] << endl;
ofs << MediaInfo;
ofs.close();
}else
{
cout << endl << "Error! " << ErrorMessage( res ) << endl;
cout << endl << "Press any key..." << endl;
getch();
}
if( LoadImpuls )
{
delete[] IT;
delete[] II;
}
delete[] IntMem;
delete[] ET;
delete[] HT;
delete[] Eds;
delete[] HEds;
}
Файл h.cpp
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
#include <conio.h>
#include "hvs.h"
int OnProgress( int action, int percent )
{
if( action != paContinue )
cout << "Decomposing impuls..." << endl;
if( percent >= 0 )
cout << percent << "% completed \r";
return 1;
}
void main( int argc, char **argv )
{
if( argc == 1 )
{
cout << "Format: h <impuls> [<out coeff>]" << endl;
cout << "Press any key." << endl;
getch();
return;
}
ifstream ifs( argv[1] );
ofstream ofs;
if( argc >= 3 )ofs.open( argv[2] );else ofs.open( "ab.dat" );
ofs.precision( 10 );
double epsi, cthick;
double *IT, *II;
int n, i;
ifs >> n;
ifs >> epsi;
ifs >> cthick;
IT = new double[n];
II = new double[n];
for( i = 0; i < n; i++ )
ifs >> IT[i] >> II[i];
ifs.close();
CEMFTransform EMFTrans( IT, II, n, 0, 0, 0 );
EMFTrans.SetDecomposeParams( epsi, cthick );
EMFTrans.SetSelfAlloc( 1 );
EMFTrans.ProgressFunc = OnProgress;
int res;
if( (res = EMFTrans.DecomposeImpuls()) == errOk )
EMFTrans.SaveCoeff( ofs );else
{
cout << endl << "Error! " << ErrorMessage( res ) << endl;
cout << endl << "Press any key..." << endl;
getch();
}
ofs.close();
delete[] II;
delete[] IT;
}
Файл misc.h/misc.cpp
#if !defined(_MISC_H_)
#define _MISC_H_
int LUSolve( int n, double *A, double *F, double *X );
int LLSolve( int n, double *A, double *F, double *X );
int LLSolveTape( int n, int m, double *A, double *F, double *X );
int CholeskySR( int n, double *A, double *betta, int nx, double *L );
int CholeSolveS( int n, double *L, double *F, int nx, double *X );
int CholeSolveSR( int n, double *L, double *betta, double *F, double *rf, int nx, double *X );
// Строит кубический сглажывающий сплайн
//
// Параметры
// Входные
// x,y - координаты точек
// n - количество точек
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.