You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@neeleshb this is both a design question and a correctness question, so I would love your help and support on the correctness here.
Design
One of the biggest speed-ups in vidyut-prakriya has been from caching and reusing partial results. For example, if we are deriving the thousands of forms that come from बोभूय, we do not need to re-derive बोभूय for each one of them. Instead, we can derive बोभूय once then reuse that derivation for each form.
In addition to maintaining a dhatu cache, we also maintain a krdanta cache. But unlike the dhatu cache, the krdanta cache does not store very much work. For example, if we are deriving बभूवान्, the cache will store भू + वस्, so for each subanta, we must repeat the work of converting भू + वस् to बभूवस्. This is wasted work.
One reason for this wasted work is that all of the rules in the अङ्गस्य and त्रिपादी sections are part of a big function called run_main_rules that is a pain to refactor. So, our caching strategy is simply "save as much work as can be done before run_main_rules, then apply run_main_rules just once." This is why our current setup creates both the krdanta and the subanta simultaneously (भू + वस् + सुँ → बभूवान्) rather than creating them in separate stages (भू + वस् → बभूवस् + सुँ → बभूवान्).
If we can refactor the code to do this work in stages, we can cache the more interesting result बभूवस्, which means that generating each subanta from बभूवस् woudl be both cheaper and faster.
Correctness
What I'm unsure about is the correctness of doing this from a traditional point of view, which is where I need your help @neeleshb. All of the examples I've seen first derive the krdanta and then create the subanta, and this feels like a natural way to go about things. But I would like confirmation that this is indeed the case and that this is what a user would expect and like to see.
If so, I think I can make the code both cleaner and about 2x faster.
The text was updated successfully, but these errors were encountered:
While भू + वस् + सुँ --> बभूवान् is technically how the prakriya happens as per grammar, creating बभूवस् first and then reusing its prakriya is not a bad idea and would only add minor complexities, which may be worth it, given the 2X performance improvements.
The complexity I am referring here is about undoing or skipping some tasks that you would otherwise do in a standalone kridanta prakriya. Here are two examples.
while creating स्था + क्वसुँ --> तस्थिवस्, you will need to do an इडागम in the kridanta prakriya. However, while doing तस्थिवस् + शस्, when the वकार of वस् undergoes सम्प्रसारण (giving तस्थिउस) it would also cause the इडागम to be "undone", finally giving तस्थुषः ।
While creating विश् + सन् + क्विप् --> विविक्ष्, you will reach a state of विविश् + स् where you will need to apply a bunch of tripadi sutras, namely व्रश्चभ्रस्ज् (8.2.36), षढोः क सि (8.2.41) and आदेशप्रत्यययोः (8.3.59) to get विविक्ष् । However, in विविक्ष् + भ्याम्, these tripadi sutras are either completely skipped or deferred, because they are असिद्ध for संयोगान्तस्य लोपः 8.2.23 which is also applicable. Therefore, the subanta prakriya would start with विविश् + स् + भ्याम्. See if you can support this by storing an "intermediate form" which would act as a starting point for the subanta-prakriya, rather than using the "final kridanta" as a starting point.
I believe such cases are limited. Nevertheless, enumerating these exhaustively would infact be an interesting research paper.
@neeleshb this is both a design question and a correctness question, so I would love your help and support on the correctness here.
Design
One of the biggest speed-ups in vidyut-prakriya has been from caching and reusing partial results. For example, if we are deriving the thousands of forms that come from बोभूय, we do not need to re-derive बोभूय for each one of them. Instead, we can derive बोभूय once then reuse that derivation for each form.
In addition to maintaining a dhatu cache, we also maintain a krdanta cache. But unlike the dhatu cache, the krdanta cache does not store very much work. For example, if we are deriving बभूवान्, the cache will store भू + वस्, so for each subanta, we must repeat the work of converting भू + वस् to बभूवस्. This is wasted work.
One reason for this wasted work is that all of the rules in the अङ्गस्य and त्रिपादी sections are part of a big function called
run_main_rules
that is a pain to refactor. So, our caching strategy is simply "save as much work as can be done beforerun_main_rules
, then applyrun_main_rules
just once." This is why our current setup creates both the krdanta and the subanta simultaneously (भू + वस् + सुँ → बभूवान्) rather than creating them in separate stages (भू + वस् → बभूवस् + सुँ → बभूवान्).If we can refactor the code to do this work in stages, we can cache the more interesting result बभूवस्, which means that generating each subanta from बभूवस् woudl be both cheaper and faster.
Correctness
What I'm unsure about is the correctness of doing this from a traditional point of view, which is where I need your help @neeleshb. All of the examples I've seen first derive the krdanta and then create the subanta, and this feels like a natural way to go about things. But I would like confirmation that this is indeed the case and that this is what a user would expect and like to see.
If so, I think I can make the code both cleaner and about 2x faster.
The text was updated successfully, but these errors were encountered: