Skip to content

Commit

Permalink
Optimize conjugate weight calculation
Browse files Browse the repository at this point in the history
Move unnecessary wavevector calculation from every calculateWeight(Vector3D r) call to constructor. The wavevector is always the same for any given instance of ConjucateWeightAlgorithm.class
  • Loading branch information
christianheina committed Feb 11, 2024
1 parent d57c9d3 commit 7512fde
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@
*/
public class ConjugateWeightAlgorithm implements WeightAlgorithm {

private double lambda;
private ThetaPhi pointingDirection;
private Vector3D k;

ConjugateWeightAlgorithm(double lambda, ThetaPhi pointingDirection) {
this.lambda = lambda;
this.pointingDirection = pointingDirection;
k = PhasedArrayUtil.calculateWaveVector(lambda, pointingDirection);
}

@Override
public Complex calculateWeight(Vector3D r) {
Vector3D k = PhasedArrayUtil.calculateWaveVector(lambda, pointingDirection);
return PhasedArrayUtil.calculateSteeringVector(k, r).conjugate();
}

Expand Down

0 comments on commit 7512fde

Please sign in to comment.