Skip to content

Conversation

jewettaij
Copy link
Contributor

@jewettaij jewettaij commented Feb 15, 2020

I was able to simplify the code for real_t.

(I also made the code for ConjugateProduct shorter.)

This is not an important pull request. I will not be offended if you reject it.

Why?

Most LAMMPS programmers are not familiar with C++11. When I add your code to LAMMPS, I need to make your code short and easy to understand. I am sending you the version of lambda_lanczos_util.hpp that I am using in LAMMPS. I don't know if it is helpful to you.
But understanding your code has taught me new C++ features!

Cheers
Andrew

…ream (mrcdr's) Makefile. Hopefully after this commit, the only differences will be in the "lambda_lanczos_util.hpp" file.
@jewettaij
Copy link
Contributor Author

jewettaij commented Feb 15, 2020

Here is one more way to simplify this file:

  1. You can remove lines 68-69:
template <typename T>
double norm(const vector<double>&);

PLEASE IGNORE EVERYTHING BELOW THIS LINE (doesn't work)

2) Perhaps we can get simplify ConjugateProduct.

Perhaps instead we can replace ConjugateProduct::prod() with something simpler:

template

T ConjugateProd(T a, T b) { return std::conj(a)*b; }

I think this is possible because std::conj() is defined for all ordinary numeric types (float, double, long double), as well as complex types. So I think it is probably safe to use ConjugateProd(a,b) on ordinary numbers as well as complex types. (I have not tested simplification #2 yet.)

I did not include either of these two changes in my pull request.
Cheers

Andrew

@jewettaij
Copy link
Contributor Author

Sorry.

Nevermind.

I just realized that this file contains a mistake.

I'll close this pull request and send another pull request (with some of the same changes).

@jewettaij jewettaij closed this Feb 16, 2020
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.

1 participant