Closed axkr closed 3 years ago
The isZero()
method already exists, it was added in version 1.8.
I checked were it could be used anbd found only FieldQRDecomposition
. Other algorithms
like ComplexEigenDecomposition
use a user-configurable epsilon to check zero.
Yes you call the FieldElement#isZero()
method for FieldQRDecomposition
.
In "standard/numeric" calculations this isZero()
method often contains a "fast default check" for 0.
But for symbolic matrix "simplification" operations, it often make sense to use a more "expensive" test to check for 0.
My proposal means that the zero test should be configurable with a "lambda function" and that the FieldElement#isZero()
method should be used as the default operation for this lambda function.
For example you can use different symbolic simplifications to test if an expression is zero:
Could you suggest a list of algorithms where we could put this feature? I guess the lambda function would be an implementation of a new interface in the spirit of:
public interface ZeroChecker<T extends FieldElement<T>> {
/** Check if value is semantically zero.
* @param value value to check
* @return true if value is semantically zero
*/
boolean isZero(T value);
}
In the first moment FieldLUDecomposition
and FieldQRDecomposition
are the main candidates.
Not sure, but some of these "zero checks" may also be "hidden" in the methods of objects of type AbstractFieldMatrix
?
I checked AbstractFieldMatrix
but found nothing. This class does not implement any solve operation, i basically just handles the basic operations as well as getter/setters for entries, rows and columns.
I'll do a quick commit, most probably incomplete and let you check of this suit your needs.
Do you provide a 1.9-SNAPSHOT somewhere?
I have pushed a basic implementation for testing. You can et the snapshot from the Orekit continuous integration server here: https://packages.orekit.org/#browse/browse:maven-snapshots
It should appear automatically if the tests pass.
For me this implementation seems to work.
For
FieldMatrix
methods can we have an "extra" method or "lambda function" for the "zero" test of aFieldElement
which is not the same as the default "zero" test?Something similar to:
which will be called in matrix operations like: