This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-3.1
in repository https://gitbox.apache.org/repos/asf/sis.git

commit f4ee01f6fe96d3cab4f19751b03053dfacdfdc26
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Fri Sep 5 11:14:31 2025 +0200

    Minor cleanups and addition of more efficient methods for inversion of 
small matrices.
---
 .../iso/extent/DefaultGeographicDescription.java   |  2 +-
 .../sis/referencing/StandardDefinitions.java       | 22 +++++++++++++++++-----
 .../internal/PositionalAccuracyConstant.java       | 11 -----------
 .../apache/sis/referencing/internal/Resources.java |  7 +------
 .../sis/referencing/internal/Resources.properties  |  1 -
 .../referencing/internal/Resources_fr.properties   |  1 -
 .../sis/referencing/operation/matrix/Matrix1.java  | 17 +++++++++++++++--
 .../sis/referencing/operation/matrix/Matrix2.java  | 16 +++++++++++++++-
 .../sis/referencing/factory/sql/epsg/README.md     |  4 ++--
 9 files changed, 51 insertions(+), 30 deletions(-)

diff --git 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultGeographicDescription.java
 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultGeographicDescription.java
index 46b05f40fe..478a525e06 100644
--- 
a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultGeographicDescription.java
+++ 
b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/DefaultGeographicDescription.java
@@ -37,7 +37,7 @@ import org.apache.sis.util.iso.Types;
  * {@code       └─code……………………………………} Alphanumeric value identifying an 
instance in the namespace.</div>
  *
  * The area is given by a {@linkplain #getGeographicIdentifier() geographic 
identifier},
- * which may be a code in the codespace of some authority (for example an EPSG 
code).
+ * which may be a code in the codespace of some authority (for example, an 
<abbr>EPSG</abbr> code).
  * In addition, the geographic identifier can optionally have a
  * {@linkplain DefaultIdentifier#getDescription() natural language 
description}.
  *
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
index f2a2c0da46..ea5b50da9c 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/StandardDefinitions.java
@@ -78,6 +78,7 @@ import static 
org.apache.sis.metadata.privy.ReferencingServices.AUTHALIC_RADIUS;
 
 // Specific to the geoapi-3.1 and geoapi-4.0 branches:
 import org.opengis.referencing.datum.DatumEnsemble;
+import org.opengis.referencing.datum.RealizationMethod;
 import static org.opengis.referencing.ObjectDomain.DOMAIN_OF_VALIDITY_KEY;
 
 
@@ -358,7 +359,7 @@ final class StandardDefinitions {
             default:   throw new AssertionError(code);
         }
         Map<String,Object> properties = properties(csCode, csName, null, 
false);
-        final DefaultVerticalCS cs = new DefaultVerticalCS(properties, 
createAxis(axis, true));
+        final var cs = new DefaultVerticalCS(properties, createAxis(axis, 
true));
         properties = properties(code, name, alias, true);
         if (wms != null) {
             addWMS(properties, wms);
@@ -375,12 +376,23 @@ final class StandardDefinitions {
     static VerticalDatum createVerticalDatum(final short code) {
         final String name;
         final String alias;
+        final RealizationMethod method;
         switch (code) {
-            case 5100: name = "Mean Sea Level";                     alias = 
"MSL";    break;
-            case 5103: name = "North American Vertical Datum 1988"; alias = 
"NAVD88"; break;
-            default:   throw new AssertionError(code);
+            case 5100: {
+                name   = "Mean Sea Level";
+                alias  = "MSL";
+                method = RealizationMethod.TIDAL;
+                break;
+            }
+            case 5103: {
+                name   = "North American Vertical Datum 1988";
+                alias  = "NAVD88";
+                method = RealizationMethod.LEVELLING;
+                break;
+            }
+            default: throw new AssertionError(code);
         }
-        return new DefaultVerticalDatum(properties(code, name, alias, true), 
null);
+        return new DefaultVerticalDatum(properties(code, name, alias, true), 
method);
     }
 
     /**
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/PositionalAccuracyConstant.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/PositionalAccuracyConstant.java
index 50307e14c7..22a60b2a89 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/PositionalAccuracyConstant.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/PositionalAccuracyConstant.java
@@ -119,13 +119,6 @@ public final class PositionalAccuracyConstant extends 
DefaultAbsoluteExternalPos
      */
     public static final PositionalAccuracy INDIRECT_SHIFT_APPLIED;
 
-    /**
-     * Coordinate operation between reference frames in the same datum 
ensemble.
-     * Should be used only with coordinate operations that are conversion,
-     * but may also be used as a fallback if a datum ensemble didn't specified 
its accuracy.
-     */
-    public static final PositionalAccuracy SAME_DATUM_ENSEMBLE;
-
     /**
      * Name for accuracy metadata of datum ensemble.
      */
@@ -160,9 +153,6 @@ public final class PositionalAccuracyConstant extends 
DefaultAbsoluteExternalPos
         DATUM_SHIFT_APPLIED    = new 
PositionalAccuracyConstant(TRANSFORMATION_REFERENCE, method, pass, 
DATUM_SHIFT_ACCURACY);
         DATUM_SHIFT_OMITTED    = new 
PositionalAccuracyConstant(TRANSFORMATION_REFERENCE, method, fail, 
UNKNOWN_ACCURACY);
         INDIRECT_SHIFT_APPLIED = new 
PositionalAccuracyConstant(TRANSFORMATION_REFERENCE, method, pass, 
INDIRECT_SHIFT_ACCURACY);
-
-        final var reference = new 
DefaultMeasureReference(Resources.formatInternational(Resources.Keys.OperationSameDatumEnsemble));
-        SAME_DATUM_ENSEMBLE = new PositionalAccuracyConstant(reference, null, 
null, null);
     }
 
     /**
@@ -246,7 +236,6 @@ public final class PositionalAccuracyConstant extends 
DefaultAbsoluteExternalPos
         if (equals(DATUM_SHIFT_APPLIED))    return DATUM_SHIFT_APPLIED;
         if (equals(DATUM_SHIFT_OMITTED))    return DATUM_SHIFT_OMITTED;
         if (equals(INDIRECT_SHIFT_APPLIED)) return INDIRECT_SHIFT_APPLIED;
-        if (equals(SAME_DATUM_ENSEMBLE))    return SAME_DATUM_ENSEMBLE;
         return this;
     }
 
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java
index 624fad4f24..dd2f78b00b 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.java
@@ -206,7 +206,7 @@ public class Resources extends IndexedResourceBundle {
         /**
          * No information about how to change from datum “{0}” to “{1}”.
          */
-        public static final short DatumChangeNotFound_2 = 110;
+        public static final short DatumChangeNotFound_2 = 106;
 
         /**
          * Datum shift files are searched in the “{0}” directory.
@@ -523,11 +523,6 @@ public class Resources extends IndexedResourceBundle {
          */
         public static final short OperationHasNoTransform_2 = 43;
 
-        /**
-         * Coordinate operation between reference frames in the same datum 
ensemble.
-         */
-        public static final short OperationSameDatumEnsemble = 106;
-
         /**
          * No parameter named “{1}” has been found in “{0}”.
          */
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties
index 0d71f64351..a602475cb3 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources.properties
@@ -43,7 +43,6 @@ NotFormalProjectionParameter_1    = This parameter borrowed 
from the \u201c{0}\u
 NonConformAxes_2                  = The coordinate system axes in the given 
\u201c{0}\u201d description do not conform to the expected axes according 
\u201c{1}\u201d authoritative description.
 NonConformCRS_3                   = The given \u201c{0}\u201d description does 
not conform to the \u201c{1}\u201d authoritative description. \
                                     Differences are found in 
{2,choice,0#conversion method|1#conversion description|2#coordinate 
system|3#ellipsoid|4#prime meridian|5#datum|6#CRS}.
-OperationSameDatumEnsemble        = Coordinate operation between reference 
frames in the same datum ensemble.
 RestrictedToPoleLatitudes         = The only valid entries are \u00b190\u00b0 
or equivalent in alternative angle units.
 
 #
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties
index e7dd3786dd..981a56dd6b 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/internal/Resources_fr.properties
@@ -48,7 +48,6 @@ NotFormalProjectionParameter_1    = Ce param\u00e8tre 
emprunt\u00e9 \u00e0 la pr
 NonConformAxes_2                  = Les axes du syst\u00e8me de 
coordonn\u00e9es d\u00e9finis dans \u00ab\u202f{0}\u202f\u00bb ne sont pas 
conformes aux axes attendus d\u2019apr\u00e8s la description officielle de 
\u00ab\u202f{1}\u202f\u00bb.
 NonConformCRS_3                   = La description donn\u00e9e pour 
\u00ab\u202f{0}\u202f\u00bb n\u2019est pas conforme \u00e0 la description 
officielle de \u00ab\u202f{1}\u202f\u00bb. \
                                     Des diff\u00e9rences ont \u00e9t\u00e9 
trouv\u00e9es dans {2,choice,0#la m\u00e9thode de conversion|1#la description 
de la conversion|2#le syst\u00e8me de 
coordonn\u00e9es|3#l\u2019ellipso\u00efde|4#le m\u00e9ridien 
d\u2019origine|5#le r\u00e9f\u00e9rentiel|6#le CRS}.
-OperationSameDatumEnsemble        = Op\u00e9ration sur les coordonn\u00e9es 
entre des r\u00e9f\u00e9rentiels qui sont dans le m\u00eame ensemble de 
r\u00e9f\u00e9rentiels.
 RestrictedToPoleLatitudes         = Les seules valeurs valides sont 
\u00b190\u00b0 ou \u00e9quivalent dans d\u2019autres unit\u00e9s.
 
 #
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix1.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix1.java
index bbde7dd681..2be78373bc 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix1.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix1.java
@@ -18,6 +18,7 @@ package org.apache.sis.referencing.operation.matrix;
 
 import org.opengis.referencing.operation.Matrix;
 import org.apache.sis.util.privy.Numerics;
+import org.apache.sis.referencing.internal.Resources;
 
 
 /**
@@ -30,7 +31,7 @@ import org.apache.sis.util.privy.Numerics;
  * └     ┘</pre></blockquote>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.4
+ * @version 1.5
  *
  * @see Matrix2
  * @see Matrix3
@@ -250,6 +251,18 @@ public class Matrix1 extends MatrixSIS {
         };
     }
 
+    /**
+     * Returns the inverse of this matrix.
+     *
+     * @return the inverse of this matrix.
+     * @throws NoninvertibleMatrixException if this matrix is not invertible.
+     */
+    @Override
+    public MatrixSIS inverse() throws NoninvertibleMatrixException {
+        if (m00 != 0) return new Matrix1(1 / m00);
+        throw new 
NoninvertibleMatrixException(Resources.format(Resources.Keys.SingularMatrix));
+    }
+
     /**
      * Normalizes all columns in-place.
      * For a 1×1 matrix with non-NaN value, this method sets the {@link #m00} 
value
@@ -259,7 +272,7 @@ public class Matrix1 extends MatrixSIS {
      */
     @Override
     public MatrixSIS normalizeColumns() {
-        final MatrixSIS magnitudes = new Matrix1(Math.abs(m00));
+        final var magnitudes = new Matrix1(Math.abs(m00));
         m00 = Math.signum(m00);
         return magnitudes;
     }
diff --git 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix2.java
 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix2.java
index 6f406bdc4b..faec664a69 100644
--- 
a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix2.java
+++ 
b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/matrix/Matrix2.java
@@ -18,6 +18,7 @@ package org.apache.sis.referencing.operation.matrix;
 
 import org.opengis.referencing.operation.Matrix;
 import org.apache.sis.util.privy.Numerics;
+import org.apache.sis.referencing.internal.Resources;
 
 
 /**
@@ -31,7 +32,7 @@ import org.apache.sis.util.privy.Numerics;
  * └         ┘</pre></blockquote>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 1.4
+ * @version 1.5
  *
  * @see Matrix1
  * @see Matrix3
@@ -299,6 +300,19 @@ public class Matrix2 extends MatrixSIS {
         };
     }
 
+    /**
+     * Returns the inverse of this matrix.
+     *
+     * @return the inverse of this matrix.
+     * @throws NoninvertibleMatrixException if this matrix is not invertible.
+     */
+    @Override
+    public MatrixSIS inverse() throws NoninvertibleMatrixException {
+        final double id = m00*m11 - m01*m10;
+        if (id != 0) return new Matrix2(m11/id, -m01/id, -m10/id, m00/id);
+        throw new 
NoninvertibleMatrixException(Resources.format(Resources.Keys.SingularMatrix));
+    }
+
     /**
      * {@inheritDoc}
      */
diff --git 
a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
 
b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
index 3aaefdee6f..e33b863fd7 100644
--- 
a/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
+++ 
b/optional/src/org.apache.sis.referencing.epsg/test/org/apache/sis/referencing/factory/sql/epsg/README.md
@@ -99,8 +99,8 @@ Then open the `FKeys.sql` file for edition:
 
 Usually, the above editions result in no change compared to the previous 
scripts (ignoring white spaces),
 in which case the maintainer can just revert the changes in order to preserve 
the formatting.
-However, if some changes are found in the schema, then hard-coded values in 
the `DataScriptFormatter` class may need
-to be modified, in particular the `booleanColumnIndicesForTables` and 
`doubleColumnIndicesForTables` collections.
+However, if some changes are found in the schema, then hard-coded values in 
the `DataScriptFormatter` class
+may need to be modified, in particular the `booleanColumns` and 
`doubleColumns` collections.
 
 
 ### Automatic updates after the manual checks

Reply via email to