| 864 | } |
| 865 | |
| 866 | @Override |
| 867 | public void applyIndexFunction(IndexFunction f) |
| 868 | { |
| 869 | if(f.f(0.0, -1) != 0.0) |
| 870 | super.applyIndexFunction(f); |
| 871 | else//Then we only need to apply it to the non zero values! |
| 872 | { |
| 873 | /* |
| 874 | * The indexFunction may turn a value to zero, if so, we need to |
| 875 | * shift everything over and skip based on how many zeros have been |
| 876 | * created |
| 877 | */ |
| 878 | int skip = 0; |
| 879 | for(int i = 0; i < used; i++) |
| 880 | { |
| 881 | indexes[i-skip] = indexes[i]; |
| 882 | values[i-skip] = f.indexFunc(values[i], i); |
| 883 | if(values[i-skip] == 0.0) |
| 884 | skip++; |
| 885 | } |
| 886 | |
| 887 | used -= skip; |
| 888 | } |
| 889 | } |
| 890 | |
| 891 | @Override |
| 892 | public void zeroOut() |