munotes®

Uddiṣṭa: From a Pattern to Its Row Number

Get access to whole semester resourcesSemester Pass

Chapter Twenty-Two

Syllabus topic Module 1, "Naṣṭa and Uddiṣṭa (index retrieval mechanisms)"

Pages 70 to 72 of 378

In one line

Uddiṣṭa takes a pattern somebody points at and tells you which row of the table it is, without looking at the table.

In the wording you can write in an examination: uddiṣṭa is the pratyaya that computes the serial number of a given metrical pattern within the prastāra. Piṅgala's rule processes the syllables from the last to the first, beginning with one, doubling at each syllable and subtracting one wherever the syllable is a guru; the result is the row number of the pattern, counted from one.

The problem

Somebody writes down L G L G G G and asks: which row of the six-syllable table is that? You could generate the table and search it, which is up to 64 rows of work for the gāyatrī and 4096 for the jagatī. Piṅgala does it in six steps, one per syllable.

The provisions

8.26, pratilomaguṇaṃ dvirlādyam. Reverse-order multiplication, doubling, beginning from the la. Halāyudha's gloss: of whichever pattern one wishes to know the number, taking it from the end, going in reverse order, double repeatedly; and since a starting value of nothing cannot be doubled, the number one is obtained to begin with.

8.27, tato'pyekaṃ jahyāt. From that also subtract one. His gloss is exact about when: in performing the aforesaid operation, if that number falls on the place of a ga, then having doubled it, drop one from the aggregate.

Both numbers agree across this book's witnesses.

The rule as steps

  1. Start with the number one.
  2. Take the syllables of the pattern from the LAST one to the first.
  3. At each syllable, double the number you have.
  4. If that syllable is a guru, subtract one from the result of the doubling.
  5. When the syllables run out, the number you have is the row.

Step three and step four are one operation in the text and it is easier to remember that way: double, and take one off at a heavy syllable.

Worked by hand: L G L G G G

The pattern is six syllables. Taking them from the last to the first, they are G, G, G, L, G, L.

Syllable takenDoubleGuru, so subtract oneRunning number
start1
6th, G2yes1
5th, G2yes1
4th, G2yes1
3rd, L2no2
2nd, G4yes3
1st, L6no6

Row six, which is the row Halāyudha uses as his own example in the naṣṭa rule.

Notice what the long run of gurus at the end does: it holds the number at one. That is correct, because trailing heavy syllables contribute nothing to the row number, which in the binary reading is the same as leading zeros contributing nothing to a number's value.

munotes.in70

Uddiṣṭa: From a Pattern to Its Row Number

Worked by hand: G G G L G L

Syllable takenDoubleGuru, so subtract oneRunning number
start1
6th, L2no2
5th, G4yes3
4th, L6no6
3rd, G12yes11
2nd, G22yes21
1st, G42yes41

Row forty-one, which is the row [Binary Number Systems, and Exactly Where Piṅgala's Order Agrees] reached by arithmetic. The two methods agree.

Why the rule is right

Write the row number, counted from one, as one plus the pattern's binary value with laghu as 1 and the leftmost syllable in the units place. Then the rule is Horner's method for evaluating that expression from the high-order end, which for this direction of writing means from the right.

Let y stand for the running number after some syllables have been taken. The step "double, and subtract one at a guru" is the same as "double, and add one at a laghu, then subtract one". Which is to say: it evaluates twice the previous value, plus the current bit, minus one. Unrolled from a start of one, that is exactly one plus the binary value.

The short version, which is the one to write in an examination: the rule is Horner's evaluation of the pattern as a binary number, shifted by one because rows are counted from one and numbers from zero.

The rule, run

def uddista(pattern):
    """8.26 pratilomagunam dvirladyam, with 8.27 tato'pyekam jahyat.

    Take the syllables from the LAST to the first. Start at one. At each
    syllable double; and if that syllable is a guru, subtract one.
    """
    y = 1
    for ch in reversed(pattern):
        y *= 2
        if ch == "G":
            y -= 1
    return y

for p in ("GGGGGG", "LGLGGG", "GGGLGL", "LLLLLL", "GGG", "LLL"):
    print("%-8s row %d" % (p, uddista(p)))
GGGGGG   row 1
LGLGGG   row 6
GGGLGL   row 41
LLLLLL   row 64
GGG      row 1
LLL      row 8

Four lines of code for a rule stated in two sūtras. The whole content is y = 2*y with a conditional y -= 1.

The cost

One pass over the pattern, one doubling and at most one subtraction per syllable. So the work is proportional to n, the number of syllables, and does not depend on how large the row number is.

Compare the alternative: generating the table and searching it costs n times 2 to the power n. For the jagatī that is 49,152 symbol operations against 12. This is the same improvement in kind that an index gives over a scan, and it is worth saying in exactly those words, because that is what MU's phrase "index retrieval mechanisms" is pointing at.

munotes.in71

Uddiṣṭa: From a Pattern to Its Row Number

What it does NOT mean

It does not mean the pattern is validated. Give the rule a pattern of the wrong length and it will cheerfully return a number. Nothing in the text checks the input, and a program should.

It does not mean rows are counted from zero. They are counted from one throughout the tradition, which is why the rule starts at one rather than at zero. Mixing the conventions is the commonest arithmetic mistake in this topic.

It does not work for another order. Later prosodists use the reverse order, and uddiṣṭa for that order is a different rule. Applying this one to a table built the other way gives a wrong answer silently.

Quick revision

  • Uddiṣṭa: from a pattern to its row number.
  • 8.26 pratilomaguṇaṃ dvirlādyam, reverse order, doubling; 8.27 tato'pyekaṃ jahyāt, and subtract one, which Halāyudha applies at a guru.
  • The rule: start at one, take syllables from last to first, double each time, subtract one at a heavy syllable.
  • Worked: L G L G G G is row 6; G G G L G L is row 41.
  • It is Horner's evaluation of the pattern as a binary number, offset by one because rows count from one.
  • Cost proportional to n, against n times 2 to the power n for generate and search.

Test yourself

1. Find the row number of G L L G by the rule, showing the running value.

Syllables from the last: G, L, L, G. Start 1. G: double to 2, subtract one, 1. L: double to 2. L: double to 4. G: double to 8, subtract one, 7. Row seven.

2. Why do trailing heavy syllables leave the running number unchanged?

Because doubling one and subtracting one gives one again. In the binary reading they are leading zeros, which contribute nothing to a number's value.

3. State the modern description of the rule in one sentence.

It is Horner's method for evaluating the pattern as a binary number with laghu as one and the leftmost syllable in the units place, offset by one because rows are counted from one.

4. Give the cost of uddiṣṭa and of the obvious alternative, for a twelve-syllable metre.

Uddiṣṭa is twelve doublings, one per syllable. Generating the table and searching it is 4096 rows of twelve symbols, about 49,000 symbol operations.

munotes.in72

The rest of this subject

These notes are cut from the University's printed syllabus. Open the syllabus itself for the same subject.

Issue
Done!