Skip to content

Add support for matrices #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 34 commits into from
Jun 27, 2025
Merged

Add support for matrices #58

merged 34 commits into from
Jun 27, 2025

Conversation

ZCG-coder
Copy link
Owner

@ZCG-coder ZCG-coder commented Jun 26, 2025

This PR fixes issues #56 and #57.

  • Added support for 2D matrices
    • Supported operations:
      • Addition
      • Subtraction
      • Multiplication (both scalar and matrix)
      • Inverse
      • Power (with positive integers only)
      • Submatrix
      • Join matrices on the left or right
      • Transpose
    • Supported generation methods
      • Zeros (Matrix::zeros)
      • Ones (Matrix::ones)
      • Diagonal (Matrix::diag)
  • Changed numerous handling mechanisms
  • ARM platforms now are officially supported, including Windows on ARM and ARM Linux.
  • Added more functions to the Python API.

Changelog

  • Fix accuracy issues for exp.

  • Fix build errors

  • Add #include for <cstdint>

  • Upgrade Windows version

    Signed-off-by: Andy Zhang [email protected]#
    Using Python to show GUI

  • Trying to fix build issue on Windows

  • Fixed Windows build issues

  • Added support for 2D matrices

    • Removed imgui directory for switching to Python tkinter.
    • Add matrix support mat2d.hpp
    • [BREAKING] Number objects now round to 10 decimal places by default.
    • [BREAKING] Steppable public headers are now in include/steppable.
  • Small fixes to improve accuracy of ref result.

    • Automatically rounds off numbers in matrix after ref operation.
    • roundOff now supports simplifying the zero polarity to always ensure positive zero.
    • Fix build issues.
  • Fix rounding issues

  • Allow building on ARM

  • Improve precision of Number operations.

    • [BREAKING] Number does not support implicit conversions from now on.
  • Fixed build issues with Nanobind.

    • Added back const qualifier to Number::operator/ and Number::operator*.
  • Cleaned up configuration files

  • Enable special build hacks to be specified.

    • Changed localization behavior: when no translations are found, defaults to en-US
    • Allow value inspections to be specified
    • Change rounding behavior to pad numbers automatically
  • Fixed bugs in multiply

  • Fixed bugs in multiply

  • Fixed rounding errors

    • Address segmentation fault in util.cpp by adding empty checks
    • Fix incorrect rounding of negative decimals (like -2.99) to -1
  • Reformat

  • Add matrix symbols and pretty-printing using better symbols

  • Added unary operator support to Number and Fraction

    • Unary operators are now supported for Number and Fraction. One can now use +number and -number to get the
      positive / negative instances of the number.
    • Python bindings now include the unary operators.
    • *.pyi files have been updated to include signatures of unary operators.
    • Matrix objects now support addition.
  • Add operators for matrices

    • Add operator-, operator*, operator== to Matrix
    • Add mat2d test targets
    • Add concepts to diffrentiate different types of objects (std::string, .present() methods and numeric)
    • Add support for assertIsEqual and assertIsNotEqual for other types of data
  • Moved out bindings to separate modules

    • Added bindings for Matrix to Python
    • Added support for implicit conversion between Python numerals and Steppable Number
    • Fix build errors by renaming assert to _assertCondition method in testing.cpp
  • Add determinant for matrices

    • Add the det function.
    • [BREAKING] ref now refer to the rref function. The ref function now does row echelon form without reduction.
    • Add the bindings for det and ref to Python.
  • Allow matrix joining laterally.

    • Matrices can now be joined using the << and >> operators
    • [BREAKING] Matrix indices are now standardized to be (row, column)
  • Add rank method for matrix.

    • Add rank method to Matrix
    • Add corresponding bindings
    • Add support for iterating through the matrix, in C++ and Python
    • Changed order of Matrix::zeros arguments
    • Add literal _n to specify a number
  • Allow matrix powers

    • Allow matrix powers
    • Allow matrix inverse by specifying -1 as power.
  • Fix build errors

    • Add parameters to Python
    • Add diag method to Python bindings.
  • Add documentation to Python binding stubs

    • [BREAKING] Change stub file names to underscores to prevent accessing
    • Add documentation
    • Corrected typing annotations in stubs
  • Add copyright headers

    • Not requiring too many GIthub Actions for pull requests
  • Fixed build errors

    • Fixed return type of Matrix::diag.

Signed-off-by: Andy Zhang <[email protected]>
- Removed imgui directory for switching to Python tkinter.
- Add matrix support `mat2d.hpp`
- [BREAKING] `Number` objects now round to 10 decimal places by default.
- [BREAKING] Steppable public headers are now in `include/steppable`.
- Automatically rounds off numbers in matrix after `ref` operation.
- `roundOff` now supports simplifying the zero polarity to always ensure positive zero.
- Fix build issues.
- [BREAKING] `Number` does not support implicit conversions from now on.
- Added back `const` qualifier to Number::operator/ and Number::operator*.
- Changed localization behavior: when no translations are found, defaults to en-US
- Allow value inspections to be specified
- Change rounding behavior to pad numbers automatically
- [#56] Fix `isPowerOfTen` detection flaw
- [WIP] Trying to address matrix rref issues.
- [#57] Fix `isPowerOfTen` handling flaw
- Address segmentation fault in util.cpp by adding empty checks
- Fix incorrect rounding of negative decimals (like -2.99) to -1
- Unary operators are now supported for `Number` and `Fraction`. One can now use `+number` and `-number` to get the
positive / negative instances of the number.
- Python bindings now include the unary operators.
- `*.pyi` files have been updated to include signatures of unary operators.
- `Matrix` objects now support addition.
- Add `operator-`, `operator*`, `operator==` to `Matrix`
- Add mat2d test targets
- Add concepts to diffrentiate different types of objects (std::string, .present() methods and numeric)
- Add support for assertIsEqual and assertIsNotEqual for other types of data
- Added bindings for `Matrix` to Python
- Added support for implicit conversion between Python numerals and Steppable `Number`
- Fix build errors by renaming `assert` to `_assertCondition` method in testing.cpp
- Add the `det` function.
- [BREAKING] `ref` now refer to the `rref` function. The `ref` function now does row echelon form without reduction.
- Add the bindings for `det` and `ref` to Python.
- Matrices can now be joined using the `<<` and `>>` operators
- [BREAKING] Matrix indices are now standardized to be (row, column)
- Add `rank` method to `Matrix`
- Add corresponding bindings
- Add support for iterating through the matrix, in C++ and Python
- Changed order of Matrix::zeros arguments
- Add literal `_n` to specify a number
- Allow matrix powers
- Allow matrix inverse by specifying -1 as power.
- Add parameters to Python
- Add `diag` method to Python bindings.
@ZCG-coder ZCG-coder added this to the First Release milestone Jun 26, 2025
@ZCG-coder ZCG-coder added the T-Bug Type - Bug and unexpected behavior. label Jun 26, 2025
@ZCG-coder ZCG-coder added T-Feature Type - New feature or request C-Python Code - Pull requests that update Python code C-C++ Code - Pull requests that update C++ code. C-Actions Code - Pull requests that update Github Actions YAML files. C-CMake Code - Pull requests that update CMake files. T-Improvement Type - Improvements to components. T-OS Support Type - Request support on another OS. labels Jun 26, 2025
@ZCG-coder ZCG-coder self-assigned this Jun 26, 2025
- [BREAKING] Change stub file names to underscores to prevent accessing
- Add documentation
- Corrected typing annotations in stubs
- Not requiring too many GIthub Actions for pull requests
- Fixed return type of Matrix::diag.
Signed-off-by: Andy Zhang <[email protected]>
- Add documentation for C++ API functions.
- Add matrix data sanity check to ensure uniform rows.
@ZCG-coder ZCG-coder merged commit 2dc4254 into main Jun 27, 2025
51 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Steppable Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Actions Code - Pull requests that update Github Actions YAML files. C-C++ Code - Pull requests that update C++ code. C-CMake Code - Pull requests that update CMake files. C-Python Code - Pull requests that update Python code T-Bug Type - Bug and unexpected behavior. T-Feature Type - New feature or request T-Improvement Type - Improvements to components. T-OS Support Type - Request support on another OS.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Incorrect result sign from multiply when one of the inputs is a power of 10 Bug: Calculation error caused by incorrect detection of isPowerOfTen()
1 participant