Skip to content

Commit

Permalink
Implemented _Adaptive interface for all adaptive filters; made edits …
Browse files Browse the repository at this point in the history
…to javadoc comments
  • Loading branch information
psambit9791 committed Dec 27, 2021
1 parent aad1bbc commit c2b29d9
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 72 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.psambit9791</groupId>
<artifactId>jdsp</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.0.0</version>

<distributionManagement>
<snapshotRepository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* @author Sambit Paul
* @version 1.2
*/
abstract class _FIRFilter {
public abstract class _FIRFilter {

/**
* FIR Filters follow the formula y_n = sum(b_i * x_(n-i)) for all coefficients i = 0 to M.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class AP implements _Adaptive {
private double[] output;

/**
* This constructor initialises the prerequisites required for the LMS adaptive filter.
* This constructor initialises the prerequisites required for the AP adaptive filter.
* @param order projection order to determine the memory
* @param learningRate also known as step size. Determines how fast the adaptive filter changes its filter weights.
* If it is too slow, the filter may have bad performance. If it is too high, the filter will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* @author Sambit Paul
* @version 1.0
*/
public class GNGD {
public class GNGD implements _Adaptive{

private double[] weights; // Weights of the filter
private double[] error;
Expand All @@ -39,16 +39,6 @@ public class GNGD {
private double last_e;
private double[] last_x;

/**
* Dictates how the filter weights initialization should be done:
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
public enum WeightsFillMethod {
RANDOM,
ZEROS
}

/**
* This constructor initialises the prerequisites required for the GNGD adaptive filter.
* @param learningRate learning rate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,13 @@
* @author Sibo Van Gool
* @version 1.0
*/
public class LMS {
public class LMS implements _Adaptive {
private final double learningRate; // Learning rate (= step size)
private final double leakageFactor; // Leakage factor
private double[] weights; // Weights of the filter
private double[] error; // Error of the filter
private double[] output; // Filtered output

/**
* Dictates how the filter weights initialization should be done:
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
public enum WeightsFillMethod {
RANDOM,
ZEROS
}

/**
* This constructor initialises the prerequisites required for the LMS adaptive filter.
* @param learningRate also known as step size. Determines how fast the adaptive filter changes its filter weights.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,13 @@
* @author Sibo Van Gool
* @version 1.0
*/
public class NLMS {
public class NLMS implements _Adaptive {
private final double learningRate; // Learning rate (= step size)
private final double leakageFactor; // Leakage factor
private double[] weights; // Weights of the filter
private double[] error; // Error of the filter
private double[] output; // Filtered output

/**
* Dictates how the filter weights initialization should be done:
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
public enum WeightsFillMethod {
RANDOM,
ZEROS
}

/**
* This constructor initialises the prerequisites required for the NLMS adaptive filter.
* @param learningRate also known as step size. Determines how fast the adaptive filter changes its filter weights.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,13 @@
* @author Sambit Paul
* @version 1.0
*/
public class NSSLMS {
public class NSSLMS implements _Adaptive{
private final double learningRate; // Learning rate (= step size)
private final double leakageFactor; // Leakage factor
private double[] weights; // Weights of the filter
private double[] error; // Error of the filter
private double[] output; // Filtered output

/**
* Dictates how the filter weights initialization should be done:
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
public enum WeightsFillMethod {
RANDOM,
ZEROS
}

/**
* Returns the sign of the input number.
* @param err Value whose sign is to be determined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,13 @@
* @author Sambit Paul
* @version 1.0
*/
public class RLS {
public class RLS implements _Adaptive{
private double[] weights; // Weights of the filter
private double[] error;
private double[] output;
private double mu; // Forgetting factor
private double[][] R;

/**
* Dictates how the filter weights initialization should be done:
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
public enum WeightsFillMethod {
RANDOM,
ZEROS
}

/**
* This constructor initialises the prerequisites required for the RLS adaptive filter.
* @param mu forgetting factor. It is introduced to give exponentially less weight to older error samples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,13 @@
* @author Sambit Paul
* @version 1.0
*/
public class SSLMS {
public class SSLMS implements _Adaptive{
private final double learningRate; // Learning rate (= step size)
private final double leakageFactor; // Leakage factor
private double[] weights; // Weights of the filter
private double[] error; // Error of the filter
private double[] output; // Filtered output

/**
* Dictates how the filter weights initialization should be done:
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
public enum WeightsFillMethod {
RANDOM,
ZEROS
}

/**
* Returns the sign of the input number.
* @param err Value whose sign is to be determined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
* @author Sambit Paul
* @version 1.0
*/
interface _Adaptive {
public interface _Adaptive {

/**
* Dictates how the filter weights initialization should be done:
* Dictates how the filter weights initialization should be done.
* RANDOM: filter weights get an initial random value ranging from 0 to 1
* ZEROS: filter weights get initial value 0
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/**
* <h1>Convolution for Complex Numbers</h1>
* The ComplexConvolution class implements different modes of convolution for a list of complex numbers.
* The window can be a list of Complex or double numbers.
* The window can be a list of Complex or real (double) numbers.
* <p>
*
* @author Sambit Paul
Expand Down

0 comments on commit c2b29d9

Please sign in to comment.