|
@@ -367,7 +367,9 @@ namespace Lemma {
|
367
|
367
|
for (int ir2=0; ir2<nrel; ++ir2) {
|
368
|
368
|
Zans(0, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
|
369
|
369
|
}
|
370
|
|
-
|
|
370
|
+ std::cout << "rho\n" << rho << std::endl;
|
|
371
|
+ std::cout << "Zans\n" << Zans << std::endl;
|
|
372
|
+ exit(EXIT_SUCCESS);
|
371
|
373
|
return ;
|
372
|
374
|
} // ----- end of method FHTKey201::ComputeRelated -----
|
373
|
375
|
|
|
@@ -376,19 +378,34 @@ namespace Lemma {
|
376
|
378
|
// Method: ComputeLaggedRelated
|
377
|
379
|
//--------------------------------------------------------------------------------------
|
378
|
380
|
void FHTKey201::ComputeLaggedRelated ( const Real& rho, const int& nlag, std::shared_ptr<KernelEM1DManager> KernelManager ) {
|
|
381
|
+
|
|
382
|
+ //std::cout << "rho max\t " << rho << std::endl;
|
|
383
|
+ //Real rho = 214.963;
|
|
384
|
+
|
379
|
385
|
int nrel = (int)(KernelManager->GetSTLVector().size());
|
380
|
|
- Eigen::Matrix<Complex, 201, Eigen::Dynamic > Zwork;
|
|
386
|
+
|
|
387
|
+ Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic > Zwork;
|
|
388
|
+ //Eigen::Matrix<Complex, 201+nrel, Eigen::Dynamic > Zwork;
|
381
|
389
|
Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(nlag, nrel);
|
382
|
|
- Zwork.resize(201, nrel);
|
383
|
|
- VectorXr lambda = WT201.col(0).array()/rho;
|
|
390
|
+ Zwork.resize(201+nlag, nrel); // Zwork needs to be expanded to filter length + nlag
|
|
391
|
+
|
|
392
|
+ // lambda needs to be expanded to include lagged results
|
|
393
|
+ VectorXr lambda = (VectorXr(201+nlag) << WT201.col(0).array()/rho, VectorXr::Zero(nlag)).finished();
|
|
394
|
+ for (int ilam =201; ilam< nlag+201; ++ilam) {
|
|
395
|
+ lambda(ilam) = lambda(ilam-1)/GetABSER();
|
|
396
|
+ }
|
|
397
|
+
|
384
|
398
|
int NumFun = 0;
|
385
|
399
|
int idx = 0;
|
386
|
400
|
|
|
401
|
+ //std::cout << lambda.transpose() << std::endl;
|
|
402
|
+
|
387
|
403
|
VectorXr Arg(nlag);
|
388
|
404
|
Arg(nlag-1) = rho;
|
389
|
405
|
for (int ilag=nlag-2; ilag>=0; --ilag) {
|
390
|
406
|
Arg(ilag) = Arg(ilag+1) * GetABSER();
|
391
|
407
|
}
|
|
408
|
+ //std::cout << "Arg\t" << Arg << std::endl;
|
392
|
409
|
|
393
|
410
|
// Get Kernel values
|
394
|
411
|
for (int ir=0; ir<lambda.size(); ++ir) {
|
|
@@ -397,9 +414,9 @@ namespace Lemma {
|
397
|
414
|
KernelManager->ComputeReflectionCoeffs(lambda(ir), idx, rho);
|
398
|
415
|
for (int ir2=0; ir2<nrel; ++ir2) {
|
399
|
416
|
// Zwork* needed due to sign convention of filter weights
|
|
417
|
+ //Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
|
400
|
418
|
Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
|
401
|
419
|
}
|
402
|
|
-
|
403
|
420
|
}
|
404
|
421
|
|
405
|
422
|
// We diverge slightly from Key here, each kernel is evaluated seperately, whereby instead
|
|
@@ -407,13 +424,20 @@ namespace Lemma {
|
407
|
424
|
// in the interests of making them as generic and reusable as possible. This approach requires slightly
|
408
|
425
|
// more multiplies, but the same number of kernel evaluations, which is the expensive part.
|
409
|
426
|
// Inner product and scale
|
410
|
|
-
|
|
427
|
+ int ilagr = nlag-1;
|
411
|
428
|
for (int ilag=0; ilag<nlag; ++ilag) {
|
412
|
429
|
for (int ir2=0; ir2<nrel; ++ir2) {
|
413
|
430
|
//Zans(ilag, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
|
414
|
|
- Zans(ilag, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/Arg(ilag);
|
|
431
|
+ //Zans(ilag, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1))/Arg(ilag);
|
|
432
|
+ // Segment
|
|
433
|
+ //std::cout << Zwork.col(ir2).segment(ilag,201).transpose() << std::endl;;
|
|
434
|
+ //WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1).segment(ilag,201);// / Arg(ilag);
|
|
435
|
+ Zans(ilagr, ir2) = Zwork.col(ir2).segment(ilag,201).dot( WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1) ) / Arg(ilagr);
|
415
|
436
|
}
|
|
437
|
+ ilagr -= 1;
|
416
|
438
|
}
|
|
439
|
+ //std::cout << "Zans" << Zans << std::endl;
|
|
440
|
+ //exit(EXIT_SUCCESS);
|
417
|
441
|
|
418
|
442
|
// make sure vectors are empty
|
419
|
443
|
splineVecReal.clear();
|
|
@@ -422,17 +446,19 @@ namespace Lemma {
|
422
|
446
|
// Now do cubic spline
|
423
|
447
|
// TODO Check that knots are set in right order, Eigen has reverse()
|
424
|
448
|
//std::cout << "Arg\n" << Arg << std::endl;
|
425
|
|
- //std::cout << "Zans\n" << Zans.col(0) << std::endl;
|
|
449
|
+ //std::cout << "Arg.reverse()\n" << Arg.reverse() << std::endl;
|
|
450
|
+ //VectorXr Argr = Arg.reverse();
|
|
451
|
+ //std::cout << "Zans\n" << Zans << std::endl;
|
|
452
|
+ //exit(EXIT_SUCCESS);
|
426
|
453
|
for (int ii=0; ii<Zans.cols(); ++ii) {
|
427
|
|
- auto Spline = CubicSplineInterpolator::NewSP();
|
428
|
|
- Spline->SetKnots( Arg, Zans.col(ii).real() );
|
429
|
|
- splineVecReal.push_back(Spline);
|
|
454
|
+ auto SplineR = CubicSplineInterpolator::NewSP();
|
|
455
|
+ SplineR->SetKnots( Arg, Zans.col(ii).real() );
|
|
456
|
+ splineVecReal.push_back(SplineR);
|
430
|
457
|
|
431
|
458
|
auto SplineI = CubicSplineInterpolator::NewSP();
|
432
|
459
|
SplineI->SetKnots( Arg, Zans.col(ii).imag() );
|
433
|
460
|
splineVecImag.push_back(SplineI);
|
434
|
461
|
}
|
435
|
|
-
|
436
|
462
|
return ;
|
437
|
463
|
} // ----- end of method FHTKey201::ComputeLaggedRelated -----
|
438
|
464
|
|