Skip to content

Precommit: Format source_hsolver (Part I) - #8199

Open
Growl1234 wants to merge 1 commit into
deepmodeling:developfrom
Growl1234:precommit-3
Open

Growl1234 wants to merge 1 commit into
deepmodeling:developfrom
Growl1234:precommit-3

Conversation

@Growl1234

Copy link
Copy Markdown
Collaborator

Reminder

  • I have read AGENTS.md and docs/developers_guide/agent_governance.md.
  • I have linked an issue or explained why this PR does not need one.
  • I have added adequate unit tests and/or case tests, or explained why not.
  • I have listed the exact verification commands run and their results.
  • I have described user-visible behavior changes, including INPUT parameter changes.
  • I have explained core-module impact for ESolver, HSolver, ElecState, Hamilt, Operator, Psi, or other source/ changes.
  • I have requested any needed governance exception below.

Linked Issue

Fix #

Unit Tests and/or Case Tests for my changes

  • Commands run:
  • Result summary:
  • Checks not run, with reason:

What's changed?

  • Example: brief summary of the user-visible or developer-facing change.

Governance Notes

  • INPUT/docs changes:
  • Core module impact:
  • Exceptions requested:

@Growl1234 Growl1234 added Refactor Refactor ABACUS codes The Absolute Zero Reduce the "entropy" of the code to 0 labels Oct 22, 2026
@Growl1234 Growl1234 changed the title Precommit: Prettify source_hsolver (Part I) Precommit: Format source_hsolver (Part I) Oct 22, 2026
// calculate the sizes needed for pre-allocated buffer.
CHECK_CUSOLVER(cusolverDnDsygvd_bufferSize(cusolver_H, CUSOLVER_EIG_TYPE_1, CUSOLVER_EIG_MODE_VECTOR, uplo, n,
A, lda, B, ldb, W, &lwork));
CHECK_CUSOLVER(cusolverDnDsygvd_bufferSize(cusolver_H,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many lines?

const int j = band * ld + i;
out[j] = direction ? x[j] + a[band] * (out[j] - b[band] * y[j]) : (out[j] + a[band] * x[j]) + b[band] * y[j];
out[j]
= direction ? x[j] + a[band] * (out[j] - b[band] * y[j]) : (out[j] + a[band] * x[j]) + b[band] * y[j];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can I say?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I don't like this either, but clang-format choose what it thinks proper :(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to

BreakBeforeBinaryOperators: All

psi_iter + (nbase + m) * dim,
psi_m_norm);
if (psi_norm) {
ModuleBase::vector_div_constant_op<T, base_device::DEVICE_CPU>()(dim,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not pretty enough...

return std::make_pair(info, std::vector<int>{});
} else if (info < 0) {
}
else if (info < 0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many lines.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing style to LLVM will avoid such addition, but that was not accepted and then dropped in my first precommit PR.

else
{
work_.dot_pair(ld_, dim_, active_, residual, residual, work_.data(shadow_slot), residual, norm_.data(), rho_.data());
work_.dot_pair(ld_,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many lines.

const Wide one(1);
const Wide zero(0);
ModuleBase::gemm_op<Wide, base_device::DEVICE_CPU>()('N', 'N', n, n, n, &one, a.data(), n, b.data(), n, &zero, result->data(), n);
ModuleBase::gemm_op<Wide, base_device::DEVICE_CPU>()('N',

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What can I say?

@ZhouXY-PKU ZhouXY-PKU removed the The Absolute Zero Reduce the "entropy" of the code to 0 label Oct 22, 2026

@ABACUS-PR-BOT ABACUS-PR-BOT left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: Please replace the template placeholders with a brief formatting/include-order summary and the exact verification commands and results. If builds or runtime tests were not run, state that and why, and note why INPUT documentation is unchanged. This reformat does not by itself require new functional tests.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants