java.lang.Object
net.algart.executors.modules.cv.matrices.misc.slopes.SlopeEmphasizer

public class SlopeEmphasizer extends Object
  • Method Details

    • getInstance

      public static SlopeEmphasizer getInstance()
    • forElementType

      public SlopeEmphasizer.ForType forElementType(Class<?> elementType)
    • getMinimalChange

      public double getMinimalChange()
    • setMinimalChange

      public SlopeEmphasizer setMinimalChange(double minimalChange)
    • getSlopeWidth

      public int getSlopeWidth()
    • setSlopeWidth

      public SlopeEmphasizer setSlopeWidth(int slopeWidth)
    • isAllowLongSlopes

      public boolean isAllowLongSlopes()
    • setAllowLongSlopes

      public SlopeEmphasizer setAllowLongSlopes(boolean allowLongSlopes)
    • isProcessAscending

      public boolean isProcessAscending()
    • setProcessAscending

      public SlopeEmphasizer setProcessAscending(boolean processAscending)
    • isProcessDescending

      public boolean isProcessDescending()
    • setProcessDescending

      public SlopeEmphasizer setProcessDescending(boolean processDescending)
    • isExactHalfSum

      public boolean isExactHalfSum()
    • setExactHalfSum

      public SlopeEmphasizer setExactHalfSum(boolean exactHalfSum)
    • emphasize

      public void emphasize(byte[] values)
    • emphasize

      public void emphasize(byte[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(byte[] values, int offset, int count, int step)
    • emphasize

      public void emphasize(char[] values)
    • emphasize

      public void emphasize(char[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(char[] values, int offset, int count, int step)
    • emphasize

      public void emphasize(short[] values)
    • emphasize

      public void emphasize(short[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(short[] values, int offset, int count, int step)
    • emphasize

      public void emphasize(int[] values)
    • emphasize

      public void emphasize(int[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(int[] values, int offset, int count, int step)
    • emphasize

      public void emphasize(long[] values)
    • emphasize

      public void emphasize(long[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(long[] values, int offset, int count, int step)
    • emphasize

      public void emphasize(float[] values)
    • emphasize

      public void emphasize(float[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(float[] values, int offset, int count, int step)
    • emphasize

      public void emphasize(double[] values)
    • emphasize

      public void emphasize(double[] values, int offset, int count)
      Emphasizes boundaries: sub-ranges of values array with high gradient. It means, that slopes of the function, represented by this array, with a large difference in values are replaced with a step function, where the border has a width of 1.

      More formal specification. Let V(x) is the function from integer argument x, represented by values array: V(i)=values[i], from ≤ i < to. This method finds all ranges x1..x2, where:

      • from ≤ x1 ≤ x2 < to;
      • the function is strictly monotone inside the range: V(x1)<V(x1+1)<...<V(x2) or V(x1)>V(x1+1)>...>V(x2); if property processAscending is cleared, first type of ranges is skipped (not changed), if property processDescending is cleared, second type of ranges is skipped (not changed), if both are cleared, this method does nothing;
      • total change of the function at this range is large, i.e. |V(x1)−V(x2)| ≥ minimalChange;
      • length of the range x2−x1+1 ≤ D, where D = slopeWidth, or, maybe, it is not so, but allowLongSlopes flag is set and and the following condition is fulfilled:
            for every sub-range with length D the total change of the function is also large, i.e. for every x, x1≤x≤x2−D+1, we have |V(x)−V(x+D−1)| ≥ minimalChange;
      • x1..x2 is a maximal range with this properties, i.e. for any other range x'1..x'2, where x'1<x1 and x'2>x2, one of the previous conditions is not fulfilled.

      For each range x1..x2 with the specified properties this method replaces every value V(x) inside this range (x1<x<x2) with the nearest from two values V(x1) and V(x2). Values, exactly equal to (V(x1)+V(x2)/2, are replaced with V(x2).

      Note: default values minimalChange=0 and slopeWidth=1 provides emphasizing every slope, regardless on its length and value of the function change.

      Parameters:
      values - array to be modified.
      offset - index of the first element of the processed fragment of this array.
      count - number of elements to process.
    • emphasize

      public void emphasize(double[] values, int offset, int count, int step)