什么时候普及高中义务教育| 秦皇岛有什么特色美食| 崇洋媚外是什么意思| 马是什么车| 医生助理是做什么的| 肚子咕咕叫放屁多是什么原因| 翌字五行属什么| 苏州有什么特产可以带回家| nit是什么意思| 梦见自己怀孕是什么意思| 脖子痛挂什么科| 不安分是什么意思| 什么芒果好吃| 早上手肿胀是什么原因| 早上11点是什么时辰| sc1是什么意思| 苦丁茶有什么功效| 猥琐男是什么意思| tomboy什么意思| 结核病是什么| 得艾滋病有什么症状| 拔完智齿吃什么食物好| 血糖高能吃什么肉| 11月1号是什么星座| 公鸡的尾巴像什么| 什么肉是发物| 什么叫家| 苏轼号什么| 预拌粉是什么东西| 米乳是什么| 胆固醇偏高是什么意思| 探索是什么意思| 慢性阑尾炎吃什么药好| 曲奇饼干为什么不成形| 三点水一个条读什么| eeg是什么意思| 什么人不宜吃石斛| 处暑的含义是什么意思| 糖尿病早餐吃什么好| 方得始终什么意思| 芙蓉粉是什么颜色| 巨蟹和什么星座最配| 维生素c的作用是什么| 朵的第二笔是什么| 剑玉是什么| 营养不良会导致身体出现什么症状| 胰岛a细胞分泌什么激素| 血糖高能吃什么食物| 白细胞低吃什么好| b族维生素什么人不能吃| 夫人是什么生肖| 男人皮肤黑穿什么颜色的衣服好看| 国树是什么树| 食是代表什么生肖| 眼屎多吃什么药| 启蒙是什么意思| 前列腺素是什么| 分母是什么意思| 农历五月属什么生肖| 晚饭吃什么减肥| 牙龈肿痛挂什么科| 脚真菌感染用什么药| 甲状腺彩超挂什么科| 怀孕初期需要注意些什么| 寒气和湿气有什么区别| 什么病治不好| 纨绔子弟是什么意思| 玉米笋是什么| 同样的药为什么价格相差很多| 不自爱是什么意思| 34是什么意思| 心率高是什么原因| naprogesic是什么药| 生育登记服务单是什么| 黑眼圈是什么原因造成的| 女命带驿马是什么意思| 张信哲为什么不结婚| 绝世是什么意思| 紫色心情是什么意思| 青光眼是什么意思| 苹果的英文是什么| 冲锋陷阵是什么生肖| 政客是什么意思| psa是什么| 腱鞘囊肿看什么科| gucci是什么意思| 转氨酶偏高是什么原因| 留个念想是什么意思| 职业年金什么时候领取| 乳腺钙化是什么意思| 脾肾阳虚吃什么药最好| 为什么小脑会萎缩| 先天愚型是什么病| 西米是什么做成的| 嘴唇为什么会干| 相依相偎是什么意思| 狮子吃什么| 甲木命是什么意思| 口腔义齿是什么| 恩裳是什么档次的衣服| 啤酒有什么牌子| 1月5号什么星座| 血脂高吃什么水果最好| 什么是水肿| 低烧是什么原因引起的| 足字旁的字跟什么有关| 考药师证需要什么条件| 烤油边是什么| 公主是什么意思| 鬼一般找什么人压床| 右耳朵疼是什么原因| 孕期什么时候补钙| 林子大了什么鸟都有| 风风火火是什么生肖| 慢阻肺是什么意思| 猫驱虫药什么牌子好| 跑龙套是什么意思| 什么冠禽兽| 内在美是什么意思| 艾滋病初期有什么症状| 上升星座什么意思| 兔跟什么生肖配对最好| 片的第二笔是什么| 猫什么时候传入中国| 什么是七情六欲| 战略纵深是什么意思| 晚上梦到蛇是什么意思| 男士内裤什么材质的好| 人流后什么时候来月经| 什么人容易得阿尔兹海默症| 巨蟹和什么星座最配对| 熟褐色是什么颜色| 6月23日是什么日子| 巴旦木和杏仁有什么区别| 吃完杏不能吃什么| 玉戴久了会有什么变化| 做胃镜之前需要做什么准备| 张牙舞爪的张是什么意思| 隔离霜是干什么用的| 泡饭为什么对胃不好| 青黄不接是什么意思| 看肛门挂什么科| 心烦焦虑吃什么药| 肚脐周围痛挂什么科| pending是什么意思啊| 扪是什么意思| 梦见大房子是什么预兆| 吃什么能增加免疫力| 隔夜茶为什么不能喝| 仔仔是什么意思| 八字加一笔是什么字| HlV是什么| cr是什么意思| 胸外科主要看什么病| 甘油三酯高用什么药好| 大姨妈来了喝红糖水有什么功效| 古代新疆叫什么| 脂肪瘤吃什么药可以消除| 第二性征是什么意思| 玩手机头疼是什么原因| 什么是黄油| 什么虫子咬了会起水泡| 曲苑杂坛为什么停播| 风起云涌是什么意思| 姜汁可乐有什么功效与作用| 是谁送你来到我身边是什么歌| 白敬亭原名叫什么| 牙根发炎吃什么药| 嘴唇上火起泡是什么原因| mm是什么意思单位| 腿脚浮肿是什么原因引起的| 貌不惊人是什么意思| 放屁太臭是什么原因| 干什么呢| 弈五行属什么| 水滴鱼长什么样子| 为什么会长结石| 霸是什么生肖| 1992属什么生肖| 甲状腺功能减退是什么原因引起的| 降压药什么时间吃最好| 布偶猫长什么样| 为什么会有乳腺结节| 摸摸唱是什么| 放浪形骸是什么意思| 凌霄花什么时候开花| 戒指带中指什么意思| 86年属虎是什么命| 因加一笔是什么字| 什么的雾| 挖坑是什么意思| 丁丁历险记的狗是什么品种| 南瓜子吃多了有什么副作用| 吃什么东西化痰| 2006年出生的是什么命| 化干戈为玉帛是什么意思| 下巴脱臼挂什么科| 怀孕初期有什么表现| 血小板少是什么病| 原研药是什么意思| 筋膜炎吃什么药好得快| 什么人心什么| 公主和郡主有什么区别| 然五行属性是什么| 颜字五行属什么| 阳五行属什么| 手脱皮用什么药好得快| 95年属什么多大| 得不偿失是什么意思| 食品科学与工程学什么| 女人大腿内侧黑是什么原因引起的| 脾是起什么作用的| 88什么意思| ms是什么单位| 紫米是什么米| 眉目传情什么意思| 洋葱生吃有什么好处| 螳螂捕蝉黄雀在后是什么意思| 混动是什么意思| 乳头瘙痒是什么原因| 为什么脸上总是出油| 卵巢囊肿术后吃什么食物好| 世界上最深的湖是什么| 肚子发胀是什么原因| 小媳妇是什么意思| 舌苔厚腻是什么原因| 2000年属什么| 什么的什么是什么的伞| 读警校需要什么条件| 载波是什么意思| 喝老陈醋有什么好处| 春风得意是什么生肖| 梦见女人是什么意思| 白牌黑字是什么车牌| 双手脱皮是什么原因引起的| 古代上元节是什么节日| 双子座是什么象| 心脏有个小洞叫什么病| 厚黑学是什么意思| 什么是阴蒂| 血常规检查能查出什么| 晨尿有泡沫是什么原因| 争奇斗艳是什么意思| 肚子疼什么原因| 伤口愈合为什么会痒| 阿尔山在内蒙古什么地方| 起水痘不能吃什么食物| 霉菌性阴道炎是什么症状| 口契是什么字| 痔瘘和痔疮有什么区别| 肌电图主要检查什么病| 朱红色是什么颜色| 加百列是什么天使| 梦到老公被蛇咬是什么意思| 白细胞高说明什么问题| 晚上七点是什么时辰| 74年大溪水命缺什么| 三高挂号挂什么科| 什么是梦魇| 猫有什么特点| 泪目是什么意思| 绦是什么意思| 验大便能查出什么| 腹泻可以吃什么| 百度Jump to content

麦粒肿是什么原因引起的

From Wikipedia, the free encyclopedia
百度 成都住房租赁服务大厅承担着成都住房租赁交易服务平台功能向线下延伸的作用,同时也提供公共租赁住房的相关咨询和服务,并接受相关投诉受理。

The move-to-front (MTF) transform is an encoding of data (typically a stream of bytes) designed to improve the performance of entropy encoding techniques of compression. When efficiently implemented, it is fast enough that its benefits usually justify including it as an extra step in data compression algorithm.

This algorithm was first published by Boris Ryabko under the name of "book stack" in 1980.[1] Subsequently, it was rediscovered by J.K. Bentley et al. in 1986,[2] as attested in the explanatory note.[3]

The transform

[edit]

The main idea is that each symbol in the data is replaced by its index in the stack of “recently used symbols”. For example, long sequences of identical symbols are replaced by as many zeroes, whereas when a symbol that has not been used in a long time appears, it is replaced with a large number. Thus at the end the data is transformed into a sequence of integers; if the data exhibits a lot of local correlations, then these integers tend to be small.

Let us give a precise description. Assume for simplicity that the symbols in the data are bytes. Each byte value is encoded by its index in a list of bytes, which changes over the course of the algorithm. The list is initially in order by byte value (0, 1, 2, 3, ..., 255). Therefore, the first byte is always encoded by its own value. However, after encoding a byte, that value is moved to the front of the list before continuing to the next byte.

An example will shed some light on how the transform works. Imagine instead of bytes, we are encoding values in a–z. We wish to transform the following sequence:

bananaaa

By convention, the list is initially (abcdefghijklmnopqrstuvwxyz). The first letter in the sequence is b, which appears at index 1 (the list is indexed from 0 to 25). We put a 1 to the output stream:

1

The b moves to the front of the list, producing (bacdefghijklmnopqrstuvwxyz). The next letter is a, which now appears at index 1. So we add a 1 to the output stream. We have:

1,1

and we move the letter a back to the top of the list. Continuing this way, we find that the sequence is encoded by:

1,1,13,1,1,1,0,0
Iteration Sequence List
bananaaa 1 (abcdefghijklmnopqrstuvwxyz)
bananaaa 1,1 (bacdefghijklmnopqrstuvwxyz)
bananaaa 1,1,13 (abcdefghijklmnopqrstuvwxyz)
bananaaa 1,1,13,1 (nabcdefghijklmopqrstuvwxyz)
bananaaa 1,1,13,1,1 (anbcdefghijklmopqrstuvwxyz)
bananaaa 1,1,13,1,1,1 (nabcdefghijklmopqrstuvwxyz)
bananaaa 1,1,13,1,1,1,0 (anbcdefghijklmopqrstuvwxyz)
bananaaa 1,1,13,1,1,1,0,0 (anbcdefghijklmopqrstuvwxyz)
Final 1,1,13,1,1,1,0,0 (anbcdefghijklmopqrstuvwxyz)

It is easy to see that the transform is reversible. Simply maintain the same list and decode by replacing each index in the encoded stream with the letter at that index in the list. Note the difference between this and the encoding method: The index in the list is used directly instead of looking up each value for its index.

i.e. you start again with (abcdefghijklmnopqrstuvwxyz). You take the "1" of the encoded block and look it up in the list, which results in "b". Then move the "b" to front which results in (bacdef...). Then take the next "1", look it up in the list, this results in "a", move the "a" to front ... etc.

Implementation

[edit]

Details of implementation are important for performance, particularly for decoding. For encoding, no clear advantage is gained by using a linked list, so using an array to store the list is acceptable, with worst-case performance O(nk), where n is the length of the data to be encoded and k is the number of values (generally a constant for a given implementation).

The typical performance is better because frequently used symbols are more likely to be at the front and will produce earlier hits. This is also the idea behind a Move-to-front self-organizing list.

However, for decoding, we can use specialized data structures to greatly improve performance.[example needed]

Python

[edit]

This is a possible implementation of the move-to-front algorithm in Python.

from collections.abc import Generator, Iterable

class MoveToFront:
    """
    >>> mtf = MoveToFront()
    >>> list(mtf.encode("Wikipedia"))
    [87, 105, 107, 1, 112, 104, 104, 3, 102]
    >>> mtf.decode([87, 105, 107, 1, 112, 104, 104, 3, 102])
    'Wikipedia'
    >>> list(mtf.encode("wikipedia"))
    [119, 106, 108, 1, 113, 105, 105, 3, 103]
    >>> mtf.decode([119, 106, 108, 1, 113, 105, 105, 3, 103])
    'wikipedia'
    """
    def __init__(self, common_dictionary: Iterable[int] = range(256)):
        """
        Instead of always transmitting an "original" dictionary,
        it is simpler to just agree on an initial set.
        Here we use the 256 possible values of a byte.
        """
        # consume the iterable so it can be used multiple times
        self.common_dictionary = list(common_dictionary)

    def encode(self, plain_text: str) -> Generator[int]:
        # Changing the common dictionary is a bad idea. Make a copy.
        dictionary = list(self.common_dictionary)

        # Read in each character
        for c in plain_text.encode("latin-1"):  # Change to bytes for 256.
            # Find the rank of the character in the dictionary [O(k)]
            rank = dictionary.index(c)  # the encoded character
            yield rank

            # Update the dictionary [Θ(k) for insert]
            dictionary.pop(rank)
            dictionary.insert(0, c)

    def decode(self, compressed_data: Iterable[int]) -> str:
        """
        Inverse function that recover the original text
        """
        dictionary = list(self.common_dictionary)
        plain_text = []

        # Read in each rank in the encoded text
        for rank in compressed_data:
            # Remove the character of that rank from the dictionary
            e = dictionary.pop(rank)
            plain_text.append(e)

            # Insert the character at the beginning of dictionary
            dictionary.insert(0, e)

        return bytes(plain_text).decode("latin-1")  # Return original string

In this example we can see the MTF code taking advantage of the three repetitive i's in the input word. The common dictionary here, however, is less than ideal since it is initialized with more commonly used ASCII printable characters put after little-used control codes, against the MTF code's design intent of keeping what's commonly used in the front. If one rotates the dictionary to put the more-used characters in earlier places, a better encoding can be obtained:

from itertools import chain

def block32(x):
    return range(x, x+32)

class MoveToFrontMoreCommon(MoveToFront):
    """
    >>> mtf = MoveToFrontMoreCommon()
    >>> list(mtf.encode("Wikipedia"))
    [55, 10, 12, 1, 17, 9, 9, 3, 7]
    """
    def __init__(self):
        super().__init__(
            chain(  # Sort the ASCII blocks:
                block32(ord("a") - 1),  # first lowercase,
                block32(ord("A") - 1),  # then uppercase,
                block32(ord("!") - 1),  # punctuation/number,
                block32(0),  # control codes,
                range(128, 256),  # and finally the non-ASCII stuff
            )
        )

if __name__ == "__main__":
    import doctest
    doctest.testmod()

Use in practical data compression algorithms

[edit]

The MTF transform takes advantage of local correlation of frequencies to reduce the entropy of a message.[clarification needed] Indeed, recently used letters stay towards the front of the list; if use of letters exhibits local correlations, this will result in a large number of small numbers such as "0"'s and "1"'s in the output.

However, not all data exhibits this type of local correlation, and for some messages, the MTF transform may actually increase the entropy.

An important use of the MTF transform is in Burrows–Wheeler transform based compression. The Burrows–Wheeler transform is very good at producing a sequence that exhibits local frequency correlation from text and certain other special classes of data. Compression benefits greatly from following up the Burrows–Wheeler transform with an MTF transform before the final entropy-encoding step.

Example

[edit]

As an example, imagine we wish to compress Hamlet's soliloquy (To be, or not to be...). We can calculate the size of this message to be 7033 bits. Naively, we might try to apply the MTF transform directly. The result is a message with 7807 bits (higher than the original). The reason is that English text does not in general exhibit a high level of local frequency correlation. However, if we first apply the Burrows–Wheeler transform, and then the MTF transform, we get a message with 6187 bits. Note that the Burrows–Wheeler transform does not decrease the entropy of the message; it only reorders the bytes in a way that makes the MTF transform more effective.

One problem with the basic MTF transform is that it makes the same changes for any character, regardless of frequency, which can result in diminished compression as characters that occur rarely may push frequent characters to higher values. Various alterations and alternatives have been developed for this reason. One common change is to make it so that characters above a certain point can only be moved to a certain threshold. Another is to make some algorithm that runs a count of each character's local frequency and uses these values to choose the characters' order at any point. Many of these transforms still reserve zero for repeat characters, since these are often the most common in data after the Burrows–Wheeler Transform.

Move-to-front linked-list

[edit]
  • The term Move To Front (MTF) is also used in a slightly different context, as a type of a dynamic linked list. In an MTF list, each element is moved to the front when it is accessed.[4] This ensures that, over time, the more frequently accessed elements are easier to access.

References

[edit]
  1. ^ Ryabko, Boris Yakovlevich [in Russian] (1980). "Data compression by means of a "book stack"" (PDF). Problems of Information Transmission. 16 (4): 265–269. Zbl 0466.94007.
  2. ^ Bentley, Jon Louis; Sleator, Daniel Dominic Kaplan; Tarjan, Robert Endre; Wei, V. K. (1986). "A Locally Adaptive Data Compression Scheme". Communications of the ACM. 29 (4): 320–330. CiteSeerX 10.1.1.69.807. doi:10.1145/5684.5688. S2CID 5854590.
  3. ^ Ryabko, Boris Yakovlevich [in Russian]; Horspool, R. Nigel; Cormack, Gordon Villy (1987). "Comments to: "A locally adaptive data compression scheme" by J. L. Bentley, D. D. Sleator, R. E. Tarjan and V. K. Wei". Comm. ACM. 30 (9): 792–794. doi:10.1145/30401.315747. S2CID 16138142.
  4. ^ Rivest, Ronald Linn (1976). "On self-organizing sequential search heuristics". Communications of the ACM. 19 (2): 63–67. doi:10.1145/359997.360000. S2CID 498886.
[edit]
来例假吃什么水果好 鸡胸肉炒什么菜好吃 政五行属什么 三点水一个兆读什么 靖五行属性是什么
液蜡是什么 鸡冠花什么时候开花 性转是什么意思 指鹿为马的反义词是什么 祸起萧墙是什么意思
夏天吃什么菜好 穿模是什么意思 什么得直什么 pcr医学上是什么意思 今天冬至吃什么
过敏是什么样子的 大于90度的角是什么角 eb病毒igg抗体阳性是什么意思 1954年出生属什么 高血脂会引起什么疾病
为什么会睡不着hcv8jop8ns2r.cn 川普是什么意思hcv8jop8ns9r.cn 什么水果对胃好hcv8jop2ns5r.cn 碱性磷酸酶偏低是什么原因hcv8jop2ns7r.cn 肺腺瘤是什么hcv7jop9ns9r.cn
张顺的绰号是什么hcv9jop0ns3r.cn 胃反流吃什么药效果好hcv9jop4ns0r.cn 甲醛闻多了有什么症状hcv8jop2ns1r.cn 什么七什么八hcv8jop5ns2r.cn 岁月的痕迹是什么意思aiwuzhiyu.com
坏垣是什么意思hcv9jop6ns8r.cn 甲状腺是什么症状hcv9jop4ns9r.cn 一什么云彩hcv8jop2ns9r.cn 代表什么意思mmeoe.com 19年属什么hcv9jop2ns0r.cn
割包为什么很多人后悔hcv7jop6ns3r.cn 电灯是什么时候发明的wmyky.com 燊是什么意思hcv7jop6ns6r.cn 包皮嵌顿是什么hcv8jop5ns4r.cn 什么是体脂率hcv7jop6ns5r.cn
百度