Coordinates: 42.750°N 25.500°E / 42.750; 25.500
– in Europe
– in the European
Union (green) –
Legend]
One of the earliest societies in the lands of modern-day Bulgaria was the Neolithic Karanovo culture, which dates back to 6,500 BC. In the 6th to 3rd century BC the region was a battleground for Thracians, Persians, Celts and ancient Macedonians; stability came when the Roman Empire conquered the region in AD 45. The Eastern Roman, or Byzantine, Empire lost some of these territories to an invading Bulgar horde in the late 7th century. The Bulgars founded the First Bulgarian Empire in AD 681, which dominated most of the Balkans and significantly influenced Slavic cultures by developing the Cyrillic script. This state lasted until the early 11th century, when Byzantine emperor Basil II conquered and dismantled it. A successful Bulgarian revolt in 1185 established a Second Bulgarian Empire, which reached its apex under Ivan Asen II (1218–1241). After numerous exhausting wars and feudal strife, the Second Bulgarian Empire disintegrated in 1396 and its territories fell under Ottoman rule for nearly five centuries.
The Russo-Turkish War of 1877–78 resulted in the formation of the current Third Bulgarian State. Many ethnic Bulgarian populations were left outside its borders, which led to several conflicts with its neighbours and an alliance with Germany in both world wars. In 1946 Bulgaria became a one-party socialist state and part of the Soviet-led Eastern Bloc. The ruling Communist Party gave up its monopoly on power after the revolutions of 1989 and allowed multi-party elections. Bulgaria then transitioned into a democracy and a market-based economy.
Since adopting a democratic constitution in 1991, the sovereign state has been a unitary parliamentary republic with a high degree of political, administrative, and economic centralisation. The population of seven million lives mainly in Sofia and the capital cities of the 27 provinces, and the country has suffered significant demographic decline since the late 1980s.
Bulgaria is a member of the European Union, NATO, and the Council of Europe; it is a founding state of the Organization for Security and Co-operation in Europe (OSCE) and has taken a seat on the UN Security Council three times. Its market economy is part of the European Single Market and mostly relies on services, followed by industry—especially machine building and mining—and agriculture. Widespread corruption is a major socioeconomic issue.
The name Bulgaria is derived from the Bulgars, a tribe of Turkic origin that founded the country. Their name is not completely understood and difficult to trace back earlier than the 4th century AD,[7] but it is possibly derived from the Proto-Turkic word bulģha ("to mix", "shake", "stir") and its derivative bulgak ("revolt", "disorder").[8] The meaning may be further extended to "rebel", "incite" or "produce a state of disorder", i.e. the "disturbers".[9][10][11] Ethnic groups in Inner Asia with phonologically similar names were frequently described in similar terms: during the 4th century, the Buluoji, a component of the "Five Barbarian" groups in Ancient China, were portrayed as both a "mixed race" and "troublemakers".[12]
Neanderthal remains dating to around 150,000 years ago, or the Middle Paleolithic, are some of the earliest traces of human activity in the lands of modern Bulgaria.[13] The Karanovo culture arose circa 6,500 BC and was one of several Neolithic societies in the region that thrived on agriculture.[14] The Copper Age Varna culture (fifth millennium BC) is credited with inventing gold metallurgy.[15][16] The associated Varna Necropolis treasure contains the oldest golden jewellery in the world with an approximate age of over 6,000 years.[17][18] The treasure has been valuable for understanding social hierarchy and stratification in the earliest European societies.[19][20][21]
The Thracians, one of the three primary ancestral groups of modern Bulgarians, appeared on the Balkan Peninsula some time before the 12th century BC.[22][23][24] The Thracians excelled in metallurgy and gave the Greeks the Orphean and Dionysian cults, but remained tribal and stateless.[25] The Persian Achaemenid Empire conquered most of present-day Bulgaria in the 6th century BC and retained control over the region until 479 BC.[26][27] The invasion became a catalyst for Thracian unity, and the bulk of their tribes united under king Teres to form the Odrysian kingdom in the 470s BC.[25][27][28] It was weakened and vassalized by Philip II of Macedon in 341 BC,[29] attacked by Celts in the 3rd century,[30] and finally became a province of the Roman Empire in AD 45.[31]
By the end of the 1st century AD, Roman governance was established over the entire Balkan Peninsula and Christianity began spreading in the region around the 4th century.[25] The Gothic Bible—the first Germanic language book—was created by Gothic bishop Ulfilas in what is today northern Bulgaria around 381.[32] The region came under Byzantine control after the fall of Rome in 476. The Byzantines were engaged in prolonged warfare against Persia and could not defend their Balkan territories from barbarian incursions.[33] This enabled the Slavs to enter the Balkan Peninsula as marauders, primarily through an area between the Danube River and the Balkan Mountains known as Moesia.[34] Gradually, the interior of the peninsula became a country of the South Slavs, who lived under a democracy.[35][36] The Slavs assimilated the partially Hellenized, Romanized, and Gothicized Thracians in the rural areas.[37][38][39][40]
Not long after the Slavic incursion, Moesia was once again invaded, this time by the Bulgars under Khan Asparukh.[41] Their horde was a remnant of Old Great Bulgaria, an extinct tribal confederacy situated north of the Black Sea in what is now Ukraine. Asparukh attacked Byzantine territories in Moesia and conquered the Slavic tribes there in 680.[23] A peace treaty with the Byzantine Empire was signed in 681, marking the foundation of the First Bulgarian Empire. The minority Bulgars formed a close-knit ruling caste.[42]
Succeeding rulers strengthened the Bulgarian state throughout the 8th and 9th centuries. Krum introduced a written code of law[43] and checked a major Byzantine incursion at the Battle of Pliska, in which Byzantine emperor Nicephorus I was killed.[44] Boris I abolished paganism in favour of Eastern Orthodox Christianity in 864. The conversion was followed by a Byzantine recognition of the Bulgarian church[45] and the adoption of the Cyrillic alphabet, developed in the capital, Preslav.[46] The common language, religion and script strengthened central authority and gradually fused the Slavs and Bulgars into a unified people speaking a single Slavic language.[47][46] A golden age began during the 34-year rule of Simeon the Great, who oversaw the largest territorial expansion of the state.[48]
After Simeon's death, Bulgaria was weakened by wars with Magyars and Pechenegs and the spread of the Bogomil heresy.[47][49] Preslav was seized by the Byzantine army in 971 after consecutive Rus' and Byzantine invasions.[47] The empire briefly recovered from the attacks under Samuil,[50] but this ended when Byzantine emperor Basil II defeated the Bulgarian army at Klyuch in 1014. Samuil died shortly after the battle,[51] and by 1018 the Byzantines had conquered the First Bulgarian Empire.[52]
After the conquest of Bulgaria, Basil II prevented revolts by retaining the rule of local nobility and relieving their lands of the obligation to pay taxes in gold, allowing tax in kind instead.[53] The Bulgarian Patriarchate was reduced to an archbishopric, but retained its autocephalous status and its dioceses.[53][54] Byzantine domestic policies changed after Basil's death and a series of unsuccessful rebellions broke out, the largest being led by Peter Delyan. In 1185 Asen dynasty nobles Ivan Asen I and Peter IV organized a major uprising which resulted in the re-establishment of the Bulgarian state. Ivan Asen and Peter laid the foundations of the Second Bulgarian Empire with Tarnovo as the capital.[55]
Kaloyan, the third of the Asen monarchs, extended his dominion to Belgrade and Ohrid. He acknowledged the spiritual supremacy of the pope and received a royal crown from a papal legate.[56] The empire reached its zenith under Ivan Asen II (1218–1241), when its borders expanded as far as the coast of Albania, Serbia and Epirus, while commerce and culture flourished.[56][55] Ivan Asen's rule was also marked by a shift away from Rome in religious matters.[57]
The Asen dynasty became extinct in 1257. Internal conflicts and incessant Byzantine and Hungarian attacks followed, enabling the Mongols to establish suzerainty over the weakened Bulgarian state.[56][57] In 1277, swineherd Ivaylo led a great peasant revolt that chased the Mongols out of Bulgaria and briefly made him emperor.[58][55] He was overthrown in 1280 by the feudal landlords,[58] whose factional conflicts caused the Second Bulgarian Empire to disintegrate into small feudal dominions by the 14th century.[55] These fragmented rump states—two tsardoms at Vidin and Tarnovo and the Despotate of Dobrudzha—became easy prey for a new threat arriving from the Southeast: the Ottoman Turks.[56]
The Ottomans were employed as mercenaries by the Byzantines in the 1340s but later became invaders in their own right.[59] Sultan Murad I took Adrianople from the Byzantines in 1362; Sofia fell in 1382, followed by Shumen in 1388.[59] The Ottomans completed their conquest of Bulgarian lands in 1393 when Tarnovo was sacked after a three-month siege and the Battle of Nicopolis which brought about the fall of the Vidin Tsardom in 1396. Sozopol was the last Bulgarian settlement to fall, in 1453.[60] The Bulgarian nobility was subsequently eliminated and the peasantry was enserfed to Ottoman masters,[59] while much of the educated clergy fled to other countries.[61]
Christians were considered an inferior class of people under the Ottoman system. Bulgarians were subjected to heavy taxes (including devshirme, or blood tax), their culture was suppressed,[61] and they experienced partial Islamisation.[62] Ottoman authorities established a religious administrative community called the Rum Millet, which governed all Orthodox Christians regardless of their ethnicity.[63] Most of the local population then gradually lost its distinct national consciousness, identifying only by its faith.[64][65] The clergy remaining in some isolated monasteries kept their ethnic identity alive, enabling its survival in remote rural areas,[66] and in the militant Catholic community in the northwest of the country.[67]
As Ottoman power began to wane, Habsburg Austria and Russia saw Bulgarian Christians as potential allies. The Austrians first backed an uprising in Tarnovo in 1598, then a second one in 1686, the Chiprovtsi Uprising in 1688 and finally Karposh's Rebellion in 1689.[68] The Russian Empire also asserted itself as a protector of Christians in Ottoman lands with the Treaty of Küçük Kaynarca in 1774.[68]
The Western European Enlightenment in the 18th century influenced the initiation of a national awakening of Bulgaria.[59] It restored national consciousness and provided an ideological basis for the liberation struggle, resulting in the 1876 April Uprising. Up to 30,000 Bulgarians were killed as Ottoman authorities put down the rebellion. The massacres prompted the Great Powers to take action.[69] They convened the Constantinople Conference in 1876, but their decisions were rejected by the Ottomans. This allowed the Russian Empire to seek a military solution without risking confrontation with other Great Powers, as had happened in the Crimean War.[69] In 1877 Russia declared war on the Ottomans and defeated them with the help of Bulgarian rebels, particularly during the crucial Battle of Shipka Pass which secured Russian control over the main road to Constantinople.[70][71]
The Treaty of San Stefano was signed on 3 March 1878 by Russia and the Ottoman Empire. It was to set up an autonomous Bulgarian principality spanning Moesia, Macedonia and Thrace, roughly on the territories of the Second Bulgarian Empire.[72][73] The other Great Powers immediately rejected the treaty out of fear that such a large country in the Balkans might threaten their interests. It was superseded by the Treaty of Berlin, signed on 13 July, which provided for a much smaller state only comprising Moesia and the region of Sofia, leaving large populations of ethnic Bulgarians outside the new country.[72][74] This significantly contributed to Bulgaria's militaristic foreign affairs approach during the first half of the 20th century.[75]
The Bulgarian principality won a war against Serbia and incorporated the semi-autonomous Ottoman territory of Eastern Rumelia in 1885, proclaiming itself an independent state on 5 October 1908.[76] In the years following independence, Bulgaria increasingly militarized and was often referred to as "the Balkan Prussia".[77] It became involved in three consecutive conflicts between 1912 and 1918—two Balkan Wars and World War I. After a disastrous defeat in the Second Balkan War, Bulgaria again found itself fighting on the losing side as a result of its alliance with the Central Powers in World War I. Despite fielding more than a quarter of its population in a 1,200,000-strong army[78][79] and achieving several decisive victories at Doiran and Monastir, the country capitulated in 1918. The war resulted in significant territorial losses and a total of 87,500 soldiers killed.[80] More than 253,000 refugees from the lost territories immigrated to Bulgaria from 1912 to 1929,[81] placing additional strain on the already ruined national economy.[82]
The resulting political unrest led to the establishment of a royal authoritarian dictatorship by Tsar Boris III (1918–1943). Bulgaria entered World War II in 1941 as a member of the Axis but declined to participate in Operation Barbarossa and saved its Jewish population from deportation to concentration camps.[83] The sudden death of Boris III in mid-1943 pushed the country into political turmoil as the war turned against Germany, and the communist guerrilla movement gained momentum. The government of Bogdan Filov subsequently failed to achieve peace with the Allies. Bulgaria did not comply with Soviet demands to expel German forces from its territory, resulting in a declaration of war and an invasion by the USSR in September 1944.[84] The communist-dominated Fatherland Front took power, ended participation in the Axis and joined the Allied side until the war ended.[85] Bulgaria suffered little war damage and the Soviet Union demanded no reparations. But all wartime gains, with the notable exception of Southern Dobrudzha, were lost.[86]
The left-wing uprising of 9 September 1944 led to the abolition of the monarchy and the executions of some 1,000–3,000 dissidents, war criminals, and members of the former royal elite.[87][88][89] But it was not until 1946 that a one-party people's republic was instituted following a referendum.[90] It fell into the Soviet sphere of influence under the leadership of Georgi Dimitrov (1946–1949), who established a repressive, rapidly industrializing Stalinist state.[86] By the mid-1950s standards of living rose significantly and political repressions eased.[91][92] The Soviet-style planned economy saw some market-oriented policies emerging on an experimental level under Todor Zhivkov (1954–1989).[93] Compared to wartime levels, national GDP increased five-fold and per capita GDP quadrupled by the 1980s,[94] although severe debt spikes took place in 1960, 1977 and 1980.[95] Zhivkov's daughter Lyudmila bolstered national pride by promoting Bulgarian heritage, culture and arts worldwide.[96] Facing declining birth rates among the ethnic Bulgarian majority, in 1984 Zhivkov's government forced the minority ethnic Turks to adopt Slavic names in an attempt to erase their identity and assimilate them.[97] These policies resulted in the emigration of some 300,000 ethnic Turks to Turkey.[98][99]
The Communist Party was forced to give up its political monopoly on 10 November 1989 under the influence of the Revolutions of 1989. Zhivkov resigned and Bulgaria embarked on a transition to a parliamentary democracy.[100] The first free elections in June 1990 were won by the Communist Party, now rebranded as the Bulgarian Socialist Party.[101] A new constitution that provided for a relatively weak elected president and for a prime minister accountable to the legislature was adopted in July 1991. The new system initially failed to improve living standards or create economic growth—the average quality of life and economic performance remained lower than under communism well into the early 2000s.[102] After 2001 economic, political and geopolitical conditions improved greatly,[103] and Bulgaria achieved high Human Development status in 2003.[104] It became a member of NATO in 2004[105] and participated in the War in Afghanistan. After several years of reforms it joined the European Union and single market in 2007 despite Brussels' concerns about government corruption.[106] Bulgaria hosted the 2018 Presidency of the Council of the European Union at the National Palace of Culture in Sofia.[107]
Bulgaria occupies a portion of the eastern Balkan peninsula, bordering five countries—Greece and Turkey to the south, Macedonia and Serbia to the west, and Romania to the north. The land borders have a total length of 1,808 kilometres (1,123 mi), and the coastline has a length of 354 kilometres (220 mi).[108] Its total area of 110,994 square kilometres (42,855 sq mi) ranks it as the world's 105th-largest country.[1][109] Bulgaria's geographic coordinates are 43° N 25° E.[110] The most notable topographical features are the Danubian Plain, the Balkan Mountains, the Thracian Plain, and the Rhodope Mountains.[108] The southern edge of the Danubian Plain slopes upward into the foothills of the Balkans, while the Danube defines the border with Romania. The Thracian Plain is roughly triangular, beginning southeast of Sofia and broadening as it reaches the Black Sea coast.[108]
The Balkan mountains run laterally through the middle of the country. The mountainous southwest has two distinct alpine ranges—Rila and Pirin, which border the lower but more extensive Rhodope Mountains to the east.[108] Musala, at 2,925 metres (9,596 ft), is the highest point in both Bulgaria and the Balkan peninsula, and the Black Sea coast is the country's lowest point.[110] Plains occupy about one third of the territory, while plateaux and hills occupy 41%.[111] Most rivers are short and with low water levels. The longest river located solely in Bulgarian territory, the Iskar, has a length of 368 kilometres (229 mi). Other major rivers include the Struma and the Maritsa in the south.[112][108]
Bulgaria has a changeable climate, which results from being positioned at the meeting point of the Mediterranean and continental air masses combined with the barrier effect of its mountains.[108] Northern Bulgaria averages 1 °C (1.8 °F) cooler, and registers 200 millimetres (7.9 in) more precipitation, than the regions south of the Balkan mountains. Temperature amplitudes vary significantly in different areas. The lowest recorded temperature is −38.3 °C (−36.9 °F), while the highest is 45.2 °C (113.4 °F).[114] Precipitation averages about 630 millimetres (24.8 in) per year, and varies from 500 millimetres (19.7 in) in Dobrudja to more than 2,500 millimetres (98.4 in) in the mountains. Continental air masses bring significant amounts of snowfall during winter.[115]
The interaction of climatic, hydrological, geological and topographical conditions has produced a relatively wide variety of plant and animal species.[116] Bulgaria's biodiversity, one of the richest in Europe,[117] is conserved in three national parks, 11 nature parks, 10 biosphere reserves and 565 protected areas.[118][119][120] Ninety-three of the 233 mammal species of Europe are found in Bulgaria, along with 49% of butterfly and 30% of vascular plant species.[121] Overall, 41,493 plant and animal species are present.[121] Larger mammals with sizable populations include deer (106,323 individuals), wild boars (88,948), jackals (47,293) and foxes (32,326). Partridges number some 328,000 individuals, making them the most widespread gamebird.[122] A third of all nesting birds in Bulgaria can be found in Rila National Park, which also hosts Arctic and alpine species at high altitudes.[123] Flora includes more than 3,800 vascular plant species of which 170 are endemic and 150 are considered endangered.[116] A checklist of larger fungi in Bulgaria by the Institute of Botany identifies more than 1,500 species.[124] More than 35% of the land area is covered by forests.[125]
In 1998, the Bulgarian government adopted the National Biological Diversity Conservation Strategy, a comprehensive programme seeking the preservation of local ecosystems, protection of endangered species and conservation of genetic resources.[126] Bulgaria has some of the largest Natura 2000 areas in Europe covering 33.8% of its territory.[127] It also achieved its Kyoto Protocol objective of reducing carbon dioxide emissions by 30% from 1990 to 2009.[128][129]
Bulgaria ranks 30th in the 2018 Environmental Performance Index, but scores low on air quality.[130] Particulate levels are the highest in Europe,[131] especially in urban areas affected by automobile traffic and coal-based power stations.[132][133] One of these, the lignite-fired Maritsa Iztok-2 station, is causing the highest damage to health and the environment in the European Union.[134] Pesticide use in agriculture and antiquated industrial sewage systems produce extensive soil and water pollution.[135] Water quality began to improve in 1998 and has maintained a trend of moderate improvement. Over 75% of surface rivers meet European standards for good quality.[136]
Bulgaria is a parliamentary democracy where the prime minister is the head of government and the most powerful executive position.[103] The political system has three branches—legislative, executive and judicial, with universal suffrage for citizens at least 18 years old. The Constitution also provides possibilities of direct democracy, namely petitions and national referenda.[137] Elections are supervised by an independent Central Election Commission that includes members from all major political parties. Parties must register with the commission prior to participating in a national election.[138] Normally, the prime minister-elect is the leader of the party receiving the most votes in parliamentary elections, although this is not always the case.[103]
Unlike the prime minister, presidential domestic power is more limited. The directly elected president serves as head of state and commander-in-chief of the armed forces, and has the authority to return a bill for further debate, although the parliament can override the presidential veto by a simple majority vote.[103] Political parties gather in the National Assembly, a body of 240 deputies elected to four-year terms by direct popular vote. The National Assembly has the power to enact laws, approve the budget, schedule presidential elections, select and dismiss the prime minister and other ministers, declare war, deploy troops abroad, and ratify international treaties and agreements.[139]
Overall, Bulgaria displays a pattern of unstable governments.[140] Boyko Borisov is serving his third term as prime minister since 2009,[141] when his centre-right, pro-EU party GERB won the general election and ruled as a minority government with 117 seats in the National Assembly.[142] His first government resigned on 20 February 2013 after nationwide protests caused by high costs of utilities, low living standards, corruption[143] and the perceived failure of the democratic system. The protest wave was notable for self-immolations, spontaneous demonstrations and a strong sentiment against political parties.[144]
The subsequent snap elections in May resulted in a narrow win for GERB,[145] but the Bulgarian Socialist Party eventually formed a government led by Plamen Oresharski after Borisov failed to secure parliamentary support.[146][147] The Oresharski government resigned in July 2014 amid continuing large-scale protests.[148][149][150] A caretaker government took over[151] and called the October 2014 elections[152] which resulted in a third GERB victory, but a total of eight parties entered parliament.[153] Borisov formed a coalition[154] with several right-wing parties, but resigned again after the candidate backed by his party failed to win the 2016 Presidential election. The March 2017 snap election was again won by GERB, but with 95 seats in Parliament. They formed a coalition with the far-right United Patriots, who hold 27 seats.[141]
Freedom House has reported a continuing deterioration of democratic governance after 2009, citing reduced media independence, stalled reforms, abuse of authority at the highest level and increased dependence of local administrations on the central government.[155] Bulgaria is still listed as "Free", with a political system designated as a semi-consolidated democracy, albeit with deteriorating scores.[155] The Democracy Index defines it as a "Flawed democracy".[156]
Bulgaria has a civil law legal system.[157] The judiciary is overseen by the Ministry of Justice. The Supreme Administrative Court and the Supreme Court of Cassation are the highest courts of appeal and oversee the application of laws in subordinate courts.[138] The Supreme Judicial Council manages the system and appoints judges. The legal system is regarded by both domestic and international observers as one of Europe's most inefficient due to pervasive lack of transparency and corruption.[158][159][160][161][162] Law enforcement is carried out by organisations mainly subordinate to the Ministry of the Interior.[163] The General Directorate of National Police (GDNP) combats general crime and maintains public order.[164] GDNP fields 26,578 police officers in its local and national sections.[165] The bulk of criminal cases are transport-related, followed by theft and drug-related crime; homicide rates are low.[166] The Ministry of the Interior also heads the Border Police Service and the National Gendarmerie—a specialized branch for anti-terrorist activity, crisis management and riot control. Counterintelligence and national security are the responsibility of the State Agency for National Security.[167]
Bulgaria is a unitary state.[168] Since the 1880s, the number of territorial management units has varied from seven to 26.[169] Between 1987 and 1999 the administrative structure consisted of nine provinces (oblasti, singular oblast). A new administrative structure was adopted in parallel with the decentralization of the economic system.[170] It includes 27 provinces and a metropolitan capital province (Sofia-Grad). All areas take their names from their respective capital cities. The provinces are subdivided into 264 municipalities. Municipalities are run by mayors, who are elected to four-year terms, and by directly elected municipal councils. Bulgaria is a highly centralized state where the Council of Ministers directly appoints regional governors and all provinces and municipalities are heavily dependent on it for funding.[138]
Bulgaria became a member of the United Nations in 1955 and since 1966 has been a non-permanent member of the Security Council three times, most recently from 2002 to 2003.[171] It was also among the founding nations of the Organization for Security and Co-operation in Europe (OSCE) in 1975. Euro-Atlantic integration has been a priority since the fall of communism, although the communist leadership also had aspirations of leaving the Warsaw Pact and joining the European Communities by 1987.[172][173] Bulgaria signed the European Union Treaty of Accession on 25 April 2005,[174] and became a full member of the European Union on 1 January 2007.[106] In addition, it has a tripartite economic and diplomatic collaboration with Romania and Greece,[175] good ties with China[176] and Vietnam[177] and a historical relationship with Russia.[178][179][180][181]
Bulgaria deployed significant numbers of both civilian and military advisors in Soviet-allied countries like Nicaragua[182] and Libya during the Cold War.[183] The first deployment of foreign troops on Bulgarian soil since World War II occurred in 2001, when the country hosted six KC-135 Stratotanker aircraft and 200 support personnel for the war effort in Afghanistan.[20] International military relations were further expanded with accession to NATO in March 2004[105] and the US-Bulgarian Defence Cooperation Agreement signed in April 2006. Bezmer and Graf Ignatievo air bases, the Novo Selo training range, and a logistics centre in Aytos subsequently became joint military training facilities cooperatively used by the United States and Bulgarian militaries.[184][185]
Domestic defence is the responsibility of the all-volunteer Bulgarian armed forces, composed of land forces, navy and an air force. The land forces consist of two mechanized brigades and eight independent regiments and battalions; the air force operates 106 aircraft and air defence systems in six air bases, and the navy operates various ships, helicopters and coastal defence weapons.[186] Active troops dwindled from 152,000 in 1988[187] to 31,300 in 2017, supplemented by 3,000 reservists and 16,000 paramilitary.[188] The inventory consists mostly of Soviet equipment like Mikoyan MiG-29 and Sukhoi Su-25 jets,[189] S-300PT air defence systems[190] and SS-21 Scarab short-range ballistic missiles.[191]
Bulgaria has an open, upper middle income range market economy where the private sector accounts for more than 70% of GDP.[192][193] From a largely agricultural country with a predominantly rural population in 1948, by the 1980s Bulgaria had transformed into an industrial economy with scientific and technological research at the top of its budgetary expenditure priorities.[194] The loss of COMECON markets in 1990 and the subsequent "shock therapy" of the planned system caused a steep decline in industrial and agricultural production, ultimately followed by an economic collapse in 1997.[195][196] The economy largely recovered during a period of rapid growth several years later,[195] but the average salary of 1,036 leva ($615) per month remains the lowest in the EU.[197] More than a fifth of the labour force are employed on a minimum wage of $1.16 per hour.[198]
A balanced budget was achieved in 2003 and the country began running a surplus the following year.[199] Expenditures amounted to $21.15 billion and revenues were $21.67 billion in 2017.[200] Most government spending on institutions is earmarked for security. The ministries of defence, the interior and justice are allocated the largest share of the annual government budget, whereas those responsible for the environment, tourism and energy receive the least amount of funding.[201] Taxes form the bulk of government revenue[201] at 30% of GDP.[202] Bulgaria has some of the lowest corporate income tax rates in the EU at a flat 10% rate.[203] The tax system is two-tier. Value added tax, excise duties, corporate and personal income tax are national, whereas real estate, inheritance, and vehicle taxes are levied by local authorities.[204] Strong economic performance in the early 2000s reduced government debt from 79.6% in 1998 to 14.1% in 2008.[199] It has since increased to 28.7% of GDP by 2016, but remains the third lowest in the EU.[205]
The Yugozapaden planning area is the most developed region with a per capita gross domestic product (PPP) of $26,580 in 2016.[206] It includes the capital city and the surrounding Sofia Province, which alone generate 42% of national gross domestic product despite hosting only 22% of the population.[207][3] PPP GDP per capita and the cost of living in 2017 stood at 49 and 48.4% of the EU average, respectively.[208][209] National PPP GDP was estimated at $143.1 billion in 2016, with a per capita value of $20,116.[210] Economic growth statistics take into account illegal transactions from the informal economy, which is the largest in the EU as a percentage of economic output.[211][212] The Bulgarian National Bank issues the national currency, lev, which is pegged to the euro at a rate of 1.95583 levа per euro.[213]
After several consecutive years of high growth, repercussions of the financial crisis of 2007–2008 resulted in a 3.6% contraction of GDP in 2009 and increased unemployment.[214][215] Industrial output declined 10%, mining by 31%, and ferrous and metal production marked a 60% drop.[216] Positive growth was restored in 2010 but intercompany debt exceeded $59 billion, meaning that 60% of all Bulgarian companies were mutually indebted.[217] By 2012, it had increased to $97 billion, or 227% of GDP.[218] The government implemented strict austerity measures with IMF and EU encouragement to some positive fiscal results, but the social consequences of these measures, such as increased income inequality and accelerated outward migration, have been "catastrophic" according to the International Trade Union Confederation.[219]
Siphoning of public funds to the families and relatives of politicians from incumbent parties has resulted in fiscal and welfare losses to society.[220][221] Bulgaria ranks 71st in the Corruption Perceptions Index[222] and experiences the worst levels of corruption in the European Union, a phenomenon that remains a source of profound public discontent.[223][224] Along with organized crime, corruption has resulted in a rejection of the country's Schengen Area application and withdrawal of foreign investment.[225][226][227] Government officials reportedly engage in embezzlement, influence trading, government procurement violations and bribery with impunity.[158] Government procurement in particular is a critical area in corruption risk. An estimated 10 billion leva ($5.99 billion) of state budget and European cohesion funds are spent on public tenders each year;[228] nearly 14 billion ($8.38 billion) were spent on public contracts in 2017 alone.[229] A large share of these contracts are awarded to a few politically connected[230] companies amid widespread irregularities, procedure violations and tailor-made award criteria.[231] Despite repeated criticism from the European Commission,[227] EU institutions refrain from taking measures against Bulgaria because it supports Brussels on a number of issues, unlike Poland or Hungary.[223]
The labour force is 3.36 million people,[232] of whom 6.8% are employed in agriculture, 26.6% in industry and 66.6% in the services sector.[233] Extraction of metals and minerals, production of chemicals, machine building, steel, biotechnology, tobacco and food processing and petroleum refining are among the major industrial activities.[234][235][236] Mining alone employs 24,000 people and generates about 5% of the country's GDP; the number of employed in all mining-related industries is 120,000.[237][238] Bulgaria is Europe's fifth-largest coal producer.[238][239] Local deposits of coal, iron, copper and lead are vital for the manufacturing and energy sectors.[240]
Two-thirds of food and agricultural exports go to OECD countries.[241] Although cereal and vegetable output dropped by 40% between 1990 and 2008,[242] output has since increased, and the 2016–2017 season registered the biggest grain output in a decade.[243][244] Maize, barley, oats and rice are also grown. Quality Oriental tobacco is a significant industrial crop.[245] Bulgaria is also the largest producer globally of lavender and rose oil, both widely used in fragrances.[20][246][247][248] Of the services sector, tourism is a significant contributor to economic growth. Bulgaria has emerged as a travelling destination with its inexpensive resorts and beaches outside the reach of the tourist industry.[249] Most of the visitors are Romanian, German, Turkish, British and Russian.[250] Sofia, Plovdiv, Veliko Tarnovo, coastal resorts Golden Sands and Sunny Beach and winter resorts Bansko, Pamporovo and Borovets are some of the locations most visited by tourists.[251]
Spending on research and development amounts to 0.78% of GDP,[252] and the bulk of public R&D funding goes to the Bulgarian Academy of Sciences (BAS).[253] Private businesses accounted for more than 73% of R&D expenditures and employed 42% of Bulgaria's 22,000 researchers in 2015.[254] The same year, Bulgaria ranked 39th out of 50 countries in the Bloomberg Innovation Index, the highest score being in education (24th) and the lowest in value-added manufacturing (48th).[255] Chronic government underinvestment in research since 1990 has forced many professionals in science and engineering to leave Bulgaria.[256]
Despite the lack of funding, research in chemistry, materials science and physics remains strong.[253] Three per cent of economic output is generated by the information and communication technologies (ICT) sector where 40,000[257] to 51,000 software engineers are employed.[258] More than a quarter of them are women, the highest percentage of females in ICT in any EU country.[259] High levels of female participation are a legacy of the Soviet era,[260] when the country was known as a "Communist Silicon Valley" due to its key role in COMECON computing technology production.[261] Bulgaria is also a regional leader in high performance computing and operates Avitohol, the most powerful supercomputer in Southeast Europe.[262]
Bulgaria has made numerous contributions to space exploration.[263] These include two scientific satellites, more than 200 payloads and 300 experiments in Earth orbit, as well as two cosmonauts since 1971.[263] Bulgaria was the first country to grow wheat and vegetables in space with its Svet greenhouses on the Mir space station.[264][265] It was involved in the development of the Granat gamma-ray observatory[266] and the Vega program, particularly in modelling trajectories and guidance algorithms for both Vega probes.[267][268] Bulgarian instruments have been used in the exploration of Mars, including a spectrometer that took the first high quality spectroscopic images of Martian moon Phobos with the Phobos 2 probe.[263][266] Cosmic radiation en route to and around the planet has been mapped by Liulin-ML dosimeters on the ExoMars TGO.[269] Variants of these instruments have also been fitted to the Chandrayaan-1 lunar probe and the International Space Station.[270][271] Bulgaria's first geostationary communications satellite—BulgariaSat-1—was launched by SpaceX in June 2017.[272]
Telephone services are widely available, and a central digital trunk line connects most regions.[273] Vivacom (BTC) serves more than 90% of fixed lines and is one of the three operators providing mobile services, along with A1 and Telenor.[274][275] Internet penetration stood at 61.9% of the population aged 16–74, in 2017.[276]
Bulgaria's strategic geographic location and well-developed energy sector make it a key European energy centre despite its lack of significant fossil fuel deposits.[277] Thermal power plants generate 48.9% of electricity, followed by nuclear power from the Kozloduy reactors (34.8%) and renewable sources (16.3%).[278] Equipment for a second nuclear power station at Belene has been acquired, but the fate of the project remains uncertain.[279] Installed capacity amounts to 12,668 MW, allowing Bulgaria to exceed domestic demand and export energy.[280]
The national road network has a total length of 19,512 kilometres (12,124 mi),[281] of which 19,235 kilometres (11,952 mi) are paved. Railroads are a major mode of freight transportation, although highways carry a progressively larger share of freight. Bulgaria has 6,238 kilometres (3,876 mi) of railway track[273] and currently a total of 81 kilometres (50 miles) of high-speed lines are in operation.[282][283] Rail links are available with Romania, Turkey, Greece, and Serbia, and express trains serve direct routes to Kiev, Minsk, Moscow and Saint Petersburg.[284] Sofia and Plovdiv are the country's air travel hubs, while Varna and Burgas are the principal maritime trade ports.[273]
The population of Bulgaria is 7,360,000 people according to the 2011 national census. The majority of the population, or 72.5%, reside in urban areas.[285] As of 2017[update], Sofia is the most populated urban centre with 1,330,000 people, followed by Plovdiv (345,000), Varna (344,000), Burgas (209,000) and Ruse (160,000).[3] Bulgarians are the main ethnic group and comprise 84.8% of the population. Turkish and Roma minorities comprise 8.8 and 4.9%, respectively; some 40 smaller minorities comprise 0.7%, and 0.8% do not self-identify with an ethnic group.[286][287] Former Statistics head Reneta Indzhova has disputed the 2011 census figures, suggesting the actual population is smaller than reported and a higher percentage of citizens are of Romani origin.[288][289] The Roma minority is usually underestimated in census data and may represent up to 11% of the population.[290] Population density is 65 per square kilometre, almost half the European Union average.[291]
Bulgaria is in a state of demographic crisis.[292][293] It has had negative population growth since the early 1990s, when the economic collapse caused a long-lasting emigration wave.[294] Some 937,000 to 1,200,000 people—mostly young adults—left the country by 2005.[294][295] The total fertility rate (TFR) was estimated at 1.46 children born per woman in 2017.[296] The majority of children are born to unmarried women.[297] Furthermore, a third of all households consist of only one person and 75.5% of families do not have children under the age of 16.[293] The resulting birth rates are among the lowest in the world[298][299] while death rates are among the highest.[300]
High death rates result from a combination of an ageing population, a high number of people at risk of poverty and a weak healthcare system.[301] Mortality rates can be sharply reduced to levels below the EU average through timely and adequate access to medical services, which the healthcare system does not provide fully.[303] Although healthcare in Bulgaria is nominally universal,[304] out-of-pocket expenses account for nearly half of all healthcare spending, which significantly limits access to medical care.[305] Other problems disrupting care provision are the emigration of doctors due to low wages, understaffed and under-equipped regional hospitals, supply shortages and frequent changes to the basic service package for those insured.[306][307] The 2018 Bloomberg Health Care Efficiency Index ranked Bulgaria last out of 56 countries.[308] Average life expectancy is 74.7 years compared with an EU average of 80.2 and a world average of 69.[309][310]
Public expenditures for education are far below the European Union average as well.[311] Educational standards were once high,[312] but have declined significantly since the early 2000s.[311] Bulgarian students were among the highest-scoring in the world in terms of reading in 2001, performing better than their Canadian and German counterparts; by 2006, scores in reading, math and science had dropped. Although average literacy stands at 98.4% with no significant difference between sexes,[313] functional illiteracy is significant. The PISA study of 2015 found 41.5% of pupils in the 9th grade to be functionally illiterate in reading, maths and science.[314] The Ministry of Education and Science partially funds public schools, colleges and universities, sets criteria for textbooks and oversees the publishing process. Education in primary and secondary public schools is free and compulsory.[312] The process spans through 12 grades, where grades one through eight are primary and nine through twelve are secondary level. Higher education consists of a 4-year bachelor degree and a 1-year master's degree.[315] Bulgaria's highest-ranked higher education institution is Sofia University.[316][317]
Bulgarian is the only language with official status and native for 85% of the population.[318] It belongs to the Slavic group of languages, but it has a number of grammatical peculiarities, shared with its closest relative Macedonian, that set it apart from other Slavic languages: these include a complex verbal morphology (which also codes for distinctions in evidentiality), the absence of noun cases and infinitives, and the use of a suffixed definite article.[319] Other major languages are Turkish and Romani, which according to the 2011 census were spoken natively by 9.1% and 4.2% respectively.
More than three-quarters of Bulgarians subscribe to Eastern Orthodoxy.[320] Sunni Muslims are the second-largest religious community and constitute 10% of Bulgaria's overall religious makeup, although a majority of them are not observant and find the use of Islamic veils in schools unacceptable.[321] Less than 3% of the population are affiliated with other religions and 11.8% are irreligious or do not self-identify with a religion.[320] The Bulgarian Orthodox Church gained autocephalous status in AD 927,[322][323] and has 12 dioceses and over 2,000 priests.[324] Bulgaria is a secular state with guaranteed religious freedom by constitution, but Orthodoxy is designated as a "traditional" religion.[325]
Contemporary Bulgarian culture blends the formal culture that helped forge a national consciousness towards the end of Ottoman rule with millennia-old folk traditions.[326] An essential element of Bulgarian folklore is fire, used to banish evil spirits and illnesses. Many of these are personified as witches, whereas other creatures like zmey and samodiva (veela) are either benevolent guardians or ambivalent tricksters.[327] Some rituals against evil spirits have survived and are still practised, most notably kukeri and survakari.[328] Martenitsa is also widely celebrated.[329] Nestinarstvo, a ritual fire-dance of Thracian origin, is included in the list of UNESCO Intangible Cultural Heritage.[330][331]
Nine historical and natural objects are UNESCO World Heritage Sites: Pirin National Park, Sreburna Nature Reserve, the Madara Rider, the Thracian tombs in Sveshtari and Kazanlak, the Rila Monastery, the Boyana Church, the Rock-hewn Churches of Ivanovo and the ancient city of Nesebar.[332] The Rila Monastery was established by Saint John of Rila, Bulgaria's patron saint, whose life has been the subject of numerous literary accounts since Medieval times.[333]
During the Middle Ages, the establishment of the Preslav and Ohrid literary schools in the 10th century is associated with a golden period in Bulgarian literature.[333] The schools' emphasis on Christian scriptures made the Bulgarian Empire a centre of Slavic culture, bringing Slavs under the influence of Christianity and providing them with a written language.[334][335][336] Its alphabet, Cyrillic script, was developed by the Preslav Literary School.[337] The Tarnovo Literary School, on the other hand, is associated with a Silver age of literature defined by high-quality manuscripts on historical or mystical themes under the Asen and Shishman dynasties.[333] Many literary and artistic masterpieces were destroyed by the Ottoman conquerors, and artistic activities did not re-emerge until the National Revival in the 19th century.[326] The enormous body of work of Ivan Vazov (1850–1921) covered every genre and touched upon every facet of Bulgarian society, bridging pre-Liberation works with literature of the newly established state.[333] Notable later works are Bay Ganyo by Aleko Konstantinov, the Nietzschean poetry of Pencho Slaveykov, the Symbolist poetry of Peyo Yavorov and Dimcho Debelyanov, the Marxist-inspired works of Geo Milev and Nikola Vaptsarov, and the Socialist realism novels of Dimitar Dimov and Dimitar Talev.[333] Tzvetan Todorov is a notable contemporary author,[338] while Bulgarian-born Elias Canetti was awarded the Nobel Prize in Literature in 1981.[339]
А religious visual arts heritage includes frescoes, murals and icons, many produced by the medieval Tarnovo Artistic School.[340] Like literature, it was not until the National Revival when Bulgarian visual arts began to reemerge. Zahari Zograf was a pioneer of the visual arts in the pre-Liberation era.[326] After the Liberation, Ivan Mrkvička, Anton Mitov, Vladimir Dimitrov, Tsanko Lavrenov and Zlatyu Boyadzhiev introduced newer styles and substance, depicting scenery from Bulgarian villages, old towns and historical subjects. Christo is the most famous Bulgarian artist of the 21st century, known for his outdoor installations.[326]
Folk music is by far the most extensive traditional art and has slowly developed throughout the ages as a fusion of Far Eastern, Oriental, medieval Eastern Orthodox and standard Western European tonalities and modes.[341] Bulgarian folk music has a distinctive sound and uses a wide range of traditional instruments, such as gadulka, gaida, kaval and tupan. A distinguishing feature is extended rhythmical time, which has no equivalent in the rest of European music.[20] The State Television Female Vocal Choir won a Grammy Award in 1990 for its performances of Bulgarian folk music.[342] Written musical composition can be traced back to the works of Yoan Kukuzel (c. 1280–1360),[343] but modern classical music began with Emanuil Manolov, who composed the first Bulgarian opera in 1890.[326] Pancho Vladigerov and Petko Staynov further enriched symphony, ballet and opera, with singers Ghena Dimitrova, Boris Christoff, Ljuba Welitsch and Nicolai Ghiaurov elevated to a world-class level.[326][344][345][346][347][348][349] Bulgarian performers have gained acclaim in other genres like electropop (Mira Aroyo), jazz (Milcho Leviev) and blends of jazz and folk (Ivo Papazov).[326]
The Bulgarian National Radio, bTV and daily newspapers Trud, Dnevnik and 24 Chasa are some of the largest national media outlets.[350] Bulgarian media were described as generally unbiased in their reporting in the early 2000s and print media had no legal restrictions.[351] Since then, freedom of the press has deteriorated to the point where Bulgaria scores 111th globally in the World Press Freedom Index, lower than all European Union members and membership candidate states. The government has diverted EU funds to sympathetic media outlets and bribed others to be less critical on problematic topics, while attacks against individual journalists have increased.[352][353] Collusion between politicians, oligarchs and the media is widespread.[352]
Bulgarian cuisine is similar to that of other Balkan countries and demonstrates strong Turkish and Greek influences.[354] Yogurt, lukanka, banitsa, shopska salad, lyutenitsa and kozunak are among the best-known local foods. Meat consumption is lower than the European average, given a cultural preference for a large variety of salads.[354] Bulgaria was the world's second-largest wine exporter until 1989, but has since lost that position.[355][356] The 2016 harvest yielded 128 million litres of wine, of which 62 million was exported mainly to Romania, Poland and Russia.[357] Mavrud, Rubin, Shiroka melnishka, Dimiat and Cherven Misket are the typical grapes used in Bulgarian wine.[358] Rakia is a traditional fruit brandy that was consumed in Bulgaria as early as the 14th century.[359]
Bulgaria appeared at the first modern Olympic games in 1896, when it was represented by gymnast Charles Champaud.[360] Since then, Bulgarian athletes have won 52 gold, 89 silver, and 83 bronze medals,[361] ranking 25th in the all-time medal table. Weight-lifting is a signature sport of Bulgaria. Coach Ivan Abadzhiev developed innovative training practices that have produced many Bulgarian world and Olympic champions in weight-lifting since the 1980s.[362] Bulgarian athletes have also excelled in wrestling, boxing, gymnastics, volleyball and tennis.[362] Stefka Kostadinova is the reigning world record holder in the women's high jump at 2.09 metres (6 feet 10 inches), achieved during the 1987 World Championships.[363] Grigor Dimitrov is the first Bulgarian tennis player in the Top 3 ATP Rankings.[364]
Football is the most popular sport in the country by a substantial margin. The national football team's best performance was a semi-final at the 1994 FIFA World Cup, when the squad was spearheaded by forward Hristo Stoichkov.[362] Stoichkov is the most successful Bulgarian player of all time; he was awarded the Golden Boot and the Golden Ball and was considered one of the best in the world while playing for FC Barcelona in the 1990s.[365][366] CSKA and Levski, both based in Sofia,[362] are the most successful clubs domestically and long-standing rivals.[367] Ludogorets is remarkable for having advanced from the local fourth division to the 2014–15 UEFA Champions League group stage in a mere nine years.[368] Placed 39th in 2018, it is Bulgaria's highest-ranked club in UEFA.[369]


The Royal Opera House Live Cinema Season gets off to a dramatic start with the return of Puccini's musically sublime final opera 'Turandot' - a tale of disguised identities, riddles, ritual executions and powerful, triumphant love.


|
YAX.Math
1.0
The standalone version of YAX's (and by extension XNA's) math utility classes.
|
Represents a row-major up-to-4x4 matrix. More...
#include <Matrix.h>
Public Member Functions | |
| Matrix (float M11, float M12, float M13, float M14, float M21, float M22, float M23, float M24, float M31, float M32, float M33, float M34, float M41, float M42, float M43, float M44) | |
| Vector3 | Backward () const |
| void | Backward (const Vector3 &) |
| Vector3 | Down () const |
| void | Down (const Vector3 &) |
| Vector3 | Forward () const |
| void | Forward (const Vector3 &) |
| Vector3 | Left () const |
| void | Left (const Vector3 &) |
| Vector3 | Right () const |
| void | Right (const Vector3 &) |
| Vector3 | Translation () const |
| void | Translation (const Vector3 &) |
| Vector3 | Up () const |
| void | Up (const Vector3 &) |
| bool | Decompose (Vector3 &scale, Quaternion &rot, Vector3 &trans) const |
| Decomposes the matrix into its scale, rotation, and translation components. More... | |
| float | Determinant () const |
| Calculates the determinant of the matrix. | |
| Matrix & | operator+= (const Matrix &) |
| Matrix & | operator-= (const Matrix &) |
| Matrix & | operator*= (const Matrix &) |
| Matrix & | operator*= (float) |
| Matrix & | operator/= (const Matrix &) |
| Matrix & | operator/= (float) |
Static Public Member Functions | |
| static Matrix | CreateBillboard (const Vector3 &objectPos, const Vector3 &cameraPos, const Vector3 &cameraUp, const Vector3 *cameraForward) |
| Creates a spherical (rotates around all axes) billboard matrix. More... | |
| static Matrix | CreateConstrainedBillboard (const Vector3 &objectPos, const Vector3 &cameraPos, const Vector3 &rotAxis, const Vector3 *cameraForward, const Vector3 *objectForward) |
| Creates a cylindrical (rotates around provided axis) billboard matrix. More... | |
| static Matrix | CreateFromAxisAngle (const Vector3 &axis, float angle) |
| Creates a rotation matrix that rotates about a given axis. More... | |
| static Matrix | CreateFromQuaternion (const Quaternion &q) |
| Converts a given quaternion into a rotation matrix. More... | |
| static Matrix | CreateFromYawPitchRoll (float y, float p, float r) |
| Creates a rotation matrix from yaw (Y), pitch (X), and roll (Z) angles. More... | |
| static Matrix | CreateLookAt (const Vector3 &cameraPos, const Vector3 &cameraTarg, const Vector3 &cameraUp) |
| Creates a view matrix. More... | |
| static Matrix | CreateOrthographic (float width, float height, float zNear, float zFar) |
| Creates a centered orthographic projection matrix. More... | |
| static Matrix | CreateOrthographicOffCenter (float left, float right, float bottom, float top, float zNear, float zFar) |
| Creates an off-center orthographic projection matrix. More... | |
| static Matrix | CreatePerspective (float width, float height, float zNear, float zFar) |
| Creates a centered perspective projection matrix. More... | |
| static Matrix | CreatePerspectiveFieldOfView (float fieldOfView, float aspectRatio, float zNear, float zFar) |
| Creates a centered perspective projection matrix from a field-of-view angle and aspect ratio. More... | |
| static Matrix | CreatePerspectiveOffCenter (float left, float right, float bottom, float top, float zNear, float zFar) |
| Creates an off-center perspective projection matrix. More... | |
| static Matrix | CreateReflection (const Vector3 &normal, float dist) |
| Creates a reflection matrix that reflects about the normal of a plane. More... | |
| static Matrix | CreateRotationX (float angle) |
| Creates a matrix that rotates around the x-axis. More... | |
| static Matrix | CreateRotationY (float angle) |
| Creates a matrix that rotates around the y-axis. More... | |
| static Matrix | CreateRotationZ (float angle) |
| Creates a matrix that rotates around the z-axis. More... | |
| static Matrix | CreateScale (float scale) |
| Creates a uniform scaling matrix. More... | |
| static Matrix | CreateScale (float scaleX, float scaleY, float scaleZ) |
| Creates a non-uniform scaling matrix. More... | |
| static Matrix | CreateScale (const Vector3 &scaleVec) |
| Creates a scaling matrix from a vector of scale factors. More... | |
| static Matrix | CreateShadow (const Vector3 &lightDir, const Vector3 &planeNormal, float planeDist) |
| Creates a matrix that projects onto the specified plane. More... | |
| static Matrix | CreateTranslation (float xT, float yT, float zT) |
| Creates a translation matrix. More... | |
| static Matrix | CreateTranslation (const Vector3 &vec) |
| Creates a translation matrix from a Vector of distances. More... | |
| static Matrix | CreateWorld (Vector3 pos, Vector3 fwd, Vector3 up) |
| Creates a world matrix that projects a point into the world's coordinate system. More... | |
| static Matrix | Invert (const Matrix &mat) |
| Finds the inverse of a matrix. More... | |
| static Matrix | Lerp (const Matrix &from, const Matrix &to, float t) |
| Performs a component-wise linear interpolation between two matrices. More... | |
| static Matrix | Transform (const Matrix &mat, const Quaternion &rotation) |
| static Matrix | Transpose (const Matrix &mat) |
| Transposes a given matrix. More... | |
Public Attributes | |
| float | M11 |
| float | M12 |
| float | M13 |
| float | M14 |
| float | M21 |
| float | M22 |
| float | M23 |
| float | M24 |
| float | M31 |
| float | M32 |
| float | M33 |
| float | M34 |
| float | M41 |
| float | M42 |
| float | M43 |
| float | M44 |
Static Public Attributes | |
| static const Matrix | Identity |
| The identity matrix. More... | |
| static const Matrix | CatmullRomMat |
| The Catmull-Rom interpolation matrix. | |
|
static |
Creates a spherical (rotates around all axes) billboard matrix.
| objectPos | The position of the billboard |
| cameraPos | The position of the camera |
| cameraUp | The up vector of the camera |
| cameraForward | Optional parameter used when objectPos and cameraPos are too close and would produce odd results; Pass nullptr if not needed |
Definition at line 161 of file Matrix.cpp.
|
static |
Creates a cylindrical (rotates around provided axis) billboard matrix.
| objectPos | The position of the billboard |
| cameraPos | The position of the camera |
| rotAxis | The axis the billboard will rotate around |
| cameraForward | Optional parameter used when objectPos and cameraPos are too close and would produce odd results; Pass nullptr if not needed |
| objectForward | Optional parameter used when the camera is looking down the rotation axis |
Definition at line 186 of file Matrix.cpp.
Creates a rotation matrix that rotates about a given axis.
| axis | The axis to rotate around |
| angle | The angle in radians |
Definition at line 230 of file Matrix.cpp.
|
static |
Converts a given quaternion into a rotation matrix.
| q | The quaternion to convert |
Definition at line 242 of file Matrix.cpp.
|
static |
Creates a rotation matrix from yaw (Y), pitch (X), and roll (Z) angles.
| y | Yaw angle in radians |
| p | Pitch angle in radians |
| r | Roll angle in radians |
Definition at line 253 of file Matrix.cpp.
|
static |
Creates a view matrix.
| cameraPos | The camera's position |
| cameraTarg | The position of the camera's target |
| cameraUp | The camera's up vector |
Definition at line 258 of file Matrix.cpp.
|
static |
Creates a centered orthographic projection matrix.
| width | The width of the view box |
| height | The height of the view box |
| zNear | The minimum z-value of the view box |
| zFar | The maximum z-value of the view box |
Definition at line 274 of file Matrix.cpp.
|
static |
Creates an off-center orthographic projection matrix.
| left | The minimum x-value of the view box |
| right | The maximum x-value of the view box |
| bottom | The minimum y-value of the view box |
| top | The maximum y-value of the view box |
| zNear | The minimum z-value of the view box |
| zFar | The maximum z-value of the view box |
Definition at line 282 of file Matrix.cpp.
|
static |
Creates a centered perspective projection matrix.
| width | The width of the near view plane |
| height | The height of the near view plane |
| zNear | The z-value at the near view plane |
| zFar | The z-value at the far view plane |
Definition at line 290 of file Matrix.cpp.
|
static |
Creates a centered perspective projection matrix from a field-of-view angle and aspect ratio.
| fieldOfView | The horizontal field of view of the view frustum |
| aspectRatio | The ratio of the near view plane's height to its width |
| zNear | The z-value at the near view plane |
| zFar | The z-value at the far view plane |
Definition at line 301 of file Matrix.cpp.
|
static |
Creates an off-center perspective projection matrix.
| left | The minimum x-value of the near view plane |
| right | The maximum x-value of the near view plane |
| bottom | The minimum y-value of the near view plane |
| top | The maximum y-value of the near view plane |
| zNear | The z-value at the near view plane |
| zFar | the z-value at the far view plane |
Definition at line 316 of file Matrix.cpp.
Creates a reflection matrix that reflects about the normal of a plane.
| normal | The normal of the reflection plane |
| dist | The distance from the origin to the plane along the normal |
Definition at line 334 of file Matrix.cpp.
|
static |
Creates a matrix that rotates around the x-axis.
| angle | The rotation angle in radians |
Definition at line 347 of file Matrix.cpp.
|
static |
Creates a matrix that rotates around the y-axis.
| angle | The rotation angle in radians |
Definition at line 352 of file Matrix.cpp.
|
static |
Creates a matrix that rotates around the z-axis.
| angle | The rotation angle in radians |
Definition at line 357 of file Matrix.cpp.
|
static |
Creates a uniform scaling matrix.
| scale | The scale factor |
Definition at line 362 of file Matrix.cpp.
|
static |
Creates a non-uniform scaling matrix.
| scaleX | The scale factor for the x-axis |
| scaleY | The scale factor for the y-axis |
| scaleZ | The scale factor for the z-axis |
Definition at line 370 of file Matrix.cpp.
Creates a scaling matrix from a vector of scale factors.
| scaleVec | Vector of scale factors |
Definition at line 378 of file Matrix.cpp.
|
static |
Creates a matrix that projects onto the specified plane.
| lightDir | The direction from which the light is coming |
| planeNormal | The normal of the shadow plane |
| planeDist | The distance along planeNormal from the origin to the plane |
Definition at line 390 of file Matrix.cpp.
|
static |
Creates a translation matrix.
| xT | Translation along the x-axis |
| yT | Translation along the y-axis |
| zT | Translation along the z-axis |
Definition at line 401 of file Matrix.cpp.
Creates a translation matrix from a Vector of distances.
| vec | The Vector of translation distances |
Definition at line 409 of file Matrix.cpp.
Creates a world matrix that projects a point into the world's coordinate system.
| pos | The position of the world's origin |
| fwd | The forward direction of the world |
| up | The up direction of the world |
Definition at line 414 of file Matrix.cpp.
| bool YAX::Matrix::Decompose | ( | Vector3 & | scale, |
| Quaternion & | rot, | ||
| Vector3 & | trans | ||
| ) | const |
Decomposes the matrix into its scale, rotation, and translation components.
| scale | Output parameter for the scale component |
| rot | Output parameter for the rotation component |
| trans | Output parameter for the translation component |
Definition at line 109 of file Matrix.cpp.
Finds the inverse of a matrix.
| mat | The matrix to find the inverse of |
Definition at line 426 of file Matrix.cpp.
Performs a component-wise linear interpolation between two matrices.
| from | The start (t = 0) matrix |
| to | The end (t = 1) matrix |
| t | The interpolation weight |
Definition at line 452 of file Matrix.cpp.
|
static |
Rotates the coordinate system represented by a matrix by a quaternion
| mat | The matrix to transform |
| rotation | The rotation to apply |
Definition at line 472 of file Matrix.cpp.
Transposes a given matrix.
| mat | The matrix to transpose |
Definition at line 477 of file Matrix.cpp.
|
static |


This week is a sing-along MIQ Sea Shanty after the style of the old “Roll the Old Chariot Down”
ManageIQ Blog
Last Month in ManageIQ: YALMiMIQ
It’s an oppressively clammy summer Saturday afternoon. You have the weekend to write YALMiMIQ. It’s Saturday and you can afford to procrastinate. You open the GitHub query and peruse the recent additions anyway, wondering what to showcase this time.
Announcing Gaprindashvili-3
We’ve just built Gaprindashvili-3. This release contains bug fixes, UI tweaks, and stabilization. Here are just a few of the things added since Gaprindashvili-2 release:
Last Month in ManageIQ: Two McMinutes
You wake up. You’re in your house. There’s a gigantic white dog slumbering peacefully with one eye open and a timer that appears to be counting down 120 seconds. You jump up, grab the timer, and run out. You stumble out into a huge monochrome map. North? West? One way is blocked. A minute left. There’s a lighthouse right next to you. You climb as the timer counts down. As the seconds slip away, you find an important quest item at the top of the lighthouse. Congrats! You are holding a tool to process logs looking for frequency of method calls! Ding! The time is up.
You wake up in your little house. There’s the dog… and oh yeah, you suddenly recall that you got an item yesterday. You look around for it. The dog is drooling all over it in its slumber. You sigh but are afraid to wake the beast. You grab the timer and run outside again. The lighthouse is gone, and the only way open to you today is south.  You see that the item is broken, that you cannot order it as you should be able to. You drop it in frustration. Ding!
You wake up. The dog is nowhere to be seen. Incidentally, your tool to process logs isn’t either, and you wonder ruefully if you should have saved it from its fate. The timer is counting down. You grab it and run, heading south again until you reach your catalog item with a tag control element from yesterday. And lo and behold, it appears to be fully functional today! Marvelling, you barely notice that you’re again out of time.
You wake up. The dog is back. Your process logs tool is beaten up but still mostly intact. You grab it and the timer. The dog stirs but does not wake.  This time there appears to be a small river next to your house. You head towards the sound of the water. On the beach are several RHV markers. Delighted, you grab them. Ding!
You wake up to a very strange sight. The dog has seemingly grown very long claws and is reading on the floor. You stumble to your feet and back up a few steps hurridly. The beast looks at the ticking timer and barks once, a strange bark infused with the burning smell of charter magic. The timer stops. The dog languidly looks up at you, its paws growing back to their regular size, and noses the book towards you.  “Fixes disk size misreporting for some disks”, you read. The dog barks again, and the time is, once again, up.
You wake up. You realize with some dread that a sense of realism, concise documentation, perfecting the art of recognizing and handling abnormal people, moving to the eighth dimension, secret messages from your teeth, knowing every line of Airplane!, the music that is sometimes known as blues, a misguided but adorable belief in meaning, or even the sudden development of some semblance of a personality cannot save you.
You cannot be saved.
Complementing NFV Orchestrators with ManageIQ/CloudForms
While those on IT side of a CSP (Communications Service Provider) business are quite familiar with cloud management platforms such as ManageIQ, the network side folks are very familiar with Network Function Virtualization Orchestrators (NFV-O) as defined in ETSI MANO spec. These two worlds are converging though and so are their technologies. We came across the presentation on how ManageIQ can now run as an NFV-O to manage your Virtual Network Functions (VNFs). But what if you are already running a ETSI NFV-O in your environment ? Is there still a place for ManageIQ? Definitely.
Last Month in ManageIQ: quandaries
Since its founding in 2018, Last Month In MIQ has been the absolute golden standard for journalistic integrity, never afraid to grab truth by the scruff of the neck and shake it up a little. Of course, that being said, we do ever so occasionally take a break from our regularly scheduled program to bring you insights into the minds of our crack team here at MIQ. I know you look forward to such rare occasions with baited breath. Best not to think about what it’s baited with.
Unfortunately the current run of our blog has had to be mostly abandoned because of its low visibility and a striking case of writers’ remorse, but we felt that our readers would still want to know a little something of the private lives of our contributors.
Announcing Gaprindashvili-2
We’ve just built Gaprindashvili-2. This release contains security fixes, bug fixes, UI tweaks, and stabilization.
Quad Icons: Help Us Improve!
Quad Icons: Help Us Improve!
Last Month in ManageIQ II by Drew: Vignettes
d-m-u
write yet another one. When will this madness end? They are tempting the very threads of fate herself, letting d-m-u
get away with this twice in a row. Who knows what horrors will befall you this time. You shudder. If you are lucky, it will be only physical monsters, not the unearthly disturbances of time and dark and cold that have been evoked with such disasterous results previously. You had held out a smattering of hope that d-m-u's
prose might be gentled the way that centuries of water smooth a pebble, but such hope is whisked away with the next thought: you never know, with these texts, if you will exist outside the inky blackness, cursed to only watch as the story dismally unfolds before your eyes, or if you will be a deeply unwilling participant, your agency slave to the whims of an unreliable, mercurial narrator.
The Path[name] to discovering a memory leak in Ruby
tl;dr we found a memory leak in Ruby… and it mostly wasn’t our fault!


Police searching for dog stolen from outside McDonald's in Brooklyn
by Eyewitness NewsBEDFORD-STUYVESANT, Brooklyn (WABC) -- Police are searching for a dog that was stolen from outside a McDonald's in Brooklyn.
The dog, a 2-year-old American Bully named Havok, had been tied to a lamp post Nov. 7 outside the restaurant on Broadway in Bedford-Stuyvesant.
The owner was watching him through a window as he quickly ordered food, police said. When he went to pay, Havok was gone.
Surveillance video obtained by the owner from a local pharmacy shows a man running away with the dog.

Anyone with information is asked to contact police at<PHONE_NUMBER>.


From the top of Mount Eden in Auckland, New Zealand
Sunrise from Mount Eden in Auckland, New Zealand
Preparing for sunset from Mount Eden in Auckland, New Zealand
Kariotahi Beach, outside of Auckland, New Zealand
Manukau Heads Lighthouse, outside of Auckland, New Zealand
HackUVa 2017 team. We created a website for the Student Senate of Hereford residential college. It's not quite complete, but you can get the idea of what we were going for: https://50wliu.github.io/keuchkerian/
Red Sox Service Scholarship award ceremony in Boston, Massachusetts
Mr. Thunderbird competition at Missisquoi Valley Union High School in Swanton, Vermont


Our curriculum blends leading, established platforms and strategies that have been proven and tested by millions of students. This includes computer science and thinking exercises from
Code.org, block programming from
Scratch; document and presentation creation and colaboration using
Google Docs; an introduction to databases by
Codecademy; website creation by
Mozilla; how the internet works with lessons on
Khan Academy; software to hardware cooperation with lessons from
Kano; and many many others.


This user will be deleted and you won't be able to find it anymore. You can also edit this user, if you just want to change something.


Welcome!  To steer, simply use the WASD keys to move across the map. You may also zoom the map in or out using the slider at the right of the screen.
To catch your haul, simply chase after the fish. When they cross within the range of your “net” (displayed by circle) they’ll be added to your stock. But be careful!  At the same time, overfish and miss out on lucrative opportunities involving their offspring.
Some other things to keep in mind. The number of fish caught is displayed below. Going after schools of fish may help maximize your catch rate. Now go forth and challenge your friends for honor and glory.
Overfishing all over the globe has turned the practice into a national issue that affects our natural ecosystem as well as the well-being of everyone on this planet. Every year, almost 25% of of fish stocks are depleted and/or overexploited, while another 52% remains in imminent danger. A lack of stringent federal regulations and illegal fishing has contributed terribly to the amassing destruction, and not enough awareness is being brought to this issue. This game has been designed to give insight into the challenges of maintaining a sustainable fish population while still catching a required amount of food. Along with its addictive retro style, this webgame employs Google APIs and Artificial Intelligence to address modern day issues and to enhance the overall player experience. Balance your fishing just right to maintain a healthy ecosystem. Else, the whole world will come crashing down... Best of Luck!!


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/Parsing.20a.20string.20into.20an.20expression.html ---
I recently discovered that Lean can read from stdin
. So now I'm curious if it is possible to do the following in Lean:
(1) and (4) are easy, but what about (2) and (3)? I assume (3) is possible with the meta stuff, but (2), I have no idea.
I'm actually more interested in this scenario so feel free to comment on that one also:
To be clear, I'm thinking about parsing Lean's syntax. (Of course, since expressions are algebraic data structures, one can could pass in say an s-expression for that expression and write a custom parser for those s-expressions.)
Actually, as I think about it, even if there was no Lean syntax parser, I'd still be interested in the other steps (evaluating an expression and setting an expression as a goal).
For parsing an expression: lean.parser.with_input interactive.types.texpr my_string
it will give you a pexpr
(plus a string) which you can feed into to_expr
to elaborate the term into something that you can evaluate or create a goal from
To evaluate it, you have to write a routine by hand creating a value of type you're interested in from an expr
. It can probably be automated with some meta programming
To set a goal with your expression:
v <- mk_meta_var e, gs <- get_goals, set_goals $ v :: gs
Thanks! I will have to try this out.
@Jason Rute I'm very interested in any code you write for this (obviously). Please make it available either publicly or email me.
Sure, but I will warn you @Tim Daly that I am a hobbist, so I might not get around to it too quickly (or I might wake up tomorrow and want to give it a try :) ).
@Simon Hudon I got this far, but I think I am mixing the parser
and tactic
monads. Do you know what I need to do here?
def experiment (s : string) : lean.parser unit := do pe <- lean.parser.with_input interactive.types.texpr s, -- parser monad e <- to_expr pe.1, -- tactic monad v <- mk_meta_var e, gs <- get_goals, set_goals $ v :: gs, t <- target, trace t, -- should output the goal given by the string s return ()
@Tim Daly You might be interested also in this thread. For example, I made a python prototype of communicating with Lean using the Lean server.
Yes, that's a very annoying separation when you need to invoke the parser. You can invoke tactic from parser but not the other way around. Figuring out how to get the user to call your automation can be tricky. If you only want to call tactic from parser, you can use lean.parser.of_tactic
For the other way around, it depends on how you want to invoke the script. If you want to call it from a normal proof script (in a begin
end
block), then we use the parse
syntax. Otherwise, you can define a user_command
using the attribute user_command
and then you just write my_command .
at the top level and it will call your script
I don't think it is possible to use with_input
when using lean --run
So this:
meta def experiment (s : string) : lean.parser unit := do pe <- lean.parser.with_input interactive.types.texpr s, e <- lean.parser.of_tactic (tactic.to_expr pe.1), v <- lean.parser.of_tactic (tactic.mk_meta_var e), gs <- lean.parser.of_tactic (tactic.get_goals), lean.parser.of_tactic (tactic.set_goals $ v :: gs), t <- lean.parser.of_tactic tactic.target, lean.parser.of_tactic (tactic.trace t), return () run_cmd experiment "true"
is giving me an error at run_cmd
: "vm check failed: dynamic_cast<vm_State*>(to_external(o)) (possibly due to incorrect axioms, or sorry)". Maybe this is related to what Mario was talking about about not being able to use lean.parser.with_input
with lean --run
.
That's a bug, run_cmd
should only accept tactic
s. lean.parser
cannot be used outside of user-defined parser extensions (notations/commands/tactic params).
@Simon Hudon Can you point me to examples of what you mean by "the parse
syntax" or using user_command
? (Or does Mario's comment mean what I want to do is ultimately doomed to fail?)
While it is fresh, can you file this run_cmd
issue? I'd like to make the error message better.
I wouldn't say your project is doomed. I would only say that you'll have to run your experiment while parsing / elaborating Lean files, not as a Lean program (with a main, etc)
Now about the user_command
idea (which I think is what you need):
setup_tactic_parser -- this is actually a user command too @[user_command] meta def my_command (meta_info : decl_meta_info) (_ : parse (tk "my_command")) : lean.parser unit := do parser.of_tactic $ trace "hello world" . my_command . -- prints "hello world"
Then if you want to user to write in an expression, you can do:
@[user_command] meta def my_command (meta_info : decl_meta_info) (_ : parse (tk "my_command")) : lean.parser unit := do e <- texpr, parser.of_tactic $ trace e . my_command 1 + 1 . -- prints "1 + 1"
(be sure not to forget the .
)
Then you can skip the part where you parse from a string. If you read the string from a file, this is where I would use the with_input
trick
While it is fresh, can you file this
run_cmd
issue? I'd like to make the error message better.
https://github.com/leanprover-community/mathlib/issues/1928
@Simon Hudon Thanks for all the help! I am wondering if I need to take a step back however. Maybe I don't want/need parsing of Lean code in the first place.
Can you explain a bit more how you'd like the user to call your program?
The issue should probably be on leanprover-community/lean
instead. I bet @Simon Hudon can transfer it over though.
Done
Good call @Bryan Gin-ge Chen
@Simon Hudon The user will be a machine and it will call lean --run my_program
and communicate via stdin and stdout. Specifically the user will send some string representing a theorem to be proved (more on that in a second) via stdin. The program will read that string in, convert it to an expression, make a goal of that type, apply a tactic (this may also be specified by the user, but for now I'm worried about the goal itself), and print (to stdout) whether the tactic succeeded and the resulting goal (in some serialization). This will be a loop. So the program waits for the next input. I'm starting to realize that it is better to directly serialize the expression than to directly parse Lean code. I was just about to ask on a new topic if there is a standard serialization of Lean expressions or if I should make my own?
For motivation, I'm trying to make a better and more reliable version of what I made here.
There I used the Lean server, but I think stdin and stdout of a running Lean program is better, faster, and more reliable.
I see. For serialization, have a look here: https://github.com/leanprover-community/lean/blob/ec1613aef1eee72e601f192b16740629c6d49690/library/system/io.lean
What imports will your lean program use? If it's a large environment, e.g. all of mathlib, you might still be better off with the server interface. There's overhead to building the environment even if the dependencies are precompiled. Keeping a single server instance going will avoid this.
It would be nice to try both. To be clear, I intend to keep either instance "going". If I use stdin/stdout, it will be in a loop.
@Simon Hudon That looks really promising! I need to upgrade Lean apparently to get that... Do you by chance know what the serialization looks like?
I don't remember what it looks like. I'll have a look
The serialization is not really legible. It's binary serialization format
Thanks Simon!
Ignoring the details of serialization for now (which have and could be solved in a number of ways), here is what I have in mind. I tested it (with dummy serializations). This code works (and is very fast to call from say Python).
import system.io open io meta def serialize_expr (e : expr) : string := sorry meta def deserialize_expr(s : string) : expr := sorry meta def apply_tactic_to_goal (t : tactic unit) (goal : expr) : tactic (list expr) := do -- set expression as goal v <- tactic.mk_meta_var goal, tactic.set_goals $ [v], -- run tactic on goal t, -- return results gs <- tactic.get_goals, return gs meta def read_eval_print (_ : unit) : io_core error (option unit) := do do -- get serialized expression from stdin expr_str ← get_line, let e := deserialize_expr expr_str, -- run tactic (skip tactic in this case) on goal gs ← io.run_tactic (apply_tactic_to_goal tactic.skip e), -- print serialized goals to stdout let goal_strs := gs.map serialize_expr, put_str (to_string goal_strs), return () meta def main : io unit := -- loop forever do iterate () read_eval_print, return ()
When I say fast, I mean that the first call is slow, but after that it is really fast compared to the lean server.
Of course this is a prototype. A better version needs error handling (and more features around selecting which tactics to apply).
@Rob Lewis I just discovered expr.to_raw_fmt
from your other post. https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/.3F.3F.3F/near/187757930 I don't suppose that hidden somewhere in Lean is a parser for this format (which takes a string of this format and converts it to an expr
)?
no
It's almost good enough that you can use it as lean surface syntax for an object of type expr
though (i.e. using the constructors directly)
expr.to_raw_fmt
is defined in lean though and it's a relatively short definition so you can modify it to suit your needs
Thanks Mario! I actually already have made my own expr
to string
function before I discovered this and made a parser too (although I haven't finished covering all the cases, like macros). I just thought it was better to use built-in tools when possible. Thanks!
Last updated: Apr 24 2020 at 19:02 UTC


Dimension Mode: to dimension a drawing
Select Dimension from MenuBar-Mode or
Press ~ or <shift>End from any GIN Mode:
Press Numeric Keys to execute:
0OptionsSetup options
1TickPuts an head on a line
2-2LineCreates a plain leader
3-3DimlineCreates a dimension entity plain
4-4ArrowCreates a dim. entity with arrow head
5-5WitnessCreates a witness line
6RadiusCreates a radius dim. + -->
7DiameterCreates a diameter dim. <--+-->
8-8 8 ArcCreates dim. arc between two lines
9ConvertConverts a line into a dim. segment
If you Nodal < edit a dimension line, the dimension number updates.
If you Cut _ a dimension line, the result is two dimension lines.