Skip to content

Conversation

@jmcdonough98
Copy link
Contributor

This PR adds classes which implement the vertex operators relating to the classical boson-fermion correspondence.
Part of #40241

cc: @tscrim

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

@github-actions
Copy link

github-actions bot commented Aug 5, 2025

Documentation preview for this PR (built with commit 44039aa; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@tscrim tscrim added the gsoc: 2025 Tag for GSoC2025 issues/PRs label Aug 6, 2025
@jmcdonough98 jmcdonough98 marked this pull request as ready for review August 31, 2025 16:07
Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

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

I will probably have more on my second pass, but this is coming together.


lazy_import('sage.algebras.yangian', 'Yangian')

import sage.algebras.vertex_operators_catalog as vertex_operators
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
import sage.algebras.vertex_operators_catalog as vertex_operators
lazy_import("sage.algebras", "vertex_operators_catalog", "vertex_operators")

so it is not imported at startup.

Comment on lines +4 to +10
from sage.misc.lazy_import import lazy_import

lazy_import('sage.algebras.vertex_operators', 'BosonicFockSpace')
lazy_import('sage.algebras.vertex_operators', 'CreationOperator')
lazy_import('sage.algebras.vertex_operators', 'AnnihilationOperator')

del lazy_import # We remove the object from here so it doesn't appear under tab completion
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
from sage.misc.lazy_import import lazy_import
lazy_import('sage.algebras.vertex_operators', 'BosonicFockSpace')
lazy_import('sage.algebras.vertex_operators', 'CreationOperator')
lazy_import('sage.algebras.vertex_operators', 'AnnihilationOperator')
del lazy_import # We remove the object from here so it doesn't appear under tab completion
from sage.algebras.vertex_operators import (BosonicFockSpace, CreationOperator, AnnihilationOperator)

If we lazily import the catalog, then we don't have to lazily import here.

from sage.structure.unique_representation import UniqueRepresentation


class FermionicFockSpace(CombinatorialFreeModule):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This class can be replaced by

Ind = cartesian_product((Partitions(), ZZ))
CombinatorialFreeModule(R, Ind, bracket=['|', '>'])

if isinstance(sym_basis, str):
b = getattr(Sym, sym_basis, None)
if b is None or b() not in Sym.realizations():
raise ValueError("Unknown symmetric function basis")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
raise ValueError("Unknown symmetric function basis")
raise ValueError("unknown symmetric function basis")

We follow Python's conventions.

raise ValueError("Unknown symmetric function basis")
return LaurentPolynomialRing(b(), names=(name,))
if sym_basis.base_ring() is not R:
raise ValueError("")
Copy link
Collaborator

Choose a reason for hiding this comment

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

No error message here.

Comment on lines +293 to +299
self.pos = HalfVertexOperator(pos)
self.neg = HalfVertexOperator(neg)
if fockspace is None:
fockspace = BosonicFockSpace()

self.cutoff = cutoff
self.dcharge = dcharge
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self.pos = HalfVertexOperator(pos)
self.neg = HalfVertexOperator(neg)
if fockspace is None:
fockspace = BosonicFockSpace()
self.cutoff = cutoff
self.dcharge = dcharge
self._pos = HalfVertexOperator(pos)
self._neg = HalfVertexOperator(neg)
if fockspace is None:
fockspace = BosonicFockSpace()
self._cutoff = cutoff
self._dcharge = dcharge

bra[1], self.fockspace.zero()).monomial_coefficients().get(Partition(bra[0]), self.fockspace.zero()))
return F if cutoff is None else self._approximate(F, cutoff)

def _approximate(self, family, cutoff):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should not be a method of this class but a function.


# op is a scalar
if op in R.base_ring():
return op*f
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return op*f
return op * f

PEP8

raise ValueError
for i in range(len(mon) - 1, -1, -1):
x = self.vertex_ops[i].act_on(mon[i], x)
if x == 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if x == 0:
if not x:

res[m] = c
return res

def vacuum_expectation(self, cutoff=None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good to move up to the base class.

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

Labels

gsoc: 2025 Tag for GSoC2025 issues/PRs s: needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants