|
@@ -340,7 +340,6 @@ namespace Lemma {
|
340
|
340
|
//kernelVec = KernelManager->GetSTLVector();
|
341
|
341
|
int nrel = (int)(KernelManager->GetSTLVector().size());
|
342
|
342
|
Eigen::Matrix<Complex, 201, Eigen::Dynamic > Zwork;
|
343
|
|
- // TODO, if we want to allow lagged, then 1 below should be nlag
|
344
|
343
|
Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(1, nrel);
|
345
|
344
|
Zwork.resize(201, nrel);
|
346
|
345
|
VectorXr lambda = WT201.col(0).array()/rho;
|
|
@@ -356,7 +355,6 @@ namespace Lemma {
|
356
|
355
|
// Zwork* needed due to sign convention of filter weights
|
357
|
356
|
Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
|
358
|
357
|
}
|
359
|
|
-
|
360
|
358
|
}
|
361
|
359
|
|
362
|
360
|
// We diverge slightly from Key here, each kernel is evaluated seperately, whereby instead
|
|
@@ -367,9 +365,6 @@ namespace Lemma {
|
367
|
365
|
for (int ir2=0; ir2<nrel; ++ir2) {
|
368
|
366
|
Zans(0, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
|
369
|
367
|
}
|
370
|
|
- std::cout << "rho\n" << rho << std::endl;
|
371
|
|
- std::cout << "Zans\n" << Zans << std::endl;
|
372
|
|
- exit(EXIT_SUCCESS);
|
373
|
368
|
return ;
|
374
|
369
|
} // ----- end of method FHTKey201::ComputeRelated -----
|
375
|
370
|
|
|
@@ -379,13 +374,9 @@ namespace Lemma {
|
379
|
374
|
//--------------------------------------------------------------------------------------
|
380
|
375
|
void FHTKey201::ComputeLaggedRelated ( const Real& rho, const int& nlag, std::shared_ptr<KernelEM1DManager> KernelManager ) {
|
381
|
376
|
|
382
|
|
- //std::cout << "rho max\t " << rho << std::endl;
|
383
|
|
- //Real rho = 214.963;
|
384
|
|
-
|
385
|
377
|
int nrel = (int)(KernelManager->GetSTLVector().size());
|
386
|
378
|
|
387
|
379
|
Eigen::Matrix< Complex, Eigen::Dynamic, Eigen::Dynamic > Zwork;
|
388
|
|
- //Eigen::Matrix<Complex, 201+nrel, Eigen::Dynamic > Zwork;
|
389
|
380
|
Zans= Eigen::Matrix<Complex, Eigen::Dynamic, Eigen::Dynamic>::Zero(nlag, nrel);
|
390
|
381
|
Zwork.resize(201+nlag, nrel); // Zwork needs to be expanded to filter length + nlag
|
391
|
382
|
|
|
@@ -398,14 +389,11 @@ namespace Lemma {
|
398
|
389
|
int NumFun = 0;
|
399
|
390
|
int idx = 0;
|
400
|
391
|
|
401
|
|
- //std::cout << lambda.transpose() << std::endl;
|
402
|
|
-
|
403
|
392
|
VectorXr Arg(nlag);
|
404
|
393
|
Arg(nlag-1) = rho;
|
405
|
394
|
for (int ilag=nlag-2; ilag>=0; --ilag) {
|
406
|
395
|
Arg(ilag) = Arg(ilag+1) * GetABSER();
|
407
|
396
|
}
|
408
|
|
- //std::cout << "Arg\t" << Arg << std::endl;
|
409
|
397
|
|
410
|
398
|
// Get Kernel values
|
411
|
399
|
for (int ir=0; ir<lambda.size(); ++ir) {
|
|
@@ -413,8 +401,6 @@ namespace Lemma {
|
413
|
401
|
++NumFun;
|
414
|
402
|
KernelManager->ComputeReflectionCoeffs(lambda(ir), idx, rho);
|
415
|
403
|
for (int ir2=0; ir2<nrel; ++ir2) {
|
416
|
|
- // Zwork* needed due to sign convention of filter weights
|
417
|
|
- //Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
|
418
|
404
|
Zwork(ir, ir2) = std::conj(KernelManager->GetSTLVector()[ir2]->RelBesselArg(lambda(ir)));
|
419
|
405
|
}
|
420
|
406
|
}
|
|
@@ -424,32 +410,19 @@ namespace Lemma {
|
424
|
410
|
// in the interests of making them as generic and reusable as possible. This approach requires slightly
|
425
|
411
|
// more multiplies, but the same number of kernel evaluations, which is the expensive part.
|
426
|
412
|
// Inner product and scale
|
427
|
|
- int ilagr = nlag-1;
|
|
413
|
+ int ilagr = nlag-1; // Zwork is in opposite order from Arg
|
428
|
414
|
for (int ilag=0; ilag<nlag; ++ilag) {
|
429
|
415
|
for (int ir2=0; ir2<nrel; ++ir2) {
|
430
|
|
- //Zans(ilag, ir2) = Zwork.col(ir2).dot(WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder() + 1))/rho;
|
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
|
416
|
Zans(ilagr, ir2) = Zwork.col(ir2).segment(ilag,201).dot( WT201.col(KernelManager->GetSTLVector()[ir2]->GetBesselOrder()+1) ) / Arg(ilagr);
|
436
|
417
|
}
|
437
|
418
|
ilagr -= 1;
|
438
|
419
|
}
|
439
|
|
- //std::cout << "Zans" << Zans << std::endl;
|
440
|
|
- //exit(EXIT_SUCCESS);
|
441
|
420
|
|
442
|
421
|
// make sure vectors are empty
|
443
|
422
|
splineVecReal.clear();
|
444
|
423
|
splineVecImag.clear();
|
445
|
424
|
|
446
|
425
|
// Now do cubic spline
|
447
|
|
- // TODO Check that knots are set in right order, Eigen has reverse()
|
448
|
|
- //std::cout << "Arg\n" << Arg << 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);
|
453
|
426
|
for (int ii=0; ii<Zans.cols(); ++ii) {
|
454
|
427
|
auto SplineR = CubicSplineInterpolator::NewSP();
|
455
|
428
|
SplineR->SetKnots( Arg, Zans.col(ii).real() );
|