# length(Module) -- Computes the length of a module

## Synopsis

• Function: length
• Usage:
l = length M
• Inputs:
• M, ,
• Outputs:
• Consequences:
• In the local case, the length of the module is stored in M.cache.length.

## Description

If M is a graded module over a singly graded polynomal ring or a quotient of a polynomial ring over a field k then length is the same as the degree.

If M is over a local ring then length is computed by summing the output of the Hilbert-Samuel function until it vanishes. Note that in this case the LocalRings package must be loaded first.

## Caveat

In the local case, the input is assumed to have finite length.