-
Notifications
You must be signed in to change notification settings - Fork 3
simplified and documented the lambda_lanczos_util.hpp file (again) #8
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
Conversation
…ream (mrcdr's) Makefile. Hopefully after this commit, the only differences will be in the "lambda_lanczos_util.hpp" file.
….hpp* file and corrected 2 mistakes. The code now compiles and runs successfully again.
Unfortunately, I noticed that this version failed your automatic tests. (But it did not fail my tests. We have different tests.) I noticed there are some additional differences between the "lambda_lanczos_util.hpp" file: I deleted these lines from my version:
I deleted these lines from my version, but they are in your version. For reason's I don't understand, my version compiles and runs with my test program. Again, feel free to ignore these suggestions. I am not sure they are helpful. Cheers! |
Thank you for your suggestion. About compile errorMy test output implies that the When I wrote the lines (which are with an anonymous namespace) I thought they can prevent using-declaration leaking outside of the header file. (When Template specializationI defined the template specialization for ConjugateProductThroughout my header files, class (structure) definitions and their implementation are separately written regardless of static or not. Strictly according to this rule, the implementation shouldn't be moved to inside class definition. However, it might be more readable that |
Yes. I am using the old version of "lambda_lanczos_test.cpp" (in the old "src/lambda_lanczos_test" subdirectory). The beginning of that file contains
In the LAMMPS version of LambdaLanczos, that is what I did.
I was confused by the current code. But now I understand why you used an anonymous namespace. Why not replace:
... with this?:
..or this?:
It is your choice. I chose the shortest method. However I think both methods are equally clear as long as there is a good comment to explain what you mean by real_t<T>. (I think real_t<T> is quite clever, by the way.)
That's fine. Be consistent. No reason to change this. Cheers and thanks for your feedback. Andrew |
The use of using in a header file affects every cpp files which include the header file implicitly. The problem is that the user who includes the header file can't know the "using" is declared so some unexpected names could be introduced into the scope (some arguments are available on this). It seems that the using is very controversial in C++. Google Style Guide says the using-directive ( |
I also prefer to avoid using.
I think this is what I will do. Andrew |
Thank you. Yes, I think so too. I'll rewrite the source code to use the P.S. |
Forgive me for sending you my previous pull request.
(It was not yet tested. When I tried to use it, it did not compile.)
Here is the newest version of the lambda_lanczos_util.hpp file which I plan to include with LAMMPS. (This time I have tested it.)
Changes:
I was able to simplify the code for real_t and ConjugateProduct.
Feel free to ignore this pull request. I do not know if this is helpful. I worry I am creating too much work for you.