Class SquareMatrices<E>

java.lang.Object
org.episteme.core.mathematics.sets.SquareMatrices<E>
Type Parameters:
E - the type of scalar elements in the field
All Implemented Interfaces:
AbelianGroup<Matrix<E>>, AbelianMonoid<Matrix<E>>, Group<Matrix<E>>, Magma<Matrix<E>>, Monoid<Matrix<E>>, Ring<Matrix<E>>, Semiring<Matrix<E>>, Set<Matrix<E>>

public final class SquareMatrices<E> extends Object implements Ring<Matrix<E>>
The structure of n×n square matrices over a field, forming a ring.

For a given field F and dimension n, the set of n×n matrices forms a ring under matrix addition and multiplication. Unlike scalar rings, matrix multiplication is generally not commutative.

Mathematical Properties

  • Addition: closed, associative, commutative, with zero matrix
  • Multiplication: closed, associative, with identity matrix
  • Distributive: A(B + C) = AB + AC
  • Non-commutative: AB ≠ BA in general
Since:
1.0
Author:
Gemini AI (Google DeepMind)
See Also:
  • Method Details

    • of

      public static <E> SquareMatrices<E> of(Field<E> scalarField, int dimension)
      Returns the SquareMatrices structure for n×n matrices over a field.
    • getDimension

      public int getDimension()
    • getScalarField

      public Field<E> getScalarField()
    • operate

      public Matrix<E> operate(Matrix<E> a, Matrix<E> b)
      Description copied from interface: Magma
      Performs the binary operation on two elements.

      This is the fundamental operation of a magma. The result must be an element of this magma (closure property).

      Properties: None required (not necessarily associative or commutative)

      Specified by:
      operate in interface Magma<E>
      Parameters:
      a - the first operand
      b - the second operand
      Returns:
      the result of a ∗ b
      See Also:
    • add

      public Matrix<E> add(Matrix<E> a, Matrix<E> b)
      Description copied from interface: AbelianMonoid
      Returns the sum of two elements (additive notation).

      Delegates to Magma.operate(Object, Object).

      Specified by:
      add in interface AbelianMonoid<E>
      Parameters:
      a - the first addend
      b - the second addend
      Returns:
      a + b
    • zero

      public Matrix<E> zero()
      Description copied from interface: AbelianMonoid
      Returns the additive identity (zero element).

      Delegates to AbelianMonoid.identity().

      Specified by:
      zero in interface AbelianMonoid<E>
      Returns:
      the zero element
    • negate

      public Matrix<E> negate(Matrix<E> element)
      Description copied from interface: AbelianGroup
      Returns the additive inverse (negation) of an element.

      Satisfies: a + (-a) = (-a) + a = 0

      Specified by:
      negate in interface AbelianGroup<E>
      Parameters:
      element - the element to negate
      Returns:
      -element
      See Also:
    • multiply

      public Matrix<E> multiply(Matrix<E> a, Matrix<E> b)
      Description copied from interface: Semiring
      Returns the product of two elements.

      Multiplication must be associative and distribute over addition.

      Specified by:
      multiply in interface Semiring<E>
      Parameters:
      a - the first factor
      b - the second factor
      Returns:
      a × b
    • one

      public Matrix<E> one()
      Description copied from interface: Semiring
      Returns the multiplicative identity (one element).

      Satisfies: 1 × a = a × 1 = a for all elements a.

      Specified by:
      one in interface Semiring<E>
      Returns:
      the multiplicative identity
    • isMultiplicationCommutative

      public boolean isMultiplicationCommutative()
      Description copied from interface: Semiring
      Tests whether multiplication is commutative in this semiring.
      Specified by:
      isMultiplicationCommutative in interface Semiring<E>
      Returns:
      true if multiplication commutes
    • inverse

      public Matrix<E> inverse(Matrix<E> element)
      Description copied from interface: Group
      Returns the inverse of the given element.

      For element a, returns a⁻¹ such that: a ∗ a⁻¹ = a⁻¹ ∗ a = e (identity).

      Specified by:
      inverse in interface Group<E>
      Parameters:
      element - the element to invert
      Returns:
      the inverse element
    • contains

      public boolean contains(Matrix<E> element)
      Description copied from interface: Set
      Tests whether this set contains the specified element.

      This is the fundamental operation of a set - membership testing.

      Specified by:
      contains in interface Set<E>
      Parameters:
      element - the element to test for membership
      Returns:
      true if this set contains the element, false otherwise
      See Also:
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Set
      Returns true if this set contains no elements.

      The empty set (∅) is a fundamental concept in set theory. It is the unique set containing no elements.

      Specified by:
      isEmpty in interface Set<E>
      Returns:
      true if this set is empty
    • description

      public String description()
      Description copied from interface: Set
      Returns a human-readable description of this set.

      Examples:

      • "ℝ (Real Numbers)"
      • "ℤ/12ℤ (Integers modulo 12)"
      • "{1, 2, 3, 4, 5}"

      Specified by:
      description in interface Set<E>
      Returns:
      a description of this set
    • toString

      public String toString()
      Overrides:
      toString in class Object