Skip to content
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

Additional test cases #96

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

dnxjay
Copy link
Contributor

@dnxjay dnxjay commented Oct 7, 2024

This update introduces additional test cases to evaluate the performance and accuracy of different methods for calculating the trace of matrices of varying sizes. Specifically:

Test Case 1: A 500x500 random matrix to measure the efficiency of Einstein summation, NumPy's built-in trace function, and a manual loop method.
Additional test cases can be easily added to further analyze performance across matrix sizes or types (e.g., sparse, identity, etc.).
These tests are crucial for comparing the time efficiency of each method, providing insight into the best approach for large-scale matrix computations.

dnxjay added 5 commits October 2, 2024 16:42
…otations

- Implemented three different methods to compute the trace of a matrix:
  1. Using Einstein summation notation (`np.einsum('ii', A)`)
  2. Using NumPy's built-in `np.trace` function
  3. A manual method using a loop to sum the diagonal elements

- Added time measurement to compare the execution times of these three methods.
  This provides insight into the performance differences between the methods.

- Created a test suite using Python's `unittest` framework to validate the correctness of the trace computations.
  - Tests ensure that all methods return the correct trace for a sample matrix.
  - Added detailed comments explaining the purpose and expected output of each test.

- Improved code readability by adding comments to explain each step, including matrix generation, timing logic, and how the trace is computed.

- This commit enhances both functionality and clarity, making the code easier to understand and verify through unit tests.
Added documentation for Trace of an Array using Einstein notation. Updated TraceOfArray.md with detailed explanation, performance considerations, milestones, and references. Converted LaTeX equations to plain text for GitHub compatibility.
Attempting to do notation properly, will finish at a later date
…ime difference becomes more noticeable or less significant in Trace of Array
@dnxjay dnxjay added python python related codespace any issue pertaining to the use of codespaces labels Oct 7, 2024
@dnxjay dnxjay added this to the Trace of an array milestone Oct 7, 2024
@dnxjay
Copy link
Contributor Author

dnxjay commented Oct 7, 2024

additional case added in test_case_1.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codespace any issue pertaining to the use of codespaces python python related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant