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

[feature] Support complex matrix #71

Conversation

soumyasen1809
Copy link
Contributor

Related to issue #35

  • Added initial support for Complex Matrix

Axect and others added 17 commits July 31, 2024 07:57
Update `lambert_w` crate to version 0.4.0
- Added R-like, Python-like and Matlab-like
complex matrix constructors
- Initial tests added
- Initial impl for complex matrix
- Adding docs alongside
- fn kronecker should return Self
- Added further impl for Complex Matrix
- Added common properties and math traits
for the same
- For now, added seperate trait
for functional programming
for ComplexMatrix
- ToDo: Merge both FPMatrix traits
- Added FPComplexMatrix
- For complex matrix added
backend utils and Linear Algebra traits
- Needed for zgemm
- Added GEMM for matrixmultiply
for complex matrix
- Added spread fn to help format matrix
- Added mutable trait for complex matrix
src/traits/fp.rs Outdated Show resolved Hide resolved
src/traits/mutable.rs Outdated Show resolved Hide resolved
@soumyasen1809 soumyasen1809 mentioned this pull request Sep 25, 2024
7 tasks
src/complex/matrix.rs Show resolved Hide resolved
src/complex/matrix.rs Show resolved Hide resolved
src/complex/matrix.rs Show resolved Hide resolved
src/traits/fp.rs Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
@Axect
Copy link
Owner

Axect commented Sep 27, 2024

Hello, @soumyasen1809

Thank you for your incredible work. I'm genuinely impressed by how comprehensively you've implemented almost everything needed for ComplexMatrix. It must have been an exhausting task, and I truly appreciate your effort.

I've reviewed the changes and left a few comments requesting some modifications. Please take a look at them when you have a chance. We can discuss any points further in the replies or you can proceed with the suggested changes as you see fit.

I noticed you've been working on the dev branch, which is great. However, I've created a new branch specifically for the Complex feature: 35-support-complex-number. It would be ideal if we could move this work to that branch to keep our feature development organized.

Once again, thank you for your hard work on this. Let's refine it together and get this fantastic addition to Peroxide across the finish line.

- Fixed result showing f64 instead of Complex<f64>
- Removed commented blocks in LinAlg trait with to-do comment
- Removed FPComplexMatrix added temporarily and used generics
to in FPMatrix to accomodate ComplexMatrix too
- Same as above for MutableMatrix
- Removed cgemm as dependency in matrixmultiply
in Cargo.toml
@soumyasen1809 soumyasen1809 changed the base branch from dev to 35-support-complex-number September 27, 2024 10:34
@soumyasen1809
Copy link
Contributor Author

soumyasen1809 commented Sep 27, 2024

Hi @Axect thank you for your kind words :)

I've reviewed the changes and left a few comments requesting some modifications. Please take a look at them when you have a chance. We can discuss any points further in the replies or you can proceed with the suggested changes as you see fit.

Please find the requested changes in my next PR: f277895
I have left 2 comments back to your comments (regarding C64 use and using unimplemented!).

I noticed you've been working on the dev branch, which is great. However, I've created a new branch specifically for the Complex feature: 35-support-complex-number. It would be ideal if we could move this work to that branch to keep our feature development organized.

Also, I have changed the branch from dev to 35-support-complex. In my opinion, this PR can be merged if you are okay with it. Other changes like using C64 etc. can be done on top of it later.

@soumyasen1809 soumyasen1809 requested a review from Axect September 27, 2024 10:45
@soumyasen1809
Copy link
Contributor Author

Hi @Axect
Once you have some time, please do review this PR. Once merged, I can rebase and add my next PRs.

@Axect
Copy link
Owner

Axect commented Sep 30, 2024

Hello @soumyasen1809

I apologize for the delay in reviewing your PR. I had gone through most of your code changes last week but held off on finalizing the review as I hadn't had the chance to test it locally.

After reviewing it today, I found that most of the changes look good. However, I noticed an error occurring in tests/complex_matrix.rs. Specifically, when running cargo test --features complex, it throws an error because ComplexMatrix and Complex64 are being used without being declared.

To resolve this, we need to add the following import statements within the test_seq function:

use peroxide::complex::matrix::ComplexMatrix;
use num_complex::Complex64;

In the future, we might want to create a fuga for complex numbers to handle this more elegantly, but for now, if you could make these modifications, I'll be able to merge the PR right away.

Also, if you don't mind, it would be helpful to run both cargo test and cargo test --features complex before submitting PRs in the future. This can help catch potential errors early and ensure smoother integration.

Once you've made these changes, please let me know, and I'll proceed with the merge. After that, you can go ahead and rebase for your next PRs.

Thank you for your patience and contribution!

- Added missing imports in test_seq
@soumyasen1809
Copy link
Contributor Author

Hi @Axect I have fixed the issue in the next PR

After reviewing it today, I found that most of the changes look good. However, I noticed an error occurring in tests/complex_matrix.rs. Specifically, when running cargo test --features complex, it throws an error because ComplexMatrix and Complex64 are being used without being declared.

To resolve this, we need to add the following import statements within the test_seq function:

use peroxide::complex::matrix::ComplexMatrix;
use num_complex::Complex64;

Thanks for pointing that out.

Also, if you don't mind, it would be helpful to run both cargo test and cargo test --features complex before submitting PRs in the future. This can help catch potential errors early and ensure smoother integration.

I forgot to run cargo test --features complex. My apologies for that. Extremely sorry!

@Axect Axect merged commit dc6d325 into Axect:35-support-complex-number Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants