text stringlengths 14 5.77M | meta dict | __index_level_0__ int64 0 9.97k ⌀ |
|---|---|---|
Do you need to fit out a company fleet?
StoreVan creates fittings for small, medium and large company fleets. Thanks to our experience, professionalism and ability to create customised solutions, we have been able to satisfied the needs of companies in different industries.
Each design is carefully studied and analysed together with the customer by a dedicated team in each phase: from start to finish.
Thanks to our fully internal production system and the large spaces available, StoreVan is able to manage even large projects, respecting the forecast time-scales and working on each vehicle with precision and quality.
Each design can be customised: the customer's needs and possible solutions are assessed together with the customer during the initial phase in order to arrive at the perfect outfitted fleet. A 3D design is then created for the customer's approval. Once granted, this is then used to create an initial prototype. Production begins only once this prototype has been inspected and assessed.
The wide range of shelving systems and coatings, together with the many accessories available for vans, allow us to propose various different solutions and maintain an excellent quality/price ratio.
If you are a company and would like to find out more about outfitting company fleets, contact us now for a free personalised quotation. | {
"redpajama_set_name": "RedPajamaC4"
} | 7,068 |
package epoxide.lpa.rdbms.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Join {
Class<?>[] value();
On[] on() default {};
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 1,923 |
Q: Augment size of a tf.variable I am training an autoencoder by giving 2 placeholders that store the following:
x1 = [x1]
X = [x1,x2,x3...xn]
It holds that:
y1 = W*x1 + b_encoding1
Therefore, I have a variable named b_encoder1 (the b)
(When I print it I get: <tf.Variable 'b_encoder1:0' shape=(10,) dtype=float32_ref>)
But it also holds that:
Y = W*X + b_encoding1
The size of the second b_encoding1 has to be (10,n) intead of (10,). How can I augment it and pass it in tensorflow?
Y = tf.compat.v1.nn.xw_plus_b(X, W1, b_encoder1, name='Y')
The whole code looks like this:
x1 = tf.compat.v1.placeholder( tf.float32, [None,input_shape], name = 'x1')
X = tf.compat.v1.placeholder( tf.float32, [None,input_shape,sp], name = 'X')
W1 = tf.Variable(tf.initializers.GlorotUniform()(shape=[input_shape,code_length]),name='W1')
b_encoder1 = tf.compat.v1.get_variable(name='b_encoder1',shape=[code_length],initializer=tf.compat.v1.initializers.zeros(), use_resource=False)
K = tf.Variable(tf.initializers.GlorotUniform()(shape=[code_length,code_length]),name='K')
b_decoder1 = tf.compat.v1.get_variable(name='b_decoder1',shape=[input_shape],initializer=tf.compat.v1.initializers.zeros(), use_resource=False)
y1 = tf.compat.v1.nn.xw_plus_b(x1, W1, b_encoder1, name='y1')
Y = tf.compat.v1.nn.xw_plus_b(X, W1, b_encoder1, name='Y')
I also declare the loss function and so on and then train with:
with tf.compat.v1.Session() as sess:
sess.run(tf.compat.v1.global_variables_initializer())
for epoch_i in range(epochs):
for batch_i in range(number_of_batches):
batch_data = getBatch(shuffled_data, batch_i, batch_size)
sess.run(optimizer, feed_dict={x1: batch_data[:,:,0], X: batch_data})
train_loss = sess.run(loss, feed_dict={x1: aug_data[:,:,0], X: aug_data})
print(epoch_i, train_loss)
A: Please try:
b_encoding1 = tf.expand_dims(b_encoding1, axis = 1)
A: You can consider X as a batch of x. X can take in an arbitrary number of samples:
import tensorflow as tf
import numpy as np
X = tf.placeholder(shape=(None, 100), dtype=tf.float32)
W = tf.get_variable('kernel', [100,10])
b = tf.get_variable('bias',[10])
Y = tf.nn.xw_plus_b(X, W,b, name='Y')
with tf.Session() as sess:
sess.run(tf.global_variables_initializer()) # tf version < 1.13
out = sess.run(Y, {X: np.random.rand(128, 100)}) # here n=128
Note that dimension of bias b is still 10-D regardless value of n.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 5,884 |
{"url":"https:\/\/asiahk16prel.kattis.com\/problems\/boxes","text":"Asia Hong Kong Online Preliminary\n\n#### Start\n\n2016-09-10 05:00 UTC\n\n## Asia Hong Kong Online Preliminary\n\n#### End\n\n2016-09-10 10:30 UTC\nThe end is near!\nContest is over.\nNot yet started.\nContest is starting in -953 days 14:03:54\n\n5:30:00\n\n0:00:00\n\n# Problem BBoxes\n\nThere are $N$ boxes, indexed by a number from $1$ to $N$. Each box may (or not may not) be put into other boxes. These boxes together form a tree structure (or a forest structure, to be precise).\n\nYou have to answer a series of queries of the following form: given a list of indices of the boxes, find the total number of boxes that the list of boxes actually contain.\n\nConsider, for example, the following five boxes.\n\n\u2022 If the query is the list \u201c1\u201d, then the correct answer is \u201c5\u201d, because box 1 contains all boxes.\n\n\u2022 If the query is the list \u201c4 5\u201d, then the correct answer is \u201c2\u201d, for boxes 4 and 5 contain themselves and nothing else.\n\n\u2022 If the query is the list \u201c3 4\u201d, then the correct answer is \u201c2\u201d.\n\n\u2022 If the query is the list \u201c2 3 4\u201d, then the correct answer is \u201c4\u201d, since box 2 also contains box 5.\n\n\u2022 If the query is the list \u201c2\u201d, then the correct answer is \u201c3\u201d, because box 2 contains itself and two other boxes.\n\n## Input\n\nThe first line contains the integer $N$ ($1 \\leq N \\leq 200\\, 000$), the number of boxes.\n\nThe second line contains $N$\u00adintegers. The $i$th integer is either the index of the box which contains the $i$th box, or zero if the $i$th box is not contained in any other box.\n\nThe third line contains an integer $Q$ ($1 \\leq Q \\leq 100\\, 000$), the number of queries. The following $Q$ lines will have the following format: on each line, the first integer $M$ ($1 \\leq M \\leq 20$) is the length of the list of boxes in this query, then $M$ integers follow, representing the indices of the boxes.\n\n## Output\n\nFor each query, output a line which contains an integer representing the total number of boxes.\n\nSample Input 1 Sample Output 1\n5\n0 1 1 2 2\n5\n1 1\n2 4 5\n2 3 4\n3 2 3 4\n1 2\n\n5\n2\n2\n4\n3","date":"2019-04-21 19:03:54","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 1, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.3004649877548218, \"perplexity\": 738.9671206788006}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2019-18\/segments\/1555578532050.7\/warc\/CC-MAIN-20190421180010-20190421202010-00263.warc.gz\"}"} | null | null |
Q: Force line break between specific words in HTML table I am trying to set up a table for a survey using HTML-code. In some of the cells I have some text that I would like to seperate into three lines at a specific place in the text.
Name of education
Salary
Unemployment rate
All three lines should be in the same cell.
However, using a <pre></pre> tag, as suggested in this thread does not work for me.
Does anyone have a tip on how to do this?
A: You can use the <br /> or <br> tag (both works the same) to get multiple lines inside a cell.
below is an example:
td, tr, table {
border: 1px solid black;
border-collapse: collapse;
padding: 4px;
}
<table>
<tr>
<td>
Cell one
</td>
<td>
Hello, <br /> you can use <br />
the br tag to get <br />
multiple lines inside a cell.
</td>
</tr>
</table>
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 6,055 |
Is Our Unique Approach to FinTech Startup Acceleration Working as Well as Expected?
ValueStream Labs launched 16 months ago with the mission to discover and grow the entrepreneurial community in FinTech. At that time, we felt strongly that the Financial Services industry required a different approach from the traditional startup accelerator, and since then we've been continually encouraged by the positive reception we receive throughout the FinServ and startup communities.
We launched ValueStream based on a number of hypotheses about how we could best help both startups and investors in FinTech to prosper. We continually reexamine these hypotheses internally, as any good startup should, but today we want to also involve our community in this discussion. We hope this will give you a better view into how we uniquely add value to both the startups and financial institutions that we work with.
Hypothesis #1: We can facilitate numerous and valuable customer introductions for our companies, not by acting as sales reps, but by building a community of FinServ professionals who benefit from win-win interactions with early-stage companies.
Estimize formed a deep relationship with a multi-billion dollar financial institution that now uses Estimize across multiple teams, spanning both quantitative and fundamental research. And subsequently, a Director of Research at this institution became a sizable personal investor in Estimize's latest round.
Within one week of joining ValueStream's Program, Exitround had a positive meeting with a top 5 private equity firm to discuss multiple opportunities to work together. Both parties were immediately interested in continuing these conversations.
The co-founder of a top hedge fund has become an informal advisor to ChartIQ, helping the company to approach his own extensive network of hedge funds and prop trading firms.
And as our community continues to grow rapidly, both past and present companies in our Development Lab program will increasingly benefit from our unique access.
The reason this has worked so well is that we create a win-win interaction for both sides of the conversation, and an important element of this is building trust between ValueStream and the institutional finance community. FinServ professionals are extremely busy, and so it's no surprise that they can't always keep up with all of the latest innovations. To fill this gap, we act as a trusted advisor not just to our companies but also to the professionals and institutions that can become their customers. And since our compensation is in the form of equity rather than cash commissions, we avoid the conflict of interest inherent in typical sales pitches. We only work with the best companies with the highest chances of success, not just whomever can pay us.
Hypothesis #2: Funding isn't the most important component of an accelerator program for FinTech startups.
Traditional accelerators are focused on funding. Most make small investments into each and every company at the start of their programs. And during the programs, they put significant energy into preparing their companies for the all-important demo day that is the culmination of their programs, where companies present to a room full of VCs and media. This has been a highly effective approach for many types of startups.
But we don't think this approach works for early-stage FinTech that targets an institutional customer base. First, the VC appetite for investing in this segment of FinTech just isn't that high (yet) so the demo day should be focused on customer sourcing, not funding. And second, we don't find that money is the major concern for FinTech startups, at least not at the seed stage. Many founders have had successful finance careers and have access to sufficient capital personally or from colleagues and that allows them to defer raising capital for longer than other startups can.
What these companies need most is strategic support with customer and product development, and that is where we place the bulk of our focus. Rarely have we heard a startup say that it wouldn't work with us because we don't provide guaranteed capital as part of our Program.
But this doesn't mean that we ignore funding. Instead, we help funding to occur organically. As a company meets hundreds of FinServ professionals over the course of our Program, any of these customers or advisors could become an investor as well. We call this the Triple Threat Investor: an investor, advisor, and customer in one.
Hypothesis #3: Strategic angel investors from the FinServ industry add substantial value to FinTech startups.
The Tripe Threat Investor is somewhat unique to the FinServ industry, largely because it is one of the few industries where the average professional has both the income to be an accredited investor and the appetite for making investments1 of above-average risk.
ValueStream raised capital to invest in Estimize from a syndicate of strategic angel investors at Goldman Sachs, JP Morgan, KKR, PNC Bank, CME, NASDAQ, Microsoft, large financial technology vendors, buyside institutions and market making firms. These influential individuals now facilitate access to their own networks throughout the Financial Services industry. .
Hypothesis #4: We can provide FinTech investors with access to exclusive investment opportunities.
The unique value that our Development Lab Program and our network of FinTech angel investors adds to our portfolio companies allows us to gain equity exposure to exclusive cap tables. We receive both equity grants and investment rights in companies that already have an oversubscription of investment for their next rounds, and even in companies that may never need to raise capital again. We believe this unique exclusivity allows our investors (both ValueStream LLC's unitholders and investors in one of our venture syndicates) to access higher quality deal flow than ever before.
Estimize's latest round discussed in the previous section is a great example of this. Even though Estimize had numerous offers from VCs to fully fund this round, ValueStream was asked to participate, and so we invested with a $300,000 syndicate sourced from our community of strategic angel investors.
Hypothesis #5: We can accept new companies into the Development Lab Program at any time, not only on a set admissions schedule.
One other way that we differ greatly from traditional accelerator programs is that we do not structure our time and activities around classes of companies. Companies are free to apply when they are ready to work with us, and we will begin to work with them as soon as we feel we can give them the right amount of attention.
We don't have to wait to work with the best companies.
We never feel pressure to fill a class with subpar companies or companies that just might not be ready.
We have been able to work with later-stage companies that need very specific types of support rather than a standardized program curriculum.
For an outside observer, it may seem like an inefficient way to operate since we can't as easily leverage our activities across multiple companies simultaneously. Although this is true (though not as often as you might think), we believe the higher amount of one-on-one attention is going to build far greater value in our portfolio in the long run.
Hypothesis #6: There are a significant number of exciting FinTech startups to work with.
FinTech disruption is in its early innings, particularly on the institutional side, and the number of exciting startups is growing. Between introductions from our community and applications on our website and AngelList, we've heard from well over 600 companies in the past 16 months across all walks of FinTech. We've met with over 200 of these companies, and we are actively tracking several dozen that we find to be highly compelling.
But to date we've only accepted 5 companies into our Program. Now you may be thinking: why is ValueStream more exclusive than an Ivy League university?
First, our Program was initially focused only on working with companies that had finished building a product but that had not yet gained customer traction. This has been (and continues to be) our sweet spot, but we also keep meeting exciting companies that are past the stage of needing a structured accelerator curriculum, but that we know we can add tremendous value for nonetheless.
In order to increase our reach into the later-stage, we launched our Industry Access Program. This Program targets later-stage companies that need a minimal amount of handholding as they access our community. It is a win-win for everyone involved: our community will see even higher quality companies that have more polished products that can be adopted immediately, the participants in this Program can meaningfully change the trajectory of their sales efforts, and ValueStream can receive equity exposure and investment opportunities in a broader range of companies. The reaction to our Industry Access Program offering has been very positive and we will announce several new participants in the near future.
The second reason is that we simply choose not to work with companies that we don't think are or can be the best in their respective niches. This keeps us focused on maximizing the value of the companies that have the greatest chances of success, and it also helps us avoid diluting the trust we have built with our community. Unlike traditional accelerators that spread their bets widely to see what "sticks", we prefer to make larger, concentrated bets. | {
"redpajama_set_name": "RedPajamaC4"
} | 7,601 |
{"url":"https:\/\/ugc.aoe2.rocks\/scenarios\/triggers\/effects\/effects\/","text":"# Effects\n\nWritten by: Alian713\n\n## 1. What are effects?\u00b6\n\nEffects are one of the two basic elements of triggers (the other one being Conditions). They are essentially \"cheats\" in some sense, that allow you to change information about the game as the game is being played. All technologies in the game utilise effects to do what they are meant to do. Usually, a technology almost always uses multiple effects in combination to achieve its purposes. Examples of technologies and the effects they use will be given when the appropriate effects for them are encountered. Some examples of basic effects that can be used in the scenario editor are: Create Unit, Send Chat, Display Instructions etc.. To use effects,\n\n1. Create a trigger\n2. Add an effect to it.\n3. Pick the effect you wish to use from the effects list.\n4. Configure the settings of the effect as desired\n\nLets look at all the effects and their configurations one by one:\n\n## 2. Common Terminology\u00b6\n\nFeel free to skip these if you are already familiar with them\n\n### 2.1. Bug\u00b6\n\nAnything in the map that is not working as intended is a bug.\n\nHistorically, the term \"bug\" comes from physical bugs getting stuck in computers and causing them to malfunction back in the day when computers used to be the size of entire rooms.\n\nIn today's context, a bug in anything just means that its malfunctioning and not working as intended.\n\n### 2.2. Debugging\u00b6\n\nAttempting to find out the cause of the malfunction, and removing\/fixing that cause is known as debugging.\n\n### 2.3. Execution\u00b6\n\nExecuting a trigger means that we carry out its effects.\n\n## 3. Effects and How to Use Them\u00b6\n\n### 3.1. AI Script Goal\u00b6\n\nThis effect is used to communicate with the AI. An AI Trigger NUMBER set with this effect can be detected in an AI script using event-detected trigger NUMBER. The configurations for this effect are as follows:\n\n1. AI Script Goal: AI Trigger ID to set\n\n### 3.2. Acknowledge AI Signal\u00b6\n\nWhen set-signal is used in an AI file, this effect is used to unset it so it can be reused. This only works in Single Player games. Refer to the Acknowledge Multiplayer AI Signal effect for the multiplayer version of this effect. The configurations for this effect are as follows:\n\n1. AI Signal Value: The AI Signal ID to acknowledge\n\n### 3.3. Acknowledge Multiplayer AI Signal\u00b6\n\nWhen set-signal is used in an AI file, this effect is used to unset it so it can be reused. This only works in Multiplayer games. Refer to the Acknowledge AI Signal effect for the single player version of this effect.. The configurations for this effect are as follows:\n\n1. AI Signal Value: The AI Signal ID to acknowledge\n\n### 3.4. Activate Trigger\u00b6\n\nThis effect can be used to activate a trigger. The configurations for this effect are as follows:\n\n1. Trigger List: The trigger to activate\/deactivate\n\n### 3.5. Attack Move\u00b6\n\nThis effect can be used to command units of a given player to attack move to a location. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\n### 3.6. Change Civilization Name\u00b6\n\nThis effect can be used to change the name of the civilization of a player to any desired name. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n3. Message: The name\/message\/instruction to show on screen or the script call to execute\n\n### 3.7. Change Color Mood\u00b6\n\nThis effect can change the colour mood of the map. The configurations for this effect are as follows:\n\n1. Color Mood: This is the new colour mood to set\n2. Quantity: The amount to modify by or a timer\n\n### 3.8. Change Diplomacy\u00b6\n\nThis effect can be used to change the diplomacy stance of the soruce players with the target player. The configurations for this effect are as follows:\n\n1. Diplomacy Stance: The new diplomacy state\n2. Source Player: The player that is affected by the effect\n3. Target Player: This is the second player that is affected by the effect\n\n### 3.9. Change Object Armor\u00b6\n\nThis effect can be used to change the armour of existing units of a given player to the specified value. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by\n2. Armour or Attack Class: The Armour\/Attack Class to Modify\n3. Unit List 1: This is the unit to affect\n4. Source Player: The player that is affected by the effect\n5. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n6. Object Group: This is the class of units to effect\n7. Object Type: This is the type of the unit to effect\n8. Operation: Add, Subtract, Multiply or Divide the given quantity\n\nSome useful tricks with this effect:\n\n1. The quantity field on this effect has a maximum limit of 255, use multiple of these effects\/addition or multiplication operations to get a higher value\n\n### 3.10. Change Object Attack\u00b6\n\nThis effect can be used to change the attack of existing units of a given player to the specified value. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by\n2. Armour or Attack Class: The Armour\/Attack Class to Modify\n3. Unit List 1: This is the unit to affect\n4. Source Player: The player that is affected by the effect\n5. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n6. Object Group: This is the class of units to effect\n7. Object Type: This is the type of the unit to effect\n8. Operation: Add, Subtract, Multiply or Divide the given quantity\n\nSome useful tricks with this effect:\n\n1. The quantity field on this effect has a maximum limit of 255, use multiple of these effects\/addition or multiplication operations to get a higher value\n\n### 3.11. Change Object Civilization Name\u00b6\n\nThis effect can be used to change the civilization name of specified objects of a given player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n2. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.12. Change Object Cost\u00b6\n\nThis effect can be used to change the cost of a specifed unit for a particular player. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Food: The new food cost of the unit\/technology\n4. Wood: The new wood cost of the unit\/technology\n5. Stone: The new stone cost of the unit\/technology\n6. Gold: The new Gold cost of the unit\/technology\n\nSome useful tricks with this effect:\n\n1. Due to a current bug in the game, to properly set costs, you need to first set all the different wood, food, stone and gold costs of the tech to -1. Now using a 2nd effect you can set them to anything you like.\n2. Units in the game can only have a maximum of 2 different resource of costs.\n\n### 3.13. Change Object Description\u00b6\n\nThis effect can be used to change the description of a specifed unit for a particular player. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n4. Message: The name\/message\/instruction to show on screen or the script call to execute\n\nSome useful tricks with this effect:\n\n1. There are special keywords that are used to display certain information about an object in its description\n2. This is illustrated with the following example:\n 1 2 3 4 Build Trade Workshop () Allows you to buy special perks LoS: 4 \n3. Here, all the words in the angle brackets are replaced by those relevant statistics for the unit.\n\n### 3.14. Change Object HP\u00b6\n\nThis effect can be used to change the max HP of existing units of a given player to the specified value. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Unit List 1: This is the unit to affect\n3. Source Player: The player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n7. Operation: Add, Subtract, Multiply or Divide the given quantity\n\nSome useful tricks with this effect:\n\n1. Unit Max HP is capped at 32768. If you try to set it to a value above 32768, the unit will die because of an overflow.\n\n### 3.15. Change Object Icon\u00b6\n\nThis effect can be used to change the icon of existing units of a given player to the 2nd unit's icon. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Object Group: This is the class of units to effect\n5. Object Type: This is the type of the unit to effect\n6. Unit List 2: This is the second unit to affect\n\n### 3.16. Change Object Name\u00b6\n\nThis effect can be used to change the names of existing units of a given player to the specified name. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Message: The name\/message\/instruction to show on screen or the script call to execute\n\nSome useful tricks with this effect:\n\n1. This effect is mostly used to make markers, signs and waypoints which the player can select and read using units on the map\n\n### 3.17. Change Object Player Color\u00b6\n\nThis effect can be used to change the colour of specified objects of a given player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Player Color: The new colour of the unit\n\n### 3.18. Change Object Player Name\u00b6\n\nThis effect can be used to change the player name of specified objects of a given player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.19. Change Object Range\u00b6\n\nThis effect can be used to change the range of existing units of a given player to the specified value. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Unit List 1: This is the unit to affect\n3. Source Player: The player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n7. Operation: Add, Subtract, Multiply or Divide the given quantity\n\n### 3.20. Change Object Speed\u00b6\n\nThis effect can be used to change the speed of existing units of a given player to the specified value. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Unit List 1: This is the unit to affect\n3. Source Player: The player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\n### 3.21. Change Object Stance\u00b6\n\nThis effect can be used to change the stance of units of a given player to the given stance. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Object Group: This is the class of units to effect\n5. Object Type: This is the type of the unit to effect\n6. Attack Stance: Set the new stance of the unit, aggressive, defensive, stand ground or no attack\n\n### 3.22. Change Ownership\u00b6\n\nThis effect can be used to convert units of the source player to the target player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Target Player: This is the second player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n7. Flash Object: When this is enabled if the source and target players are the same, the selected object(s) will be flashed\n\nSome useful tricks with this effect:\n\n1. This effect can be used to make unconvertable gaia units. If a unit is originally owned by a different player, but is then converted to gaia using this effect, then that unit can no longer be converted by other players\n\n### 3.23. Change Player Name\u00b6\n\nThis effect can be used to change the name of a player to any desired name. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n3. Message: The name\/message\/instruction to show on screen or the script call to execute\n\n### 3.24. Change Research Location\u00b6\n\nThis effect can be used to change the research location of a specifed technology for a particular player to another unit. The research location of Loom is the Town Centre. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n3. Unit List 2: This is the second unit to affect\n4. Button Location: The location of the button for a unit or technology. This number is given by $$(row-1)\\times5+column$$. For example, the button location for the man at arms research in the barracks, which is in the 2nd row and 1st column, is given by $$(2-1)\\times5+1 = 6$$\n\n### 3.25. Change Technology Cost\u00b6\n\nThis effect can be used to change a technology's cost for a particular player. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n3. Food: The new food cost of the unit\/technology\n4. Wood: The new wood cost of the unit\/technology\n5. Stone: The new stone cost of the unit\/technology\n6. Gold: The new Gold cost of the unit\/technology\n\nSome useful tricks with this effect:\n\n1. Due to a current bug in the game, this effect changes the cost of the tech for all players\n2. Due to a current bug in the game, to properly set costs, you need to first set all the different wood, food, stone and gold costs of the tech to -1. Now using a 2nd effect you can set them to anything you like.\n3. Techs in the game can only have a maximum of 3 different resource of costs.\n\n### 3.26. Change Technology Description\u00b6\n\nThis effect can be used to change a technology's Description for a particular player. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n3. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n4. Message: The name\/message\/instruction to show on screen or the script call to execute\n\n### 3.27. Change Technology Name\u00b6\n\nThis effect can be used to change a technology's name for a particular player. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n3. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n4. Message: The name\/message\/instruction to show on screen or the script call to execute\n\n### 3.28. Change Technology Research Time\u00b6\n\nThis effect can be used to change a technology's research time for a particular player. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Source Player: The player that is affected by the effect\n3. Technology: The technology to affect\n\n### 3.29. Change Train Location\u00b6\n\nThis effect can be used to change the train location of a specifed unit for a particular player to another unit. The train location of Archers is Archery Range. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Unit List 2: This is the second unit to affect\n4. Button Location: The location of the button for a unit or technology. This number is given by $$(row-1)\\times5+column$$. For example, the button location for the man at arms research in the barracks, which is in the 2nd row and 1st column, is given by $$(2-1)\\times5+1 = 6$$\n\n### 3.30. Change Variable\u00b6\n\nThis effect can be used to change the value of a variable.. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Operation: Add, Subtract, Multiply or Divide the given quantity\n3. Variable: The variable to modify\n4. Message: The name\/message\/instruction to show on screen or the script call to execute\n\n### 3.31. Change View\u00b6\n\nThis effect can be used to move the camera of the player to a specified location. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Location: The location to create the unit on, or task a unit to\n3. Scroll: If this is enabled, changing the camera to a new position shows a scrolling animation from the position the player was previously on. If not enabled, the camera cuts to the new position wihout any animations.\n\nSome useful tricks with this effect:\n\n1. This effect can be used to bring attention of the player to a certain part of the map\n\n### 3.32. Clear Instructions\u00b6\n\nThis effect can be used to clear instructions on the screen before the timer for that instruction is up.. The configurations for this effect are as follows:\n\n1. Panel Position: Position 0 displays the instruction at the top, Position 1 displays the instruction in the middle of the top half of the screen and Position 2 displays the instruction at the bottom of the top half of the screen\n\nSome useful tricks with this effect:\n\n1. This effect is not used very often, since mostly you want your display instruction effects to display an instruction for the full length of time you specify\n\n### 3.33. Clear Timer\u00b6\n\nThis effect can be used to remove a displayed timer from the screen. The configurations for this effect are as follows:\n\n1. Timer: The time to display the message for\n\n### 3.34. Create Garrisoned Object\u00b6\n\nThis effect creates the unit chosen in the 2nd list inside the selected object or the unit chosen in the 1st list. The unit that the created unit is garrisoned inside does not need to be of the same player.. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Unit List 2: This is the second unit to affect\n\nSome useful tricks with this effect:\n\n1. The object you are creating garrisoned objects inside must have at least 1 garrison capacity and it must have the garrison ability\n\n### 3.35. Create Object\u00b6\n\nThis effect can be used to create a unit or building for the specified player. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Facet: The rotation of the created unit\n\n### 3.36. Damage Object\u00b6\n\nThis effect can be used to deal damage to units of a given player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Unit List 1: This is the unit to affect\n3. Source Player: The player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\nSome useful tricks with this effect:\n\n1. Dealing negative damage to an object will actually increase their HP beyond their max HP. Using this, a unit's HP can go over 32768.\n2. This is used in Tower Defence maps like ATD where units have over a million HP, since directly setting an object's HP to over 32768 using the change object HP effect would kill the object.\n\n### 3.37. Deactivate Trigger\u00b6\n\nThis effect can be used to activate a trigger. The configurations for this effect are as follows:\n\n1. Trigger List: The trigger to activate\/deactivate\n\n### 3.38. Declare Victory\u00b6\n\nThis effect can be used to grant victory or defeat to a specifed player. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Victory: If this is selected, the chosen player will win the game. If it is not selected, then the chosen player is defeated\n\n### 3.39. Disable Object Selection\u00b6\n\nThis effect makes specified units of the given player unselectable. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.40. Disable Technology Stacking\u00b6\n\nThis effect disables 256x tech mode for the specified technology and player. Refer to the Enable Technology Stacking effect. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n\n### 3.41. Disable Unit Targeting\u00b6\n\nThis effect makes it so that the specified units of the given player cannot be targeted (basically, you can't perform any right click actions from another unit on these units anymore) by other units. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.42. Display Instructions\u00b6\n\nThis effect can be used to display instructions on the screen. An icon of a unit may also be displayed along with the instructions. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n4. Display Time: The amount of time to display the instruction for\n5. Panel Position: Position 0 displays the instruction at the top, Position 1 displays the instruction in the middle of the top half of the screen and Position 2 displays the instruction at the bottom of the top half of the screen\n6. Play Sound: The sound to play\n7. Message: The name\/message\/instruction to show on screen or the script call to execute\n8. Sound Name: The name of the sound to play\n\nSome useful tricks with this effect:\n\n1. This effect is useful for making dialogue sequences\n2. When you do multiple display instruction effects on the same panel position at the same time, only the last instruction is shown. One panel position can only show one instruction at a time\n3. Adding a colour prefix to a messages will colour the message in chat. The message must begin with the colour prefix for it to work, and the colour prefix is not shown in the real message shown in chat. The following colour prefixes may be used:\n1. <BLUE>\n2. <RED>\n3. <GREEN>\n4. <YELLOW>\n5. <AQUA>\n6. <PURPLE>\n7. <GREY>\n8. <ORANGE>\n\n### 3.43. Display Timer\u00b6\n\nThis effect can be used to display a timer on screen. The configurations for this effect are as follows:\n\n1. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n2. Display Time: The amount of time to display the instruction for\n3. Time Unit: This specifies the unit of time used in the timer trigger. This can be seconds, minutes or years\n4. Timer: The time to display the message for\n5. Message: The name\/message\/instruction to show on screen or the script call to execute\n\nSome useful tricks with this effect:\n\n1. Adding a colour prefix to a messages will colour the message in chat. The message must begin with the colour prefix for it to work, and the colour prefix is not shown in the real message shown in chat. The following colour prefixes may be used:\n1. <BLUE>\n2. <RED>\n3. <GREEN>\n4. <YELLOW>\n5. <AQUA>\n6. <PURPLE>\n7. <GREY>\n8. <ORANGE>\n\n### 3.44. Enable Disable Object\u00b6\n\nThis effect can be used to enable\/disable any unit for a specific player. Note that sometimes, simply enabling a unit wont allow you to train them, because if it is not a default unit, the game doesn't know which building to train the unit in. Thus, A train location and a train button (Change Train Location), a cost (Change Object Cost), and optionally a discription (Change Object Description), of the unit are needed to also be set using additional effects to allow training the enabled unit.. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Enabled: If this is selected, the units\/technology is enabled if it is not already enabled\n\n### 3.45. Enable Disable Technology\u00b6\n\nThis effect can be used to enable\/disable any technology for a specific player. Similar to units, when a non default technology is enabled, its train location and button (Change Research Location), costs (Change Technology Cost), and optionally a description (Change Technology Description), must be set using additional effects for someone to research it.. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n3. Enabled: If this is selected, the units\/technology is enabled if it is not already enabled\n\n### 3.46. Enable Object Selection\u00b6\n\nThis effect makes specified units of the given player selectable. Refer to the Disable Object Selection effect. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.47. Enable Technology Stacking\u00b6\n\nThis effect enables 256x tech mode for the specified technology and player. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n\n### 3.48. Enable Unit Targeting\u00b6\n\nThis effect makes it so that the specified units of the given player can be targeted by other units. Refer to the Disable Unit Targeting effect. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.49. Freeze Object\u00b6\n\nThis effect can be used to stop units of a specific player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Object Group: This is the class of units to effect\n5. Object Type: This is the type of the unit to effect\n\n### 3.50. Heal Object\u00b6\n\nThis effect can be used to heal existing units of a given player by the specifed HP amount. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Unit List 1: This is the unit to affect\n3. Source Player: The player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\nSome useful tricks with this effect:\n\n1. This effect should not be used to simulate regeneration of HP of a unit similar to heroes, because there is another effect (Modify Attribute, change attribute regeneration rate to the desired quantity), that does exactly this\n\n### 3.51. Kill Object\u00b6\n\nThis effect can be used to kill certain units of the specified player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Object Group: This is the class of units to effect\n5. Object Type: This is the type of the unit to effect\n\n### 3.52. Lock Gate\u00b6\n\nThis effect can be used to lock an unlocked gate. The configurations for this effect are as follows:\n\n1. Selected Objects: The units to apply the effect to\n\n### 3.53. Modify Attribute\u00b6\n\nThis effect can be used to modify any attribute of a specified unit. Note that this effects the unit itself, not just existing units. This means that even new units created will have the modified attribute. Refer to the Attributes section of the guide to see a list of modifiable attributes and what each of them does. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Unit List 1: This is the unit to affect\n3. Source Player: The player that is affected by the effect\n4. Operation: Add, Subtract, Multiply or Divide the given quantity\n5. Attribute List: The attribute of a unit to modify\n\nSome useful tricks with this effect:\n\n1. Changing the Amount of 1st Resource of a unit changes its population requirement\n2. Since the quantity field cannot take in fractional values, to modify an attribute by a fractional amount, use the division operation to your advantage. for example setting a value to 0.1 is the same as first setting it to 1 and then dividing by 10. Similarly, adding a value of 0.5 is the same as first multiplying the initial value by 10, adding 5 and then dividing by 10.\n\n### 3.54. Modify Resource\u00b6\n\nThis effect can be used to modify the resource amounts of a particular player by specified amounts. Refer to the Resources section of the guide to see all the resources that can be modified and their purposes. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Tribute List: The resource to tribute\n3. Source Player: The player that is affected by the effect\n4. Operation: Add, Subtract, Multiply or Divide the given quantity\n\n### 3.55. Modify Resource By Variable\u00b6\n\nThis effect can be used to modify the resource amounts of a particular player by the value of another variable. Refer to the Resources section of the guide to see all the resources that can be modified and their purposes. The configurations for this effect are as follows:\n\n1. Tribute List: The resource to tribute\n2. Source Player: The player that is affected by the effect\n3. Operation: Add, Subtract, Multiply or Divide the given quantity\n4. Variable: The variable to modify\n\n### 3.56. Patrol\u00b6\n\nThis effect can be used to make units of a specified player patrol from one location to another. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\n### 3.57. Place Foundation\u00b6\n\nThis effect can be used to automatically place down a building foundation for a specific player. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n\n### 3.58. Play Sound\u00b6\n\nThis effect can be used to play a specified sound. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Location: The location to create the unit on, or task a unit to\n3. Sound Name: The name of the sound to play\n\nSome useful tricks with this effect:\n\n1. This effect is useful for playing a notification sound\n\n### 3.59. Remove Object\u00b6\n\nThis effect can be used to remove certain units of the specified player from the map. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Object Group: This is the class of units to effect\n5. Object Type: This is the type of the unit to effect\n\n### 3.60. Replace Object\u00b6\n\nThis effect can be used to replace existing units of a given player with another unit. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Target Player: This is the second player that is affected by the effect\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n7. Unit List 2: This is the second unit to affect\n\nSome useful tricks with this effect:\n\n1. This effect is widely used by unit upgrade technologies.\n2. Researching Man at Arms replaces all Militia with Man at Arms on the map\n3. Researching Crossbowman replaces all Archers with Crossbowmen on the map\n\n### 3.61. Research Technology\u00b6\n\nThis effect can automatically research a technology for the specified player.. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Technology: The technology to affect\n3. Force: If this is enabled, then the technology is researched even if the player's civilization does not have access to it\n\n### 3.62. Script Call\u00b6\n\nThis effect allows us to write or call functions from an XS Script. While the script call effect can be used to both call functions and write small scripts, it is advised to always use a function call and never use this effect for writing scripts. Refer to the XS Scripting. The configurations for this effect are as follows:\n\n1. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n2. Message: The name\/message\/instruction to show on screen or the script call to execute\n\n### 3.63. Send Chat\u00b6\n\nThis effect can be used to display messages in chat. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. String Id: This is the same as the Name String ID. Refer to Name String ID section of the guide\n3. Message: The name\/message\/instruction to show on screen or the script call to execute\n4. Sound Name: The name of the sound to play\n\nSome useful tricks with this effect:\n\n1. This effect is super useful for debugging. When you're unsure of which triggers in your map are executed at which point, adding one of these to that trigger will display a message on screen when it gets executed\n2. This effect can also be used to simulate chat between two players\n3. This effect should NOT be used to display instructions to players, because there is an effect that can be used specifically for that\n4. Duplicate messages are not shown\n5. Adding a colour prefix to a messages will colour the message in chat. The message must begin with the colour prefix for it to work, and the colour prefix is not shown in the real message shown in chat. The following colour prefixes may be used:\n1. <BLUE>\n2. <RED>\n3. <GREEN>\n4. <YELLOW>\n5. <AQUA>\n6. <PURPLE>\n7. <GREY>\n8. <ORANGE>\n\n### 3.64. Set Building Gather Point\u00b6\n\nThis effect can be used to set a gather point for specified buildings of a given player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n\n### 3.65. Set Player Visibility\u00b6\n\nThis trigger sets the visibility of the target player for the source player. The configurations for this effect are as follows:\n\n1. Source Player: The player that is affected by the effect\n2. Target Player: This is the second player that is affected by the effect\n3. Visibility State: The new visibility state\n\n### 3.66. Stop Object\u00b6\n\nThis effect can be used to stop units of a given player. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n4. Object Group: This is the class of units to effect\n5. Object Type: This is the type of the unit to effect\n\nThis effect can be used to task certain units of the specified player to (it basically simulates a right click at the specified location or unit) move to a specified locaiton, or perform an action on another unit. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\n### 3.68. Teleport Object\u00b6\n\nThis effect can be used to teleport units of a player from one area of the map to another location on the map. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\n### 3.69. Tribute\u00b6\n\nThis effect can be used to tribute resources from one player to another. The configurations for this effect are as follows:\n\n1. Quantity: The amount to modify by or a timer\n2. Tribute List: The resource to tribute\n3. Source Player: The player that is affected by the effect\n4. Target Player: This is the second player that is affected by the effect\n\nSome useful tricks with this effect:\n\n1. Tributing negative resources actually gives the source player the resource and deducts that amount from the target player\n2. Tributing negative resources from a player to gaia is a way to make silent resource trickles that do not make the tribute sound.\n\nThis effect can be used to ungarisson objects from a unit or building. The units affected by this effect are determined by the configurations of the effect. The configurations for this effect are as follows:\n\n1. Unit List 1: This is the unit to affect\n2. Source Player: The player that is affected by the effect\n3. Location: The location to create the unit on, or task a unit to\n4. Area: Only units on this selected area will be affected by the effect. If not set, units on the entire map are affected.\n5. Object Group: This is the class of units to effect\n6. Object Type: This is the type of the unit to effect\n\n### 3.71. Unlock Gate\u00b6\n\nThis effect can be used to unlock a locked gate. The configurations for this effect are as follows:\n\n1. Selected Objects: The units to apply the effect to","date":"2023-03-22 13:52:38","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 1, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.2846595346927643, \"perplexity\": 1572.1944225545303}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2023-14\/segments\/1679296943809.76\/warc\/CC-MAIN-20230322114226-20230322144226-00507.warc.gz\"}"} | null | null |
\section{Introduction}
The Tohoku-Pacific Ocean Earthquake happened in Japan on March 11, 2011,
and many people failed to evacuate and lost their lives due to severe attack by tsunamis.
From the viewpoint of disaster prevention from city planning and evacuation planning,
it has now become extremely important to establish effective evacuation planning systems against large scale disasters. In particular,
arrangements of tsunami evacuation buildings in large Japanese cities near the coast has become an urgent issue.
To determine appropriate tsunami evacuation buildings, we need to consider where evacuation buildings are assigned
and how to partition a large area into small regions so that one evacuation building is designated in each region.
This produces several theoretical issues to be considered.
Among them, this paper focuses on the location problem of multiple evacuation buildings
assuming that we fix the region such that all evacuees in the region are planned to evacuate to one of these buildings.
In this paper, we consider the simplest case for which the region consists of a single road.
In order to represent the evacuation, we consider the {\it dynamic} setting in graph networks, which was first introduced by Ford et al.~\cite{ff58}.
In a graph network under the dynamic setting, each vertex is given supply and each edge is given length and capacity which limits the rate of the flow into the edge per unit time.
We call such networks under the dynamic setting {\it dynamic networks}.
Dynamic networks can be considered in discrete and continuous models.
In discrete model, each input value is given as an integer.
Then each supply can be regarded as a set of evacuees, and edge capacity is defined as the maximum number of evacuees who can enter an edge per unit time.
On the other hand, in continuous model, each input value is given as a real number.
Then each supply can be regarded as fluid, and edge capacity is defined as the maximum amount of supply which can enter an edge per unit time.
In either model, we assume that all supply at a vertex is sent to the same sink.
{\it The $k$-sink location problem in dynamic networks} is defined as the problem which requires to find the optimal location of $k$ sinks in a given network
so that all supply of each vertex is sent to one of $k$ sinks in the shortest time.
For the 1-sink location problem in dynamic networks, the following two criteria can be naturally considered: {\it maximum cost criterion} and {\it total cost criterion}
(in static networks, these criteria correspond to the center problem and the median problem in facility location, respectively).
If a sink location $x$ is given in a dynamic network with discrete model,
the cost of $x$ for an evacuee is defined as the minimum time required to send him/her to $x$
(by taking into account the congestion).
Then two criteria are defined as the maximum of cost of $x$ for all evacuees and the sum of cost of $x$ for all evacuees, respectively.
Now let us turn to continuous model.
In continuous model, we define the {\it unit} as the infinitesimally small portion of supply,
then the cost is defined on each unit.
If a sink location $x$ is given in a dynamic network with continuous model,
the cost of $x$ for a unit is defined as the minimum time required to send the unit to $x$.
Also two criteria are defined as the maximum of cost of $x$ for all units and the sum of cost of $x$ for all units, respectively.
Definitions for $k$-sink location problem are given later.
Then, {\it the minimax} (resp. {\it minisum}) {\it $k$-sink location problem in dynamic networks} requires to find a $k$-sink location in a given dynamic network which minimizes the maximum (resp. total) cost.
Mamada et al.~\cite{mumf06} studied the minimax 1-sink location problem in dynamic tree networks with discrete model assuming that the sink must be located at a vertex,
and proposed an $O(n \log^2 n)$ time algorithm.
Higashikawa et al.~\cite{hgk14} also studied the same problem as \cite{mumf06} assuming that edge capacity is uniform and the sink can be located at any point in the network,
and proposed an $O(n \log n)$ time algorithm.
Recently, Higashikawa et al.~\cite{hgk14_2} studied the $k$-sink location problems in a dynamic path network with continuous model assuming that edge capacity is uniform and the sink can be located at any point in the network, and proved that the minimax problem can be solved in $O(kn \log n)$ time and the minisum problem can be solved in $O(kn^2)$ time.
In this paper, we study the same problems as \cite{hgk14_2}, and improve the previous time bounds:
$O(kn \log n)$ to $O(kn)$ for the minimax problem and $O(kn^2)$ to $O(n^2 \cdot \min \{ k, 2^{\sqrt{\log k \log \log n}}\})$ for the minisum problem.
\section{Minimax $k$-sink location problem}
\label{sec:minimax}
\subsection{Preliminaries}
\label{sec:mmp}
\subsubsection{Model definition:}
Let $P =(V, E)$ be an undirected path where $V = \{ v_1, v_2,$ $\ldots, v_n \}$ and $E = \{ e_1, e_2$, $\ldots, e_{n-1} \}$
such that $v_i$ and $v_{i+1}$ are endpoints of $e_i$ for $1 \le i \le n-1$.
Let $\mathcal{N} = (P, l, w, c, \tau)$ be a dynamic network
with the underlying graph being a path $P$,
$l$ is a function that associates each edge $e_i$ with positive length $l_i$,
$w$ is also a function that associates each vertex $v_i$ with positive weight $w_i$ representing the amount of supply at $v_i$,
$c$ is a positive constant representing the amount of supply which can enter an edge per unit time,
and $\tau$ is also a constant representing the time required by flow for traversing the unit distance.
We call such networks with path structures {\it dynamic path networks}.
In the following, we use the notation $P$ to denote the set of all points $p \in P$.
Also, for a vertex $v_i \in P$ with $1 \le i \le n$, we abuse the notation $v_i$ to denote the distance from $v_1$ to $v_i$,
and for a point $p \in P$, we abuse the notation $p$ to denote the distance from $v_1$ to $p$.
Then, we can regard $P$ as embedded on a real line such that $v_1 = 0$.
For two points $p, q \in P$ with $p < q$,
let $[p, q]$ (resp. $[p, q)$, $(p, q]$ and $(p, q)$) denote the part of $P$ which consists of all points $x \in P$
such that $p \le x \le q$ (resp. $p \le x < q$, $p < x \le q$ and $p < x < q$).
\subsubsection{$k$-sink location and $(k-1)$-divider:}
Suppose that $k$ sinks are located at points $x_1, x_2, \ldots, x_k \in P$ such that $x_1 \le x_2 \le \ldots \le x_k$, respectively.
Note that each sink can be located at any point in $P$.
In this paper, we assume that if we place a sink at a vertex, all supply of the vertex can finish the evacuation in no time.
So, without loss of generality, we assume $k \le n$
(otherwise, at least one sink can be located at each vertex).
Let ${\bm x} = (x_1, x_2, \ldots, x_k)$ which is a $k$-dimensional vector, called {\it $k$-sink location}.
Let us consider the optimal evacuation for a given ${\bm x}$.
In this paper, we assume that all units of a vertex are sent to the same sink.
We call a directed path along which all units of a vertex are sent to a sink {\it evacuation path}.
Then, any two evacuation paths never cross each other in an optimal evacuation
(otherwise, we can realize the better or equivalent evacuation by exchanging the two destinations of crossing evacuation paths).
Suppose that there exists only one vertex $v_j$ in $[x_i, x_{i+1}]$ and all units of the vertex are sent to $x_i$,
then $x_{i+1}$ can be moved to $v_{j+1}$ without increasing the cost of any unit.
Therefore, if we optimally locate $k$ sinks with $k \ge 2$, there exist at least two vertices in $[x_i, x_{i+1}]$ for any $i$ with $1 \le i \le k-1$, i.e.,
there exist two vertices $v_j$ and $v_{j+1}$ with $1 \le j \le n-1$ in $[x_i, x_{i+1}]$
such that all supplies on $[x_i, v_j]$ are sent to $x_i$ and
all supplies on $[v_{j+1}, x_{i+1}]$ are sent to $x_{i+1}$.
We call such a vertex $v_j$ {\it dividing vertex}.
For an integer $i$ with $1 \le i \le k-1$ with $k \ge 2$, let $d_i$ be an index of the dividing vertex in $[x_i, x_{i+1})$.
By the above discussion, $d_{i-1}+1 \le d_i$ holds for $1 \le i \le k$ where $d_0 = -1$ and $d_k = n$.
Let ${\bm d} = (d_1, d_2, \ldots, d_{k-1})$ which is a $(k-1)$-dimensional vector, called {\it $(k-1)$-divider}.
For a given ${\bm d}$, we need only consider ${\bm x}$ such that $x_i $ is given on $[v_{d_{i-1}+1}, v_{d_i}]$ for $1 \le i \le k$, where $d_0 = 0$ and $d_k = n$.
\subsubsection{Problem definition:}
For given ${\bm x}$ and ${\bm d}$,
and also for an integer $i$ with $1 \le i \le k$, let $\Theta_i({\bm x}, {\bm d})$ denote the minimum time required to send all supplies on $[v_{d_{i-1}+1}, v_{d_i}]$ to $x_i$, where $d_0 = 0$ and $d_k = n$.
Letting $\Theta({\bm x}, {\bm d}) = \max \{ \Theta_i({\bm x}, {\bm d}) \mid 1 \le i \le k \}$, the minimax $k$-sink location problem is defined as follows:
\begin{eqnarray}
{\rm Q_{minimax}}(P): \ {\rm minimize} \ \left\{ \Theta({\bm x}, {\bm d}) \mid {\bm x} \in P^k \ {\rm and} \ {\bm d} \in \{ 1, 2, \ldots, n \}^{k-1} \right\}.
\label{pro1}
\end{eqnarray}
\subsection{Recursive formulation}
We now consider a subproblem of the above mentioned problem:
for some integers $i, j$ and $p$ with $1 \le i \le j \le n$ and $1 \le p \le k$, the $p$-sink location problem in $[v_i, v_j]$.
For $[v_i, v_j]$, let ${\bm x}^*(p, i, j)$ denote the optimal $p$-sink location and ${\bm d}^*(p, i, j)$ denote the optimal $(p-1)$-divider.
Note that ${\bm x}^*(p, i, j)$ is a $p$-dimensional vector and ${\bm d}^*(p, i, j)$ is also a $(p-1)$-dimensional vector,
so ${\bm d}^*(p, i, j)$ is not defined for $p=1$.
Also, let ${\sf OPT}(p, i, j)$ denote the optimal cost of $p$-sink location in $[v_i, v_j]$,
i.e., the minimum time required to send all supplies on $[v_i, v_j]$ divided by ${\bm d}^*(p, i, j)$ to ${\bm x}^*(p, i, j)$.
Note that if $p \ge j-i+1$ holds, the optimal sink location is trivial, i.e., ${\sf OPT}(p, i, j) = 0$.
Next, we show the recursive formula of ${\sf OPT}(p, i, j)$.
For integers $i, j$ and $p$ with $1 \le i \le j \le n$ and $1 \le p \le k-1$,
let us consider the optimal $(p+1)$-sink location and $p$-divider for $[v_i, v_j]$, i.e., ${\bm x}^*(p+1, i, j)$ and ${\bm d}^*(p+1, i, j)$.
Since any two evacuation paths never cross each other in an optimal evacuation,
there exists an integer $h$ with $i \le h \le j-1$ such that
all supplies on $[v_{h+1}, x_j]$ are sent to the rightmost sink
and all supplies on $[x_i, v_h]$ are sent to the other $k$ sinks.
Thus, we have the following recursion:
\begin{eqnarray}
{\sf OPT}(p+1, i, j) = \min_{i \le h \le j-1} \max \{ {\sf OPT}(p, i, h), {\sf OPT}(1, h+1, j) \}.
\label{eq0.0}
\end{eqnarray}
Here, let $d$ be an integer which minimizes the maximum of ${\sf OPT}(p, i, h)$ and ${\sf OPT}(1, h+1, j)$ on $i \le h \le j-1$:
\begin{eqnarray}
d = \operatornamewithlimits{argmin}_{i \le h \le j-1} \max \{ {\sf OPT}(p, i, h), {\sf OPT}(1, h+1, j) \}.
\label{eq0.1}
\end{eqnarray}
Then, ${\bm x}^*(p+1, i, j)$ and ${\bm d}^*(p+1, i, j)$ can be represented by using $d$ as follows:
\begin{eqnarray}
{\bm x}^*(p+1, i, j) &=& ({\bm x}^*(p, i, d), {\bm x}^*(1, d+1, j)), \label{eq0.2} \\
{\bm d}^*(p+1, i, j) &=& ({\bm d}^*(p, i, d), d). \label{eq0.3}
\end{eqnarray}
\subsection{Known properties of 1-sink location problem}
Here, we introduce the properties of 1-sink location problem, which were explicitly shown in \cite{hgk14_2} (based on \cite{chknsx13,hacgknsx14}).
For fixed integers $i$ and $j$ with $1 \le i \le j \le n$, let us consider how to compute the optimal 1-sink location in $[v_i, v_j]$.
Suppose that a sink is located at a point $x$ in $[v_i, v_j]$.
Let $\Theta_{i, j}(x)$ denote the minimum time required to send all supplies on $[v_i, v_j]$ to $x$.
Here, let $L_i(x)$ (resp. $R_j(x)$) denote the minimum time required to send all supplies on $[v_i, x]$ (resp. $[x, v_j]$) to $x$ where $L_i(v_i) = 0$ and $R_j(v_j) = 0$.
Then, $\Theta_{i, j}(x)$ is the maximum of $L_i(x)$ and $R_j(x)$,
i.e.,
\begin{eqnarray}
\Theta_{i, j}(x) = \max \{ L_i(x), R_j(x) \}. \label{eq4}
\end{eqnarray}
For discrete model, Kamiyama et al. \cite{kkt06} showed that
$L_i(x)$ and $R_j(x)$ are expressed as follows:
\begin{eqnarray*}
L_i(x) &=& \max_l \left\{ \tau(x - v_l) + \bigg\lceil \frac{\sum_{i \le h \le l} w_h}{c} \bigg\rceil - 1 \ \bigg| \ v_l \in [v_i, x) \right\}, \\
R_j(x) &=& \max_l \left\{ \tau(v_l - x) + \bigg\lceil \frac{\sum_{l \le h \le j} w_h}{c} \bigg\rceil - 1 \ \bigg| \ v_l \in (x, v_j] \right\}.
\end{eqnarray*}
From these, we can immediately develop the formulae for continuous model as follows:
\begin{eqnarray}
L_i(x) &=& \max_l \left\{ \tau(x - v_l) + \frac{\sum_{i \le h \le l} w_h}{c} \ \bigg| \ v_l \in [v_i, x) \right\}, \label{eq3.1} \\
R_j(x) &=& \max_l \left\{ \tau(v_l - x) + \frac{\sum_{l \le h \le j} w_h}{c} \ \bigg| \ v_l \in (x, v_j] \right\}. \label{eq3.2}
\end{eqnarray}
Note that $L_i(x)$ (resp. $R_j(x)$) is a piecewise linear strictly increasing (resp. decreasing) function of $x$.
Therefore, a function $\Theta_{i, j}(x)$ is unimodal in $x$, and there exists the unique point which minimizes $\Theta_{i, j}(x)$, they is, ${\bm x}^*(1, i, j)$.
Then, as \cite{chknsx13,hacgknsx14,hgk14_2} showed, we immediately have the following claim.
\begin{clm}
For any integers $i$ and $j$ with $1 \le i \le j \le n$ and a point $x \in [v_i, v_j]$, \\
{\rm (i)} if $L_i(x) \le R_j(x)$ holds, ${\bm x}^*(1, i, j) \ge x$ holds, and \\
{\rm (ii)} if $L_i(x) \ge R_j(x)$ holds, ${\bm x}^*(1, i, j) \le x$ holds.
\label{clm2}
\end{clm}
In the following, when $x$ is at a vertex $v_t$ with $i \le t \le j$,
we use the notation $L(i, t)$ (resp. $R(t, j)$) to denote the value $L_i(v_t)$ (resp. $R_j(v_t)$).
Then, we have the following claim (which was also shown in \cite{chknsx13,hacgknsx14,hgk14_2}).
\begin{clm}
For given integers $i$ and $j$ with $1 \le i \le j \le n$,
suppose that for the interval $[v_l, v_{l+1}]$ with $i \le l \le j-1$, $L(i, l) \le R(l, j)$ and $L(i, l+1) \ge R(l+1, j)$ hold,
and let $\alpha^*$ denote the solution to an equation for $\alpha$: $R(l, j) - \alpha\tau(v_{l+1} - v_l) = L(i, l+1) - (1 - \alpha)\tau(v_{l+1} - v_l)$.
Then, \\
{\rm (i)} if $1 \le \alpha^* \le 1$ holds, ${\bm x}^*(1, i, j)$ is a point dividing the interval $[v_l, v_{l+1}]$ with the ratio of $\alpha^*$ to $1-\alpha^*$
and ${\sf OPT}(1, i, j) = R(l, j) - \alpha^*\tau(v_{l+1} - v_l)$ holds, \\
{\rm (ii)} if $\alpha^* < 0$ holds, ${\bm x}^*(1, i, j) = v_l$ and ${\sf OPT}(1, i, j) = R(l, j)$ hold, and \\
{\rm (iii)} if $\alpha^* > 1$ holds, ${\bm x}^*(1, i, j) = v_{l+1}$ and ${\sf OPT}(1, i, j) = L(i, l+1)$ hold. \\
\label{clm2.1}
\end{clm}
\subsection{Key properties of $k$-sink location problem}
\label{sec:mmkp}
In this section, we show several key properties of the $k$-sink location problem.
Here,
for integers $p$ and $i$ with $2 \le p \le k$ and $2 \le i \le n$,
let $f_{p, i}(t)$ denote a function defined on $\{ t \in \mathbb{Z} \mid 1 \le t \le i-1 \}$:
\begin{eqnarray}
f_{p, i}(t) = \max \{ {\sf OPT}(p-1, 1, t), {\sf OPT}(1, t+1, i) \}.
\label{eq1}
\end{eqnarray}
Note that for fixed $p$ and $i$, ${\sf OPT}(p-1, 1, t)$ is monotonically increasing in $t$ and ${\sf OPT}(1, t+1, i)$ is monotonically decreasing in $t$.
Thus, we have the following claim.
\begin{clm}
For any integers $p$ and $i$ with $2 \le p \le k$ and $2 \le i \le n$,
function $f_{p, i}(t)$ is unimodal in $t$ on $1 \le t \le i-1$.
\label{clm1}
\end{clm}
Let $d_{p, i}$ be an integer which minimizes $f_{p, i}(t)$ for $1 \le t \le i-1$:
\begin{eqnarray}
d_{p, i} = \operatornamewithlimits{argmin}_{1 \le t \le i-1} f_{p, i}(t).
\label{eq1.1}
\end{eqnarray}
By Claim \ref{clm1}, there uniquely exists $d_{p, i}$.
By (\ref{eq0.2}) and (\ref{eq0.3}), we have
\begin{eqnarray}
{\bm x}^*(p, 1, i) &=& ({\bm x}^*(p-1, 1, d_{p, i}), {\bm x}^*(1, d_{p, i} + 1, i)), \label{eq2.1} \\
{\bm d}^*(p, 1, i) &=& ({\bm d}^*(p-1, 1, d_{p, i}), d_{p, i}). \label{eq2.2}
\end{eqnarray}
Then, we prove the following two lemmas.
\begin{lem}
For any integers $p$ and $i$ with $2 \le p \le k$ and $2 \le i \le n-1$,
$d_{p, i} \le d_{p, i+1}$ holds.
\label{lem1}
\end{lem}
\begin{lem}
For any integers $h, i, j$ and $l$ with $1 \le i \le j \le n$, $1 \le h \le l \le n$, $i \le h$ and $j \le l$,
${\bm x}^*(1, i, j) \le {\bm x}^*(1, h, l)$ holds.
\label{lem2}
\end{lem}
\subsubsection{Proof of Lemma \ref{lem1}:}
In order to prove Lemma \ref{lem1}, we first confirm a fundamental property.
\begin{clm}
For any integers $p$ with $1 \le p \le k$, and $h, i, j$ and $l$ with $1 \le h \le i \le j \le l \le n$,
${\sf OPT}(p, i, j) \le {\sf OPT}(p, h, l)$ holds.
\label{clm:mm1.1}
\end{clm}
We prove Lemma \ref{lem1} by contradiction:
there exist integers $p$ and $i$ with $2 \le p \le k$ and $2 \le i \le n-1$ such that
$d_{p, i} > d_{p, i+1}$ holds.
For ease of notation in the proof, we use the notations $A, B, C, D, E$ and $F$ as follows:
\begin{eqnarray}
\begin{array}{ll}
A = {\sf OPT}(p-1, 1, d_{p, i}), & B = {\sf OPT}(1, d_{p, i}+1, i), \\
C = {\sf OPT}(p-1, 1, d_{p, i+1}), & D = {\sf OPT}(1, d_{p, i+1}+1, i+1), \\
E = {\sf OPT}(1, d_{p, i+1}+1, i), & F = {\sf OPT}(1, d_{p, i}+1, i+1).
\end{array}
\label{eq:mm1.1}
\end{eqnarray}
From the assumption of $d_{p, i} > d_{p, i+1}$ and Claim \ref{clm:mm1.1}, we can derive the following inequalities:
\begin{eqnarray}
C &\le& A, \label{eq:mm1.5} \\
B &\le& E \le D, \label{eq:mm1.6} \\
B &\le& F \le D. \label{eq:mm1.7}
\end{eqnarray}
Since $d_{p, i}$ minimizes $f_{p, i}(t) = \max \{ {\sf OPT}(p-1, 1, t), {\sf OPT}(1, t+1, i) \}$ (refer to (\ref{eq1}) and (\ref{eq1.1})),
we have the following inequality:
\begin{eqnarray}
\max \{A, B \} \le \max \{ C, E \}.
\label{eq:mm1.2}
\end{eqnarray}
Also, without loss of generality, we assume that $d_{p, i+1}$ is maximized unless the cost increases.
By this assumption, we have the following inequality:
\begin{eqnarray}
\max \{C, D \} < \max \{ A, F \}.
\label{eq:mm1.3}
\end{eqnarray}
Then, we consider three cases:
[Case 1] $A \le B$; [Case 2] $D \le C$; [Case 3] $B < A$ and $C < D$. \\
\noindent
[Case 1]: By (\ref{eq:mm1.5}), (\ref{eq:mm1.7}) and the condition of $A \le B$, we have $C \le A \le F \le D$, which contradicts (\ref{eq:mm1.3}).\\
\noindent
[Case 2]: By (\ref{eq:mm1.5}), (\ref{eq:mm1.6}) and the condition of $D \le C$, we have $B \le E \le C \le A$.
By this and (\ref{eq:mm1.2}), we have $A \le C$.
Also, by (\ref{eq:mm1.5}), (\ref{eq:mm1.7}) and the condition of $D \le C$, we have $F \le D \le C \le A$.
By this and (\ref{eq:mm1.3}), we have $C < A$, which contradicts $A \le C$.\\
\noindent
[Case 3]: By (\ref{eq:mm1.2}) and the condition of $B < A$, we have
\begin{eqnarray}
A \le \max \{ C, E \}. \label{eq:mm1.8}
\end{eqnarray}
Also, by (\ref{eq:mm1.3}) and the condition of $C < D$, we have
\begin{eqnarray}
D < \max \{ A, F \}. \label{eq:mm1.9}
\end{eqnarray}
If $F \le A$ holds, we have $D < \max \{ C, E \}$ by (\ref{eq:mm1.8}) and (\ref{eq:mm1.9}), which contradicts the condition of $C < D$ or (\ref{eq:mm1.6}).
If $A < F$ holds, we have $D < F$ by (\ref{eq:mm1.9}), which contradicts (\ref{eq:mm1.7}).
\qed
\subsubsection{Proof of Lemma \ref{lem2}:}
In order to prove Lemma \ref{lem2}, we first confirm the following claim (refer to the definitions of (\ref{eq3.1}) and (\ref{eq3.2})).
\begin{clm}
{\rm (i)} For any integers $i$ and $j$ with $1 \le j \le i \le n$ and any points $x$ and $y$ with $v_i \le x \le y \le v_n$,
$L_i(x) \le L_j(x)$ and $L_i(x) \le L_i(y)$ hold.\\
{\rm (ii)} For any integers $i$ and $j$ with $1 \le i \le j \le n$ and any points $x$ and $y$ with $v_1 \le y \le x \le v_i$,
$R_i(x) \le R_j(x)$ and $R_i(x) \le R_i(y)$ hold.
\label{clm:mm2.1}
\end{clm}
We prove Lemma \ref{lem2} by contradiction:
there exist integers $h, i, j$ and $l$ with $1 \le i \le j \le n$, $1 \le h \le l \le n$, $i \le h$ and $j \le l$ such that
${\bm x}^*(1, i, j) > {\bm x}^*(1, h, l)$ holds.
By this assumption, we have the following inequality:
\begin{eqnarray}
i \le h \le {\bm x}^*(1, h, l) < {\bm x}^*(1, i, j) \le j \le l.
\label{eq:mm2.4}
\end{eqnarray}
For ease of notation in the proof, we use the notations $A, B, C, D, E, F, G$ and $H$ as follows:
\begin{eqnarray}
\begin{array}{ll}
A = L_i({\bm x}^*(1, i, j)), & B = R_j({\bm x}^*(1, i, j)), \\
C = L_h({\bm x}^*(1, h, l)), & D = R_l({\bm x}^*(1, h, l)), \\
E = L_i({\bm x}^*(1, h, l)), & F = R_j({\bm x}^*(1, h, l)), \\
G = L_h({\bm x}^*(1, i, j)), & H = R_l({\bm x}^*(1, i, j)).
\end{array}
\label{eq:mm2.1}
\end{eqnarray}
From (\ref{eq:mm2.4}) and Claim \ref{clm:mm2.1}, we can derive the following inequalities:
\begin{eqnarray}
C &\le& E \le A, \label{eq:mm2.5} \\
C &\le& G \le A, \label{eq:mm2.6} \\
B &\le& F \le D, \label{eq:mm2.7} \\
B &\le& H \le D. \label{eq:mm2.8}
\end{eqnarray}
Since ${\bm x}^*(1, i, j)$ and ${\bm x}^*(1, h, l)$ are the unique points which minimize $\Theta_{i, j}(x) = \max \{ L_i(x),$ $R_j(x)\}$ and $\Theta_{h, l}(x) = \max \{ L_h(x), R_l(x)\}$, respectively
(refer to (\ref{eq4})), we have the following inequalities:
\begin{eqnarray}
\max \{A, B \} < \max \{ E, F \}, \label{eq:mm2.2} \\
\max \{C, D \} < \max \{ G, H \}. \label{eq:mm2.3}
\end{eqnarray}
Then, we consider three cases:
[Case 1] $A \le B$; [Case 2] $D \le C$; [Case 3] $B < A$ and $C < D$. \\
\noindent
[Case 1]: By (\ref{eq:mm2.6}), (\ref{eq:mm2.8}) and the condition of $A \le B$, we have $C \le G \le H \le D$, which contradicts (\ref{eq:mm2.3}).\\
\noindent
[Case 2]: By (\ref{eq:mm2.5}), (\ref{eq:mm2.7}) and the condition of $D \le C$, we have $B \le F \le E \le A$, which contradicts (\ref{eq:mm2.2}).\\
\noindent
[Case 3]: By (\ref{eq:mm2.2}) and the condition of $B < A$, we have
\begin{eqnarray}
A < \max \{ E, F \}. \label{eq:mm2.9}
\end{eqnarray}
Also, by (\ref{eq:mm2.3}) and the condition of $C < D$, we have
\begin{eqnarray}
D < \max \{ G, H \}. \label{eq:mm2.10}
\end{eqnarray}
If $F \le E$ holds, we have $A < E$ by (\ref{eq:mm2.9}), which contradicts (\ref{eq:mm2.5}).
Also, if $G \le H$ holds, we have $D < H$ by (\ref{eq:mm2.10}), which contradicts (\ref{eq:mm2.8}).
If $E < F$ and $H < G$ hold, we have $A < F \le D < G$ by (\ref{eq:mm2.7}), (\ref{eq:mm2.9}) and (\ref{eq:mm2.10}),
that is, $A < G$ holds, which contradicts (\ref{eq:mm2.6}).
\qed
\subsection{Algorithm based on dynamic programming}
\label{sec:mma}
The algorithm basically computes ${\sf OPT}(1, 1, 1)$, $\ldots$, ${\sf OPT}(1, 1, n)$, ${\sf OPT}(2, 1, 1)$, $\ldots$, ${\sf OPT}(2, 1, n)$, $\ldots$, ${\sf OPT}(k, 1, 1)$, $\ldots$, ${\sf OPT}(k, 1, n)$ in this order.
For some integers $p$ and $i$ with $2 \le p \le k$ and $2 \le i \le n$,
let us consider how to obtain ${\sf OPT}(p, 1, i)$.
Actually, in order to obtain ${\sf OPT}(p, 1, i)$, the algorithm needs ${\sf OPT}(p-1, 1, l)$ for $l = 1, 2, \ldots, n$ and ${\sf OPT}(p, 1, i-1)$, which are supposed to have been obtained.
By (\ref{eq0.0}), (\ref{eq1}) and (\ref{eq1.1}), we have
\begin{eqnarray}
{\sf OPT}(p, 1, i) = f_{p, i}(d_{p, i}) = \max \{ {\sf OPT}(p-1, 1, d_{p, i}), {\sf OPT}(1, d_{p, i}+1, i) \}. \label{eq8}
\end{eqnarray}
Here, we assumed that ${\sf OPT}(p-1, 1, d_{p, i})$ has already been obtained.
Thus, in order to obtain ${\sf OPT}(p, 1, i)$, we only need to compute ${\sf OPT}(1, d_{p, i} + 1, i)$.
Recall that $d_{p, i}$ is the unique point which minimizes function $f_{p, i}(t)$ (refer to (\ref{eq1}) and (\ref{eq1.1})).
Now, the algorithm knows where $d_{p, i-1}$ exists, and by Lemma \ref{lem1}, $d_{p, i-1} \le d_{p, i}$ holds.
So the algorithm starts to compute $f_{p, i}(t)$ for $t=d_{p, i-1}$,
and continues to compute in ascending order of $t$, as will be shown below.
Note that function $f_{p, i}(t)$ is unimodal in $t$ by Claim \ref{clm1},
which implies that $f_{p, i}(t)$ is strictly decreasing until $t=d_{p, i}$.
Thus, if the algorithm reaches the first integer $t^* \ge d_{p, i-1}$ such that $f_{p, i}(t^*) \le f_{p, i}(t^*+1)$,
it outputs $t^*$ as $d_{p, i}$.
Then, the algorithm also outputs $f_{p, i}(t^*)$ as ${\sf OPT}(p, 1, i)$.
\subsubsection{Computation of $f_{p, i}(t)$ for $t = d_{p, i-1}$:}
As above mentioned, the algorithm first computes $f_{p, i}(t)$ with $t = d_{p, i-1}$ which is defined as follows:
\begin{eqnarray}
f_{p, i}(d_{p, i-1}) = \max \{ {\sf OPT}(p-1, 1, d_{p, i-1}), {\sf OPT}(1, d_{p, i-1}+1, i) \}. \label{eq11}
\end{eqnarray}
Since the algorithm has already obtained ${\sf OPT}(p-1, 1, d_{p, i-1})$,
we only need to compute ${\sf OPT}(1, d_{p, i-1}+1, i)$.
To do this, we actually need to find ${\bm x}^*(1, d_{p, i-1}+1, i)$.
On the other hand, the algorithm has already obtained ${\sf OPT}(p, 1, i-1)$ as follows:
\begin{eqnarray}
{\sf OPT}(p, 1, i-1) = \max \{ {\sf OPT}(p-1, 1, d_{p, i-1}), {\sf OPT}(1, d_{p, i-1}+1, i-1) \}, \label{eq12}
\end{eqnarray}
which implies that ${\bm x}^*(1, d_{p, i-1}+1, i-1)$ has been obtained.
By Lemma \ref{lem2}, ${\bm x}^*(1, d_{p, i-1}+1, i-1) \le {\bm x}^*(1, d_{p, i-1}+1, i)$ holds.
Let $l$ and $l'$ be the indices of vertices
such that ${\bm x}^*(1, d_{p, i-1}+1, i-1) \in [v_{l}, v_{l+1}]$ with $d_{p, i-1}+1 \le l \le i-2$
and ${\bm x}^*(1, d_{p, i-1}+1, i) \in [v_{l'}, v_{l'+1}]$ with $d_{p, i-1}+1 \le l' \le i-1$, respectively (see Figure \ref{fig1}).
\begin{figure}[h]
\centering
\includegraphics[width=70mm,clip]{fig1c.eps}
\caption{Illustrations of ${\bm x}^*(1, d_{p, i-1}+1, i-1)$ and ${\bm x}^*(1, d_{p, i-1}+1, i)$}
\label{fig1}
\end{figure}
By Claim \ref{clm2}, for any interval $[v_h, v_{h+1}]$ with $d_{p, i-1}+1 \le h \le i-1$, there exists ${\bm x}^*(1, d_{p, i-1}+1, i)$ in $[v_h, v_{h+1}]$
if $L(d_{p, i-1}+1, h) \ge R(h, i)$ and $L(d_{p, i-1}+1, h+1) \le R(h+1, i)$ hold.
Therefore, if we maintain the data structure so that we can compute these values,
the algorithm can test if there exists ${\bm x}^*(1, d_{p, i-1}+1, i) \in [v_h, v_{h+1}]$ or not
(what the data structure is or how we can maintain and use it will be explained in the next subsection).
Then, the algorithm starts to test for $h=l$,
and continues to test in ascending order of $h$.
If an interval where ${\bm x}^*(1, d_{p, i-1}+1, i)$ exists, that is, $[v_{l'}, v_{l'+1}]$ is found,
then ${\bm x}^*(1, d_{p, i-1}+1, i)$ and ${\sf OPT}(1, d_{p, i-1}+1, i)$ can be computed in $O(1)$ time by Claim \ref{clm2.1}.
\subsubsection{Computation of $f_{p, i}(t)$ for $t \ge d_{p, i-1}+1$:}
Now, suppose that for an integer $t$ with $t \ge d_{p, i-1}$,
the algorithm has already obtained $f_{p, i}(t)$, that is, ${\bm x}^*(1, t+1, i)$ and ${\sf OPT}(1, t+1, i)$.
For an integer $t$ with $t \ge d_{p, i-1}$, let $l(t+1)$ be the index of a vertex with $t+1 \le l(t+1) \le i-1$
such that ${\bm x}^*(1, t+1, i) \in [v_{l(t+1)}, v_{l(t+1)+1}]$.
Note that $l(t+1)$ has also been obtained (see Figure \ref{fig2}).
Then, the computation of $f_{p, i}(t+1)$ comes down to finding $l(t+2)$ which is greater than or equal to $l(t+1)$,
and so, it can be treated in the similar manner as the computation of $f_{p, i}(d_{p, i-1})$.
\begin{figure}[h]
\centering
\includegraphics[width=70mm,clip]{fig2.eps}
\caption{Illustrations of ${\bm x}^*(1, t+1, i)$ and ${\bm x}^*(1, t+2, i)$}
\label{fig2}
\end{figure}
\subsection{How to compute $L(\alpha, \beta)$ and $R(\beta, \gamma)$}
\label{s2}
As mentioned in Section \ref{sec:mma}, in order to obtain ${\sf OPT}(p, 1, i)$ for fixed $p$ and all $i=p+1, p+2, \ldots, n$
(note that ${\sf OPT}(p, 1, i)$ $ = 0$ for $i=1, 2, \ldots, p$),
the algorithm computes $f_{p, p+1}(d_{p, p}),\ldots,f_{p, p+1}(d_{p, p+1})$,
$f_{p, p+2}(d_{p, p+1}),\ldots,f_{p, p+2}(d_{p, p+2}),\ldots,$
$f_{p, n}(d_{p, n-1}),\ldots,f_{p, n}(d_{p, n})$.
In this computation,
the algorithm actually computes $L(p, p),L(p, p+1),\ldots,L(p, l(p)),L(p+1, l(p)),L(p+1, l(p)+1),\ldots, L(p+1, l(p+1)),\ldots$
where $l(i)$ is the index of vertex with $p \le l(i) \le l(i+1) \le n$ for any $i \ge p$,
and also, $R(p, p),R(p, p+1),\ldots,R(p, r(p)),R(p+1, r(p)),R(p+1, r(p)+1),\ldots, R(p+1, r(p+1)),\ldots$
where $r(i)$ is the index of vertex with $p \le r(i) \le r(i+1) \le n$ for any $i \ge p$.
In order to compute $L(\alpha, \beta)$ and $R(\beta, \gamma)$ for any integers $\alpha, \beta$ and $\gamma$ with $1 \le \alpha \le \beta \le \gamma \le n$,
the algorithm maintains the specific data structures $D_L(\alpha, \beta)$ and $D_R(\beta, \gamma)$, respectively.
Depending on the situation, the algorithm updates $D_L(\alpha, \beta)$ to $D_L(\alpha+1, \beta)$ or $D_L(\alpha, \beta+1)$ and $D_R(\beta, \gamma)$ to $D_R(\beta+1, \gamma)$ or $D_R(\beta, \gamma+1)$.
We below show definitions of the two data structures and how to maintain these.
\subsubsection{Definition of $D_L(\alpha, \beta)$ and how to maintain $D_L(\alpha, \beta)$:}
In this discussion, we assume that $\alpha < \beta$ holds ($D_L(\alpha, \beta) = \emptyset$ when $\alpha = \beta$).
Let us consider the evacuation of all supplies on $[v_\alpha, v_\beta]$ to $v_\beta$.
We define the vertex indices $\rho_1, \ldots, \rho_e$ as
\begin{eqnarray}
\begin{array}{ll}
\rho_1 = \operatornamewithlimits{argmax} \left\{ \tau(v_\beta - v_j) + \frac{\sum_{l=\alpha}^j w_l}{c} \ \bigg| \ \alpha \le j < \beta \right\} & \mbox{and} \\
\rho_i = \operatornamewithlimits{argmax} \left\{ \tau(v_\beta - v_j) + \frac{\sum_{l=\rho_{i-1}+1}^j w_l}{c} \ \bigg| \ \rho_{i-1} < j < \beta \right\} & \mbox{for} \ 2 \le i \le e.
\end{array}
\label{eq13}
\end{eqnarray}
Note that $\rho_e = \beta-1$ holds.
For every integer $i$ with $1 \le i \le e$, we also define the value of $\rho_i$ as $\sigma_i = \sum \{ w_h \mid \rho_{i-1}+1 \le h \le \rho_i \}$ where $\rho_0+1 = \alpha$.
Here, we notice that for every integer $i$ with $2 \le i \le e$, the first unit of $v_{\rho_{i-1}}$ never be induced to stop at any vertex $v_j$ with $\rho_{i-1} < j < \beta$.
The data structure $D_L(\alpha, \beta)$ consists of the two sequences $(\rho_1, \ldots, \rho_e)$ and $(\sigma_1, \ldots, \sigma_e)$.
Note that we define the size of $D_L(\alpha, \beta)$ as $|D_L(\alpha, \beta)| = e$.
Recall that in continuous model, the cost is defined on each infinitesimal unit of supply,
i.e., the cost of $x$ for a unit is defined as the minimum time required to send the unit to $x$.
Here, we notice that for any integer $i$ with $2 \le i \le e$, the first unit of $v_{\rho_{i-1}}$ never be induced to stop at $v_{\rho_i}$.
Then, $L(\alpha, \beta)$ can be computed as
\begin{eqnarray}
L(\alpha, \beta) = \tau(v_\beta - v_{\rho_1}) + \frac{\sigma_1}{c}.
\label{eq14}
\end{eqnarray}
In order to update $D_L(\alpha, \beta)$ to $D_L(\alpha+1, \beta)$, the algorithm tests if $\rho_1 = \alpha$ holds or not.
If it holds, the algorithm sets $D_L(\alpha+1, \beta)$ so that
\begin{eqnarray}
\begin{array}{lllll}
\rho_i \leftarrow \rho_{i+1} \ & \mbox{and} \ & \sigma_i \leftarrow \sigma_{i+1} \ & \mbox{for} \ & 1 \le i \le e-1.
\end{array}
\label{eq15}
\end{eqnarray}
Otherwise, the algorithm sets $D_L(\alpha+1, \beta)$ so that
\begin{eqnarray}
\begin{array}{lllll}
\rho_1 \leftarrow \rho_1 \ & \mbox{and} \ & \sigma_1 \leftarrow \sigma_1 - w_\alpha, \ & \\
\rho_i \leftarrow \rho_i \ & \mbox{and} \ & \sigma_i \leftarrow \sigma_i \ & \mbox{for} \ & 2 \le i \le e.
\end{array}
\label{eq16}
\end{eqnarray}
On the other hand, in order to update $D_L(\alpha, \beta)$ to $D_L(\alpha, \beta+1)$, the algorithm first sets $\rho_{e+1} = \beta$ and $\sigma_{e+1} = w_\beta$.
Then, the algorithm repeatedly tests if $\tau(v_{\rho_{j+1}}-v_{\rho_j}) \le \sigma_{j+1}/c$ holds or not in descending order of $j$ from $j = e$.
If it holds, the algorithm sets $D_L(\alpha, \beta+1)$ so that
\begin{eqnarray}
\begin{array}{lllll}
\rho_i \leftarrow \rho_i \ & \mbox{and} \ & \sigma_i \leftarrow \sigma_i \ & \mbox{for} \ & 1 \le i \le j-1, \\
\rho_j \leftarrow \rho_{j+1} \ & \mbox{and} \ & \sigma_j \leftarrow \sigma_j + \sigma_{j+1}, \ &
\end{array}
\label{eq17}
\end{eqnarray}
until $\tau(v_{\rho_{e'+1}}-v_{\rho_{e'}}) > \sigma_{e'+1}/c$ holds for $j = e'$ with some integer $e' \le e$.
Let $t(\alpha, \beta)$ denote the number of such tests required to update $D_L(\alpha, \beta)$ to $D_L(\alpha, \beta+1)$, which can be represent as
\begin{eqnarray}
t(\alpha, \beta) = e - e' + 1 = |D_L(\alpha, \beta)| - |D_L(\alpha, \beta+1)| + 2.
\label{eq18}
\end{eqnarray}
Recall that in the computation to obtain ${\sf OPT}(p, 1, i)$ for fixed $p$ and all $i=p+1, p+2, \ldots, n$
for a given integer $\alpha$ with $p \le \alpha \le n-1$, the algorithm updates $D_L(\alpha, l(\alpha-1))$ to $D_L(\alpha, l(\alpha))$ where $l(p-1)=p$ and $l(n) = n$.
Let $T(\alpha)$ denote the total number of such tests required to update $D_L(\alpha, l(\alpha-1))$ to $D_L(\alpha, l(\alpha))$,
and $T$ denote the sum of $T(\alpha)$ for $p \le \alpha \le n-1$.
By (\ref{eq15}) and (\ref{eq16}), we have $|D_L(\alpha, l(\alpha))| \ge |D_L(\alpha+1, l(\alpha))|$, so the upper bound of $T$ can be obtained as
\begin{eqnarray}
T &=& \sum_{\alpha=p}^{n-1} T(\alpha) = \sum_{\alpha=p}^{n-1} \sum_{\beta=l(\alpha-1)}^{l(\alpha)} t(\alpha, \beta) \nonumber \\
&=& \sum_{\alpha=p}^{n-1} \big\{ |D_L(\alpha, l(\alpha-1))| - |D_L(\alpha, l(\alpha))| + 2l(\alpha) - 2l(\alpha-1) \big\} \nonumber \\
&\le& \sum_{\alpha=p}^{n-1} \big\{ |D_L(\alpha, l(\alpha-1))| - |D_L(\alpha+1, l(\alpha))| + 2l(\alpha) - 2l(\alpha-1) \big\} \nonumber \\
&=& |D_L(p, l(p-1))| + 2l(n-1) - 2l(p-1) \in O(n-p),
\label{eq19}
\end{eqnarray}
which implies that $t(\alpha, \beta)$ is amortized $O(1)$.
\subsubsection{Definition of $D_R(\beta, \gamma)$ and how to maintain $D_R(\beta, \gamma)$:}
In this discussion, we assume that $\beta < \gamma$ holds ($D_R(\beta, \gamma) = \emptyset$ when $\beta = \gamma$).
Let us consider the evacuation of all supplies on $[v_\beta, v_\gamma]$ to $v_\beta$.
We define the vertex indices $\mu_1, \ldots, \mu_f$ as
\begin{eqnarray}
\begin{array}{ll}
\mu_1 = \operatornamewithlimits{argmax} \left\{ \tau(v_j - v_\beta) + \frac{\sum_{l=j}^\gamma w_l}{c} \ \bigg| \ \beta < j \le \gamma \right\} & \mbox{and} \\
\mu_i = \operatornamewithlimits{argmax} \left\{ \tau(v_j - \mu_{i-1}) + \frac{\sum_{l=j}^\gamma w_l}{c} \ \bigg| \ \mu_{i-1} < j \le \gamma \right\} & \mbox{for} \ 2 \le i \le f.
\end{array}
\label{eq20}
\end{eqnarray}
Note that $\mu_f = \gamma$ holds.
For every integer $i$ with $1 \le i \le f$, we also define the value of $\mu_i$ as $W_i = \sum \{ w_h \mid \mu_i \le h \le n\}$.
Here, we notice that $v_{\mu_i}$ is the rightmost vertex of which the first unit never be induced to stop at any vertex $v_j$ with $\mu_{i-1} < j < \mu_i$ where $\mu_0 = \beta$.
In addition, let $os(\gamma) = \sum \{ w_h \mid \gamma+1 \le h \le n\}$.
The data structure $D_R(\beta, \gamma)$ consists of the offset value $os(\gamma)$ and the two sequences $(\mu_1, \ldots, \mu_f)$ and $(W_1, \ldots, W_f)$.
Note that we define the size of $D_R(\beta, \gamma)$ as $|D_R(\beta, \gamma)| = f$.
Then, $R(\beta, \gamma)$ can be computed as
\begin{eqnarray}
R(\beta, \gamma) = \tau(v_{\mu_1} - v_\beta) + \frac{W_1 - os(\gamma)}{c}.
\label{eq21}
\end{eqnarray}
In order to update $D_R(\beta, \gamma)$ to $D_R(\beta+1, \gamma)$, the algorithm tests if $\mu_1 = \beta+1$ holds or not.
If it holds, the algorithm sets $D_R(\beta+1, \gamma)$ so that
\begin{eqnarray}
\begin{array}{lllll}
\mu_i \leftarrow \mu_{i+1} \ & \mbox{and} \ & W_i \leftarrow W_{i+1} \ & \mbox{for} \ & 1 \le i \le f-1.
\end{array}
\label{eq22}
\end{eqnarray}
Otherwise, nothing changes, that is, the algorithm sets $D_R(\beta+1, \gamma) = D_R(\beta, \gamma)$.
On the other hand, in order to update $D_R(\beta, \gamma)$ to $D_R(\beta, \gamma+1)$, the algorithm first sets $\mu_{f+1} = \gamma+1$ and
compute $W_{f+1} = W_f - w_\gamma$ and $os(\gamma+1) = os(\gamma) - w_{\gamma+1}$.
Then, the algorithm repeatedly tests if
$\tau v_{\gamma+1} + w_{\gamma+1}/c \ge \tau v_{\mu_j} + (W_j - os(\gamma+1))/c$ holds or not in descending order of $j$ from $j = f$.
If it holds, the algorithm sets $D_R(\beta, \gamma+1)$ so that
\begin{eqnarray}
\begin{array}{lllll}
\mu_i \leftarrow \mu_i \ & \mbox{and} \ & W_i \leftarrow W_i \ & \mbox{for} \ & 1 \le i \le j-1, \\
\mu_{j} \leftarrow \mu_{j+1} \ & \mbox{and} \ & W_{j} \leftarrow W_{j+1}, \ &
\end{array}
\label{eq23}
\end{eqnarray}
until $\tau v_{\gamma+1} + w_{\gamma+1}/c < \tau v_{\mu_{f'}} + (W_{f'} - os(\gamma+1))/c$ holds for $j=f'$ with some integer $f' \le f$.
Let $t'(\beta, \gamma)$ denote the number of such tests required to update $D_R(\beta, \gamma)$ to $D_R(\beta, \gamma+1)$, which can be represent as
\begin{eqnarray}
t'(\beta, \gamma) = f - f' + 1 = |D_R(\beta, \gamma)| - |D_R(\beta, \gamma+1)| + 2,
\label{eq24}
\end{eqnarray}
which is amortized $O(1)$ by the same discussion as that for $t(\alpha, \beta)$ defined at (\ref{eq18}).
\begin{clm}
For any integers $\alpha, \beta$ and $\gamma$ with $1 \le \alpha \le \beta \le \gamma \le n$,
$L(\alpha, \beta)$ and $R(\beta, \gamma)$ can be computed in $O(1)$ time once $D_L(\alpha, \beta)$ and $D_R(\beta, \gamma)$ have been obtained.
\label{clm:ds1}
\end{clm}
\begin{clm}
{\rm (i)} For any integers $\alpha, \beta$ and $\gamma$ with $1 \le \alpha < \beta < r \le n$,
$L(\alpha, \beta)$ and $R(\beta, \gamma)$ can be updated to $L(\alpha+1, \beta)$ and $R(\beta+1, \gamma)$ in amortized $O(1)$ time, respectively. \\
{\rm (ii)} For any integers $\alpha, \beta$ and $\gamma$ with $1 \le \alpha \le \beta \le \gamma \le n-1$,
$L(\alpha, \beta)$ and $R(\beta, \gamma)$ can be updated to $L(\alpha, \beta+1)$ and $R(\beta, \gamma+1)$ in amortized $O(1)$ time, respectively.
\label{clm:ds2}
\end{clm}
\subsection{Time complexity}
As mentioned in Section \ref{sec:mma} and at the beginning of Section \ref{s2}, in order to obtain ${\sf OPT}(p, 1, i)$ for fixed $p$ and all $i=p+1, p+2, \ldots, n$,
$O(n)$ intervals are tested in total as follows:
in order to test if there exists ${\bm x}^*(1, i, j)$ in an interval $[v_h, v_{h+1}]$ or not,
the algorithm needs to confirm that $L(i, h) \ge R(h, j)$ and $L(i, h+1) \le R(h+1, j)$ hold by Claim \ref{clm2},
which takes $O(1)$ time once $D_L(i, h), D_L(i, h+1), D_R(h, j)$ and $D_R(h+1, j)$ have been obtained by Claim \ref{clm:ds1}.
Thus, such computations take $O(n)$ time in total.
On the other hand, let us consider the total time required to update the data structures.
For fixed $p$ and $i$, when ${\sf OPT}(p, 1, i-1)$ is obtained, the algorithm maintains $D_L(d_{p, i-1}+1, l), D_L(d_{p, i-1}+1, l+1), D_R(l, i-1)$ and $D_R(l+1, i-1)$,
where ${\bm x}^*(1, d_{p, i-1}+1, i-1)$ exists in $[v_l, v_{l+1}]$.
When ${\sf OPT}(p, 1, i)$ is obtained after repeatedly updating these four vertex sets,
the algorithm maintains $D_L(d_{p, i}+1, l'), D_L(d_{p, i}+1, l'+1), D_R(l', i)$ and $D_R(l'+1, i)$,
where ${\bm x}^*(1, d_{p, i}+1, i)$ exists in $[v_{l'}, v_{l'+1}]$.
Recall that $d_{p, i-1} \le d_{p, i}$ and $l \le l'$ hold by Lemmas \ref{lem1} and \ref{lem2}.
Thus, in order to obtain ${\sf OPT}(p, 1, i)$, the algorithm updates the four vertex sets $2(d_{p, i}-d_{p, i-1}) + 4(l'-l) + 2$ times,
and so, for fixed $p$ and all $i=1, 2, \ldots, n$, the algorithm updates these sets $O(n)$ times in total,
which takes $O(n)$ time by Claim \ref{clm:ds2}.
Therefore, ${\sf OPT}(p, 1, i)$ for all $i=1, 2, \ldots, n$ and $p=1, 2, \ldots, k$ can be obtained in $O(kn)$ time.
\begin{thm}
The minimax $k$-sink location problem in a dynamic path network with uniform capacity can be solved in $O(kn)$ time.
\label{thm:mm1}
\end{thm}
\section{Minisum $k$-sink location problem}
\label{sec:minisum}
In this section, an input graph of this problem is a dynamic path network defined in Section \ref{sec:minimax}.
As a preliminary step, let us consider the minisum 1-sink location problem.
\subsection{Properties of the minisum 1-sink location problem}
\label{sec:minisum1}
Suppose that a sink is located at a point $x \in P$ where $P$ is the input path with $n+1$ vertices.
In continuous model, the cost is defined on each infinitesimal unit of supply,
i.e., the cost of $x$ for a unit is defined as the minimum time required to send the unit to $x$.
Let $sum(x)$ denote the total cost of $x$, i.e., the sum of cost of $x$ for all units on $P$.
Here, let $sum_L(x)$ (resp. $sum_R(x)$) denote the sum of cost of $x$ for all units on $[v_1, x)$ (resp. $(x, v_n]$).
Then, $sum(x)$ is the maximum of $sum_L(x)$ and $sum_R(x)$, i.e.,
\begin{eqnarray}
sum(x) = sum_L(x) + sum_R(x). \label{eq:ms1}
\end{eqnarray}
Without loss of generality, we assume $sum_L(v_1) = 0$ and $sum_R(v_n) = 0$.
Now, suppose that $x$ is located in an open interval $(v_h, v_{h+1})$ with $1 \le h \le n-1$,
then let us explain how function $sum_L(x)$ is determined.
\subsubsection{Case 1:}
For every integer $i$ with $1 \le i \le h$, $\tau(v_i-v_{i-1}) > w_i/c$ holds.
In this case, the first unit of each vertex on $[v_1, v_h]$ can reach $x$ after leaving the original vertex
without being blocked due to the existence of other units at an intermediate vertex.
For an integer $i$ with $1 \le i \le h$, let $sum^i(x)$ denote the sum of cost of $x$ for all units of $v_i$.
Here, suppose that there are $\alpha$ units at $v_i$ with sufficiently large $\alpha$, i.e., the size of each unit is equal to $w_i/\alpha$,
and these units continuously reach $x$.
Then by (\ref{eq3.1}), the $l$-th unit finishes reaching $x$ at time $\tau(x-v_i) + l \cdot (w_i/\alpha)/c$.
Therefore, by taking $\alpha$ to the infinity, $sum^i(x)$ can be represented as follows:
\begin{eqnarray}
sum^i(x) &=& \lim_{\alpha \to \infty} \sum_{l=1}^\alpha \frac{w_i}{\alpha}\left( \tau(x-v_i) + l \cdot \frac{w_i}{\alpha} \cdot \frac{1}{c} \right) \nonumber \\
&=& \int_0^1 \left( w_i\tau(x-v_i) + \frac{{w_i}^2}{c} \cdot r \right) dr = w_i\tau(x-v_i) + \frac{{w_i}^2}{2c},
\end{eqnarray}
and also $sum_L(x)$ is represented as follows:
\begin{eqnarray}
sum_L(x) &=& \sum_{1 \le i \le h} sum^i(x) = \sum_{1 \le i \le h} \left( w_i\tau(x-v_i) + \frac{{w_i}^2}{2c} \right). \label{eq:ms2}
\end{eqnarray}
\subsubsection{Case 2:}
We define the vertex indices $\rho_1, \ldots, \rho_e$ as
\begin{eqnarray}
\begin{array}{ll}
\rho_1 = \operatornamewithlimits{argmax} \left\{ \tau(v_h - v_j) + \frac{\sum_{l=1}^j w_l}{c} \ \bigg| \ 1 \le j \le h \right\} & \mbox{and} \\
\rho_i = \operatornamewithlimits{argmax} \left\{ \tau(v_h - v_j) + \frac{\sum_{l=\rho_{i-1}+1}^j w_l}{c} \ \bigg| \ \rho_{i-1} < j \le h \right\} & \mbox{for} \ 2 \le i \le e.
\end{array}
\label{ms2.5}
\end{eqnarray}
Note that $\rho_e = h$ holds.
For every integer $i$ with $1 \le i \le e$, we also define the value of $\rho_i$ as $\sigma_i = \sum \{ w_h \mid \rho_{i-1}+1 \le h \le \rho_i \}$ where $\rho_0 = 0$.
Here, we notice that for every integer $i$ with $2 \le i \le e$, the first unit of $v_{\rho_{i-1}}$ never be induced to stop at any vertex $v_j$ with $\rho_{i-1} < j < \beta$.
Then, as with (\ref{eq:ms2}), $sum_L(x)$ is represented as follows:
\begin{eqnarray}
sum_L(x) &=& \sum_{1 \le i \le e} \left( \sigma_i\tau(x-\rho_i) + \frac{{\sigma_i}^2}{2c} \right). \label{eq:ms3}
\end{eqnarray}
Note that $\sum_{1 \le i \le h^*} \sigma_i = \sum_{1 \le i \le h} w_i$ holds.
\vspace{4mm}
We can compute $sum_R(x)$ in the similar manner as $sum_L(x)$.
Thus, for an open interval $(v_j, v_{j+1})$ with $1 \le j \le n-1$, function $sum(x)$ is linear in $x$ with slope $\tau(\sum_{1 \le i \le j} w_i - \sum_{j+1 \le i \le n} w_i)$.
Now let us consider an open interval $(v_j, v_{j+1})$ with $1 \le j \le n-1$ such that $\sum_{1 \le i \le j} w_i - \sum_{j+1 \le i \le n} w_i \ge 0$ holds.
Then, we can see that for any two points $p, q \in (v_j, v_{j+1})$ with $p < q$, $sum(p) \le sum(q)$ holds.
We will show that for sufficiently small $\epsilon > 0$, $sum(v_j) \le sum(v_j + \epsilon)$ holds.
We confirm
\begin{eqnarray}
sum_R(v_j) &=& sum_R(v_j + \epsilon) + \left( \sum_{j+1 \le i \le n} w_i \right) \cdot \tau \epsilon, \ \ \mbox{and} \label{eq:ms4} \\
sum_L(v_j + \epsilon) &\ge& sum_L(v_j) + \left( \sum_{1 \le i \le j} w_i \right) \cdot \tau \epsilon. \label{eq:ms5}
\end{eqnarray}
From (\ref{eq:ms4}), (\ref{eq:ms5}) and the assumption of $\sum_{1 \le i \le j} w_i - \sum_{j+1 \le i \le n} w_i \ge 0$,
we can derive $sum(v_j) \le sum(v_j + \epsilon)$.
In general, we have the following claim.
\begin{clm}
{\rm (i)} For an open interval $(v_j, v_{j+1})$ with $1 \le j \le n-1$ such that $\sum_{1 \le i \le j} w_i - \sum_{j+1 \le i \le n} w_i \ge 0$,
$sum(v_j) \le sum(p)$ holds where $p \in (v_j, v_{j+1})$. \\
{\rm (ii)} For an open interval $(v_j, v_{j+1})$ with $1 \le j \le n-1$ such that $\sum_{1 \le i \le j} w_i - \sum_{j+1 \le i \le n} w_i < 0$,
$sum(v_{j+1}) < sum(p)$ holds where $p \in (v_j, v_{j+1})$.
\label{clm:ms1}
\end{clm}
Let $x^*$ denote the optimal sink location which minimizes $sum(x)$.
Then, Claim \ref{clm:ms1} implies that $x^*$ is located at some vertex.
\begin{clm}
There exists $x^*$ at a vertex.
\label{clm:ms2}
\end{clm}
\subsection{Algorithm and time complexity for the minisum 1-sink location problem}
We propose the algorithm which can solve the minisum 1-sink location problem in a dynamic path network.
Basically, the algorithm first computes $sum_L(v_i)$ for $2 \le i \le n$ in ascending order of $i$, and next $sum_R(v_i)$ for $1 \le i \le n-1$ in descending order of $i$.
After computing all these values, $sum(v_i)$ can be computed and evaluated for $1 \le i \le n$ in $O(n)$ time.
Then, by Claim \ref{clm:ms2}, the optimal sink location $x^*$ is at a vertex which minimizes $sum(v_i)$ for $1 \le i \le n$.
Below, we show how to compute $sum_L(v_i)$ (computation of $sum_R(v_i)$ can be treated in the similar manner).
First, the algorithm sets $\rho_1 = 1$, $\sigma_1 = w_1$.
By (\ref{eq:ms2}), $sum_L(v_2)$ is computed in $O(1)$ time as follows:
\begin{eqnarray}
sum_L(v_1) &=& \sigma_1\tau(v_2-v_{\rho_1}) + \frac{{\sigma_1}^2}{2c}. \label{eq:ms6}
\end{eqnarray}
Now, suppose that for some integer $j$ with $1 \le j \le n-1$, $h(j)$ has been set as a non-negative integer,
$\rho_i$ and $\sigma_i$ have been obtained for all $i$ with $1 \le i \le h(j)$ in the same manner as mentioned in Case 2, Section \ref{sec:minisum1},
and $sum_L(v_j)$ has been already computed as follows:
\begin{eqnarray}
sum_L(v_j) &=& \sum_{1 \le i \le h(j)} \left( \sigma_i\tau(v_j-v_{\rho_i}) + \frac{{\sigma_i}^2}{2c} \right). \label{eq:ms7}
\end{eqnarray}
Let $W_{j-1} = \sum_{1 \le i \le j-1} w_i = \sum_{1 \le i \le h(j)} \sigma_i$ and suppose that $W_{j-1}$ has also been computed.
We then show how to compute $sum_L(v_{j+1})$.
The algorithm newly sets
\begin{eqnarray}
sum' = sum_L(v_j), \ \ \mbox{and} \ \ W' = W_{j-1}.
\end{eqnarray}
Next, the algorithm tests if $\tau(v_j-v_{\rho_i}) \le w_j/c$ for $1 \le i \le h(j)$ in descending order.
If so, it updates $sum'$ and $W'$ as follows:
\begin{eqnarray}
sum' \leftarrow sum' - \left( \sigma_i\tau(v_j-v_{\rho_i}) + \frac{{\sigma_i}^2}{2c} \right), \ \ \mbox{and} \ \ W' \leftarrow W' - \sigma_i,
\end{eqnarray}
and deletes $\rho_i$.
If the maximum integer $m$ such that $\tau(v_j-v_{\rho_m}) > w_j/c$ is found or $\tau(v_j-v_{\rho_1}) \le w_j/c$ is obtained, the algorithm stops testing.
In the former case, after the algorithm tests $h(j)-m+1$ times, $\rho_1, \ldots, \rho_{m}$ remain.
Then, after computing $W_j$ as $W_j = W_{j-1} + w_j$,
by (\ref{eq:ms3}), $sum_L(v_{j+1})$ can be computed as
\begin{eqnarray}
sum_L(v_{j+1}) = sum' &+& W'\tau(v_{j+1}-v_j) + \nonumber \\
& & \left( (W_j - W')\tau(v_{j+1}-v_j) + \frac{(W_j - W')^2}{2c} \right).
\end{eqnarray}
Also, for the next recursive step, the algorithm eventually sets
\begin{eqnarray}
h(j+1)=m+1, \ \ \rho_{m+1} = j, \ \ \mbox{and} \ \ \sigma_{m+1} = W_j - W'.
\end{eqnarray}
Since the algorithm tests $h(j)-m+1 = h(j)-h(j+1)+2$ times to compute $sum_L(v_{j+1})$,
it needs to test $\sum_{1 \le i \le n-1} (h(i)-h(i+1)+2)$ times to compute $sum_L(v_i)$ for $2 \le i \le n$.
Here, by $h(1) = 0$, we have
\begin{eqnarray}
\sum_{1 \le i \le n-1} \left( h(i)-h(i+1)+2 \right) = - h(n) + 2(n-1) = O(n).
\end{eqnarray}
\begin{lem}
The minisum 1-sink location problem in a dynamic path network with uniform capacity can be solved in $O(n)$ time.
\label{lem:ms1}
\end{lem}
\subsection{Extension to the minisum $k$-sink location problem}
Let ${\bm x} = (x_1, x_2, \ldots, x_k)$ representing a $k$-sink location given on $P$ and ${\bm d} = (d_1, d_2,$ $\ldots, d_{k-1})$ representing a $(k-1)$-divider given on $P$
(which are defined in the same manner as mentioned in Section \ref{sec:mmp}).
For a given ${\bm d}$, we need only consider ${\bm x}$ such that $x_i $ is given on $[v_{d_{i-1}+1}, v_{d_i}]$ for $1 \le i \le k$, where $d_0 = 0$ and $d_k = n$.
For given ${\bm x}$ and ${\bm d}$,
and for an integer $i$ with $1 \le i \le k$, let $sum_i({\bm x}, {\bm d})$ denote the sum of cost of $x_i$ for all supplies on $[v_{d_{i-1}+1}, v_{d_i}]$.
Letting $sum({\bm x}, {\bm d}) = \sum \{ sum_i({\bm x}, {\bm d}) \mid 1 \le i \le k \}$, the minisum $k$-sink location problem is defined as follows:
\begin{eqnarray}
{\rm Q_{minisum}}(P): \ {\rm minimize} \ \left\{ sum({\bm x}, {\bm d}) \ \bigg| \ {\bm x} \in P^k \ {\rm and} \ {\bm d} \in \{ 1, 2, \ldots, n \}^{k-1} \right\}.
\label{pro2}
\end{eqnarray}
We below show that this problem can be transformed to an equivalent problem, which requires to find the minimum $k$-link path in a weighted, complete, directed acyclic graph (DAG) \cite{s98}.
First, for integers $i$ and $j$ with $1 \le i < j \le n+1$, let ${\sf OPT}(i, j)$ denote the optimal cost for the minisum $1$-sink location problem in $[v_i, v_{j-1}]$.
Let us consider a DAG $G = (N, A)$ such that $N = \{ u_1, u_2, \ldots, u_n, u_{n+1} \}$ and
for every vertex pair $(u_i, u_j)$ with $1 \le i < j \le n+1$,
there exists an edge which is directed from $u_i$ to $u_j$ and associated with the weight of ${\sf OPT}(i, j)$.
Then, ${\rm Q_{minisum}}(P)$ is equivalent to a problem requiring to find a path in $G$ from $u_1$ to $u_{n+1}$ which contains exactly $k$ edges such that the sum of weights is minimized.
Schieber \cite{s98} showed that this problem can be solved by querying edge weights $O(n \cdot \min \{ k, 2^{\sqrt{\log k \log \log n}}\})$ times
if the input DAG satisfies the {\it concave Monge property}, that is, ${\sf OPT}(i, j) + {\sf OPT}(i+1, j+1) \le {\sf OPT}(i+1, j) + {\sf OPT}(i, j+1)$ holds for any integers $i$ and $j$ with $1 \le i+1 < j \le n$.
Since each weight query takes $O(n)$ time by Lemma \ref{lem:ms1}, if the concave Monge property is proved, ${\rm Q_{minisum}}(P)$ can be solved in $O(n^2 \cdot \min \{ k, 2^{\sqrt{\log k \log \log n}}\})$ time.
Therefore, we prove the following lemma.
\begin{lem}
For any integers $i$ and $j$ with $1 \le i+1 < j \le n$,
${\sf OPT}(i, j) + {\sf OPT}(i+1, j+1) \le {\sf OPT}(i+1, j) + {\sf OPT}(i, j+1)$ holds.
\label{lem:ms2}
\end{lem}
\begin{proof}
For integers $i$ and $j$ with $1 \le i < j \le n+1$, and a 1-sink location $x \in [v_i, v_{j-1}]$,
let $sum_{i, j}(x)$ denote the sum of cost of $x$ for all supplies on $[v_i, v_{j-1}]$,
and let $sum_L^i(x)$ (resp. $sum_R^j(x)$) denote the sum of cost of $x$ for all supplies on $[v_i, x)$ (resp. $(x, v_{j-1}]$).
Also, let $x^*(i, j) = \operatornamewithlimits{argmin} \{ sum_{i, j}(x) \mid x \in [v_i, v_{j-1}] \}$.
By the definitions, we have
\begin{eqnarray}
sum_{i, j}(x) &=& sum_L^i(x) + sum_R^j(x), \ \mbox{and} \label{eq:ms2.1} \\
{\sf OPT}(i, j) &=& sum_{i, j}(x^*(i, j)). \label{eq:ms2.2}
\end{eqnarray}
Then, we consider two cases: [Case 1] $x^*(i+1, j) \le x^*(i, j+1)$ and [Case 2] $x^*(i+1, j) > x^*(i, j+1)$.
Here, let us prove only Case 1 (Case 2 can be symmetrically proved).
We first show that
\begin{eqnarray}
sum_{i, j}(x^*(i+1, j)) &-&sum_{i+1, j}(x^*(i+1, j)) \nonumber \\
&\le& sum_{i, j+1}(x^*(i, j+1)) - sum_{i+1, j+1}(x^*(i, j+1)).
\label{eq:ms2.3}
\end{eqnarray}
By (\ref{eq:ms2.1}), the left side of (\ref{eq:ms2.3}) is equal to $sum_L^i(x^*(i+1, j)) - sum_L^{i+1}(x^*(i+1, j))$ and the right side of (\ref{eq:ms2.3}) is equal to $sum_L^i(x^*(i, j+1)) - sum_L^{i+1}(x^*(i, j+1))$.
Let $D = sum_L^{i+1}(x^*(i, j+1)) - sum_L^{i+1}(x^*(i+1, j))$ (clearly $D > 0$), that is,
\begin{eqnarray}
sum_L^{i+1}(x^*(i, j+1)) = sum_L^{i+1}(x^*(i+1, j)) + D.
\label{eq:ms2.4}
\end{eqnarray}
Then, we have
\begin{eqnarray}
sum_L^i(x^*(i, j+1)) \ge sum_L^i(x^*(i+1, j)) + D.
\label{eq:ms2.5}
\end{eqnarray}
By (\ref{eq:ms2.4}) and (\ref{eq:ms2.5}), we obtain
\begin{eqnarray}
sum_L^i(x^*(i+1, j)) &-& sum_L^{i+1}(x^*(i+1, j)) \nonumber \\
&\le& sum_L^i(x^*(i, j+1)) - sum_L^{i+1}(x^*(i, j+1)),
\label{eq:ms2.6}
\end{eqnarray}
which is equivalent to (\ref{eq:ms2.3}) as mentioned above.
On the other hand, by the optimality of ${\sf OPT}(i, j)$ and ${\sf OPT}(i+1, j+1)$, we have
\begin{eqnarray}
sum_{i, j}(x^*(i+1, j)) &\ge& {\sf OPT}(i, j), \ \mbox{and} \label{eq:ms2.7} \\
sum_{i+1, j+1}(x^*(i, j+1)) &\ge& {\sf OPT}(i+1, j+1). \label{eq:ms2.8}
\end{eqnarray}
Then, by (\ref{eq:ms2.3}), (\ref{eq:ms2.7}), (\ref{eq:ms2.8}) and the definitions of $sum_{i+1, j}(x^*(i+1, j)) = {\sf OPT}(i+1, j)$ and $sum_{i, j+1}(x^*(i, j+1)) = {\sf OPT}(i, j+1)$, we obtain
\begin{eqnarray}
{\sf OPT}(i, j) - {\sf OPT}(i+1, j) \le {\sf OPT}(i, j+1) - {\sf OPT}(i+1, j+1),
\end{eqnarray}
which implies that the lemma holds in Case 1.
\qed
\end{proof}
\begin{thm}
The minisum $k$-sink location problem in a dynamic path network with uniform capacity can be solved in $O(n^2 \cdot \min \{ k, 2^{\sqrt{\log k \log \log n}}\})$ time.
\label{thm:ms1}
\end{thm}
\section{Conclusion}
In this paper, we study the $k$-sink location problem in dynamic path networks with continuous model assuming that edge capacity is uniform and sinks can be located at any point in the network, and prove that the minimax problem can be solved in $O(kn)$ time and the minisum problem can be solved in $O(n^2 \cdot \min \{ k, 2^{\sqrt{\log k \log \log n}}\})$ time.
On the other hand, we leave as an open problem to reduce the time bound to $O(kn)$ for the minisum problem,
and extend the solvable networks into dynamic path networks with general capacities or more general networks (e.g., trees).
\clearpage
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 3,015 |
About the College:
Tribhuvan University School of Management is located in Kirtipur Nepal. This college provides comprehensive modern education, research and training facilities to management professionals. Rigorous practice under guidelines of Nepal council, is conducted through seminars, training programs, laboratory practices, curricular activities, job oriented programs and workshop.
The Institute offers a learning environment that is conducive to -
• This college conducted professional project exposures
• Every year, There are conducted job counseling & entrepreneurs skill development programs
• And also, they will be conducted programs for interpersonal skills, analytical, problem solving skills, team work, and personality development in regularly
Check the details about college – Click Here
Tribhuvan University School of Management Placements:
Tribhuvan University School of Management is students will got jobs at leading companies across world and also some companies participate in interview sessions, offering coveted profiles with complementing packages.
Tribhuvan University School of Management Environments for Placement Opportunities:
These students get an edge over the others as they are completely prepared as they take their first step into the real world outside.
This college is conducted the below skill program for help to students self-improvement.
• Interactive tutorials
• Case study presentations
• Brain-storming sessions
• Problem solving skills
Tribhuvan University School of Management, Nepal is also provide NRI Quota Admission. Admissions to the management college are also granted under Payment Seat or Management Seat quota.
Students pursuing the management education at the Institute can take utmost advantage of the Tribhuvan University School of Management, Nepal placements. The campus recruitment formulated by the management college provides for bright career prospects for the budding professionals in the field of healthcare and medicine. After the completion of the course, students get a chance to be a part of the Tribhuvan University School of Management, Nepal placements program, wherein the freshly graduated doctors are absorbed into the mainstream profession by reputed organizations.
This college staff help to every students in pursuing their career goals via regular interaction with corporate professionals through Seminars and Practical training. In this college's previous years students are placed in top most companies and also some student start own business.
The Tribhuvan University School of Management Placement cell co-ordinates with the various industries, organizations and institutions for placement of the students and thereby helps in developing the industry-academic inter-relationship. The placement cell organizes certain orientation programs, grooming sessions, mock interviews for students of each stream through Console Management System provided by the College at free of cost.
There are campus recruitment drives conducted here which enable students to participate and take advantage. The students participating here are subjected to employment opportunities from big names in the industry. The Engineers graduating from here get an opportunity to work in international companies. These employment opportunities ensure a smooth career growth for those who take advantage of the placement program.
This college last year students placed with reputed companies like
• IBM
• TCS
• CTS
• Wipro
• Accenture
For any other information regarding Tribhuvan University School of Management placements, write to us at This email address is being protected from spambots. You need JavaScript enabled to view it.
You can even contact us at the below mentioned numbers – 0353-2577991/0353-2577992
Graduating from here would entail you to an opportunity to work for the best names in the industry!
Tribhuvan University School of Management, Nepal
Kirtipur,
Qus: How do I get an admission in Tribhuvan University School of Management?
Ans: If you are looking for direct admission in Tribhuvan University School of Management, Bright Educational Service is the right place for you which have India's top most direct admission consultants and where we give 100% assurance of admissions in India as well as admissions abroad.
Qus: Does the Tribhuvan University School of Management college have hostel facility?
Ans: Yes, Tribhuvan University School of Management has separate hostel facility for both boys and girls. It is situated in inside a campus.
Qus: How is library facilities in Tribhuvan University School of Management?
Ans: Tribhuvan University School of Management College Library is offers more than 25,000 books in stock. Also, This College Library's includes e-journals, print journals, previous question papers, magazine and news papers. This college have 1500 square feet library study room for students books reading purpose.
Ans: Yes. +2 student can apply for Tribhuvan University School of Management admission. candidate must submit required document after class 12 results. If you need any assistance or help regarding admission please feel free to contact us anytime at +91-9564733330. We will be more than happy to assist you.
Qus: Which are the entrance exams accepted by Tribhuvan University School of Management?
Ans: Tribhuvan University School of Management, Kirtipur will accept the entrance exam scores of TU-CMAT Entrance Exam for admission. This college conducted eligible test and personal interview. Candidates who are the got eligible score in all the entrance test and fulfil all the eligibility, the candidates will be admitted in the college
Tribhuvan University School of Management, Tribhuvan University School of Management Admission, Tribhuvan University School of Management Admission 2019, Tribhuvan University School of Management Admission Procedure, Tribhuvan University School of Management Placements, Tribhuvan University School of Management Placements 2019, Tribhuvan University School of Management Fees Structure 2019, Tribhuvan University School of Management Fees Structure for Self Finance, Tribhuvan University School of Management Courses, Tribhuvan University School of Management Entrance Exam, Tribhuvan University School of Management Facilities, Tribhuvan University School of Management Scholorship
Direct Admission in Tribhuvan University School of Management , Direct Admission Procedure in Tribhuvan University School of Management , Tribhuvan University School of Management Direct Admission 2019, Tribhuvan University School of Management Direct Admission Procedure 2019, How to get admission in Tribhuvan University School of Management , How to get direct admission in Tribhuvan University School of Management , How to get management quota admission in Tribhuvan University School of Management , How to get NRI quota admission in Tribhuvan University School of Management , MCA/MBA direct admission in Tribhuvan University School of Management , MCA/MBA direct admission procedure in Tribhuvan University School of Management , Tribhuvan University School of Management MCA/MBA Admissions 2019, Tribhuvan University School of Management MCA/MBA Admissions Procedure, How to get MCA/MBA direct admission in Tribhuvan University School of Management , MCA/MBA direct admission in Tribhuvan University School of Management , MCA/MBA direct admission procedure in Tribhuvan University School of Management , Tribhuvan University School of Management MCA/MBA Admissions 2019, Tribhuvan University School of Management MCA/MBA Admissions Procedure, How to get MCA/MBA direct admission in Tribhuvan University School of Management
TU SOMCollege, TU SOMPatan, TU SOMCollege Patan, TU SOMKirtipur Admission, TU SOMAcceptance Entrance Exam, TU SOMKirtipur B. Tech Admission 2019, TU SOMCollege Admission 2019, TU SOMKirtipur Patan, TU SOMPatan, TU SOMKirtipur Nepal, TU SOMreviews, TU SOMKirtipur Nepal, Tribhuvan University School of Management Kirtipur Patan, Tribhuvan University School of Management Recruitment, Tribhuvan University School of Management Infrastructure, Tribhuvan University School of Management review, Tribhuvan University School of Management for mba, Tribhuvan University School of Management placement 2019, Tribhuvan University School of Management Kirtipur Nepal, Tribhuvan University School of Management Kirtipur Nepal
About Tribhuvan University School of Management, Tribhuvan University School of Management fee structure, Tribhuvan University School of Management location, Tribhuvan University School of Management merit list, Tribhuvan University School of Management vacancy, Admission Tribhuvan University School of Management without neet, Tribhuvan University School of Management logo, Annual PG fee in Tribhuvan University School of Management, Application form of Tribhuvan University School of Management, Tribhuvan University School of Management application form charge, Tribhuvan University School of Management entrance test, Tribhuvan University School of Management entrance test 2019 date, Tribhuvan University School of Management nepal BBA/BCA foreign students, Tribhuvan University School of Management in nepal fees structure, Tribhuvan University School of Management application form 2019, Tribhuvan University School of Management Admission Guideline, BBA/BCA fees for Tribhuvan University School of Management nepal, Tribhuvan University School of Management accept TU-IOE Entrance exam score, Tribhuvan University School of Management accept Purbanchal University Entrance score, Tribhuvan University School of Management accepted TU-IOE Entrance exam score, Tribhuvan University School of Management accepted Purbanchal University Entrance score, Tribhuvan University School of Management accepting Purbanchal University Entrance exam score, Tribhuvan University School of Management accepting Purbanchal University Entrance score , Tribhuvan University School of Management minimum Purbanchal University Entrance score, Tribhuvan University School of Management accept minimum score in neet, nepal medical college admission procedure, BBA/BCA admission in nepal, study BBA/BCA in nepal, best colleges in pokhra nepal, all the medical college of nepal 2019, College Admission Guideline, Competetive Entrance exams form to be filled in 2019, entrance exam for BBA/BCA in nepal, entrance exam for BBA/BCA in nepal 2019, study BBA/BCA in nepal for indian students, medical colleges in nepal for indian students, private BBA/BCA college in nepal, govt medical college in nepal, mci approved medical colleges in nepal, study management in nepal, nepal mbbs, BBA/BCA course in nepal, direct admission in BBA/BCA in nepal without donation, ku and tu affiliated management colleges in nepal | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 563 |
La cimera intercoreana de maig de 2018 va ser la segona cimera intercoreana de 2018. El 26 de maig, el president de Corea del Nord Kim Jong-un i el president de Corea del Sud Moon Jae-in es van reunir de nou a l'Àrea de Seguretat Conjunta, aquesta vegada al costat nord-coreà a la Casa de la Pau en el Pavelló d'Unificació. La reunió va durar dues hores, i a diferència d'altres cimeres, no s'havia anunciat públicament abans.
Les fotos publicades per l'oficina presidencial de Corea del Sud van mostrar que Moon arribava al costat nord del poble de la treva de Panmunjeom i encaixant la mà de la germana de Kim, Kim Yo-jong, abans d'asseure's amb Kim per a la seva cimera. Moon va ser acompanyat per Suh Hoon, director del Servei Nacional d'Intel·ligència de Corea del Sud, mentre que Kim es va unir a Kim Yong-chol, un antic cap d'intel·ligència militar que ara és vicepresident del comitè central del partit governant de Corea del Nord encarregat de les relacions intercoreanes. La reunió es va centrar en gran part al voltant del líder nord-coreà Kim Jong-un en la propera cimera amb el president dels Estats Units Donald Trump i, en menor mesura, continuar avançant en les converses de desnuclearització. Kim i Moon també es van abraçar abans que Moon tornés a Corea del Sud.
El 27 de maig, Moon va declarar en un discurs públic que ell i Kim van acordar reunir-se de nou a "qualsevol moment i qualsevol lloc" sense cap formalitat i que el líder nord-coreà es va comprometre una vegada més a desnuclearitzar la península de Corea d'acord amb la Declaració de Panmunjeom.
El 13 d'agost, es va anunciar que una tercera cimera intercoreana de 2018 se celebraria a Pyongyang, la capital de Corea del Nord, al setembre. El president sud-coreà Moon va enviar una delegació especial a la cimera, que va durar tres dies entre el 18 i 20 de setembre.
Referències
Relacions entre Corea del Nord i Corea del Sud
Esdeveniments del 2018
Conferències diplomàtiques | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 576 |
Q: why except doesn't work properly ? (newbie) Building a JSON, I have no need for the ":new" and ":edit/:id" routes .
So I asked rails to do not create those but when I specify the routes which should not be routable (with Be_routable matcher)...it doesn't work.
Any suggestions please ?
routes.rb :
Rails.application.routes.draw do
resources :todos, :except => [:edit, :new]
end
routes_spec.rb :
require 'spec_helper'
RSpec.describe "routes for Todos", :type => :routing do
it "routes get /todos to the todos controller index action" do
expect(:get => "/todos").
to route_to(:controller => "todos", :action => "index")
end
it "routes post /todos to the todos controller create action" do
expect(:post => "/todos").
to route_to(:controller => "todos", :action => "create")
end
it "routes get /todos/:id to the todos controller show action" do
expect(:get => "/todos/:id").
to route_to(:controller => "todos", :action => "show", :id => ":id")
end
it "routes patch /todos/:id to the todos controller update action" do
expect(:patch => "/todos/:id").
to route_to(:controller => "todos", :action => "update", :id => ":id")
end
it "routes put /todos/:id to the todos controller update action" do
expect(:put => "/todos/:id").
to route_to(:controller => "todos", :action => "update", :id => ":id")
end
it "routes delete /todos/:id to the todos controller delete action" do
expect(:delete => "/todos/:id").
to route_to(:controller => "todos", :action => "destroy", :id => ":id")
end
it "does not route to /todos/new" do
expect(:get => "/todos/new").not_to be_routable
end
end
the last it block throw this error :
Failures:
1) routes for Todos does not route to /todos/new
Failure/Error: expect(:get => "/todos/new").not_to be_routable
expected {:get=>"/todos/new"} not to be routable, but it routes to {:controller=>"todos", :action=>"show", :id=>"new"}
# ./spec/routing/routes_spec.rb:43:in `block (2 levels) in <top (required)>'
all the other it blocks are OK
todos_controller.rb :
class TodosController < ActionController::API
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
def create
@todo = Todo.new(todo_params)
if @todo.save
render json: @todo, status: :created, location: @todo
else
render json: @todo.errors, status: :unprocessable_entity
end
end
def show
@todo = Todo.find(params[:id])
render json: @todo, status: :ok, location: @todo
end
def index
@todos = Todo.all
render json: @todos, status: :ok #, location: @todos DOESN'T WORK 'location:' OPTION
end
def update
@todo = Todo.find(params[:id])
if @todo.update(todo_params)
render json: @todo, status: :ok, location: @todo
else
render json: @todo.errors, status: :unprocessable_entity
end
end
def destroy
@todo = Todo.destroy(params[:id])
render json: @todo, status: :no_content, location: @todo
end
private
def todo_params
params.require(:todo).permit(:title, :content)
end
def not_found(e)
render :json => { :message => e.message }, :status => :not_found
end
end
A: The reason you are getting the error is because you cannot use this test.
The reason is this route:
/todos/:id
is the route that routes to the SHOW action.
So when you browse to
/todos/new
the value of ':id' will be 'new'.
You can check this by adding 'puts params[:id]' in the show method, then in the browser goto '/todos/new' and you will see in the log that it will display 'new'.
You should probably add a route constraint. For example:
get 'todos/:id' => 'todos#show', constraint: { id: /\d+/ }
More info here which I strongly advise you to read and understand. :)
EDIT: The constraint restricts the param :id so that only integers are allowed.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 7,173 |
Q: Protect python code in raspberry pi I'm a few weeks away from finishing up a python project written for raspberry pi 2 B, on raspbian os.
The only thing I'm still afraid is, how to protect my code from others?
Anyone can connect a screen with hdmi cable, and easily access my raspberry pi.
In windows, just compile your code as executable (.exe) file and all done. But what should I do in linux?
any suggestions would be appreciated.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 5,640 |
Q: Filtering noisy buffer output Please bear with me as this is my first time working with filters.
I am trying to scale down the voltage from my piezo to a voltage which my ADC can read (from >100V on the piezo to 0-5V on the ADC inputs). Reading older threads on voltage dividers and ADC inputs, it was suggested that I use a buffer after my voltage divider in order to create a low impedance output for the ADC.
EDIT: The two resistors should be swapped, did not notice it until it was pointed out to me.
(I used a capacitor to represent the piezoelectric because I couldn't find a piezo symbol in Tina)
I have been testing my circuit with a much smaller impact that produces voltages of ~1V on the piezo, and have noticed that there is a huge amount of noise on the output of the buffer.
Orange in the above picture is the original signal, measuring directly across the piezo
Green in the above picture is the signal after it leaves the buffer
Figuring that it was an issue of high frequency noise, I attempted to filter the data in Python, using a 1st order butterworth filter with a cutoff of 10kHz and a sampling frequency of 50MHz (The sampling frequency of the oscilloscope)
Red is the original signal, blue is the buffer output after going through a lowpass filter (This was a seperate hit on the piezo, so it doesn't match the previous picture)
Considering that I need the ability to do this in real time, I needed to build an analog low pass filter. From my understanding, the calculation is that
$$
F_c = \frac 1 {2\pi RC}
$$
So I used \$ F_c = 10kHz \$ , C = 0.1uF and R = 150\$\Omega\$ in order to get an actual \$ F_c \$ of 10.6Khz.
However, instead of getting a nice, smoothed out signal like in Python, I get this:
The orange is the signal from the piezo and the green is the output of the buffer. As you can see, the low pass filter seems to have had smoothed out the actual signal while leaving the noise behind!
Now what I want is the following:
*
*What am I doing wrong that is causing the low pass filter to filter out the signal?
*Why is the buffer output so noisy? I chose this buffer because it is supposed to be unity gain stable.
*What could I do to alleviate the noise and keep the signal? Would using an active filter instead help?
Thank you, and sorry for the wall of text.
A: BUF634 is the WRONG part to use. Use an op-amp and bias the input to approximately half of the ADC input voltage peak value (2.5 volts). At the moment you have a very powerful buffer chip on a single supply being fed an input that is approximately 0 volts. The BUF634 normally works with a split positive and negative supply so feeding it with an input that is nominally at one of the power rails is illegal and it may well produce a pile of output noise.
If you are trying to make a sizable attenuator it's highly likely that you need to swap the 10 kohm and 309 kohm resistors.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 461 |
Q: Sips command in a Python script is not working - "Error 4: no file was specified" and "not a valid file - skipping" Trying to resize (only Width) some images by a Python script.
This is a Python script:
# -*- coding: utf-8 -*-
import subprocess
import os
# New width
new_width = '200'
# Create for converted images
create_directory_out = subprocess.run(['mkdir', '-p', './Result'])
# Directory with started images
directory_source = 'Source'
# Directory with converted images
directory_out = 'Result'
# get list of started images to variable files
files = os.listdir(directory_source)
# Filtre by mask .jpg to variable images
images = filter(lambda x: x.endswith('.jpg'), files)
img_list = list(images)
# Loop of convert images by sips
for file_name in img_list:
print(file_name)
subprocess.run(['sips', '--resampleWidth', 'new_width', '--out', './directory_out/file_name', './directory_source/file_name', ])
I get an error:
face-04.jpg
Warning: ./directory_source/file_name not a valid file - skipping
Error 4: no file was specified
Try 'sips --help' for help using this tool
face-04.jpg
But sips command in Terminal is working:
sips --resampleWidth 200 --out ./Result/face-04.jpg ./Source/face-04.jpg
What else could be going wrong?
Thanks in advance for the help.
A: you're mixing up literals with variables:
subprocess.run(['sips', '--resampleWidth', 'new_width', '--out', './directory_out/file_name', './directory_source/file_name', ])
tries to access './directory_out/file_name' literally!
you need to actually use your variables and join directory & file names:
subprocess.run(['sips', '--resampleWidth', 'new_width', '--out', os.path.join(directory_out,file_name), os.path.join(directory_source,file_name)])
Aside:
create_directory_out = subprocess.run(['mkdir', '-p', './Result'])
could be replaced by a native python call:
os.makedirs(directory_out)
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 360 |
While in San Diego, Ca for vacation, make sure you leave some time to stop by the San Diego Natural History Museum. The museum is one of the oldest in the Southern California area, dating back to 1874, so the exhibits contained in the building are a major part of this country's history. The Museum is definitely the place for family, as you children will learn so much about the local area. | {
"redpajama_set_name": "RedPajamaC4"
} | 3,337 |
{"url":"https:\/\/dsp.stackexchange.com\/questions\/72176\/using-oversampling-to-increase-resolution-of-a-dc-signal-as-input\/72317","text":"Using oversampling to increase resolution of a DC-signal as input\n\nCurrently I'm working on a project which uses oversampling to increase the resolution of a 12 bit ADC to a maximum of 16 bits. My goal is to fully understand the theory behind oversampling and why it is increasing the resolution. As far as I understood this topic, oversampling and decimation increases the resolution because the white noise of the input signal is distributed along a larger frequency span. After the oversampling the signal gets low pass filtered, so that we achieve fewer noise in the frequency span of interest (see the first figure).\n\nSo far so good, but I think i'm still not 100% confident of what is going on here:\n\n1. How is the low pass filtering achieved? I know that I need to sample the input signal $$4^n$$ ($$n$$ = additional bits) times for every additional bit. After adding all samples together, the sum gets right shifted by $$n$$, which is equal to divide the sum by $$2^n$$. Is this the low pass filtering or do i need to somehow low pass filter it after i shifted the sum? In the application note AN118 that I used to understand this topic it seemed like the process of shifting is the low pass filter.\n\n2. My input signal is a dc signal (sensor output) and I'm getting kind of a headache to understand why oversampling can increase the resolution of dc signals. Inside the appendix A of the application AN118 is a good approach to explain the reason for the increased resolution with oversampling. It also shows where the often used equation f_os = 4^n * f_s (f_os = oversampling frequency; f_s = sampling frequency) comes from. My problem is this whole appendix refers to AC-Signals... You can see this with for example equation 8 inside the application note, where the in-band noise power is calculated with the integral from 0 to f_m (f_m = highest spectral component of the input signal). In case of a dc signal as input i got f_m = 0. Am I missing something or can someone maybe explain to me why the resolution of a dc signal can be improved with oversampling?\n\n3. Is something like SNR a good specification to describe the quality of a dc signal? I've read from a source that SNR is an AC specific attribute, for example in Table 2 of this Texas Instruments document. This document also states that ENOB can't be calculated for dc signals and that i need to calculate the \"effective resolution\" for dc signals. This was the first time i've read something about this... Can someone verify that for sure dc signals can't be specified with SNR and ENOB?\n\nAt the end of my project I would like to compare different resolutions achieved with oversampling. What would be a good specification to compare the measured results? Maybe the \"effective resolution\" or the overall noise calculated with the variance?\n\nI hope someone can answere my questions. At the moment i'm struggling a bit to fully understand this topic...\n\nMy input signal is a dc signal (sensor output) and im getting kind of a headache to understand why oversampling can increase the resolution of dc signals.\n\nThe ADC puts out integers. So, let $$x$$ be the integer that would come out of the ADC (100.3, say, or -333.3). Now let $$y = \\lfloor r \\rfloor$$ be the quantization operation, where you get straight integers, like 100 or -334.\n\nNow, let $$r$$ be the sum of some actual value $$x$$ and some nice well-behaved zero-mean noise -- $$r = x + n$$. For the right sort of noise (zero-mean Gaussian that's big enough is one kind) the ADC output is a random variable with a mean equal to $$x$$. So treat $$y = x + n_{ADC}$$, where $$n_{ADC}$$ is a zero-mean noise process.\n\nNow when you average a bunch of samples of $$y$$, the effect of $$n_{ADC}$$ on the signal diminishes (in fact, its deviation goes down as $$\\sqrt n$$ for an $$n$$-sample average). That's why oversampling and averaging reduces the noise and increases resolution.\n\nHow is the low pass filtering achieved?\n\nIn the method you outline, you're averaging the input samples. That's effectively low-pass filtering.\n\nNote that the app note gets it slightly wrong: it's having you add up $$2^n$$ samples, then shift by $$n$$, effectively dividing by $$2^n$$. However, by virtue of the averaging, you're effectively adding bits to the ADC resolution*. Usually when I do this I just take the sum of the $$2^n$$ samples, knowing that there's a lot of noise in the LSBs. If I do shift down, I shift down by $$n\/2$$, not by $$n$$.\n\nIs something like SNR a good specification to describe the quality of a dc signal?\n\nNot really. SNR is good when you have a well-defined signal strength.\n\nFor DC, it's much better to use $$\\pm x_e$$, where $$x_e$$ is the anticipated error bars, or effective number of bits, or something. There's plenty of examples out there -- I'd take my guidance from voltmeter specs, or from industrial instrument specs.\n\n* You are adding to precision, not accuracy. Accuracy is a different thing**. The accuracy of an ADC is limited by things other than its noise characteristics.\n\n** The best short description I have is throwing darts: accuracy is how well-centered the darts are around the bullseye -- precision is how tightly clumped they are. If all your darts land on a point 3\" over and 1\" down from the bullseye, you're very precise -- but not terribly accurate.\n\n\u2022 For the precision vs accuracy, I find the following example useful: Think about an analog wrist watch to measure time. If it works correctly, then for every true 24 hours (official day) the arms meet vertically exact upwards. Neither late or early, just on time. Then we call this an accurate clock; it measures the time correctly. The precision is related with the tic marks on its rim. The more tickmarks there are, the more precise it tells the time. Eventually, I would prefer a more accurate clock with less precision (less tickmarks) over a less accurate one with more tics. Dec 23, 2020 at 19:33\n\u2022 Thanks for the replies! Both examples to understand the difference between accuracy and precision were helpful for me. I still have a few questions: When averaging acts like low pass filter, can I define a cut-off frequency? I mean when I use oversampling it should be somewhere around the signal frequency or not? Another questions relates to @TimWescott method of taking the sum of $2^n$ samples and not shifting them. So your method doesn't add bits to the ADC resolution? I dont really understand why you are just taking the sum without shifting, or why you only shift by $n\/2$... Dec 27, 2020 at 13:17\n\u2022 If I want to find out if a coin is fair, I flip it a bunch of times and see how closely the average ratio of heads to tails is to $\\frac{1}{2}$. If my coin is a 1-bit \"ADC\", and I use your article's rule, then I add up the results of 256 flips (getting a number somewhere around 128) and divide by 256 (i.e., shift down by 8). The result will be zero every time, or evenly distributed between 0 and 1 with rounding. Thus, I lose all that good information implied by the fact that the deviation before rounding to 0 or 1 is $\\frac{1}{16\\sqrt{2}}$. Dec 27, 2020 at 18:35\n\u2022 Yes, your lowpass filter will have a cutoff -- even if you're doing a running average. And yes, there's an optimal cutoff to give you the best tradeoff between preserving signal accuracy and corrupting it with noise. That's the subject of a separate question, I think. Dec 27, 2020 at 18:37\n\u2022 Ahh okay, sorry i think you misunderstood the application note and i didn't read your first response well enough... The application note mentions that you add up the sum of $4^n$ samples and shift that sum by n bits, or divide it by $2^n$. I think in the first figure of the application note they call it downsampling. It's essencially the method you described in your first response. Dec 28, 2020 at 11:44\n\nI feel that someone ought to advise the questioner against thinking that this process is automagically going to give an extra 4 bits of resolution. IF the noise on the DC signal is uncorrelated, gaussian-distributed noise, then yes it will. In the vast majority of real cases, the noise is not like that. In particular, for DC type signals with low-cost ADCs, there are nonlinearity and \"sticky counts\" that will make the averaging results much worse. Try and find out. If you you get less than you want, look into dithering your signal. This technique helps spread the quantization errors out into a smoother distribution, approximating a gaussian.\n\n\u2022 I've already tested my setup and im happy with the results. I have a good gaussian-distribution of values when I measure signals. With 4 additional bits via oversampling and a reference voltage of 3V, I get a rms voltage of 57,54\u00b5V. Using the formula from table 2(ti.com\/lit\/eb\/slyy192\/\u2026) i get a effective resolution of 15,67 bits, which is a pretty good result I think. Dec 30, 2020 at 18:00","date":"2022-05-19 17:34:44","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 1, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 24, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.641549825668335, \"perplexity\": 625.9615573951372}, \"config\": {\"markdown_headings\": false, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2022-21\/segments\/1652662529658.48\/warc\/CC-MAIN-20220519172853-20220519202853-00654.warc.gz\"}"} | null | null |
\section{Introduction}
In the previous article we discussed the necessary constraints on a many body wavefunction to correspond to a ``classical'' solid, specifically, one describable by a three dimensional set of variables governing its shape, composition and dynamics. These were far-from-eigenstate wavefunctions that exhibited a long lasting quasi-ground state and quasi-eigenstates corresponding to phonons. While the origin of such states is still somewhat unclear, the specificity of this description was robust enough to explain, from a quantum mechanical point of view, several points including: classical motion, the distinction of phonons as quasiparticles that carry no true momentum, some subtleties for bodies with discrete symmetries, and even a natural explanation and extension of quantum measurement.
Gases introduce some new complications. The long lasting localization macroscopic bodies can possess that allows classical descriptors including well defined shape and orientation is not present for them. The hydrodynamic and thermodynamic properties of these are typically inseparable. Our task is to first provide a single wavefunction understanding of thermalization and overcome the long standing apparent contradictions of quantum statistical mechanics with quantum evolution itself. We will show that the meaning of the ensemble averages can be reinterpreted to be consistent with the quasi-local properties of a single wavefunction that gives the complete description of the system at all times. Temperature can be defined in a satisfactory manner but we will have to reconsider the thermodynamic limit as more involved than just involving large numbers of particles. Since quantum evolution still holds we don't get equilibration for eigenstates and few state superpositions of them. Thermodynamics thus depends on having a sufficiently broad distribution of such eigenstates.
Our motivation for such specific descriptions of classical matter in terms of single wavefunctions is to compare with more evidently quantum ones. If a single descriptor and evolution equation can describe measurement and thermodynamics of apparently classical system then it will have stronger credibility in its implications for ultracold gases. The state of the field of many body quantum mechanics is ``ansatz-heavy.'' When the bar for conceptual justification of a calculation is low, methods proliferate and it is tempting to assume our way to standard classical form of motion from which such methods provide thermodynamic variables and transport coefficients. Even when these results turn out to be valid, we lack sufficient understanding to jusficy them over other less successful attempts.
Hydrodynamics introduces several more problems. Here we must give an explanation for the apparently greatly reduced set of degrees of freedom a classical gas exhibits versus quantum many body wavefunction. We demonstrate that there are many dynamic nonclassical gas solutions and that bulk expansion, generally associated with bulk viscosity, can pick up nonclassical nonhydrodynamic behavior. Nevertheless, for a physically recognizable set of states that correspond to hydrodynamics and some not-to-violent motions, the classical hydrodynamics of gases is recovered. The primary difference is that corrections to these can involve deviations from the ``classicality'' of the system and its representation in terms of such a limited 3D variable set.
Ultracold quantum gases will be shown to often not have well defined thermodynamics or hydrodynamics although static behavior and small oscillations near the ground state can be well modeled with the Euler equation. These systems do, however, relax in the limited set of variables we typically probe: the one-body density function. The extent to which this can be associated with a viscosity, a purely hydrodynamic concept, is discussed.
Experiments are proposed to reveal history dependent effects hidden in the relaxed states of these clouds.
The origin of superfluidity and a derivation of the two-fluid model are still waiting. The theory of ultracold gases often more embraces the two-fluid model and its concepts as building blocks rather than using them as an opportunity to test its limits and ultimately give a justification for it. This is undoubtable a very hard problem to treat from the other direction. Classical hydro is expected to govern the normal component in the two-fluid model and we are still lacking a good quantum and microscopic understanding of classical liquids. Some agreement has been found by combining molecular dynamics simulations and linear response theory \cite{Eu} but it is still unclear how much of a fundamental understanding will follow from this approach. The biggest motivation for the following is to elucidate classical and extreme quantum systems from a single description in hopes of finding the right questions, hence the right calculations, to explain such persistent phenomena. A better understanding of ultracold gases is certainly a positive step in this direction.
\section{Thermalization}
\subsection{Conceptual Problems }
Thermalization is most natural as a classical notion. It implies that observable history dependent effects are obliterated over time so that a system with fixed energy (and other conserved quantities) tends to states that are apparently equivalent. This seems to violate the time reversibility of the fundamental equations of motion. Usually this is phrased in terms of the ``microscopic'' equations. In the classical case this is resovable. Larger scale motions and less stable small scale ones are generally short lived over the longest time scales \cite{Jeans}. This does not mean they cannot return arbitrarily close to their original state. In fact, for isolated systems of fixed size, the Poincare cycle implies they must and extensions of this result show they must do so with arbitrarily long arithmetic progressions \cite{Petersen}. However, the long time behavior is dominated, in almost all cases, by global uniformity of motion and a local particular velocity distribution that is well attained by averaging over short time scales of the system. If there is a conceptual problem, it is how such initial data arose that led to such an apparently unidirectional time. The anthropomorphic principle gives a suitable resolution. If there were no such gradients present, there would be nothing to power living beings to observe it.
Quantum systems are more troubling for a number of reasons. It is standard to invoke a kind of loose standard to quantum arguments that allows a convenient mixing in of classical notions. When forced to be more specific about this, there are numerous problems. If we wish to think of quantum effects as driving the ``microscopic'' equations, we have the situation that quantum effects can manifest on large scales as in the case of superfluidity and superconductivity. In the case of ultracold gases, we will show there can be other large scale quantum effects that do not vanish as well. In the previous sections \cite{Chafin} we saw reason to not exclude macroscopic superpositions of a certain class. This makes it unclear if we can expect our observations to settle down into an apparent uniformity and consistency of motion with initial larger scale variations vanishing into unobservable smaller scale ones. More frustrating is that quantum dynamics never change the eigenstate distribution of a given state so the origin of ``equilibration'' is even more mysterious.
Classical gases have the property of thermalization.
This is most easy to see in the case of a gas where a system with a spatial energy and momentum distribution that is ``uniform'' in some spatial average over mean free path size parcels
equilibrates to the Maxwell-Boltzmann distribution; usually in just a few collision times. Analyses of this state can be from the classical kinetics \cite{Boltzmann} of billiard-like motions to more abstract formulations in terms of phase space distributions, ergodicity or the partition function \cite{Tolman}. The former treatment is the most direct, though much more demanding. It has the virtue of being a \textit{dynamic} approach rather than a kinematic one based on more abstract notions (that we would ultimately need to validate by dynamic means) and therefore include information on fluctuations and transient relaxation.
It is easily seen that the delocalization rate of gas particles at usual densities causes the wavefunction spreading to rapidly exceed the interparticle separation. This weakens the conceptual link of this model with a realistic gas that we expect to be described by a wavefunction. We will pursue this when we discuss hydrodynamics.
Phase space is well defined for the classical case as any set of N particles can be represented as a point in 6N-D phase space. Allowing for some uncertainty in the initial data, we may define a weighted volume in this space and evolve it accordingly.
Liouville's theorem guarantees the volumes of parcel are preserved and so suggests that the canonical momentum gives the natural measure on this space. Most physical Hamiltonians give strong stretching and folding of this volume in the manner of a Smale Horseshoe map\cite{Abraham}. In many cases this mapping is ergodic; specifically the time average at each point tends to be uniform in phase space. This lead to the temptation to use such phase space averages to give thermodynamic averages.
However, not all systems display ergodicity and, even for the ones that do, the sampling time to fill out the phase space to a given level of global uniformity is generally far greater than any observation time of the system. Boltzmann understood that ergodicity was a poor foundation for statistical averages and
was determined not to involve ergodicity in the definition of thermal equilibrium values. The long lasting confusion that ergodicity was essential can be traced to an early and well read article by the the evidently confused P. and T. Ehrenfest \cite{Boltzmann}.
Additionally, there are other conservation laws to preserve. This demonstrates to us that to discuss thermal states we really need a ``typical'' element of our system that gives the averaged thermodynamic quantities as nearly-always holding conditions of the system rather than the sum over an ensemble (though we expect there to be generally no difference in the resulting values).
In quantum mechanics, the partition function and thermodynamic averages have greater problems and a long frustrating history. The Boltzmann factor is so strongly validated by experiment that theory must offer an explanation. However, the justification in quantum treatments of statistical mechanics is even worse than in the classical case. One root of the problem is that quantum systems do not ``equilibrate.'' Eigenstates and finite superpositions have predictable stationary or periodic behavior. Infinite state superpositions are not generally periodic but still maintain a fixed ratio of occupancy. If ``equilibration'' depends on arriving at a special subset of distributions of states, this never happens.
The microcanonical ensemble \cite{Tolman}\cite{Landau:smI} is of fundamental importance since it is the starting point to later generate the more practical canonical and grand canonical ones.
To form the microcanonical ensemble one takes a sum over the \textit{eigenstates} of energy $E_{i}$ within some $\delta E$ spread and, for large enough particle number $N$, constructs a quasicontinuum of such states with the number of such states as $\Omega(E)\equiv e^{S(E)}$. Weakly coupling with an another much larger such system allows the subsystem's eigenstates to remain near eigenstates with long lasting validity and products of such functions give good approximations to the net system's eigenstates. The exponential growth of the density of states and an enumeration argument shows that the most likely ones are from a sharply peaked distribution where the energy per particle in both the system+reservoir and the system individually is $\epsilon=E_{Net}/N$. Defining the temperature as $T^{-1}=dS/dE$ for this closed system\footnote{Volume, net energy and particle number are fixed and T is explicity a function of them.} we arrive at the ``probability'' of a state with energy $E_{i}$ in this distribution of as $p_{i}\sim e^{-E_{i}/T}$. Combining this decreasing probability with the exponentially increasing number of states $\Omega(E)$ gives back our sharply peaked distribution for our system about $E=N_{sys}\epsilon$.
Of course, there is no reason to assume that the system is in an eigenstate and there are many superpositions that have net energy $E$ that do not come from the narrow band of many body eigenstates near this value. Since any weighted combination of eigenstates are allowed and this never changes, it is hard to see how this ``probability'' has any meaning as a likelihood from an equilibration. We can imaging scenarios where we randomly turn on and off coupling to the reservoir or otherwise perturb the system to try to bring this situation about but classical systems seem to reach equilibration in isolation. A famous method for treating quantum equilibration by coupling to a ``bath'' of harmonic oscillators is the Caldeira-Leggett model \cite{Caldeira} yet each of these seems like just a more elaborate contrivance to obtain the Boltzmann factor we know is somehow important.
Energy is not the only conserved quantity in physics even though it is the one that plays the singular role in almost all statistical mechanical calculations. Galilean translations alone give ten global invariants. A rotationally invariant potential gives angular momentum conservation. In the classical case, we can just impose this as another subfoliation of our fixed energy surfaces in phase space. (It is interesting that this is typically ignored for net $L=0$ systems yet we still tend to get correct results.) Nonrotationally invariant systems can give nonzero time averaged $L$ conservation for many solutions as in the case of the vertical pendulum so this is a concern for thermodynamics even when rotational invariance fails. In the quantum case, it is unclear what to do. Do we restrict our microcanonical ensemble to only consider eigenstates with the desired angular momentum? Do we bias the weights in the distribution in some yet unspecified way? Instead of the ensemble, should we just look at the totality of possible wavefunctions with fixed $L$ and $E$ and average desired quantities? If so, will this agree with the microcanonical result as $L\rightarrow0$? The canonical ensemble does provide an ansatz for handling this with the thermodynamic average, specifically $\Braket{|Q-L\omega|}$, but this seems like one more bit of subject lore to be remembered rather than explained.
There is no natural analog of phase space in quantum mechanics. Classical systems are described by position and momentum but quantum ones are described by vectors in Hilbert space or, more humbly, smooth bounded wavefunctions where the value at each point\footnote{Here we allow ``point'' to be both a postion in coordinate and spin space.} is a complex value. There have been arguments using a vague partitioning of the $(p^{3N},q^{3N})$ phase space via the uncertainty relation. Some of these have led to useful results but it is unclear how to make these precise and why they should be meaningful.
The canonical ensemble introduces ``mixed'' states that do not correspond to any eigenstate of the system \cite{Neumann}. Such objects are inconsistent with the evolution of a single wavefunction. One can attempt to justify such collections by assuming these other states simply represent some uncertainty in our knowledge as observers outside the system. In this case, it is hard to see why the equilibration and averages should ultimately depend on them and why further measurements should not restrict the set to a more refined subset of such a distribution. If one believes the many body quantum objects we study in cold gas traps are truly just evolving wavefunctions, it is hard to see how one could justify using the canonical or grand canonical ensemble for results beyond what would automatically hold by consistency with the microcanonical one. Furthermore, why should such objects even be limited to such a narrow range of energy eigenstates in its construction and how does introducing angular momentum to the initial data alter this?
In the case of typical macroscopic objects, we have come to expect some sort of disconnect between the worlds of quantum and classical dynamics. As such, we get more comfortable with using quantum reasoning to determine microscopic properties that map on to the macroscopically classical physics. In the case of effective field theory and green's function approaches to transport in hydrodynamics, we assume that classical hydro holds and then introduce linear response theory to compute the relevant parameters in the equations. In a sense we have assumed our way almost to the conclusion and derived the missing values.
From such a picture, it is not such a great step to then introduce some additional baggage of the mixed states. However, for our cold gas traps we are more directly confronted with the inconsistency. A trap is with one particle is clearly a pure state. So is one with two, three and so on. At what particle number do we transition to a mixed state? Is this Bayesian uncertainty in our knowledge a result of large N? coupling to the outside world? Is it just a harmless tool that works because of sharply peaked distributions?
The difference between quantum and classical statistical mechanics can be summed up this way. A classical gas at fixed energy will almost always be in a state that is locally reasonably described as thermal. An isolated quantum gas is in whatever distribution of eigenstates it starts in and this never changes. Classical gases rapidly tend to a well defined hydrodynamic flow but in the quantum case, the space of configurations is so much larger that, as in the case of solids above, a well defined velocity profile $v(x)$ seems like a rather special subset of them. The evolution of such a general state will be considered when we discuss hydrodynamics.
In the spirit of seeking subset of wavefunctions for classical matter that corresponds to ``thermal'' states we will begin by giving a criterion for the ``thermodynamic limit.'' Traditionally, this is the $N\rightarrow \infty$ limit. For trapped gases and small clusters, this seems overly restrictive since some sort of equilibration can occur for them for very modestly sized $N$. Furthermore, we will show that there is both experimental and theoretical reasons to believe that isolated cold atomic clouds can persist in very far from what we would consider a thermal state. These can have exotic momentum distributions and lack the properties of self-thermalization and thermalization with other bodies they are made to interact with.
There has been recent work utilizing the properties of very high dimensional spheres (Levy's theorem) \cite{Popescu} to show that in the high dimensionality of a many body system, the thermal distribution is overwhelmingly favored. This is kinematic argument and gives no notion of how such states would be arrived at. Other methods to attempt to justify the thermodynamic dominance of the microcanonical states generally involve some Hilbert space measure \cite{Brody} \cite{Goldstein} and a coupling to an external pure state universe. External coupling is known not to be important for equilibration and, moreover, there is no immediately obviously physical measure on this space. Such a natural measure could only be defined by the dynamics of the system in choosing it in equilibration, not the mathematical aesthetics of a theorist. These methods typically don't include any other conserved quantities but energy that the system must conserve. Ultimately, we would like dynamic understanding of equilibration that incorporates all of them.
We argue that wavefunctions of systems that start off sufficiently ``broadband,'' not made of a very small $\Delta E$ spread or number of energy eigenstates and for which the expected standing \textit{and} dynamic fluctuation wavelengths are much smaller than the interparticle separation, tend to long time stable distributions of local current flux balanced systems. This is generally independent of the details of the energy distribution of the superposition and gives a new way to assign meaning to the ``ensemble averages'' in terms of a typical \textit{single} wavefunction. Local dynamics of such a wavefunction near the scattering centers naturally leads to equipartition and gives a reason for the success of classical kinetic results of thermodynamics.
The ``thermal wavelength,'' $\lambda_{th}=\frac{\hbar}{2\pi m k_{B} T}$ is a basic parameter used the thermodynamic discussions of quantum systems. The arguments using this are typically vague but this parameter does give a unique length scale in terms of the temperature. We will be primarily interested in wavefunctions far from eigenstates that approach a kind of local regularity in their behavior independent of the particular distribution of eigenstates they are constructed from. For fermions with an energy per particle $\epsilon\lesssim E_{F}$ we have a lot of curvature to the wavefunction we don't want to consider as ``thermal.'' The traveling component of the waves associated with local currents is the part that we are concerned with. In some cases there may be states with too little energy above the ground state to give what we consider thermal, specifically a local kind of universality independent of the initial data.
It is convenient to have a term to describe the kinds of wavelengths that appear in the currents in both of these cases. Assuming some dominant local frequency exists at a point, we can express $\lambda_{typ}$ in terms of the local current $\tilde{J}=-\hbar\rho \frac{1}{m_{i}}{\nabla_{i}}\Phi$ where tilde's indicate a many body (3N component) vector and $\Phi$ is the phase of the many body wavefunction. In a region with nearly constant potential height, the nonzero current part of the oscillations have wavelength (along the $x_{i}$ coordinate direction) $\lambda_{typ}^{(i)}=2\pi/|\nabla_{i}\Phi|$.
The updated ``thermodynamic limit'' for quantum systems will then be $N\rightarrow\infty$ \textit{and} $\lambda_{typ}\ll d_{mfp}$ where $\lambda_{typ}$ will correspond to the thermal wavelength in the limit of high energy ($E\gg E_{F}$ or $E\gg E_{gs}$ for fermionic and bosonic atoms respectively).\footnote{The thermal state of metal band electrons seems like it would be a counterexample since the thermal oscillations in wavelength can be much longer than the mfp. However, the net effect will still usually be governed by these atomic wavelengths since the net wavefunction is a function of cores and electrons and the cores typically give much shorter wavelength. The case of ultracold fermionic gases is different since the cores themselves typically have very short wavelength.}
For later reference, we extend the above notion more precisely and notice that the kinetic energy of a wavefunction can be decomposed uniquely into standing and traveling wave components. This is convenient when we wish to discuss the kinetic energy that arises from vorticity (hence angular momentum) and currents from thermal motion independently of the, sometimes dominant, standing wave component especially at very low energies.
For the one-body case, $\Psi=A(x) e^{i\phi(x)}$. The kinetic energy density of the wavefunction decomposes as $\mathcal{E}=\frac{\hbar^{2}}{2m}A^{2}(- A''/A+\phi'^{2})=\mathcal{E}_{s} +\mathcal{E}_{j}$ for the static and current components. This obviously generalizes for many body wavefunctions. We thus have a local decomposition of energy density $E=E_{s}+E_{j}+U$. Extensions of virial results are possible. For example, classical gases have $U\approx0$ and $E_{s}=E_{j}$. Eigenstates (with Dirichlet boundary conditions) in potentials without rotational symmetry give $E_{j}=0$. The energy of solids are dominated by $U$. If we let $\Delta U$ be the difference in potential energy over the ground state, harmonic solids also have $E_{j}+\Delta E_{s}=\Delta U$, by the usual virial theorem.
\subsection{Typical Thermal States}
Let us consider some first guesses at a typical thermal wavefunction and see why they don't work. The microcanonical distribution suggests that we choose a wavefunction from the span of eigenstates sufficiently close to $E_{0}$. If we make this width narrow enough we eliminate all temporal fluctuations. Spatial correlations will generally persist and this is what is generally referred to as the quantum fluctuations of a system. Temporal fluctuations are often treated by imposing stochastic forces but, presumably, a good approximation to the actual wavefunction would let us read these off directly.
Since we know that temporal fluctuations are an important part of thermodynamics, we do not use the microcanonical ensemble as our starting point.
The next logical choice is to try the canonical distribution as a guide. Noting that $P(E)=Cg(E)e^{-\beta E}$ where $g(E)$ is the (many body) density of states,
we try a trial wavefunction
\begin{align}
\label{trial}
\Psi=\sum_{k} g(E_{k}) e^{-\beta E_{k}} e^{i\theta(E_{k})}\Psi(E_{k})e^{iE_{k}t/\hbar}
\end{align}
There is quasicontinuum of energy levels and we choose one representative from each level $E_{k}$ with a random phase specified by $\theta(E_{k})$. It is not clear how well defined this definition is since we can keep refining our $\delta E$ separation of levels until the quasicontinuum approximation fails and eventually we include every such state. Spatial coordinates are suppressed but the time evolution is explicitly included. Two major problems exist with this wavefunction. First it is unclear how a system ever arrives at it under (reversible) Schr\"{o}dinger evolution. Second, some of the ``representative'' states of each energy level can be highly anisotropic both in their 3D projections and in their many body directions e.g. the high angular momentum eigenstates and the strongly interacting ultracold gas ground state. Experience with high temperature gases tells us that isotropy is favored and correlations disappear. (In terms of a wavefunction this would imply it averages to be isotropic on scales larger than the mean free path\footnote{The meaning of ``mean free path'' in the quantum case should be clarified. For the case of short wavelengths compared to the particle cross sections, we have geometric scattering and the meaning is obvious. This is primarily the case where we argue thermalization occurs. For phonons, which don't have an easy packet construction, as argued earlier, so the collision time is a better measure. It can be defined by the time our quasiparticle picture maintains its product function like validity.}
when rotated about hyperangular directions.) It is probably true that a random wavefunction from the space spanned by this energy width $\delta E$ has these properties. However, the previous reasons make it clear we should work harder at finding what a typical thermal wavefunction should look like.
Let us begin with a proposition that describes what equilibration means for a wavefunction.
{\bf Equilibration Condition }: The scattering rates of many body currents at each frequency from scattering centers about the two body diagonals along each single body coordinate direction must balance. Specifically,
\begin{equation}
\Braket{|\frac{1}{m_{i}}\Im\nabla_{x_{i}}\Psi(\tilde{X})|_{x_{i}\approx x_{j}}|}=\Braket{|\frac{1}{m_{j}}\Im\nabla_{x_{j}}\Psi(\tilde{X})|_{x_{i}\approx x_{j}}|}
\end{equation}
where these are time averages over time scales typical of the local oscillation periods and
spin labels have been suppressed. The region of consideration around $x_{j}=x_{i}$ is the zone where incident flux is changing due to the scatterers. For this energy scale, we are concerned with the region near the classical turning point of the two-body potential out to the region where the potential makes small changes for such kinetic motion.\footnote{This makes the Coulomb potential and any other potential where the range may extend larger than the interparticle separation a poor candidate for this model and further consideration in those cases is important.}
If we think in terms of momentum flux balance this gives $\braket{\rho mv\cdot v}=2\mathcal{K}$ along each coordinate evaluated near the two body diagonals. Here $v$ is the velocity of the currents $v=j/\rho$ along each one-body coordinate direction. At higher energies we expect oppositely moving traveling waves to have no correlation and potential energy contributions to vanish so that half of the kinetic energy is in the form of such fluxes.
This shows that we should have the same kinetic energy contribution for gases along each coordinate direction. This condition does not depend on the particles having the same masses.
A very simple picture of the equilibrated state we envision as a fine scale excitation over the ground state of the system where the oscillations' wavelength is much finer that the curvature of the potentials and ground state wavefunction. Because of this, we expect it to ``fill in'' regions of lower potential energy function $\mathcal{U}(\tilde{X})$ much like water fills in a basin. The kinetic energy density is
\begin{equation}
\label{eq1}
\mathcal{K}(\tilde{X})=
\begin{cases}
E-\mathcal{U}(\tilde{X}), & \text{if}\ \mathcal{U}(\tilde{X})<E \\
0, & \text{otherwise}
\end{cases}
\end{equation}
subject to the condition that
\begin{align}
\label{eq2}
\int dX^{N}[E-\mathcal{U}(\tilde{X})]\Theta(E-\mathcal{U}(\tilde{X}))=E_{thermal}
\end{align}
that implicitly defines $E$. This is reasonable as long as the vast majority of the the amplitude is not in the low KE density region where the function tails off. For phonons we have a set of very anisotropic wells corresponding to orthogonal directions in $\mathbb{R}^{3N-5}$. When we get excited occupancy in all directions the material tends to melt \cite{Reif}. For realistic solids we expect that the lowest phonon modes will have high occupancy and this tails off to near zero occupancy for a finite fraction of states. The thermal wavefunction we can expect to satisfy the high frequency equilibration condition in terms of the two-body diagonals of the normal coordinates: $u^{(i)}(\tilde{X})$ but not for the low occupancy states. This means that this simple picture is only valuable for a solid when the vast majority of the thermal energy is in such high occupancy modes.
We can not specialize our equilibration condition to describe situations where we expect the collection to have thermal meaning:
{\bf Equilibrated Thermal State}: A wavefunction where there are a combination of both time varying currents and standing waves with typical wavelengths over a broad distribution that are much smaller than the scatterers and the mean free path, $\lambda_{typ}<<\sigma^{1/2},\lambda_{mfp}$, and the local oscillation distribution of the many body wavefunction is stable for long times over short time averages.\footnote{The case of electrons in a solid is slightly deceptive. It seems that, at typical temperatures, these wavelengths are often rather long compared to the atomic, electron-electron separation or electron mean free path. The decomposition of electron and core parts is artificial. There is really only one wavefunction for the combination of them. The typically short thermal wavelengths of the heavy cores determine the scale for both over time. This distinguishes electrons in solids from fermionic gases where no such background of heavier objects exists. The effects of this on thermalization will be discussed.}
To continue, we consider that the kinds of matter we most associate with classical behavior are solids and gases. (Liquids are still a subject of much debate.) In the former case the oscillations are phonons. In the latter, they are mostly unobstructed long range motions of individual particle waves. These both give nearly free motions in terms of these respective bases. Instead of giving an exact representation of the wavefunction on the true eigenbasis, we will utilize this property and describe it on the corresponding basis for this nearly-free approximation (NFA).\footnote{It is important to not use the true basis set for this description because we can start with an enormous distribution of energy eigenstates still attain a ``thermal state.'' The energy distribution in this basis will never change in isolation. We use the NFA basis in this global fashion but are really only interested in it as a good local description of the wavefunction away from the two-body diagonals. This is certainly not constant as the wavefunction evolves. To the extent that the system allows a viable 3D description, the evolving expression on this basis describes the microscopic current oscillations to give a more physical approach to stochastic thermal motions.} Specifically, for gases, we use a basis of free waves and for solids, we use a basis of phonons. It is not clear if this is a completely general approach. When excitations get large enough, as when temperature is large enough to cause appreciable expansion of the material and change in its elastic properties, the state is still built of many body eigenfunctions but they not decompose into products of the phonons as in the case of the low energy states. Our motivation here is that, for such high frequency states, geometric scattering tends to locally dominate and so that such an NFA basis gives a good local picture of the wavefunction away from the two-body diagonal scattering regions. It is such a basis that we presume always exists and will give meaning to the otherwise hard-to-justify ensemble averages and macroscopic thermodynamic quantities.
As a specific case, let us attempt to encode the (free and spinless) MB gas into a trial thermal wavefunction. Given the constant energy sphere in N-body momentum space we know that typical many body wavevectors $\tilde{k}=\{k_{1},k_{2},\ldots k_{N}\}\in\mathbb{R}^{3N}$ satisfy the MB distribution in its one body components. We can construct a trial wavefunction
\begin{align}
\Psi=\hat{\mathcal{S}}\prod_{j=1}^{N}(e^{ i k_{j}\cdot x_{j}})
\end{align}
Since this is an eigenstate, it has no temporal oscillations so is not suitable for our purposes. Neither does it have the expected MB statistical distribuion.
Using the one body kinetic result as motivation, let us consider a general Boltzman weighted sum on a free gas basis. Let $\psi_{k}=e^{ik\cdot x}$ be the one body free states with energy $E_{k}=\frac{\hbar^{2}k^{2}}{2m}$. (The volume normalization is chosen $\pi^{3}$ for simplicity).
\begin{align}
\Psi= \hat{\mathcal{S}}\prod_{l=1}^{N}(\sum_{k\in \mathbb{Z}^{3}}\psi_{k}(x_{l})e^{-\beta E_{k}})=\sum_{\tilde{k}\in \mathbb{Z}^{3N}}e^{i\tilde{k}\cdot \tilde{X}}e^{-\beta \frac{\hbar^{2}}{2m}\tilde{k}^{2}}=\sum_{\tilde{k}\in \mathbb{Z}^{3N}}e^{(i\cdot \tilde{X}- \frac{\hbar^{2}\beta}{2m}\tilde{k})\cdot\tilde{k}}
\end{align}
This latter wavefunction has (desirable) oscillatory time dependence, since it is not an energy eigenstate, but also possesses phase correlation at $t=0$ that are undesirable.
To eliminate the artificial phase correlations we choose a set of random phases $\theta(\tilde{k})$ and define our trial thermal wavefunction as
\begin{align}
\label{psith}
\Psi_{th}= \hat{\mathcal{S}}\sum_{\tilde{k}\in \mathbb{Z}^{3N}}e^{(i\cdot \tilde{X}- \frac{\hbar^{2}\beta}{2m}\tilde{k})\cdot\tilde{k}}e^{i\theta(\tilde{k})}
\end{align}
where the phases are random up to the symmetry conditions implied by bosonic or fermionic symmetry. (Spin labels have been suppressed in this discussion.)
As evidence for equilibration among wavefunctions that tend to such a local description, consider the \textit{interacting} dilute gas. A distribution of high frequency random oscillations produce currents that interact with the hard core scattering centers in the manner of geometric optics. In the two body CM frame, these centers gives the same dynamics as packets with energy and momentum conservation; the same dynamics that generate the classical MB distribution for hard spheres then apply here. The big difference is in the delocalization of the many body wavefunction so that is cannot be thought of as a set of billiard balls on the microscopic scale. Ultimately, even at such high frequencies, we know that there are eigenstates and superpositions that do not give us anything like MB or hydrodynamic behavior. From a Green's function point of view, these are cases with constructive scatting interference. The supposition here is that, at least for thermodynamics, this is rather unusual and energy distributes itself rather uniformly over space and with a range of frequencies given by Eqn.~\ref{psith}. We have presumed a unique local equilibrium distribution and this should be investigated further but, as in the classical case, expect it to be so.
The conditions on the smallness of the wavelength versus the scatter sizes and separation extends this reasoning to the case of solids with phonons as discussed above. In the case of liquids, the localized peaks presumably delocalize into a percolating structure that replace the lattice of well defined locations; some of the phonon modes being replaced by traveling modes that transport mass and allow greater penetration of vorticity. The ``necks'' in the percolating structure could provide for scattering losses from asymmetry in the density buildup about them and the shape of these altered by electron bond strain. This removes the need for aperiodicity to produced scattering which is important since we showed earlier that that notion of periodicity in a crystalline solid has no intrinsic meaning among transformations of the wavefunction corresponding to it \cite{Chafin}.\footnote{This is often overlooked because the electron part of the wavefunction for a solid with fixed cores is typically what is written down. This function does have discrete translational symmetry. However this part has only a limited role in determining the fluidity of a liquid. }
\subsection{Transitive Equilibrium}
So far we have not define the parameter $\beta$ which we anticipate will be related to the reciprocal of temperature. The most basic feature of temperature is its transitive nature; equilibration of a body A with a body B and equilibration of B with C implies A is also in thermal equilibrium with C. We can check to see if two such thermal wavefunctions with the same value of $\beta$ give a similar state.
\begin{align}
\hat{\mathcal{S}}\Psi_{th}\Psi_{th}'&= \hat{\mathcal{S}}\sum_{\tilde{k}\in \mathbb{Z}^{3N}}e^{(i\cdot \tilde{X}- \frac{\hbar^{2}\beta}{2m}\tilde{k})\cdot\tilde{k}}e^{i\theta(\tilde{k})}\sum_{\tilde{k}'\in \mathbb{Z}^{3M}}e^{(i\cdot \tilde{X'}- \frac{\hbar^{2}\beta}{2m}\tilde{k}')\cdot\tilde{k}'}e^{i\theta(\tilde{k}')}\\
&=\sum_{\tilde{k}''\in \mathbb{Z}^{3(N+M)}}e^{(i\cdot \tilde{X}''- \frac{\hbar^{2}\beta}{2m}\tilde{k}'')\cdot\tilde{k}''}e^{i\theta(\tilde{k})}e^{i\theta(\tilde{k}')}
\end{align}
Where $\tilde{k}''=(\tilde{k}',\tilde{k})$ and similarly for $\tilde{X}''$.
Assuming that the action of scattering mixes the phases sufficiently, this NFA basis representation of $\Psi_{th}$ gives an equilibration for two uniform density interposed gases. From this we can define thermometry based on equilibrium with a particular chosen standard gas.
\subsection{Thermodynamics}
The case of homogenous state thermodynamics is of limited interest but really all that we are in a position to now discuss. Inhomogenous stationary cases like heat transport and dynamic cases like sound waves and hydrodynamics generally require the validity of a 3D description so that we can apply the Navier-Stokes equations and chemical potentials. When such a description holds and the extent to which it applies in the case of ultracold gases will be the subject of the next section.
The homogeneous case gives a starting point to try to assign meaning to the ensemble averages and thermodynamic variables. Pressure, temperature and entropy can all be defined in terms of the NFA basis. For an interacting gas this gives the free gas pressure which is correct microscopically. The two body interactions alter the net pressure on the edges of the trap by excluding regions from contact with the support of the wavefunction and replacing them with potential terms. Entropy and temperature have similar microscopic meanings. The larger scale values don't have an immediately obvious connection with the true density of states of the system. For this reason we investigate these in terms of the true eigenstates of the system.
Our initial trial wavefunction of Eqn.~\ref{trial} was built on the NFA basis not using the true many body eigenstates. The thermal equilibration condition leads to local configurations well described by this but obtaining the macroscopic averages requires us to do better. We know that the NFA basis with the thermalization property led to a dominant contribution from a narrow distribution of states. For similar reasons we assume the same is true on larger scales where the true basis gives a better description. It is important to remember that the net wavefunction is in the same eigenstate distribution it started in. The scales we are talking about are much larger than the mean free path but much smaller than the total system size.
We extend Eqn.~\ref{trial} for the quasicontinuum to a typical state of the form
\begin{align}
\Psi_{th}=\int dE g(E) e^{-\beta E} e^{i\theta(E)}\Psi(E)e^{iEt/\hbar}
\end{align}
where $\Psi(E)$ is a suitably isotropic and random element of the constant $E$ sphere. When the distribution is strongly peaked, the hyperarea, $\mathcal{A}(\Psi_{th})$, of the dominant energy surface is all we need to characterize the state for this purpose.
In terms of this we can define the entropy as $S=k_{B}^{-1}\ln \mathcal{A}(\Psi_{th})$ temperature $\beta=(k_{B}T)^{-1}=\partial\ln \mathcal{A}/\partial{E}$ which lead to the usual thermodynamic relations and canonical averages without requiring the use of mixed states or any type of ``ensemble.'' Introducing additional constraints on angular momentum and other conserved quantities is important when computing results for macroscopic matter. These are always well defined here although it is not immediately clear how to best do this and if history independent results must follow. The most natural guess would be to restrict each of the $\Psi(E)$ to be a most probably choice with the restricted angular momentum. This certainly deserves more consideration but is probably an involved topic on its own.
\section{Hydrodynamics}
\subsection{Convection and Vorticity in Solids}\label{convection}
In \cite{Chafin} we discussed the kinematic constraints of a solid and the nature of microscopic (longitudinal phonon) excitations. The equations of motion of a wavefunction are always linear but the motions of fluids and even acoustic waves in solids contains nonlinear advective terms. It is illuminating to examine how this and the classical pressure and stress arise in the solid case briefly first before examining the fluid case. We discussed the case of longitudinal oscillations in \cite{Chafin} but shear waves also exist and these require the presence and transport of vorticity. The location and mobility of vorticity is an important topic in fluid dynamics but here we will argue it is also very important for a comparison of classical hydrodynamics with angular momentum and quantum systems ranging from ultracold bosonic and fermionic gases to superfluid Helium.
We conventionally think of sound waves as particular linear combinations of phonons. The weakness in this argument is that the core displacements in the phonon are assumed to be small changes in their equilibrium positions. For larger solid with long wave sound of even modest amplitude, the displacements can be many atomic spacings. There is no reason to doubt that such excitations can be built on eigenstates of the system but it is not clear that they can be made from one-body excitations in the quasiparticle limit of such modes with long lifetimes. In this case, by ``lifetime'' we mean that duration of time that the solid can be well represented in the form
\begin{equation}
\Psi (\tilde{X})^{(N)}\approx\hat{\mathcal{S}}^{f/b} \int d\tilde{X'}_{\perp}d{u} F(\tilde{X};\tilde{X}'_{\perp},u)\Psi(\tilde{X'}_{\perp})^{(N-1)} f(u)
\end{equation}
where $F$ is a kernel that includes two-body and higher corrections near the ground state and $\tilde{X}'_{\perp}$ gives the 3N-3 coordinate space perpendicular to $u$.
The classical equation for solid motion is the Navier-Stokes (N-S) equations with strong local restoring stresses
\begin{align}
\label{NS}
\rho\partial_{t}v+\rho v\cdot\nabla v&=-\nabla\cdot\Pi\\
\partial_{t}\rho&=-\nabla\cdot(\rho v)
\end{align}
where the internal stress tensor $\Pi$ provides energy and momentum conservation and provides restoring forces. (Following convention we have used $\rho=nm$ here as the mass rather than the particle density.) More accurate treatments include thermodynamic changes from local compression and their effects on temperature. For gases this gives a large contribution to the speed of sound but for our discussion of solids we neglect it.
As a first example consider the wavefunction of a solid, $\Psi_{class}$, consisting of N distinct atoms on a lattice as in \cite{Chafin} Eqn.~2 but without the symmetry constraints on the core locations. This corresponds to a single localized peak in $\mathbb{R}^{3N}$ space corresponding to the lattice sites $\tilde{R}=\{R_{1}\ldots R_{N}\}$. If we perform a displacement of the cores while preserving their localization we obtain a new set of lattice sites $\tilde{R'}=\{R_{1}'\ldots R_{N}'\}$. We can map this into a 3D density function $\rho(x)=m\braket{R_{i}}$ where $\braket{R_{i}}$ is the volume averaged density of the cores on a scale much larger than their separation. By using the local velocity of the cores and the bond energy density we can define $v$ and $\Pi$ to derive Eqn.~\ref{NS}. This follows from the lagrangian form of the Schr\"{o}dinger equation since these are long lasting qualitiative states and in this limit we obtain the classical lagrangian.
Since N-S are a nonlinear equations we expect that the corresponding evolution in terms of an eigenstate expansion must probe regimes of the many body eigenstate spectrum beyond any linear quasiparticle picture. It also implies that such a regime always exists in any system that gives classical N-S behavior.
Now let us consider the simplest case of vorticity and solids: rotation. A classical body undergoes rigid body rotation with velocity field $v=r\omega$ where $r$ is the distance from the axis of rotation. This velocity field has the virtue of having the lowest kinetic energy of any velocity flow field with a fixed angular momentum. Quantum systems with large amounts of angular momentum like superfluid Helium exhibit an Abrikosov vortex lattice \cite{Putterman} that give this as an averaged velocity field. This suggests that we might expect a solid to have such a hidden lattice of rotation somehow hidden in its corresponding many body wavefunction $\Psi_{class}$ however we will see that this can be very far from the truth. We saw in \cite{Chafin} that being specific about the kinds of wavefunctions that specify classical matter removed the apparent problem with macroscopic superpositions by giving low energy long lasting partitions of the observers evolution and that naive superpositions created huge energy barriers that lead to unphysical states. Here we will see that the way vorticity can enter the wavefunction of such a classical body generates very little energy change unlike the usual quantum fluid examples we are familiar with.
Let us continue with our example of distinct particles in the solid as above. The state of this system is represented by a single peak at $\tilde{R}$ that now evolves according to the classical orbits $\dot{R}_{i}(t)={\omega}\times R_{i}(t)$. This generates a 1D loop in $\mathbb{R}^{3N}$. This loop induces a 2D surface but, in such a high dimensional space, it has no unique normal to orient a vortex line about the center. We can, nevertheless, choose any one of many vortex lines through the middle it with a (typically huge) winding number that generates the orbit in a period about the loop of $T=2\pi/\omega$. The vortex cuts through the
low amplitude tail of the wavefunction so has very little energy contribution to the system. Furthemore, there are many such vortices that can generate the same behavior. In fact, many vortices could be used as long as they generate the uniform orbital motion around the 2D loop. If we now allow the atoms that make up the body to be identical (or just as problematically, allow them to be composed of the same type of constituent fundamental baryons and leptons) we now symmetrize and generate a set of $N!$ peaks and the same multiplicity of new vortex lines. In a solid there are many low amplitude regions between the cores so it is energetically favorable for them to fish their way through these percolating ``interstitial'' gaps.
Now consider a cubic solid that has undergone a shear deformation and is released at $t=0$. The net angular momentum of the solid is zero but the motion is now a combination of shear and rotation so that relative motions induce opposing vorticity that is created and destroyed over time. We can still use the above method to track the core locations and make statements about the kinds of vorticity distributions allowable. In particular, the constant density of the material implies that vorticity only passes in and out of the surface rather than being created. This means that we can expect apparently singular domains of vorticity at the edges of the body in the low amplitude tails of the wavefunction.
Even though it seems like there is no net vorticity, the presence of opposing vorticity have dynamical effects are are important especially in classical fluid dynamics. The enstrophy is defined as the measure of the square of the voriticity. For a constant density fluid, this has kinetic energy contributions. However, for our solid, it seems that the low amplitude regions of the wavefunction induced by the strong binding forces that induce relative localization and motion constraints among the cores are so much more important than any vorticity contribution to the kinetic energy that vorticity is simply created, destroyed and moved about as needed with little effect on the classical motions. Gases will not have such features and the role of vorticity here will be different.
\subsection{Classical Gases}
The distinction between classical gases and familiar quantum gas cases is central to the upcoming discussion on thermalization and the validity of hydrodynamics for ultracold gases. For this reason we will enumerate some of the differences in the observed behaviors and what corresponding differences the many body wavefunction describing each must exhibit.
Consider an isolated 1~kg solid. The delocalization of an atom versus that of the CM is related by $\sqrt{N}\delta X_{a}=\delta X_{CM}$. Assuming each atom is localized to $\delta X_{a}\approx10^{-11}$m we have the CM localized to $\delta x_{cm}\approx 10$~m. The delocalization rate of the CM is therefore $v_{del}\sim 10^{-33}$~m/s.\footnote{It is surprising that the CM is not extremely well localized based on this assumption but the kinematics of large bodies can be unaffected by it. Placing two such bodies adjacent to each other encounters no overlap or restrictions from it since the interactions come from the lack of localization in each individual coordinate label.}
In contrast, the delocalization rate of a lone atom with the same initial localization is $v_{del}\sim10^{4}$~m/s. Thus, while the atoms of a solid maintain the picture of being classical very well, the gas leaves the category of ``classical'' rapidly and expands into a very delocalized object where strong correlations are necessary to avoid the large overlap energies we obtained earlier from ``naive superpositions'' \cite{Chafin}. The kinetic oscillations will still dominate the gas as they are much more energetic than the curvature of delocalization. In one sense, this is heartening, if the gas were to stay very localized then it would cast doubt on the relevance of the entropy values derived from the Sakur-Tetrode equation. In another sense, it is distressing because it makes it hard to justify the 3D parcel assumptions we generally use to build thermodynamics and hydrodynamics. Being so energetic in the relative coordinate directions suggests that there is very little energy cost to generating vortices that enter the support of the wavefunction.
We can make a first estimate this by using the thermal wavelength to bound the size of norm exclusion about a vortex core. In the low temperature bose gas case the correlation length specifies the damping of the order parameter about a vortex \cite{Putterman}. Here the vorticity does not experience the same tendency to correlate over all particles but for our estimate here we want the density to truly get driven to zero when we symmetrize so we assume an N-fold vortex product. Such a ``vortex line'' of length $d$ generates a volume exclusion of $\sim \lambda_{th}^{2}d$. The local energy cost for this is very little kinetically since the local oscillation curvature of the attenuation about the vortex is comparable to the thermal curvature it replaces. The density change must be compensated for in the overall compression of the gas so, assuming each vortex\footnote{We will reexamine this assumption more carefully in Sec.\ \ref{angular}.} gives angular momentum $N\hbar$, we have a net hidden quantum contribution to the thermodynamic energy of $\Delta E\approx P ( \lambda_{th}^{2}d)(L/N\hbar)$ where $d$ is a measure of the extent of the cloud and $L$ is its net angular momentum. From this we conclude that $\Delta E\ll E=\frac{3}{2}k_{B}T$ when the rotational period of the cloud, $\Omega$, satisfies $\frac{k_{B}T}{\hbar}\gg \Omega$. (If we have residual quantum enstrophy this gives another increase in the energy correction.) For a room temperature object this gives $10^{12}\gg\Omega$. It is evident that only very small and tightly bound objects can ever obtain such a rate of rotation. When $\Omega\sim k_{B}T$, which occurs for $T\sim10^{-8}$ for KHz frequencies, the quantum correction to the thermal energy of the system becomes comparable to classical thermal one which is when visible coherent vortices dominate the motion instead of rigid body rotation. In both cases the angular momentum is due to vortices in the cloud but in the high energy case there is no favored coherence of them so that angular momentum must increase in $\sim N\hbar$ steps rather than just $\hbar$ steps.
In principle we will see there is no quantum limits on the actual size of vorticity due to possibilities for superpositions but there is always a ``vorticity penetration cost'' that dominates in the lower energy states where the ground state curvature is large relative to excitations. How vorticity appears in higher energy wavefunctions to give classical hydrodynamics is the central topic of the next sections.
The effect of collisions of gas atoms with solid walls is known to be profound. It was observed in the 1880's that the viscous flow of gases in narrow tubes can only be explained if there is a nonspecular reflection of gas particles at a solid surface \cite{Jeans}. The results are consistent with adsorption and reemission of gas particles as thermalized with the surface. A delocalized gas molecule undergoing an effective measurement by the surface would effectively be part of the phonon structure of the solid at the end of it. Ejection follows from the state of the surface being unable to bind the molecule even at rest rather that from a conservation of momentum at the surface. A highly correlated history of collisions induces some constraint on its history in that slice. Whether this is a strong enough effect to induce a well defined 3D hydrodynamic gas flow in each slice is an important question and a possible future test for this model.
In the absence of such solid material, the gas will continue expanding to even much larger distances to create a wavefunction that has little in common with the classical billiard ball picture of a gas. The distinction is so strong that it is hard to see how calculations based on this model can be considered to make any statement about the system. It turns out that things are not that bad but only after a more serious consideration of the system based on its actual state as a wavefunction. Thermal properties seem to agree, however, the resurrection of classical hydrodynamics is rather complicated. We follow our example with solids and write down the simplest plausible many body wavefunction consistent with classical hydrodynamics and discuss some conditions under which it would evolve according to the hydrodynamic limit.
\subsection{Quantum Gases}\label{quantumgas}
The experimental quantum fluids are superfluid $^{4}$He, $^{3}$He and ultracold gases. There are other examples of experimental quantum systems like superconducting electrons and exciton-polariton condensates that can exhibit migration but neither exhibit the clear fluidity of hydrodynamic systems. The telltale features of superfluid behavior are irrotational motion, specifically the presence of vortices, a lack of viscosity and two-fluid behavior. In the case of Helium, the two-fluid model has been well verified \cite{Putterman}. Damping has been measured in particular configurations like the oscillating plate Andronikashvilli experiment and the case of vibrating wires. It is often stated that these experiments measure viscosity. Damping can be calculated by the phonon and roton scattering model of Landau and Khalatinikov \cite{Khalatnikov:65} however viscosity is more than just a measure of damping. It is defined by the N-S equations and places very particular constraints on how vorticity can move and enter the fluid. In the constant density fluid, the vorticity transport theorem \cite{Batchelor} implies vorticity is advected and can only enter or leave through the boundaries. In Sec.\ \ref{ultracold} we will examine the possibilities than nonequilibrium history dependent behavior is persisting and what small effects might be evident in the cloud shape from them including a tendency to keep vorticity out of the higher density regions.
The two-fluid model describes a fluid as having a normal and superfluid component where the superfluid part has no viscosity. As $T\rightarrow0$ the normal component vanishes yet these damping processes persist and the critical velocity in small tubes remains finite. The damping of flow in larger tubes and flow rates what phenomenologically explained by Landau due to quasiparticle excitations. This explanation is largely no longer believed as pictures of superfluid turbulence have become more clear. Thus the case of superfluid Helium seems to still have some mysteries despite the successes of the two-fluid model and there is no fundamental understanding of how the two-fluid model arises.
These considerations are important because ultracold bosonic gases have exhibited long lasting vortices. This suggests superfluidity and that a two-fluid model might apply to them however, these vortices often decay leaving one to wonder what is happening to the angular momentum they possess. The possible existence of quantum limit on viscosity \cite{Kovtun:2004de} is a pressing problem and has attracted much theoretical and experimental attention with the study of these gases playing a central role. For this to be a valid approach, thermodynamics and hydrodynamics should provide a well defined description of them.
The most simple and successful treatement trongly repulsive bosons at low energy is the Gross-Pitaevskii (GP). The simplest treatment of GP is to assume that the many body wavefunction is a simple product $\Psi=\prod_{i}^{N}\psi(x_{i})$. Variational methods then give the evolution equation
\begin{align}
i\hbar\partial_{t}\psi(x,t)=\left(-\frac{\hbar^{2}}{2m}\nabla^{2}+V(r)+\frac{4\pi\hbar^{2}a_{s}}{m}|\psi(x,t)|^{2} \right)\psi(x,t)
\end{align}
where the last term which could be summarized as the interaction strength ``g'' is written in terms of the two-body scattering length $a_{s}$ and the normalization has been chosen $\int |\psi|^{2}dx=N$. With this normalization $\psi$ is usually called the order parameter and labeled $\Phi_{GP}$. It is distressing to have a nonlinear equation appear but the price of forcing a product function solution. A more realistic function would have the form
\begin{align}\label{product}
\Psi(\tilde{X'})=\int d\tilde{X} F(\tilde{X'},\tilde{X})\prod_{i}^{N}\psi(x_{i})
\end{align}
The interaction strength is really a measure of the interaction contribution at the near contact potential and the kinetic energy induced by the curvature as summed up in the kernel $F(\tilde{X'},\tilde{X})$. This is important since the true interaction between particles is often attractive. We can obtain effectively repulsive effects by having the system in an excited branch of the two body potential's spectrum.
Being in a low energy state suggests that the wavefunction is strongly limited in the motion it can exhibit. If we have a cloud in a spherical harmonic trap and make small quasi-static deformations of it through a one-parameter set of quadrupolar deformations, we can obtain a set of wavefunctions $\Psi(\tilde{X};\alpha)$ where $\alpha$ gives the deformation. A deformation that is then released in the spherical trap can then evolve over this set to a good approximation so long as $E_{j}\ll E_{s}$ for all time. This gives a solution $\Psi(\tilde{X};\alpha(t))$. The many body $\Psi$ can be described in terms of a limited set of variables like the one-body density $\rho(x)$, a one-coordinate projection $\psi(x)=\psi(x_{1})=\Psi((\tilde{X})|_{x_{2}=c_{2}\ldots x_{N}=c_{N}})$, the best fit product expansion as in Eqn.\ \ref{product}, or even the single parameter $\alpha$. Any equation of motion in terms of these variables must eventually fail since the $\Psi$ has current terms and so is not going to stay well describable by such a limited class of function forever. Since the Schr\"{o}dinger equation can be written as a hydrodynamic equation with a quantum pressure term it is not surprising that we can get a linearized Euler equation for the dynamics in terms of $\psi(x)$ induced $\rho(x), v(x)$ valid for some finite time. This is expressed in Fig.\ \ref{fig: NS2}. The extent to which such a situation holds for more general gases the subject of the following sections.
\begin{figure}
\[
\xymatrix @C=5pc @R=5pc{
\Psi(\tilde{X},t) \ar[d]_{U_{H}(t,t')} \ar[r]^{\hat{P}} & \rho(x,t),~v(x, t) \ar[d]^{\text{Euler Eqns.}} \\
\Psi(\tilde{X},t') \ar[r]^{\hat{P}} & \rho(x,t'),~v(x, t') }
\]
\caption{For a near ground state of an interacting Bose gas the kinds of adiabatic deformations and release in a trap and the stiffness of such a wavefunction implies near commutativity of the diagram. In contrast, a noninteracting gas makes this exact since the induced many-body currents cannot transfer energy to its transverse directions. }\label{fig: NS2}
\end{figure}
Another approach to such abbreviated ``order parameters'' to describe $\Psi$ is to look at it along a particular subslice. For bosons we could use the value of $\Psi$ near the many body diagonal $x_{1}=x_{2}=\ldots x_{N}=x$. The function must near vanish there due to interactions but we can look at an $\epsilon$ displacement from it $\psi_{d}(x)=\Psi(x+\epsilon,\ldots x+\epsilon)$. This is also possible for a fermionic wavefunction as long as we don't evaluate it on a node $\psi_{d}^{(f)}(x)=\Psi(x,x+\epsilon_{1},x+\epsilon_{2},\ldots x+\epsilon_{N})$ where $\epsilon_{i}\ne\epsilon_{j}$ for all $i\ne j$. This can be made unique by choosing the many body directions that give the largest local amplitude.
Of course, such an approach is most interesting if we can give an equation of motion valid for reasonably long times in terms of it or relate it to some measurable quantity. For large deformations or time changing potentials or interactions, it will often be the case that such a description is not meaningful since the evolution of $\Psi$ will access many more degrees of freedom on much shorter time scales.
In the favor of such an approach for bosons is that the GP equation for ultracold bosonic gases gives excellent static description of cloud densities.
Dynamically, it has given qualitative and sometimes quantitative descriptions of such clouds \cite{Dolfovo}. In the case of small oscillations of boson and fermion clouds near unitarity, the hydrodynamic approximations for static cloud shapes works very well and predicts the small oscillation periods quite accurately at least for the lowest modes \cite{Stringari:2004}. This is rather profound. A classical gas as a set of billiard balls defines mean free path, collision times, cross sections and the like in a very intuitive manner. The quantum case, as we have seen, allows rapid delocalization of localize packetsd into a cloud where correlation effects can dominate. Even in the high temperature regime it is not clear that we should get Navier-Stokes evolution and that the huge cardinality of degrees of freedom in a general many body wavefunction should condense to the very limited set corresponding to a cloud with well defined temperature, velocity, density etc.\ that are purely 3D variables. Microscopically we expect that this is a single wavefunction with a well defined phase moving with only singular sources of vorticity. We know a wavefunction can exhibit perfect stationary or periodic motions at any energy by producing linear combinations of eigenstates, yet hydro and thermodynamics give a vastly restricted class of motions. To date there has been no derivation of classical hydrodynamics from a wavefunction based approach. It is not even obvious how to choose appropriate initial data for such a description.
Shortly, we will give a proposed explanation for N-S behavior as a suitable limit for high temperature gases and a non-hydrodynamic explanation for why and when the linearized N-S equations should give a valid description for oscillatory modes in bosonic gases. Damping of these modes provides an additional challenge usually tackled through linear response theory and the Kubo formula. These can be thought of as scattering based approaches. For a fixed external potential and interaction strength, the system could also be considered as expanded on a basis of eigenfunctions. This should give a consistency check on linear response theory since the end results must be consistent. The Kubo formula for dissipative response has been very successful yet there are longstanding serious doubts about the validity of its derivation \cite{Kampen}. No conclusive resolution of these problems have been obtained. Linear response theory is generally applied to get response functions and transport coefficients. In the case of hydrodynamics, a N-S model with possible gradient expansion is assumed and the coefficients are derived. Classically, higher order expansions tend to have convergence problems \cite{Cohen}. The Kubo approach generates fractional order expansion coefficients that cannot be mapped onto any gradient expansion. Fractional derivative equation might hold some promise for resolving this but tend to introduce many unfavorable behaviors on their own. Generally, this situation is described as the case when hydro ``breaks.'' However, the aspect of this problem that is generally ignored is when the N-S expansion is even valid at lower order for such gases. For it to be so, important correlation properties must hold and persist. This would then be a specific model to give an eigenstate based consistency check on the linear response approach.
\subsection{Angular Momentum and Vorticity}\label{angular}
In quantum mechanics we learn that angular momentum is quantized in units of $\hbar$. This is evident from eigenstates of the Hydrogen atom. Photons don't have a wavefunction and classical electromagnetic waves exhibit a kind of ``angular momentum paradox'' due to the fact that classical spiraling wave solutions seem to posses zero angular momentum. However, for photons, we use second quantized solutions with angular momentum given by the helicity of the wave derived from the operator rules \cite{Schweber}. In the case of superfluids we append the superfluid phase rule $v_{s}=-\frac{\hbar}{m}\nabla \phi$ to the two fluid model and verify integral increases in angular momentum corresponding to all particles in the superfluid fraction contributing $\hbar$.
For a general wavefunction, is it clear that angular momentum requires a current hence an advancing phase (so $E_{j}\ne0$). Topologically, this implies there are 3N-1~D hyperlines where the phase evolves about with diverging velocity near them, the amplitude of the wavefunction must vanish there. Thus, angular momentum necessitates the presence of vorticity.
Angular momentum is always determined about a fixed base point.
In the study of rigid bodies, the parallel-axis theorem tells us we can compute the angular momentum of a system about their CM and then the bulk motion of these bodies about the base point. For a general wavefunction let us consider the implications of shifting the base point on the angular momentum of the system.
For an Abrikosov vortex lattice in strongly interacting bosonic systems, the collection of vortices rotate like a rigid body and the velocity advances, when averaged over scales larger than the coherence length, to that of rigid body rotation. Consider a wavefunction with uniform support in a cylinder of radius $R$, height $H$ and attenuation at $r_{0}\approx0$. The density is $\rho=(\pi H(R^{2}-r_{0}^{2}))^{-1}$.
If we have a single vortex line down the central axis the velocity field is $v(r)=v_{s}\frac{R}{r}$ where $v_{s}$ is the velocity at the surface then the angular momentum is $L=\int dm(r) v(r) r=\int (m \rho H ~2\pi r dr)(v_{s})r$. Since this field corresponds to a wavefunction $v_{s}=n\frac{\hbar}{m r}$ where $n$ is the winding number so we have $L=n\hbar$. The kinetic energy is $K=n^{2}\frac{\hbar^{2}}{m(R^{2}-r_{0}^{2})}\ln(\frac{R}{r_{0}})$ which tends to the classical result for a ring as $r_{0}\rightarrow R$. The logarithmic trend vanishes in the limit of many closely packed vortices but for dilute vortex fractions such considerations are important. Thermodynamic quantities are generally extensive in the size of the sample. Angular momentum is not but the ratio of it and kinetic energy for a solid are nicely related by $K/L=\frac{\Omega}{2}$. For our irrotational rotating cylinder the ratio is $K/L\approx\frac{n\hbar}{mR^{2}}\ln(\frac{R}{r_{0}})$.
If we displace the vortex from the center of our cylinder (moving the attenuation radius with it) so that the phase pattern remains uniform, both the angular momentum and kinetic energy are altered. To measure the angular momentum we must make a choice between still using the center of the cylinder and using the new center of the vortex. If we keep the base point at the center of our distribution and displace the vortex radially then the angular momentum of the system drops to zero as the vortex moves to infinity. If we, alternately, keep our base point at the vortex center then the angular momentum decreases similarly. As the vortex leaves the support of the density and approaches large distances, the cloud picks up a net motion about the vortex center. In neither case is angular momentum (nor linear momentum) conserved. Since the vortices are topological objects that can combine with vortices of opposite helicity but, otherwise must enter an leave the support intact, changes in the angular momentum must occur by changes in their curvature and orientation, the local phase gradients that wrap around them or the density of the norm. Naive shifts in vortex structures are generally forbidden by angular momentum conservation.
Regardless of what what base point we choose, the kinetic energy is, of course, the same which reminds us that the ratio of $K/L$ generally won't have any coordinate invariant meaning. The angular momentum per vortex is now no longer $\hbar$. How can this be? The state is clearly not an eigenstate since there is now a transverse velocity field at the boundary. The angular momentum was never really a localized quantity. We only associated it to the vortex since it has an obvious and precise location. The phase fronts do not need to be uniform as in the cylindrically symmetric case. General superpositions are allowed so that the many body vortices can give $L<N\hbar$.
These all make evident that intuition we have gleaned from superfluids or symmetrical quantum eigenstates are prone to lead us astray. The interesting questions are how classical and superfluid motion arise from such a general wavefunction.
It is now clear that we must now be more careful in assuming that there is a simple relation of the form $L=N_{vor}\hbar$ where $N_{vor}$ it the number of vortices in the sample. If a uniform lattice exists with vortex separation distance given by $d$, there is a smoothed flow that gives rigid body rotation as is evident by computing the circulation about symmetrically nested circles.
We are now in a position to compute deviations from the rigid body result. For a uniform density rotating disk $L=\int d\theta \int \rho~r~dr (v r)$ where $\rho=M/\pi R^{2}$ and $v=\Omega r$ so $L_{class}=\frac{1}{2}M\Omega R^{2}$. If we consider our vortices are made of nested rings at radii $r_{k}$ spaced by $d$, the circulation in the integral is altered since $v r=\Omega r_{k}^{2}$ for $dk=r_{k}<r<r_{k+1}=d(k+1)$. The resulting angular momentum is
\begin{align}
L=\int (r~dr) d\theta \rho~ (v ~r
\end{align}
where the approximation $v=\Omega r_{i}\frac{r_{i}}{r}$ between every pair $(r_{i},r_{i+1})$ gives the \textit{exact} circulation along every closed loop in this interval. The resulting integral becomes
\begin{align}
L&=2\frac{M\Omega}{R^{2}} d^{4}\sum_{j}^{s} j^{3}\\
&\approx \frac{1}{2}M\Omega^{2}d^{2}\left( s^{2}-2s \right)
\end{align}
where $s=R/d$.
Neglecting density changes from attenuation near the vortices, the classical result is excessive by $\Delta L\approx 2\frac{d}{R}L_{class}$. Similar corrections exist for kinetic energy that is actually in excess of the classical result. Notice that this correction is only small because of the large number of vortices. A few widely separated vortices give energies that are not even independent of the size of the system.
The case of interacting (repulsive) bosonic gases are the most dramatic in terms of angular momentum because these gases can exhibit visible vortices and vortex lattices like we see in superfluid Helium. This is the opposite limit of a high temperature gas since the thermal oscillations are now small compared to the ground state curvature. This leads us to expect the kinetic and potential energy cost of introducing vorticity will be much larger hence give different behavior.
In the noninteracting case, we can have a product of individually evolving one-particle functions that each have arbitrary vortex structures. The role of interactions is to force the many body wavefunction to cause these structures to correlate so that these give a visible density drop in the one body density function $\rho(x)$. Using one-particle language we would say that every particle shares in the same vorticity structure. If the vortex is at the center, this corresponds to $L=N\hbar$ where $N$ is the total number of particles.
If we model two body interactions with a set of Jastrow-like corrections the function looks like
\begin{align}\label{eqn:vortex}
\Psi(\tilde{X'})=\int d\tilde{X} F(\tilde{X'},\tilde{X})\prod_{i}^{N}\psi(x_{i})
\end{align}
where $\psi(x)$ encodes the phase and vorticity structure and $F(\tilde{X'},\tilde{X})$ gives the curvature due to the interactions.
The repulsive interaction is greatest at the two-body diagonals. If the vortex structure was built from a set of functions that did not have vorticity at all the same points we could still symmetrize it but the cores would not be falling on these repulsive diagonals. If we used only $n<N$ of the particles in the system then a fraction of the $~N^{2}$ diagonals would not intersect with these diagonals. Even if this was only $\sim N^{-1}$ particles there are still $\sim N$ diagonals with amplitude not vanishing except for the damping action of the kernel $F$. We have implicitly considered each vortex to have winding number $n=1$ (often the most stable case) but, in this ``one-body'' picture of the many body vortex, we also have to consider the ``occupancy'' of these vortices. Implicit in the two-fluid model is the the superfluid component has ``full'' occupancy and, for ultracold bose gases, the stable states do as well. This observation tells us that it is more accurate, for superfluids, to describe the vortices of having full occupancy rather than quantized angular momentum since we saw that sifting these vortices relative to the fluid surface changes it when we leave the base point fixed.\footnote{We will soon see that high temperature gases tend to a coarse grained irrotational product function to reduce scattering. Vorticity is less expensive for these gases and the higher velocities are short range so not necessarily so constrained. For strongly interacting gases, similar scattering effects may explain why vorticity does get so restricted.}
A better understanding of this might lead to a non-phenomenological description of the two-fluid model in terms of the specific dynamics of a many body wavefunction.
As we noted above, displacing the vortex from the center of an axially symmetric cloud, reduces the angular momentum of the system. The coherence effect seems to be more a statement of the orientation of the many body vortices due to the interactions than one of angular momentum quantization itself. This begs the question of what happens as the cloud relaxes as this vortex shifts or if less than such an optimal amount of angular momentum is initially imparted.
If the angular momentum is low enough of a cloud in an axially symmetric trap, we can get surface waves which correspond to vorticity at infinity or at finite distances in the low amplitude tails of the distribution. These vortices don't suffer the same vortex penetration costs. Such surface waves are familiar in both bosonic and fermionic clouds. What is unclear is what happens to it as these oscillations seem to settle down. The angular momentum must be preserved. In a classical gas, we expect the final state to give rigid body rotation as predicted by viscous N-S evolution. In the case of interacting bosons, this seems to require vortices to penetrate the whole cloud uniformly like a vortex lattice or to be ``uncorrelated'' in the sense above. This gives large kinetic energy contributions without the corresponding decrease in interaction energy. An energetiically more favorable situation would by to allow some angular decorrelation in the picture of one-body states in Eqn.\ \ref{eqn:vortex}. If we use the one-body functions $\psi(x_{i};\theta_{i}(t))$ as elliptically deformed rotating states where $\theta_{i}(t)$ indicates the angle of the major axis of the $i$th function then a final state such wavefunction is
\begin{align}\label{eqn:rot}
\Psi(\tilde{X'})=\hat{\mathcal{S}}\int d\tilde{X} F^{\star}(\tilde{X'},\tilde{X})\prod_{i}^{N}\psi(x_{i};\theta_{i}(t))
\end{align}
The choice of $\theta_{k}(t)=k\frac{2\pi}{N}+\Omega t$ gives an axially symmetric one-body density function for $\Psi$ that retains the angular momentum of the state with $\theta_{k}(t)=\Omega t$ for all $k$. ($F^{\star}$ indicates that the kernel we use to include correlations may be somewhat different than the one used for the true ground state.)
There is a reduction in the interaction energy at the surface due to reduced interaction energy. This provides a distinct picture than the GP equation for angular momentum to exist and ultimately enter the bulk of the cloud in more observable form. Since the overlap of the one particle wavefunctions gives the interaction energy. The decorrelation of these semi-major axes reduces the repulsive interaction so that the cloud radius will contract compared with the simple rotation of the one body functions.
Due to interaction effects and the possibility of hidden phase gradients it would be convenient to have a measure of the number of one body wavefunctions that overlap.
We can quantify the ``number density'' in this model
in a fashion other than the usual GP order parameter and independent of the one-body density function $n(x)$. Let
\begin{align}
\mathcal{N}(x)=\frac{\sum_{i}^{N}|\psi_{i}(x)|^{2}}{|\psi_{max}(x)|^{2}}
\end{align}
where $\psi_{max}(x)$ specifies the index in the sum of Eqn.\ \ref{eqn:rot} that gives the largest norm at $x$. An alternate definition that is model and basis independent is
\begin{align}
\tilde{\mathcal{N}}(x)=\begin{cases}N\cdot f_{N}\left(\frac{\int d\tilde{X} {|\Psi(x_{1}\ldots x_{k}\ldots x_{N})|}\sqrt{\rho(x_{1})\rho(x_{2})\ldots\rho(x_{N})}\delta(x-x_{1})}{\rho(x)}\right)
&\mbox{if}~ \rho(x)\ne0\\
0&\mbox{if}~\rho(x)=0\end{cases}
\end{align}
$f_{N}(y)$ is a function that sends $y=1\rightarrow1$ so that product functions give $\tilde{\mathcal{N}}(x)=N$ for values of $x$ where $\rho\ne0$ and $f\rightarrow\frac{1}{N}$ for functions corresponding to well defined locations at different points. For example, if we used a function $|\Psi|^{2}=\hat{\mathcal{S}}\sum_{j}^{N}\delta(x_{j}-d\,j)$ then $\mathcal{N}(x)=1$ at $x=d\,j$ for all integers $0<j\le N$ and zero elsewhere.
In the case of a product function, of identical functions $\mathcal{N}(x)=N$ everywhere.
These functions measure the the extent of spatial correlations. Greater correlations allow hidden irrotational motion that can hide angular momentum from one-body functions like $\rho(x)$ or the GP order parameter $\Phi_{GP}(x)$. If $\mathcal{N}(x)=1$ everywhere the GP solution is expected to be accurate. A local value of $\mathcal{N}(x)<1$ indicates that a distribution of phase gradients can correspond to that location so gives a kind of bifurcation of the order parameter allowing an apparent rotational component to the velocity field driving fluxes of $\rho(x)$. This suggests an alternate approach to higher corrections to the GP model but we won't pursue this further here. Ultimately, we would like a measure that tells us when the vortex penetration cost is favored versus leaving angular momentum in surface oscillations about the surface.
\subsection{Hydrodynamic Kinematics}
Just as we worked to establish a set of plausible initial data for the wavefunction of a solid classical body that was consistent with the usual phonon and solid state electron orbital calculations, we would like to give some plausible subclass of wavefunctions that correspond to a gas that is thermalized and hydrodynamic. In the case of the Gross-Pitaevskii equation for a condensed bosonic gas we often consider the order to parameter to be a scaled copy of a single particle wavefunction and all the particles to be ``in the same state'' as in Sec.\ \ref{quantumgas}. This is a manifestly single body descriptions of the situation. It is not manifestly clear this makes sense. After all the ``g'' that describes the interaction strength (usually in terms of the scattering length) typically is a subtle combination of both potential energy of the interactions and kinetic energy of the wavefunction oscillations about the two-body diagonals. One can derive a static version of the GP equation from the result of LHY \cite{LHY:57} or Bogoliubov \cite{Bogo:57} theory by applying mean field theory. Extensions of this to time dependence, especially with higher order corrections, as in the case of Bogoliubov-Hartree-Fock theory, introduce unphysical gaps in the energy spectrum or violate conservation laws \cite{Yukalov}. Despite these efforts, experiment seems to show that the case of very low T bosonic systems are very correlated systems, rigid enough that they only require a single order parameter for their description. Persistent vortices can occur and hence these gases are often dubbed superfluid, often leading to the inference that the two fluid model is applicable.
What about the high temperature limit? What enforces such a limiting rigidity on the system so that hydrodynamic variables are relevant. In the case of contact potentials, Werner has come to the conclusion that most eigenstates at high energy are noninteracting \cite{Werner:2009}. This is of little help for seeking how generally and fast a hydrodynamic state is established. In the noninteracting case we can assign every atom a wavefunction corresponding to a different flow. Furthermore, we can superimpose these. The questions we can ask are: Do most such states tend to ``equilibrate'' to a hydrodynamic state? Does only a special subset of wavefunctions correspond to the kinds of flows we observe, perhaps by starting from equilibrium and then initially driven by classical 3D objects and forces with their associated kinematic constraints? As in the case of thermodynamics, must any gas wavefunction tend to a recognizable hydrodynamic state on its way towards long term equilibration?
Specifically we can ask when the diagram in Fig.\ \ref{fig: NS} commutes.
\begin{figure}
\[
\xymatrix @C=5pc @R=5pc{
\Psi(\tilde{X},t) \ar[d]_{U_{H}(t,t')} \ar[r]^{\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\hat{P}} & \rho(x,t),~v(x, t),~ T(x,t) \ar[d]^{\text{Navier-Stokes}} \\
\Psi(\tilde{X},t') \ar[r]^{\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\hat{P}} & \rho(x,t'),~v(x, t'),~ T(x,t') }
\]
\caption{Mapping of a general many body wavefunction onto classical hydrodynamic variables by one particle averages. It is unclear when this diagram commutes.}\label{fig: NS}
\end{figure}
Here we have assumed that $\rho(x)$ is the one body density function defined by integrating out $N-1$ of the coordinates of the many-body density. The definition of $v(x)$ is chosen to satisfy the one-body conservation law, $\partial_{t}\rho=-\nabla\cdot(\rho v)$. This will, in general, lead to a displeasing nonlocal definition via the Helmholtz theorem that is not simply related to the phase of $\Psi$ and may contain rotational components, so not correspond to any one-body wavefunction. The generation of $\rho(x)$ is ultimately a nonlocal action as well but it has the merit of being simpler. The variable $T$, of course, does not have general meaning even for classical systems. If we can define a generally smoothed density and velocity profile we can interpret the rest of the excitation energy as thermal. By the ansatz (const)$\cdot k_{B}T= E_{th}$ we can define such a variable that is consistent with the very high temperature thermalized case.
Discussions of the GP equation often utilize that one way to think of it is as the product of many one-body wavefunctions (with some Jastrow-like correction that is not rapidly changing as the function evolves). If this reasoning is also valid for the wavefunction of a gas in the range of higher temperatures then we would instead have to consider the commutation of actions as in Fig.\ \ref{fig: NS2}
where we assume that dynamics enforce a coarse grained view of
\begin{align}\label{productpsi}
\Psi(\tilde{X})\approx \prod_{i}^{N}\psi(x_{i})
\end{align}
The map $P$ is assumed to give $\rho=|\psi|^{2}$ and $v=\nabla \varphi$ where $\varphi$ is the local phase of $\psi$. We are hoping a general $\Psi$ will tend to such a state after some period of relaxation. It is clear there will be many that do not since arbitrary energy eigenstates exist as do few state superpositions of them. The wavefunction of classical gases we expect does not have so much ``stiffness'' that constrains its possible motion yet there must be some dynamical effect of interactions akin to those that drive thermalization to produce long range order implied by Eqn.\ \ref{productpsi}.
The above picture is appealing at some level but if we seek to derive N-S from this we immediately encounter two problems. First, the thermal motion must be hidden in the fine scale motions of $\Psi$ that are not part of the macroscopic flow. Secondly, vorticity exists in classical flows but appears only in a singular fashion in wavefunctions. Furthermore, we can have very small vorticity densities in fluids, densities that are much lower than a single quantum vortex would give if granularly spread out on the same scale as the interparticle separation. We will need to update our above mapping $\hat{P}$, specifically its typical inverses, to consider such more general flows.
Given a $\rho(x), v(x)$ we can extract $|\psi|=\sqrt{\rho}$ and irrotational part for the phase $v=-\frac{\hbar}{m}\nabla \varphi$ by the Helmholtz theorem. The rotational part of $v^{(r)}=v+\frac{\hbar}{m}\nabla\varphi$ must correspond to the coarse grained average of 3N-1 dimensional vortex lines. Self consistency dictates these can never end but must go to infinity or close in loops. Fortunately, the identity $\nabla\cdot\nabla\times v=0$ ensures that this can be satisfied. We may have to consider the low density wavefunction tails outside the support of our classical distribution of matter to do this but we consider this small scale to be resolvable and just a limitation of our best classical description versus a hindrance to a solution. We insert these vortex line function in the product function fashion if Eqn.\ \ref{productpsi}, however, we do not assume there will be $N$ of them.
{\bf Gas Hydrodynamic Wavefunction} (GHW):\\
Our trial wavefunction corresponding to a classical hydrodynamic flow $\rho(x), v(x)$ is:
\begin{align}
\label{fluidpsi}
\Psi=\hat{\mathcal{S}}_{\{x_{j}\}}\prod_{i}^{N}\psi_{i}(x_{i})
\end{align}
where $\mathcal{S}$ is the appropriate symmetrization operator over the coordinate labels and $\psi_{i}=\psi_{0}+\psi^{(r)}_{i}$ is a sum of our best fit irrotational $\psi$ and a similar $\psi$ with a vortex curve and a damping of near it defined by some characteristic length $\xi$. We have no immediate ansatz to assign winding numbers so we assume that typically the phase advanced by $2\pi$ around each. The net effect of all these is to generate the observe vorticity in $v^{(r)}$. A first guess for the characteristic length $\xi$ would be the thermal wavelength. However, we have only incorporated bulk flow and density information into our trial wavefunction. To incorporate thermal information, we note that, in this ``geometric'' local scattering limit, a Maxwell-Boltzmann distribution is necessary if the current arrives is fluctuating parcels much smaller than the mfp. This lets us define a local distribution of small scale oscillations such that $\psi_{T}(x)\approx \int e^{i\phi_{E}}e^{i k_{T}(E) x}dE$ where $k_{T}(E)$ is taken from the classical M-B distribution and $e^{i\phi_{E}}$ is a set of random phases. There is a natural cutoff for the integral so that $k(E)>\lambda_{mfp}$. Our final trial ``typical'' wavefunctions are labelled $\Psi(\rho(x),v(x),T(x))$ is as in eqn.\ \ref{fluidpsi} where each $\psi_{i}(x)$ now incorporates the irrotational and rotational flows as before, $\xi=\lambda_{th}$, and $T(x)$ is embedded in the fine oscillatory structure of each. Furthermore, we randomize the final product phases as in eqn.\ \ref{psith}.
Although this is hardly a trivial mapping, it seems to be the simplest way to create a plausible typical $\Psi$ corresponding to a classical flowing gas. The evolution of this then needs to be shown consistent with N-S for long times which implicitly includes the persistence of the wavefunction in such a form. Conversely, we want to know that given almost any sufficiently energetic $\Psi$ contained in a volume that it will tend to evolve to such a more limited class of typical thermal and hydrodynamic wavefunctions for long times.
In this trial (GHW) picture notice that the vorticity enters in a very different way than proposed for a rotating solid in Sec.\ \ref{convection}. The vorticity now penetrates the support of the wavefunction in an unavoidable way and we have favored products of one-body vortices; a condition that deserves future scrutiny. Despite its limitations it does have an advantage over the quantum Boltzmann equation. The derivation of such master equations have occupied tremendous journal space and yet they still seem far from realizing their promise of providing a sound basis for statistical mechanics \cite{Vacchini}. In terms of a justification for hydrodynamics, the use of such an equation would be a delicate proposition. The complex part of the wavefunction is encoded in the off-diagonal components of the density matrix $\rho_{ij}$. These also encode \textit{all} the angular momentum information of the gas. If we don't keep very carful track of these components this will not be conserved. The attenuated features of the wavefunction norm that exists at the locations of singular vorticty and its mobility is also rather delicate and it is not clear how such information would be mined from the density matrix. N-S hydrodynamics is generally viewed as a statement of energy and momentum conservation and is often derived as such \cite{Chorin}. For a quantum based treatment it seems advantageous to utilize such conserved and topological quantities as its foundation. We will pursue this as a derivation of the N-S equations from consideration of the wavefunction.
Given the extreme delocalization of realistic gases it is hard to see how the classical billiard ball picture of gases has much of anything to say about gases that are given by many body wavefunctions. The utility of simple picture of classical kinetics has endured a long time and its results are consistent with experiment of high temperature gases however, if the delocalization time of a gas is so short, why should it be relevant? We had some success at a plausible explanation of thermal behavior for a broad class of wavefunctions but
the derivation of N-S from such equations looks even more onerous. What can we say about the high energy limit to suggest that such a coarse grained ($n/|\nabla n|,~|v|/|\nabla v|\gg n^{-1/3}$) product exists?
The free body wavefunction is not constrained and maintains broad long range kinematic freedom. Assuming the typical wavelengths are small compared to $n^{-1/3}$, the interacting case can be thought of of as having $\sim N^{2}$ scattering 3N-3 dimensional rays that emanate from the origin acting the currents of the 3N dimensional wavefunction. The vast number of these suggests that, when the oscillating wavelengths and currents are very small they will tend to move parallel to them. This however, is exactly what we expect for a wavefunction whose phase is a product function $\Phi(\tilde{X})\approx \prod \varphi_{i}(x_{i})$ since the scattering from the center at $x_{j}\approx x_{k}$ is only from transverse components to the many body current $\tilde{J}$ in the $(x_{j},x_{k})$ subspace. Let us seek a more general global phase in 3N-D to accomplish this. Fix the phase on a one body projection $\phi(x)=\Phi|_{x_{2},\ldots x_{N}}$, and seek symmetry preserving deformations that preserve this and give no transverse fluxes at the scattering centers. Seek a first order deformation of $\Phi=\prod_{i}\phi(x_{i})$ of the form
\begin{align}\label{productfluid}
\Phi'=\hat{\mathcal{S}}\prod_{i}(\phi(x_{i})+\epsilon_{i} \zeta_{i}(x_{i}))
\end{align}
where all the $\zeta_{i}$ functions are linearly independent of $\phi$ and not all proportional to each other. We are interested in a solution in the span of this basis that obeys the $\sim N^{2}$ transverse flux conditions. To get a general solution valid on the scale of our coarse graining $n^{-1/3}$ we need a set of $\{\zeta_{i}\}$ with oscillations on this scale. This places a bound on the oscillation scale by which we can alter our product function approximation that is finer than we associate with the bulk flow properties our gas.
There are examples where hydrodynamics ``breaks,'' specifically, when no gradient expansion can be accurate. This can nullify the problems of convergence of higher expansions from Chapman-Enskog theory \cite{Chapman} \cite{Cohen} by making them irrelevant but it does leave some uncertainty as to how to correct the evolution. One can further ask if there is a time when thermodynamics itself ``breaks.'' For example, if a gas is in a trap where $|V|/|\nabla V|\lesssim \lambda_{mfp}$ the local velocity distribution may become so distorted and the Knudsen number ($Kn=\lambda_{mfp}/L$) so large that a local definition of thermodynamic variables is not valuable.
If one has a rapidly expanding gas where the radial velocity approaches or exceeds the thermal velocity of the thermal waves or the outwards mean free path diverges, equilibration itself become quenched. The currents simply have no time to reach the scattering regions about the two-body diagonals to exchange hyperradial with hyperangular motion. This suggests that bulk expansion of a fluid may introduce some special problems and corrections that are not of a classical nature. One could similarly label this situation as being one where the ``classicality'' of the gas (as exhibited by Eqn.\ \ref{fluidpsi}) ``breaks.'' As an example, consider high frequency sound of a packet with width $d<n^{-1/3}$ or $d<\lambda_{mfp}$. In classical kinetics such a density fluctuation makes no sense. However, such high frequency contributions are completely allowed in a wavefunction. On these scales the expansion is governed by unequilibrated motion or the quantum pressure. Such contributions might provide a physical way to extend the hydrodynamic gradient expansions without convergence problems.
There are many persistent oscillatory high energy states that are not similar to product functions on any scale. For the case of contact potentials this is demonstrated with the hyperradial expansion flows in Castin and Werner \cite{Castin}. Given an $\mathcal{L}^{2}$ wavefunction with discrete symmetry about exchanges of coordinate labels in a harmonic trap, many periodic solutions can be observed even for states that are very far from symmetrized products. The contact potentials give an exceptional simplicity to the problem that mirrors the free case gas but with boundary conditions at the two-body diagonals.\footnote{Werner \cite{Werner:2009} in his thesis noted that for contact interactions, at higher energies, almost all states are ``noninteracting.'' My opinion is that the limit of a contact potential has eliminated the very process of thermalization. The finite width of the potentials and the shorter wavelength of the fluctuation's oscillations is what gives the lateral changes in motion that cause equilibration. Similarly, in the case of classical kinetic configurations, they equilibrate in 2D and higher but fail in 1D. } However, for any system made from spherically symmetric two-body potentials we can equivalently consider this to be just an elaborate external potential with a discrete symmetry under coordinate pair exchanges. This immediately implies that any wavefunction with similar symmetry will undergo hyperradial expansion that leaves this symmetry preserved. As such there is no ``damping'' that drives this energy to hyperangular motions that would allow the one body density function $\rho(x)$ to relax and so interpret the evolution as governed by the N-S equations. These counterexamples shows that the hydrodynamic limit must be somewhat subtle. The harmonic potential is very special in that it is the only one that gives hyperspherically symmetric isopotentials. For gases that start from equilibrium, don't endure extreme expansions and are perturbed by forces that have the 3D nature of classical matter we will see that N-S gives a believable evolution for GHW initial data.
\subsection{Navier-Stokes Equations}
Ideally we would like to know how a general energetic wavefunction settles down to something we would recognize as thermodynamic with a well defined 3D notion of density, velocity and temperature. Even in the classical case, this has been a huge undertaking. A well accepted treatment of the Boltzmann equation was only recently derived \cite{Villani}. Therefore we accept a more modest set of goals.
Given the GHW approximation we need to know 1.\ why such a function tends to arise and 2.\ why it persists. The previous section discussed the favorability and durability of the the high temperature coarse grained product Eqn.\ \ref{fluidpsi}. The evolution of such a state thus amounts to finding the evolution of $\rho(x)$, $v(x)$ and $T(x)$. Since the density is low we know that the currents from the fluctuations carry true momentum and transport mass. This makes them suitable for deriving real forces and stresses on the system. The vorticity penetration cost is considered to be negligible so that it can be transported and created in any locally conserved manner necessary to preserve the other conservation laws.
The velocity field $v(x)$ is assumed to have small gradients on the scale of the mean free path $|v|/|\nabla v|\ll \lambda_{mfp}$ and the currents from the thermal velocity transport mass much faster than velocity $v$ changes. This can be expressed in terms of the collision time $\tau=\lambda_{mfp}/v_{th}$ as $v_{th}\gg\dot{v}\tau$. Since the evolution equations will determine $\dot{v}$ this is a self consistency condition.
The internal stress of a given flow is given by the pressure $P$ that measures the rate of reflected momentum in a parcel several mean free paths or larger. The shear stress is due to the transfer of momentum across mfp sized regions that then average momenta nonlocally. Since this always results in a decrease in macroscopic kinetic energy this results in internal heating. Based on previous arguments, MB statistics for the currents hold so the net stress is identical, to this order, with the classical kinetic arguments $\Pi_{ij}=-P\delta_{ij}-2\eta(v_{ij}-\frac{1}{3}\nabla\cdot v)$ where $P$ and $\eta$ are determined by the internal distribution or the thermal velocity and density of the gas \cite{Jeans}.
Using that these 3D dynamic variables stay well defined for such conditions we can impose momentum conservation to immediately derive \cite{Chorin}
\begin{align}\label{NSeqn}
\rho(\partial_{t}v+v\cdot\nabla v)=\nabla\cdot\Pi
\end{align}
Together with the conservation of mass condition. $\partial_{t}\rho+\nabla\cdot(\rho v)=0$, we have the usual Navier-Stokes equations.
This does not seem very impressive. Essentially, we have done a lot of work to show that the usual hydrodynamic equations hold, at one point, invoking parts of the usual classical kinetic arguments. A virtue of this is that it reminds us that old arguments with, later revealed, unphysical starting points can still give correct results. At least as importantly, it gives us a new starting point for looking for higher order corrections. The usual Chapman-Enskog expansion has serious and long standing problems \cite{Cohen}. Despite this much labor has been put into deriving corrections from classical virial expansions and molecular dynamics (MD) simulations. A typical wavefunction approach reveals that higher order corrections can have nonclassical variations that include small scale quantum pressure driven waves and variations from the GHW form. Inspired by Eqn.\ \ref{productfluid} and the
bifurcation of the order parameter near the edges of condensed bose gases in Eqn.\ \ref{eqn:rot} we might seek corrections of the form
\begin{align}
\Psi'=\hat{\mathcal{S}}\prod_{i}(\psi_{i}(x_{i})+\epsilon_{i} \zeta_{i}(x_{i}))
\end{align}
where vorticity is distributed among the, otherwise identical, $\psi_{i}$ and there are a distribution of small irrotational and vorticity corrections included by the $\zeta_{i}$ functions.
This wavefunction approach suggests that we might be better off modifying the Chapman-Enskog expansion by allowing a multiplicity of $\rho,\,v,\,T$ variables at each point. The classical kinetic approach is limited to the effect of deformed local velocity distributions and their fluctuations. A quantum approach allows for the simultaneous superposition of such variations.
In this discussion we have been primarily interested in the two extremes of high temperature (``classical'') and low internal energy (unavoidably quantum) to lend support for the notion that a single wavefunction approach has credibility. Now we move on to the implications of this idea for ultracold gases and history dependent effects that imply thermodynamic and hydrodynamic treatments are overreaching.
\subsection{Equilibrium Limit in Gaussian Traps}
We have already seen that there are some difficulties in deriving N-S for gases described by wavefunctions at energies that would ostensibly be ``classical'' even for large particle number. The problems arise from finding a class of functions that can be adequately mapped onto the usual hydrodynamic variables $(\rho(x), v(x), T(x))$ and showing this mapping remains valid under propagation by the Schr\"{o}dinger equation and that N-S equations give a good coarse grained description in terms of them. However there is a more basic equilibrium problem that is very germane to the types of experiments we do with ultracold traps in gaussian shaped laser traps.
Consider the case of $N$ classical (billiard-like) particles in such a well. The potential for such a trap can be well approximated by $V(r)=V_{0}(1-e^{-a^{2}/r^{2}})$ where $r$ is the single particle radial coordinate and the net potential is the many body sum of these.
If the mean free path is small compared to potential gradients, $\lambda_{mfp}(x) \ll V/|\nabla V|$, we expect MB statistics to be well reproduced locally. The trap depth is $V_{0}$ and the thermal energy per particle is $E_{th}=\frac{3}{2}k_{B}T$. If $V_{0}\gg E_{th}$ we can expect an exponential-like damping in the density with height. However, the MB distribution always has some probability of particles near the edges of the trap (where \textit{outwards} mean free paths diverge) have escape energy. This gives losses, assuming ergodity, that will continue until the remaining particles have less net energy than the energy for a single particle to escape $N_{r}E'_{th}\lesssim V_{0}$. Since the energy lost by each escaping particle is $E >
E_{th}(t)$, we see that the large $N$ case gives almost all particles ejected and the remaining ones having almost zero energy. Similar losses must exist for self bound gravitational bodies like the sun although with very long lifetimes. However, in the case of gaussian traps, the forces are much more localized and the escape times much shorter.
In contrast, a many body wavefunction localized in the trap by cooling must be primarily composed of components that are truly bound states. Unbound components ($E> 0$) will leak out with characteristic time $\tau\sim\hbar E$. This leaves the only important loss processes as three body recombination and heating from external sources which are independent and somewhat controllable. The contrast between these two situations is not directly one of hydrodynamic or thermodynamic behavior but of the necessary existence of a bound stationary state in one case and the practical absence of one in the other.
\subsection{Ultracold Gases}\label{ultracold}
In the case of ultracold bosons, we have already seen that the energy cost of a vortex penetrating the support of the wavefunction can be prohibitive and that surface waves generated by external vorticity can be favorable. This is especially true for the case of interacting bosons where strong curvature near the two body diagonals makes further attenuation of the amplitude there more expensive and the current's energy, $E_{j}$, must increase to avoid these centers. The decorrelation of such surface waves as in Eqn.\ \ref{eqn:rot} leads to a state where even the pure irrotational motion cannot be well defined by the classical hydrodynamic variables. These examples give clearly nonhydrodynamic behavior.
The temperature of such gases using the microcanonical ensemble would we derived by many-body eigenstates near a given energy $E_{0}$. Many-body superpositions give currents and fluctuations. A gas that is evaporatively cooled by reducing the trap depth allows these fluctuations or higher frequencies to exit the gas. This causes not just the average energy, $\Braket{E}$ to decrease but also the spread in the energy, $\Delta E$, of the component eigenstates that make up the state. Magnetic field sweeps alter the interaction of the particles and helps keep the hyperradial directions populated with energy for further evaporation. Since superpositions give time dependent fluctuations and these always attain local energies greater than the mean $\braket{E}$, this drives the energy spread to zero faster than the mean energy itself.
For these reasons, it seems fair to assign an evaporatively cooled cloud a well defined temperature. When $\Delta E/\braket{E}\approx 0$ the microcanonical definition of temperature suggests we assign $T^{-1}=dS/d\braket{E}$ where $S$ is the logarithm of the number of states in window about $\braket{E}$. However, this does not mean that such a state has any power to equilibrate other clouds or objects to such a state. If we combine two clouds with the same particle number at different such temperatures corresponding to $E_{1}$ and $E_{2}$, we end up with a cloud with energy $E_{1}+E_{2}$ but $\Delta E\sim |E_{1}-E_{2}|$.\footnote{For a thermalized state we expect fluctuations to make up a large part of the kinetic energy so that $E_{j}\sim E_{s}$ or $\Delta E\gtrsim \braket{E}$ where local oscillations vary much faster than external potential, so such combinations might lead to thermalization. For $T(x)$ to be locally defined by the the nearly free Hamiltonian we still need a kind of coarse product function structure to the system which is not always obviously true. }
Now let us compare with the result of a less gentle transformation of the wavefunction. If we make slow enough changes in the potential and interactions the Gell-Mann Lowe theorem guarantees we stay in the same distribution of states we started with and can quasi-statically return to the original state by such a process \cite{Peskin}. A common way of heating such systems is by abrupt trap release and recapture \cite{Thomas:2005}. This can be done in a large step or through many small ones. The distinguishing feature is that the potential is stepwise rather than smoothly evolving so it cannot remove kinetic energy from the wavefunction. The different paths describing these two methods of changing the internal energy, evaporative cooling and discontinuous trap release, are illustrated in Fig.\ \ref{commute}.
\begin{figure}
\[
\xymatrix @C=5pc @R=5pc{
\Psi(\tilde{X}) \ar[r]^{\text{evaporation}} \ar[rd]_{\text{evaporation}} &\Psi_{gs}(\tilde{X}) \ar[d]^{\text{rapid expansion}}\\
&\Psi^{*}(\tilde{X})}
\]
\caption{The wavefunction for a gas evaporatively cooled to finite thermal $E_{th}$ versus cooled to the ground state then heated by abrupt release to reach the same thermal energy. The diagram does not commute. }\label{commute}
\end{figure}
\begin{figure}
\[
\xymatrix @C=5pc @R=5pc{
\mathcal{O}(\Psi(\tilde{X})) \ar[r]^{\text{evaporation}} \ar[rd]_{\text{evaporation}} &\mathcal{O}(\Psi_{gs}(\tilde{X})) \ar[d]^{\text{rapid expansion}}\\
&\mathcal{O}(\Psi^{*}(\tilde{X}))}
\]
\caption{Some observables of a many body wavefunction e.g.\ the cloud radius, may commute under this action if they are only a function of the net energy. }
\end{figure}\label{commute1}
If thermodynamic equilibrium is obtained we would expect all observables of the system to be independent of the history of its preparation as in Fig.\ \ref{commute1}.
The observables of a cloud in a spherical trap include its radius $R$ and details of its density $\rho(x)$. The velocity is not directly observable but vortex motion can be detected by characteristic density variations and sometimes by careful interference of the matter waves. Momentum distributions are calculated from free expansion of the cloud. The density function $\rho(x,t)$ can be observed and we can measure depth averaged values of $\dot{\rho}$. Perpendicular measurements typically allow an accurate assessment of $\dot{\rho}$ at every point.
If this was a product function we could extract $v$ from the Helmholtz theorem assuming a local conservation law. The resulting many body momentum distribution is then easily found from that of a single state and the multiplicity of copies of it.
If the interaction was slowly turned off before the expansion and the system was initially in the ground state, this would be accurate. In general, it is not entirely clear that a one-body velocity function $v(x)$ is well defined. For it to be meaningful, we would expect a local hydrodynamic set of equations to close as a function of $v$ and information derived from $\rho(x)$. For the general many-body wavefunction a histogram of $\Re \Psi^{\star}\tilde{\nabla}^{2}\Psi$ gives a well defined measure of the distribution of kinetic energy but it is unclear how this relates to something we can measure. We also are often more concerned with one-body kinetic contributions $\Re \Psi^{\star}{\nabla}^{2}_{x_{k}}\Psi$ but for interacting or highly correlated functions it is also not clear how to extract the distribution of these values from data either. Presumably, scattering experiments could yield some velocity information but I am unaware of if this is an idea that has fruitfully progressed. Other measurable quantities are fluctuations \cite{Meineke} \cite{Esteve}, three body recombination rates and tunneling rates from a trap.
For a narrow $\Delta E$ state (near eigenstate) above the grounds state, $E_{j}/E_{s}\rightarrow0$. This tells us that the tunneling rates from a gaussian trap should vanish and the three body recombination should be at a minimum. The relaxed cloud radius $R=\braket{r^{2}}^{1/2}$ should be largely insensitive to the size of $\Delta E$ since it is a measure of the balance between the net kinetic and potential energy. However, the details of the attenuation of the cloud we would expect to be different. Higher frequency waves in the hyperradial direction will extend further from the trap center. To quantify this, let $\Delta E$ become large enough so that the typical eigenstates of energy $E_{0}$ have a radius $R(E_{0})$ that exhibits a nonlinear behavior over the range $E_{0}\pm\Delta E$. Specifically, if $R(E_{0}+\epsilon)\approx R_{0}+A(\epsilon-E_{0})+B(\epsilon-E_{0})^{2}$ then we expect a difference in the difference in the trap radius $\Delta R= R_{heating}(E_{0})-R_{cooling}(E_{0})\approx \frac{1}{12}B \Delta E$.
Interestingly, the most accurate measurements of the presumed equation of state (EoS) have been done during cooling \cite{Ku:2012}. It would be interesting to make a systematic study of the variation in experimental results based on cloud preparation and see if they correlate with history dependence from heating that introduces such internal persistent currents.
To enhance our ability to probe tunneling loss rates we can introduce a barrier potential by replacing the usual gaussian shaped laser beam with a cylindrical varying beam that generates a barrier potential of height $V_{0}$, with resonant states, $V(r)=V_{0}(\alpha e^{-a^{2}/r^{2}}-e^{-a^{2}/(r-b)^{2}}-e^{-a^{2}/(r+b)^{2}})$
This is most easily realized in 2D with a (not necessarily narrow) harmonic confinement in the z-direction. An advantageous property about this potential is that we can start with our usual gaussian trap and produce the the desired $\braket{E}$ and $\Delta E$ by the usual methods, then optically convert to this new potential. By adjusting $\braket{E}-V_{0}\gtrsim\Delta E$ we can observe tunneling losses out of the trap at a rate much faster than three body recombination.
So far we have only discussed variations in the internal structure due to radial changes in the external potential. There are two other experimental handles at our disposal: interaction strength and angular momentum. The possibilities for angular momentum to distribute itself were partially discussed in Sec.\ \ref{angular}. Starting from a rotating elliptically deformed cloud of interacting bosons in a spherical trap the one-body function $\rho(x)$ will relax to an ellipsoidal deformed cloud. Hydrodynamics predicts a final rigid body cloud rotation but the strong internal curvature can raise the energy cost of vortex penetration to large for the initial angular momentum present to enter. The barrier for this is lowered if the interaction strength is lowered or the thermal energy is increased. Each of these should make a change in the shape of the clouds, rate of evaporative losses and the ratio of angular momentum to mass loss carried with this flux of evaporated atoms.
The case of fermionic gases is special in several ways. Firstly, there is no natural reason for vorticity to correlate in them leading to some visible depression in the one-body density function $\rho(x)$. This leads to the opinion that they are not ``superfluid.'' Additionally, we can control the range of interaction over a much larger range while keeping the clouds stable thanks to the effect of antisymmetry that keeps amplitude low at the n-body diagonals where amplitude can get transferred to small bound states that leave the trap. Three body recombination is the dominant such process.
So far we have made extensive arguments that thermodynamics and hydrodynamics do not properly apply to bosonic ultracold gases. Fermionic gases are more complicated but similar arguments apply although the consideration of the distribution of angular momentum is evidently more complicated. For free bosons near their ground state in a trap we can have oscillations persist indefinitely and, due to Madelung reformulation of Schr\"{o}dinger dynamics, these are hydrodynamic. Bosonic clouds with interactions exhibiting small oscillations also obey an Euler equation approximation for the evolution.
For free fermions, a similar situation exists but it does not make itself evident in the one-body density function $\rho(x)$ due to the many frequencies that must compose it due to the antisymmetry of same spin label coordinates.
It is however very interesting that near unitarity, $a_{sc}k_{F}=0$, hydrodynamic evolution seems to be recovered. The Euler equation gives ``elliptic flow'' in free expansion rather than the ballistic motion we would see for classical kinetics at low density or free fermion waves. Small oscillations correspondingly give long lifetimes of coherent motion for $\rho(x)$ which would rapidly become an undifferentiated static ellipsoid in the free case.
The antisymmetry of the wavefunction drives the wavefunction to zero for all the $\mathcal{O}(N/2)^{2}$ same spin label diagonals. In a spin unpolarized gas, there are many more diagonals where the function gets driven to zero, specifically, all the pairs of coordinates where the spin labels are $(\uparrow,\downarrow)$. It seems that this is sufficient to drive the cloud to a restricted set of velocity fields and a stiffness of evolution so that the motion of $\rho(x)$ seems to closely track the case of the cloud under quasi-static multipolar shifts in the potential. We gave a similar argument for why interacting bosonic clouds do this Sec.\ \ref{quantumgas}. In the case of bosons the interactions are strongly repulsive (else the cloud collapses). For fermions near unitarity we have attractive interactions that are just at the threshold for bound states to occur. If the interaction is too strong we have bound pairs that repel (due to the effect of symmetry that is still evident from their composite fermion structure). This seems not to be enough to enforce hydrodynamic behavior as these pairs get smaller. The threshold case gives long scattering lengths, $a_{sc}>n^{-1/3}$, so that the ground state curvature can enforce correlations that strongly constrain the evolution. It would be interesting to prepare a state with large $\Delta E$ so that the time varying currents are comparable to this $E_{s}$. Presumably, this would destroy hydrodynamic behavior faster for clouds with the same net energy and the same strength of interactions.
The question of damping is an important one. In hydrodynamics, it measure the time for oscillations and nonrigid rotation to settle down to a minimum energy state and is parameterized by the viscosity. Viscosity and vorticity are closely interrelated in that the final states tend to have uniform vorticity and even purely irrotational flows tend to pull in vorticity at the boundaries as a result of viscosity. Incompressible fluids without viscosity subject to conservative forces leave vorticity unchanged. In the case of our gas clouds, we must first ask what exactly is damping. Since we now have reason to believe in a history dependent structure hidden in the apparently stationary relaxed cloud density $\rho(x)$ we must ask what observable is damping. The most evident observable is the cloud density $\rho(x)$ itself.
Quantum treatments of damping typically begin with linear response theory, generally the Kubo formula. This can be thought of as a scattering based approach. It is interesting to consider the same problem from the standpoint of eigenstate superposition. As we argued for thermalization, some systems will tend to a local universality of current distributions and fluctuations that depend only on the energy density despite being very different distributions of eigenstates. Relaxation to such states is what we measure in damping. Because we expect this to be universal behavior that is independent of the eigenstate distributions it seems generally fruitless to approach it from such a point of view. However, for our cold gases that contain history dependent features this is not necessarily true. It is entirely possible that knowing the energy distribution of states with a small set of additional information about them that we could derive damping rates in terms of fundamental constants.
The density of states $g(E)$ is the function on which quantum thermostatistics is built. For a cloud in a fixed trap we can, more generally, consider the set of eigenstates partitioned based on other parameters such as mean radius $R$, angular momentum $L$, ellipticity $\eta$ and so forth. By constructing typical initial data based on distributions of, not just the energy, but these other variables we can consider the damping rates of measurable features such as the distortion of the cloud, ${\eta}$, and the mean radial profile $\braket{\rho(r)}$. This seems to be the natural extension of thermo and hydro to trapped gases. As the distributions get larger we may be able to detect a crossover and convergence to classical hydro and, for the first time, measure a quantum to classical hydrodynamic transition that clearly conserves angular momentum.
\subsection{Harmonic Oscillations}
There are variety of trapping configurations for holding ultracold gases. Laser and magnetic fields exploit the low field seeking property of some hyperfine states. Some of these are now done on chip sets which allow compactness of the device and manipulation features that are novel. However for optimal isolation and trap shape control optical lattices now dominate the subject. Although these beams typically have a gaussian profile, the lowest few percentiles of them are well described by harmonic potentials. This shape induces a high dimensional symmetry that allows a great simplification in the structure of the eigenspectrum. The gaussian traps were convenient for our discussion above where evaporation and internal currents were our main interest. However, the many-body shape of the cloud in such a trap is not simple. The isopotentials exhibit bulging away from the origin in the manner of the $L^{p}$ spaces for $p>1$ of analysis \cite{Rudin}. This makes the analysis of small oscillations very difficult and, for large $N$, will eventually create tight $n$-body ``corners'' where the curvature of the wavefunction cannot penetrate.
In contrast, the harmonic potential is exceptionally simple.
To see why this is so consider that our 3N dimensional wavefunction feels an external potential given by $\sum_{i}^{N}V_{ext}(x_{i})$. For a harmonic (and anisotropic) potential we see that its equipotentials are perfect hyperspheres. For contact potentials we can view the Hamiltonian as a free Hamiltonian over a space with modified boundary conditions along the two body diagonals. This has been exploited by Castin and Warner \cite{Castin} to demonstrate that the eigenstates of the free and unitarity bounded systems form towers of states separated by $\Delta \omega=2\omega_{0}$ where the ground state $E_{g'}$ of each tower varies. Further, they demonstrate that any eigenstate of the trap, when suddenly released or the trap begins to periodically oscillate obey a mathematically simple dynamic behavior \cite{Stringari:2004}.
For small radial cloud oscillations, this is often taken as proof of zero bulk viscosity in a unitary gas but it is good to reflect on this from the point of view of arbitrary superpositions and how this reflects on observables. We can choose some linear combination of the ground state and first excited state of a tower and obtain persistent $2\omega_{0}$ oscillations. However the magnitude of such oscillations is very small since all N particles share in the meager $2\omega_{0}\hbar$ energy. This is clearly below the threshold of an observable change in the denisty of our cloud $\rho(x)$. To get large energy oscillations we can take simple superpositions of the ground state and states with $E\sim N\hbar\omega_{0}$. These states are high frequency and therefore still low in amplitude. To generate the kind of relatively large amplitude ($\delta R\sim R_{trap}$) low frequency ($\omega\sim\omega_{0}$) motions we observe in experiment let us first consider how it works in the free particle case.
We can form the states $\psi_{2n}(x_{i})+\alpha\psi_{2n+1}(x_{i})$ for each coordinate where these are one-body states separated by energy $\epsilon=2\hbar\omega_{0}$. If we do this over all states $\psi_{n}$ up to twice the Fermi level and take an antisymmetrized product we will have our observables persistently oscillate at $\omega'=\epsilon/\hbar$. Expanding we see that we have a very large range of energy of the many-body eigenstates involved in the superposition. This distribution will be sharply peaked but the spread is important in obtaining oscillations that are measurably large and of low frequency.
This introduces a time scale $\tau=\hbar/\Delta E$ from which we can find a damping rate for one-body observables. However, we must be careful in this interpretation. If I have a one dimensional wavefunction as the states in a square well and take a superposition of eigenstates with spread $\Delta E$ corresponding to a peak displaced from the center, then the center-of-mass never settles down to an equilibrium value.
The ``equilibration'' of one-body observables evidently depends on the high dimensionality of the system. This is familiar from the case of classical kinetics where the 1D case of a gas of hard spheres may never relax.
An example just discussed \cite{Castin} is the pure hyperradial oscillation of an interacting fermi gas in a harmonic trap never relaxes.
If we choose our superposition to come from one tower of states (identified by the ground state $E_{g'}$) we have only hyperradial changes to the wavefunction and thus, even though we have some energy spread of eigenstates, the cloud width is a superposition of a one-parameter set of oscillations. Additionally, experience with interacting bosonic gases \cite{Polkovnikov} show that equilibration in such cases does not happen. Therefore the actual superpositions involved for damped states must involve some change in the hyperangular motion as well. This gives the beginnings of what could be a condition on wavefunction superposition for damping of few body observables. The most important observation is that observable distortions of the the cloud will involve distributions of eigenstates over a broad energy scale and relaxation of some observables will be related to this spread of energy.
In the hydrodynamic picture of damping, viscosity provides the mechanism and we obtain
\begin{align}
\rho\frac{v}{\tau}\approx \eta \frac{v}{l^{2}}
\end{align}
where $\tau$ is the characteristic damping time and $v$ and $l$ are typical velocities and length scales of the flow. From this we see $\tau\sim \rho l^{2}/\eta$. A dimensional observation that $[\eta/\rho]=[\hbar/m]$ suggests a way to relate the damping rate to the quantum of action. Such arguments are similar to reasoning for why viscosity has a quantum bound. If one is more skeptical that hydrodynamics is a suitable model for such a system, one can still arrive at such a relaxation time scale for oscillations of the cloud by using the above observation on the energy spread of the distribution of eigenstates involved at unitarity.
Using that the universal parameter for a unitary gas $\beta\sim\mathcal{O}(1)$, we can say
the energy spread per particle of $\Psi$ is $\Delta E\sim \frac{\hbar^{2}}{m L^{3}} l$ where $L$ is the cloud size and $l$ the deformation width of the trap at the beginning of the oscillation. Assuming that there are many hyperangular excitations involved in this superposition, so that it is not a 1D subset, as in the hyperradial expansion case, we have a relaxation time for the trap anisotropy of $\tau\sim \hbar/\Delta E\sim \frac{\hbar}{E}\frac{L}{l}$. This gives a
quantum expression of damping that is independent of hydrodynamics. As noted above, this is the time for the one-body density function $\rho(x)$ to settle down in the trap. It does not imply that the internal currents and evaporation rates are the same as the cloud before it was released or the same as an evaporatively cooled cloud with the same energy.
\section{Conclusions}
In the preceding paper we discussed the problems in mapping classical objects on to wavefunctions. The kinematic freedom of 3D solids and fluids are so restrictive compared to the general many body wavefunction that it is not clear when this is possible. The issue is somewhat confused by solid state treatments of the electron portion of a solid's wavefunction that exhibits the symmetry and discreteness we imagine of classical bodies. True grounds states exhibit a rotational delocalization we don't observe in nature and is not present in these solutions because these functions are only functions of the electron coordinates. By generating a specific wavefunction for solids with phonon excitations we have a sufficiently clear example, along with gases with high internal energy and short range interactions, to consider thermalization and the paradoxes that surround attempts to view equilibration in terms of a single wavefunction's evolution. By establishing a local condition on equilibration we arrive at a definition of temperature that depends on the energy of the system but not on the net eigenstate distribution of the system and a required modification of the thermodynamic limit. This allows a notion of thermodynamics that is sufficiently universal for high energy systems and allows very cold systems, as in ultracold gas physics, to retain history dependent features while still acting sufficiently hydrodynamic and exhibiting some apparent transient relaxation while not being truly thermodynamic.
Gases are distinct from solids in that they cannot maintain the long lasting localization of bound large mass objects. This requires that any consideration of hydrodynamic evolution consider delocalization and reconcile it with apparent 3D behavior. This introduced some additional energy costs to the presence of vorticity that solids did not have. The appearance of a 3D description for high energy gases is not the result of wavefunction ``stiffness'' as is common for very low energy gases, that is one-particle language are referred to as degenerate, but from the minimization of long range scattering in flows. This limit is rather delicate and it is not clear how fast arbitrary initial data will tend to it.
It seems that higher corrections to hydrodynamic behavior may have more to do with failure of the system's ``classicality'' resulting in multivalued descriptors than higher terms in the classical Boltzmann expansion.
Ultracold gases and their dynamical behavior has motivated much of the hydrodynamic treatments of these systems. In some cases, these have been fairly successful. In other cases, data seems inconsistent with various theories and experiments. Our treatment in terms of single wavefunction evolution (pure states), instead of with density matrices or hydrodynamics, predicts history dependent effects in the evaporation, recombination rates and profile as well as some small changes in the cloud extent. Damping is discussed as a possible measure of relaxation of particular one-body observables rather than viscous hydrodynamics.
The author gratefully acknowledges conversations with Thomas Sch\"{a}fer, Dean Lee and Lubos Mitas.
\bibliographystyle{plain}
\cleardoublepage
\normalbaselines
\clearpage
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 4,047 |
Q: Implementing Login Via Instagram 2020 Login via Instagram has been depricated.
Facebook suggested to use Login via Facebook for authentication.
Problem - Not all my target users have a Facebook account.
The App is to be made For Instagram users not Facebook users.
My app flow - Login Via Instagram (Input Instagram name and password -> HomeActivity), Get LoggedInUser Instagram info (Photos, Profile etc).
I just want to log the user via Instagram and get the logged in user Instagram Profile. NOT Facebook Profile.
I have read about the basic dispay API. but according to docs, It shouldn't be used for Authentication or the App would be instantly rejected.
Question
Is there a recent workaround/way to implement "Login Via Instagram" for authentication?
If Not, How do you suggest I do this knowing that my App is built for Instagram Users?
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 921 |
Entries in 'Last Christmas' (15)
Warner Chappell renews George Michael partnership as fans hope for another festive No.1
Warner Chappell Music UK has renewed its global deal with the estate of George Michael. The renewal was announced following "fierce" competition for the music icon's catalogue, during the ...
Ed Sheeran & Elton John land festive No.1 with Merry Christmas
Ed Sheeran and Elton John have debuted at No.1 with their new collaboration, Merry Christmas. The song registered 76,708 chart sales in its first week, including 22,156 pure sales (physical, ...
Step into Christmas: Ed Sheeran & Elton John lead the festive charge on singles chart
Ed Sheeran & Elton John are setting the pace in the Midweeks with Merry Christmas, a new collaboration that's competing with festive classics. The pair are aiming to dethrone Adele's ...
Wham! finally reach No.1 with Last Christmas after 36 years
Wham!'s Last Christmas has finally made No.1 after 36 years. Last Christmas was famously held off the top spot by Band Aid during Christmas 1984. The single has now climbed ...
Can Wham! finally make No.1 with Last Christmas?
Mariah Carey has done it. And now Wham! could be about to repeat her trick of taking a Christmas classic to No.1. Last Christmas (Sony CG) could finally reach a ...
Warner Chappell MD Shani Gonzales on the big Christmas campaigns
Warner Chappell has been busy securing high-profile placements for Christmas campaigns. Celeste, one of the publisher's rising artist-songwriters, landed perhaps the biggest sync at this time of year. The Polydor-signed ...
Mariah Carey's All I Want For Christmas Is You is No.1 with biggest streaming total of 2020 so far
Mariah Carey's All I Want For Christmas Is You (Columbia) has finally reached No.1, 26 years after it was first released. Mariah Carey topped the singles rundown despite the Official ...
Can Mariah Carey finally reach No.1 with All I Want For Christmas Is You?
After 26 years, Mariah Carey could finally be about to claim No.1 with her festive perennial All I Want For Christmas Is You (Columbia). In the latest issue of Music ...
Can LadBaby claim the Christmas No.1 for the second year running?
LadBaby is still the frontrunner for this year's Christmas No.1 with I Love Sausage Rolls, according to the latest sales data from the Official Charts Company. The YouTuber's reworking ...
Charts analysis: Westlife reach summit with first album in nine years
Westlife's first studio album for nine years, and their 11th in all, Spectrum races to a No.1 debut, opening atop the chart on consumption of 62,621 copies, including 1,867 from ... | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 4,843 |
Q: Get Items with smallest vote count including 0 in postgresql I am working on a project where I need to get the 2 items with the least amount of votes where I have 2 tables an item table and a votes table with a forgienkey of ItemId.
I have this query:
SELECT id FROM (
SELECT "ItemId" AS id,
count("ItemId") AS total
FROM "Votes"
WHERE "ItemId" IN (
SELECT id FROM "Items"
WHERE date("Items"."createdAt") = date('2015-05-26 18:30:00.565+00')
AND "Items"."region" = 'west'
)
GROUP BY "ItemId" ORDER BY total LIMIT 2
) x;
Which in some respects is fine but it doesn't include the Items with the count being null or 0. Is there a better way to do this?
Thanks. Please let me know if you need more info.
Postgresql: 9.4
A: something like this should work:
SELECT id,
coalesce((SELECT count(*) FROM "Votes" WHERE "ItemId" = "Items".id), 0) as total
FROM "Items"
WHERE date("Items"."createdAt") = date('2015-05-26 18:30:00.565+00')
AND "Items"."region" = 'west'
ORDER BY total LIMIT 2
A: If an item has not been voted for, then the "Votes" table will not return anything for it and therefore the main query does not display the item at all.
You need to select from "Items" and then LEFT JOIN to "Votes" grouped by "ItemId" and the count of votes for it. Like this, all the items will be considered, also those for which no votes have been cast. Use the coalesce() function to convert NULLs to 0:
SELECT "Items".id, coalesce(x.total, 0) AS cnt
FROM "Items"
LEFT JOIN (
SELECT "ItemId" AS id, count("ItemId") AS total
FROM "Votes"
GROUP BY "ItemId") x USING (id)
WHERE date("Items"."createdAt") = '2015-05-26'::date
AND "Items"."region" = 'west'
ORDER BY cnt
LIMIT 2;
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 3,768 |
⏸️ Investing
Should you buy the best performing shares of 2017?
These 10 shares have delivered super-sized gains in 2017, but Is it too late to buy?
Christopher Georges
Christopher Georges has been a contributor to The Motley Fool since May 2015. He currently holds a Bachelors Degree in Pharmacy and is currently working towards his Masters of Applied Finance. Christopher started investing more than 10 years ago and aims to find undervalued stocks that can generate long term wealth. A keen sportsman, he plays cricket, tennis and golf and is also an avid Sydney Swans supporter. Working with other members of the team, Christopher hopes to carry out The Motley Fool's mission: To help the world invest, better.
Latest posts by Christopher Georges (see all)
Why these 4 shares are getting hammered today - May 3, 2017 5:08pm
3 shares to avoid if the property market starts to crack - May 3, 2017 8:02am
Why these 4 shares are falling today - May 2, 2017 4:21pm
Published March 28, 2017 3:25pm AEDT
| More on: AC8CDVFMSIRDMMJSASSMM
The S&P/ASX 200 (Index: ^AXJO) (ASX:XJO) has managed to post a respectable gain of 2.5% for the year-to-date, but that is nothing compared to some of the gains posted by the shares below:
Company Market Cap* P/E Ratio Dividend Yield Year-to-date Gain 5 Year Total Return
Auscann Group Holdings Ltd (ASX: AC8)
$89 million – – 348% N/A
Summit Resources Ltd (Australia) (ASX: SMM)
$83 million – – 320% -25.4%
Macphersons Resources Ltd (ASX: MRP)
$83 million – – 258% -1.4%
MMJ Phytotech Ltd (ASX: MMJ) $136 million – – 212% N/A
SKY and Space Global Ltd (ASX: SAS)
$124 million – – 173% N/A
Flinders Mines Limited (ASX: FMS)
$246 million – – 119% -23.4%
Global Geoscience Limited (ASX: GSC)
$150 million – – 111% 17.4%
Cardinal Resources Ltd (ASX: CDV)
Champion Iron Ltd (ASX: CIA)
$380 million – – 95.6% 34.9%
Iron Road Limited (ASX: IRD)
$190 million – – 85.2% -13.5%
Source: CommSec
*Please note, I have excluded shares with a market capitalisation of less than $80 million.
Unfortunately, it would be very difficult to consider any of the shares listed above as investment grade material.
In fact, it is pretty clear that most investors should steer well-clear of the shares above considering that not a single company managed to turn a profit over the past year. On top of that, it is hard to envisage any of these companies as having the ability to pay out a dividend anytime soon.
Nonetheless, there are some interesting companies on that list and it is not hard to see why some traders may be interested in them.
For example, Auscann and MMJ Phytotech operate in the medical marijuana sector and perhaps have the most credible prospects of those listed on the ASX. There is no doubt that the sector could be highly lucrative, but it still remains unclear exactly how these companies will develop a long-term competitive advantage.
Uranium, cobalt, lithium, gold and iron ore miners are also represented in the list above. Cobalt and lithium shares have been particularly popular over the last few months as some analysts have forecast huge demand for these minerals as a result of the growing demand for rechargeable batteries. Unfortunately, many of these smaller players are competing against much larger competitors who are likely to bring a higher level of expertise and scale to their operations.
Finally, Sky and Space Global is an exciting company that is developing nano-satellite technology aimed at providing telecommunications services to over 4 billion people. The company has an ambitious target of rolling out around 200 satellites over a five-year time frame, but with only three satellites contracted so far, this target seems a like a universe away.
Motley Fool contributor Christopher Georges has no position in any stocks mentioned. The Motley Fool Australia has no position in any of the stocks mentioned. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy. This article contains general investment advice only (under AFSL 400691). Authorised by Bruce Jackson.
More on ⏸️ Investing
What has happened to the Baby Bunting (ASX:BBN) share price this year?
August 27, 2021 | Rhys Brock
The share price of ASX infant products retailer Baby Bunting Group Ltd (ASX:BBN) has been a solid performer so far …
3 ASX ETFs that invest in companies fighting climate change
A new landmark report by the Intergovernmental Panel on Climate Change (IPCC) was released earlier this week. It provided a …
The Michael Hill (ASX: MHJ) share price poised for growth
February 24, 2021 | Nikhil Gangaram
Investors will be keeping an eye on the Michael Hill International Limited (ASX: MHJ) share price today. The keen interest …
The Atomos (ASX:AMS) share price is up 15% in a week
February 19, 2021 | Rhys Brock
The Atomos Limited (ASX: AMS) share price has been on a tear this past week, rising 15% on the back …
How does the Temple & Webster (ASX:TPW) share price stack up against Nick Scali (ASX:NCK)?
February 8, 2021 | Rhys Brock
Online furniture retailer Temple & Webster Group Ltd (ASX: TPW) had a breakout year in 2020, moving from relative obscurity …
The Aroa (ASX:ARX) share price has surged 60% since its IPO
Shares in ASX healthcare company Polynovo Limited (ASX: PNV) almost doubled in price last year. And, despite a shaky start …
⏸️ How to Invest
How to buy US shares from Australia right now
Investing in other geographic markets has become a popular way to diversify a portfolio. The risks associated with being exposed …
Why Fox (NASDAQ:FOX) might hurt News Corp (ASX:NWS) shareholders
Despite the News Corporation (ASX: NWS) share price getting a 31% bump between November last year and today, News Corp … | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 5,060 |
\section{\@startsection{section}{1}%
\def\subsection{\@startsection{subsection}{2}%
\z@{.5\linespacing\@plus.7\linespacing}{.5\linespacing}%
{\normalfont\large\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}%
\z@{.5\linespacing\@plus.7\linespacing}{.5\linespacing}%
{\normalfont\itshape}}
\usepackage[usenames, dvipsnames]{color}
\definecolor{darkblue}{rgb}{0.0, 0.0, 0.45}
\usepackage[colorlinks = true,
raiselinks = true,
linkcolor = darkblue,
citecolor = Mahogany,
urlcolor = ForestGreen,
pdfauthor = {Peyman Mohajerin Esfahani},
pdftitle = {},
pdfkeywords = {},
pdfsubject = {},
plainpages = false]{hyperref}
\usepackage{dsfont,amssymb,amsmath,subcaption, graphicx,enumitem}
\usepackage{amsfonts,dsfont,mathtools, mathrsfs,amsthm}
\usepackage[amssymb, thickqspace]{SIunits}
\usepackage{algorithm,algorithmicx,fancyhdr}
\allowdisplaybreaks
\date{\today}
\graphicspath{{./fig/}}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}
\renewcommand\thesubsubsection{\thesubsection.\Alph{subsubsection}}
\theoremstyle{theorem}
\newtheorem{Thm}{Theorem}[section]
\newtheorem{Prop}[Thm]{Proposition}
\newtheorem{Fact}[Thm]{Fact}
\newtheorem{Lem}[Thm]{Lemma}
\newtheorem{Cor}[Thm]{Corollary}
\newtheorem{As}[Thm]{Assumption}
\newtheorem{Def}[Thm]{Definition}
\newtheorem*{ddef}{Definition}
\newtheorem{Rem}[Thm]{Remark}
\theoremstyle{remark}
\newtheorem{Ex}{Example}
\definecolor{green}{rgb}{0,.6,0}
\newcommand{\max\limits_}{\max\limits_}
\newcommand{\min\limits_}{\min\limits_}
\newcommand{\sup\limits_}{\sup\limits_}
\newcommand{\inf\limits_}{\inf\limits_}
\newcommand{\mathds{P}}{\mathds{P}}
\newcommand{\mathds{E}}{\mathds{E}}
\newcommand{\mathbb{R}}{\mathbb{R}}
\newcommand{\overline {\R}}{\overline {\mathbb{R}}}
\newcommand{\underline {\R}}{\underline {\mathbb{R}}}
\newcommand{\mathbb{N}}{\mathbb{N}}
\newcommand{\mathfrak{B}}{\mathfrak{B}}
\newcommand{\longrightarrow}{\longrightarrow}
\newcommand{\Longrightarrow}{\Longrightarrow}
\newcommand{\Longleftrightarrow}{\Longleftrightarrow}
\newcommand{\rightarrow}{\rightarrow}
\newcommand{\downarrow}{\downarrow}
\newcommand{\uparrow}{\uparrow}
\newcommand{\rightrightarrows}{\rightrightarrows}
\newcommand{\ind}[1]{\mathds{1}_{#1}}
\newcommand{\coloneqq}{\coloneqq}
\newcommand{\eqqcolon}{\eqqcolon}
\newcommand{\mathrm{d}}{\mathrm{d}}
\newcommand{\wedge}{\wedge}
\newcommand{\vee}{\vee}
\newcommand{\ol}[1]{\overline{#1}}
\newcommand{\ul}[1]{\underline{#1}}
\newcommand{\widetilde}{\widetilde}
\newcommand{\widehat}{\widehat}
\newcommand{\vartheta}{\vartheta}
\newcommand{\circ}{\circ}
\newcommand{^\intercal}{^\intercal}
\newcommand{^\star}{^\star}
\newcommand{\eqsmall}[1]{{\small $#1$}}
\newcommand{\hspace{\subfigtopskip}}{\hspace{\subfigtopskip}}
\newcommand{\note}[1]{{\bf \color{green} #1}}
\newcommand{\varepsilon}{\varepsilon}
\DeclareMathOperator{\e}{e}
\DeclareMathOperator{\esup}{esssup}
\newcommand{\mathbb{X}}{\mathbb{X}}
\newcommand{\mathbb{Y}}{\mathbb{Y}}
\newcommand{\wh{\mathcal{P}}}{\widehat{\mathcal{P}}}
\newcommand{\wh{\xi}}{\widehat{\xi}}
\newcommand{\wh{\PP}_N}{\widehat{\mathds{P}}_N}
\newcommand{\wh{\Xi}_N}{\widehat{\Xi}_N}
\newcommand{\mathds{Q}}{\mathds{Q}}
\newcommand{\mathcal{M}}{\mathcal{M}}
\newcommand{\mathcal{L}}{\mathcal{L}}
\newcommand{\dir}[1]{\delta_{#1}}
\newcommand{\Wass}[2]{d_{\mathrm W}\big(#1,#2\big)}
\newcommand{\inner}[2]{\big \langle #1, #2 \big \rangle }
\newcommand{\KL}[2]{d_{\mathrm{KL}}\big(#1,#2\big)}
\newcommand{\TV}[2]{d_{\mathrm{TV}}\big(#1,#2\big)}
\newcommand{\InfCon}[2]{\overset{#2}{\underset{#1}{\Box}}}
\DeclareMathOperator{\cl}{cl}
\newcommand{\set}[1]{\mathbb{#1}}
\newcommand{\normT}[1]{\left\| #1 \right\|_{\rm T}}
\newcommand{J^\star}{J^\star}
\newcommand{J^\star_N}{J^\star_N}
\newcommand{x^\star_N}{x^\star_N}
\newcommand{\J_{\text{Ts}}}{J^\star_{\text{Ts}}}
\newcommand{\wh{x}_{\rm SAA}}{\widehat{x}_{\rm SAA}}
\newcommand{\wh{J}_{\rm SAA}}{\widehat{J}_{\rm SAA}}
\newcommand{\wh{x}_N} %{x_{\rm DD}^\star}{\widehat{x}_N}
\newcommand{\wh{J}_N} %{J_{\rm DD}^\star}{\widehat{J}_N}
\newcommand{\wh{J}_{\rm DRO}}{\widehat{J}_{\rm DRO}}
\newcommand{\wh{x}_{\rm DRO}}{\widehat{x}_{\rm DRO}}
\newcommand{x^\star}{x^\star}
\newcommand{\ball}[2]{\mathbb{B}_{#2}(#1)}
\newcommand{\ballTV}[2]{\mathbb{B}^{\mathrm{TV}}_{#2}(#1)}
\newcommand{\ballKL}[2]{\mathbb{B}^{\mathrm{KL}}_{#2}(#1)}
\newcommand{\normalfont \text{s.t.}}{\normalfont \text{s.t.}}
\newcommand{\mathcal{O}}{\mathcal{O}}
\newcommand{\indI}[1]{\chi_{#1}}
\newcommand{\mathrm{epi}}{\mathrm{epi}}
\newcommand{e}{e}
\newcommand{\normal}[1]{\mathcal{N}(#1)}
\newcommand{{\rm CVaR}}{{\rm CVaR}}
\newcommand{\RNum}[1]{\uppercase\expandafter{\romannumeral #1\relax}}
\newcommand{\revised}[1]{\textcolor{blue}{#1}}
\newcommand{\mbox{Im}}{\mbox{Im}}
\newcommand{F_{\mathrm b}}{F_{\mathrm b}}
\newcommand{I}{I}
\title[From Static to Dynamic Anomaly Detection]
{From Static to Dynamic Anomaly Detection
\\with Application to Power System Cyber Security}
\author{Kaikai~Pan,
Peter~Palensky,
and~Peyman~Mohajerin~Esfahani}%
\thanks{The authors are with the Delft University of Technology, The Netherlands (email: \tt{\{K.Pan, P.Palensky, P.MohajerinEsfahani\}}@tudelft.nl).}
\begin{document}
\maketitle
\begin{abstract}
Developing advanced diagnosis tools to detect cyber attacks is the key to security of power systems. It has been shown that multivariate attacks can bypass bad data detection schemes typically built on static behavior of the systems, which misleads operators to disruptive decisions. In this article, we depart from the existing static viewpoint to develop a diagnosis filter that captures the dynamics signatures of such a multivariate intrusion. To this end, we introduce a dynamic residual generator approach formulated as a robust optimization program in order to detect a class of disruptive multivariate attacks that potentially remain stealthy in view of a static bad data detector. We then reformulate the proposed approach as finite, but possibly non-convex, optimization program. We further develop a linear programming relaxation that improves the scalability, and as such practicality, of the diagnosis filter design. To illustrate the performance of our theoretical results, we implement the proposed diagnosis filter to detect multivariate attacks on the system measurements deployed to generate the so-called Automatic Generation Control signals in a three-area IEEE 39-bus system.
\end{abstract}
\section{Introduction}
\label{sec:intro}
The digital transformation of our power system does not only lead to better observability, flexibility and efficiency, but also introduces a phenomenon that is new to power system controls: cyber security threats. NIST \cite{NIST2018} defines five functions for protecting Information and Communication Technology (ICT): Identify, Protect, Detect, Respond, Recover. It would be naive to think an ICT system can be perfectly protected (point 2) in order to save points 3-5. This paper focuses on point three for supervisory control and data acquisition (SCADA) systems, which are in charge of transmitting measurement and control signals between power system substations and control centers \cite{Kirschen2009}, and which are notorious for being based on legacy ICT. Such SCADA systems are a popular target for adversaries \cite{Gorman2009, ChenAbu-Nimeh2011} nowadays, and it is of utmost importance to detect attacks and respond in an appropriate manner. The consequences of a successful attack to SCADA systems can be catastrophic to an economy and society in general \cite{Liang2017a}. Notably, if attacks can be detected sufficiently fast, the corrupted signals can be disconnected or corrected by resilient controls, preventing further severe damage \cite{Tiniou2013}.
\paragraph*{\bf Literature on Anomaly Detection}
Traditionally, SCADA systems deploy bad data detection~(BDD) to filter out possible erroneous measurements due to sensor failures or anomalies~\cite{AburExposito2004, Teixeira2010}.
The BDD process captures only a snapshot of the steady states of system trajectories, and thus only exploits possible {\em static} impact of intrusions. Although this method can perform successfully
in detecting basic attacks, it may fail in the presence of the so-called {\em stealthy attacks} that carefully launch synthesized false data injections~\cite{Hug2012}.
It was first explored in \cite{LiuNingReiter2009} that such an attack can perturb the state estimation function without triggering alarms in BDD. Since then vulnerability and impact analysis of stealthy attacks on power systems have been a prominent subject in the literature. Without advanced diagnosis tools, tampering measurements remains undetected, causing state deviations, equipment damages or even cascading failures~\cite{Liang2016}. Techniques proposed to deal with stealthy attacks include statistical methods such as sequential detection using Cumulative Sum (CUSUM)-type algorithms~\cite{Li2015}, and measurements consistency assessment under certain observability assumptions~\cite{Zhao2018}. A detection method that leverages online information is described in \cite{Ashok2018}, which is applicable by ensuring the availability and accuracy of load forecasts and generation schedules. In \cite{Liu2014a}, a mechanism is introduced to formulate the detection scheme as a matrix separation problem, but it only recovers intrusions among corrupted measurements over a particular period of time.
These techniques are essentially static detection methods that may be confined by certain prior assumptions on the distribution of measurement errors. Despite an extensive and ongoing literature focusing on the static part of BDD mechanism, the following question remains largely unexplored:
\begin{flushleft}
\centering
{\em Would it be possible to detect stealthy multivariate attacks in a real-time operation by exploiting the attack impact on the dynamics of system trajectories during the transient?}
\end{flushleft}
The importance of an appropriate answer to this question has been reinforced thanks to recent advances in sensing technology in the modern power systems. Our main objective in this article is to address this question.
\paragraph*{\bf Related Work}
Detection methods concerning system dynamics have primarily emerged under the topic of {\em fault detection and isolation filters}. A subclass of these schemes is the observer-based approach applied initially to linear models~\cite{Massoumnia1989}; see also \cite{Ding2008} for a comprehensive summary of the large body of the literature. The authors in~\cite{Nyberg2006} further extend the modeling framework to general linear differential-algebraic equations (DAEs), enhancing the applicability of such methods particularly for power system applications due to the common governing physical laws in this setting. Recently, a variant of observer-based methods is also investigated in~\cite{Ameli2018a} so as to deal with unknown natural exogenous inputs.
An inherent shortcoming of observe-based approaches is that the degree of the resulting diagnosis filter is effectively the same as the system dynamics, which may yield an unnecessarily complex filter in large-scale power systems. The closest approach in the literature is~\cite{Esfahani2016} where a scalable optimization-based filter design is developed for high-dimensional nonlinear control systems. However, the proposed method opts for mainly dealing with a single fault scenario, and may not be as effective in case of smart multivariate adversarial inputs.
\paragraph*{\bf Our Contributions}
The main objective of this article is to develop a {\em diagnosis filter} to detect multivariate attacks in a real-time operation. For this purpose, considering a class of disruptive multivariate attack scenarios (Definition~\ref{def:destruct_attack}), we first characterize the attack impact on power system dynamics through a set of differential equations. Having transferred the dynamics into the discrete-time domain, we further restrict the diagnosis filter to a family of dynamic residual generators %
that entirely decouples the contributions of the attacks from the system states and natural disturbances. In order to identify an admissible multivariate attack scenario, we propose an optimization-based framework to robustify the diagnosis filter with respect to such attacks, i.e., aiming to design a filter whose residual (output) is sensitive to any plausible disruptive attacks. The main contributions of this article can be summarized as follows:
\begin{itemize}
\item[(i)] Unlike the existing literature, we go beyond a static viewpoint of anomaly %
detection to capture the attack impact on the dynamics of system trajectories. To this end, we characterize the diagnosis filter design approach as a robust optimization program. It is guaranteed that while the filter residual is decoupled from system states and disturbances, it still remains sensitive to all admissible disruptive multivariate attacks even if the attacker has full knowledge about the diagnosis filter architecture (Definition~\ref{def:robust_detect} and the program~\eqref{opt:max-min-opt}).
\item[(ii)] We reformulate the resulting robust program as a finite, possibly non-convex, optimization program~(Theorem~\ref{the:max-min-reform}). To improve the scalability of the proposed solution, we further propose a linear programming relaxation which is highly tractable for large scale systems~(Corollary~\ref{cor:convex_rel}). It is guaranteed that if the optimal value of the relaxed program is positive, the resulting diagnosis filter succeeds to detect all admissible disruptive attack scenarios, which may remain stealthy in the lens of a static detector.
\end{itemize}
In addition to the above theoretical results, we validate the performance and effectiveness of the proposed diagnosis filter on a multi-area IEEE 39-bus system. Numerical results illustrate that the diagnosis filter successfully generates a residual ``alert'' in the presence of multivariate attacks that are stealthy in a static viewpoint, even in a noisy environment with imprecise measurements.
Section~\ref{sec:prob} introduces the problem of power system cyber security, and the challenges posed by multivariate attacks are highlighted. Section~\ref{sec:powersys_model} discusses a model instance of power system dynamics under measurement attacks. Our diagnosis filter design is proposed in Section~\ref{sec:detect} where an optimization framework is introduced, and numerical simulations are reported in Section~\ref{sec:results}.
\paragraph*{\bf Notation}
The symbols $\mathbb{R}$, $\mathbb{R}_{+}$, $\mathbb{N}$ represent the set of real numbers, nonnegative real numbers, and integers, respectively. Given a matrix $A \in \mathbb{R}^{m \times n}$, $A^\top$ denotes its transpose, and the space $\mbox{Im}(A)$ represents its range space. Throughout the paper, the matrix $I$ is the identity matrix with an appropriate dimension. Given a column vector~$a \in \mathbb{R}^{m}$, $\mbox{diag}(a)$ denotes an $m \times m$ diagonal matrix with the elements of vector $a$ sitting on the main diagonal and the rest of the elements being zero. We also denote by $\mbox{diag}[A_1, \ A_2, \ \dots, \ A_k]$ a block matrix whose main diagonal elements are the matrices $A_1, A_2,\dots,A_k$. Given a vector~$a \in \mathbb R^m$, the associated $\ell_{\infty}-$norm is denoted by $\| a \|_{\infty} = \max_{i\le m}|a_{i}|$.
\section{Problem Statement}
\label{sec:prob}
\subsection{Static Detection and System Modeling}
\label{subsec:basic}
For a power grid, measurements are collected by remote sensors and transmitted through a SCADA network. The typical BDD is conducted to detect the erroneous measurements at each time instance. We can see this as a static process: it only concerns the system states $X[k] \in \mathbb{R}^{n_{X}}$ and measurements $Y[k] \in \mathbb{R}^{n_{Y}}$ at time step $k \in \mathbb{N}$, which can be described by
\begin{equation}\label{eq:static_sys}
Y[k] = CX[k] + D_{f}f[k],
\end{equation}
where $C \in \mathbb{R}^{n_{Y}\times n_{X}}$ is the measurement matrix; $f[\cdot] \in \mathbb{R}^{n_{f}}$ denotes the attacks on measurements. Note that the matrix $D_{f}$ characterizes which measurement is vulnerable to attacks. It is customary to define a {\em residual signal} for a static detector, $r_{S}[k] := Y[k] - \hat{Y}[k]$, where $\hat{Y}[\cdot]$ denotes the estimated measurements. In the traditional weighted least squares estimation, the estimate of state is $({C}^\top{C})^{-1}{C}^\top Y[k]$, assuming that $C$ has full column rank with high measurement redundancy. Then the measurements estimate becomes $C({C}^\top{C})^{-1}{C}^\top Y[k]$, and the residual signal of BDD can be further expressed as
\begin{equation}\label{eq:static_r}
r_{S}[k] = \big(I - C({C}^\top{C})^{-1}{C}^\top \big)Y[k].
\end{equation}
Such an anomaly detector has shown a good effectiveness in detecting erroneous data and basic attacks \cite{Deng2018}. However, in the face of coordinated attacks on multiple measurements, this static detector can fail. In this article, motivated by this shortcoming, we take a dynamic design perspective where we shift the emphasis on an attack as a static process to its effects on power system dynamics. In particular, we opt for differentiating the attack impact on the systems trajectories from natural disturbances such as load deviations.
\begin{figure}[t!p]
\centering
\includegraphics[scale=1]{fig_sys_schematic.pdf}
\caption{Schematic block diagram of the system model.}
\label{fig:sys_schem}
\end{figure}
To model its impact on the dynamics, let us consider a more general modeling framework in Figure~\ref{fig:sys_schem}. The electrical grid is operated by a digital controller that receives measurements as inputs and sends control signals to the actuators through communication networks. These transmitted data are applied in discrete-time samples. On the power grid side, the input $d[k] \in \mathbb{R}^{n_{d}}$ represents natural disturbances. On the controller side, a control signal $u[k] \in \mathbb{R}^{n_{u}}$ is computed given the measurements $Y[k]$. Note that with the closed-loop control, the corruptions $f[k]$ on the measurements would affect the system dynamics. A linear description of the closed-loop system is %
\begin{equation}\label{eq:dis_sys}
\left\{
\begin{aligned}
& X[k+1] = A_{x}X[k] + B_{d}d[k] + B_{u}u[k], \\
& Y[k] = CX[k] + D_{f}f[k],
\end{aligned}
\right.
\end{equation}
where $A_{x}$, $B_{d}$ and $B_{u}$ are constant matrices. Note the difference between the dynamic model \eqref{eq:dis_sys} and the static one \eqref{eq:static_sys}. To illustrate the attack impact on the system dynamics, we can simply consider the feedback controller as a linear operator such that $u[k] = GY[k]$ where $G\in \mathbb{R}^{n_{u}\times n_Y}$ is a matrix gain. By defining the closed-loop system matrices $A_{cl}:= A+B_{u}GC$ and $B_{f}:=B_{u}GD_{f}$, we can reformulate \eqref{eq:dis_sys} into
\begin{equation}\label{eq:dis_cls}
\left\{
\begin{aligned}
& X[k+1] = A_{cl}X[k] + B_{d}d[k] + B_{f}f[k], \\
& Y[k] = CX[k] + D_{f}f[k]. \\
\end{aligned}
\right.
\end{equation}
\begin{Rem}[Dynamic feedback controller]\label{rem:dyn_feedback_ctrl}
The restriction to only a static feedback controller~$u[k]=GY[k]$ to transfer from \eqref{eq:dis_sys} to \eqref{eq:dis_cls} is without loss of generality. Namely, the proposed framework is rich enough to subsume a dynamic controller architecture as well. Indeed, when the controller has certain dynamics,
it suffices to augment the system dynamics~\eqref{eq:dis_sys} with the controller states and outputs. We refer to Appendix-B ~\ref{subsec:app_rem_dyn_ctrl} for such a detailed analysis.
\end{Rem}
\begin{Rem}[Attacks impact on the dynamics of system trajectories]\label{rem:att_affect_dyn}
In light of \eqref{eq:dis_cls}, matrices $B_{f}$, $D_{f}$ capture the attack impact on the power system dynamics, mapping attacks $f[\cdot]$ to the system states and measurements respectively. \par
\end{Rem}
In the following, we show that the state-space description \eqref{eq:dis_cls} is a particular case of DAE model. By introducing a time-shift operator $q$ : $qX[k] \rightarrow X[k+1]$, one can fit \eqref{eq:dis_cls} into
\begin{equation}\label{eq:dae}
H(q)x[k] + L(q)y[k] + F(q)f[k] = 0,
\end{equation}
where $x:= [X^\top \ d^\top]^{\top}$ represents the unknown signals of system states and disturbances; $y := Y$ contains all the available data for the operator. Let $n_{x}$ and $n_{y}$ be the dimensions of $x[\cdot]$, $y[\cdot]$. We denote $n_{r}$ as the number of rows in \eqref{eq:dae}. Then $H, \ L, \ F$ are polynomial matrices in terms of the time-shift operator $q$ with $n_{r}$ rows and $n_{x}, n_{y}, n_{f}$ columns separately, by defining,
\begin{equation}\label{eq:dae_def}
H(q) := \left[\begin{matrix} -qI + A_{cl} & B_{d}\\ C & 0\\ \end{matrix}\right], \quad L(q) := \left[\begin{matrix} 0 \\ -I \\ \end{matrix}\right], \quad F(q) := \left[\begin{matrix} B_{f}\\ D_{f} \\ \end{matrix}\right]. \nonumber
\end{equation}
\subsection{Challenge: Multivariate Attacks}
\label{subsec:challenge}
We start this subsection with an existing result characterizing the set of stealthy attacks that can bypass the static detector. %
\begin{Lem}[{Stealthy attack values~\cite[Theorem 1]{LiuNingReiter2009}}]\label{lem:stealth set}
Consider the measurement equation~\eqref{eq:static_sys} and the static detector with the respective residual function~\eqref{eq:static_r}. Then, an attack $f[\cdot]$ remains stealthy, i.e., it does not cause any additional residue to~\eqref{eq:static_r}, if it takes values from the set
\begin{equation}\label{eq:att_sp}
\mathcal{F} \coloneqq \big\{ f[k] \in \mathbb{R}^{n_{f}}: \ D_{f}f[k] \in \mbox{Im} (C), \quad k \in \mathbb{N} \big\},
\end{equation}
\end{Lem}
One can observe that a stealthy attack~$D_{f}f[\cdot]$ indeed lies in the range space of $C$ that represents a tampered value~$D_{f}f[k] = C \Delta X$ where $\Delta X \in \mathbb{R}^{n_{X}}$ can be any injected bias influencing certain sensor measurements. Such multivariate attacks would challenge the detector design as they may neutralize the diagnosis filter outputs.
\begin{As}[Stationary attacks]\label{ass:station_att}
Throughout this article, we consider attacks~$f[\cdot]$ that are time-invariant, i.e., $f[k] = 0$ for all $k \le k_{\min}$; $f[k]= f \in \mathcal{F}$ for all $k > k_{\min}$. Namely, the attack occurs as a constant bias injection~$f$ on measurements during the system operations at a specific unknown time instance $k_{\min}$, and it remains unchanged since then.
\end{As}
Advanced attacks also pursue a maximized impact on the system dynamics. Thus, an adversary would try to inject ``{\em smart}" false data, possibly with large magnitudes, in such a way that it causes the maximum damage. The next definition opts to formalize this class of attacks.
\begin{Def}[Disruptive stealthy attack] \label{def:destruct_attack}
Consider a set of vectors~$F_{\mathrm b} \coloneqq [f_{1}, f_{2}, \dots, f_{d}]$ representing a finite basis for the set of stealthy attacks~\eqref{eq:att_sp}, i.e., the set~$\mathcal{F}$ defined in \eqref{eq:att_sp} can equivalently be represented by
\begin{align*}
\mathcal{F} = \left\{F_{\mathrm b}^\top\alpha = \sum_{i=1}^{d}\alpha_i f_i ~\Big |~ \alpha = [\alpha_{1}, \alpha_{2}, \cdots, \alpha_{d}]^\top \in \mathbb{R}^d \right \} \,.
\end{align*}
%
We call a signal~$f\in\mathcal F$ {\em disruptive stealthy attack} if its corresponding coefficients~$\alpha$ is a polytopic set, i.e., it belongs to %
\begin{equation}\label{eq:alpha_set}
\mathcal{A} : = \big\{ \alpha \in \mathbb{R}^{d} \ | \ A\alpha \geq b \big\},
\end{equation}
where $A \in \mathbb{R}^{n_{b}\times d}$ and $b \in \mathbb{R}^{n_{b}}$ are given matrices. We emphasize that the subsequent analysis and the proposed diagnosis filter design only reply on the convexity of the set~$\mathcal{A}$. Namely, the choice~\eqref{eq:alpha_set} may be adjusted according to the application at hand, as long as the convexity of the set is respected.
\end{Def}
\section{Cyber Security of Power Systems: AGC modeling}
\label{sec:powersys_model}
In this section, we first go through a modeling instance of power system dynamics in the form of \eqref{eq:dis_cls}: AGC closed-loop system under attacks. This model will be used to validate our diagnosis filter. Figure~\ref{fig:39bus} depicts the diagram of a three-area IEEE 39-bus system. AGC is a feedback controller that tunes the setpoints of participated generators %
(e.g., G11 of Area 1) %
to maintain the frequency as its nominal value and the tie-line (e.g., L1-2 between Area 1 and 2) power as the scheduled one. %
In the work of AGC, a linearized model is commonly used for the load-generation dynamics \cite{Rakhshani2017}. For a multi-area system, the frequency dynamics in Area $i$ can be written as
\begin{subequations}\label{eq:dynamics}
\begin{align}\label{eq:freq}
\Delta \dot{\omega}_{i} = \frac{1}{2H_{i}}(\Delta P_{m_{i}} - \Delta P_{tie_{i}} -\Delta P_{l_{i}} - D_{i} \Delta \omega_{i}),
\end{align}
where $H_{i}$ is the equivalent inertia constant; $D_{i}$ is the damping coefficient and $\Delta P_{l_{i}}$ denotes load deviations. Here $\Delta P_{tie_{i}}$, $\Delta P_{m_{i}}$ represent the total tie-line power exchanges from Area $i$ and the total generated power in Area $i$, i.e., $\Delta P_{tie_{i}} = \sum_{j \in \mathcal{E}_{i}} \Delta P_{tie_{i,j}}$ where $\mathcal{E}_{i}$ denotes the set of areas that connect to Area $i$, and $\Delta {P}_{m_{i}} = \sum_{g=1}^{G_{i}} \Delta {P}_{m_{i,g}}$ where $G_{i}$ denotes the number of participated generators in Area $i$, and we have %
\begin{align}
\Delta \dot{P}_{m_{i,g}} &= -\frac{1}{T_{ch_{i,g}}}(\Delta P_{m_{i,g}} + \frac{1}{S_{i,g}} \Delta \omega_{i} - \phi_{i,g}\Delta P_{agc_{i}}), \\
\Delta \dot{P}_{tie_{i,j}} &= T_{ij} (\Delta \omega_{i} - \Delta \omega_{j}),
\end{align}
where $T_{ch_{i,g}}$ is the governor-turbine's time constant; $S_{i,g}$ denote the droop coefficient; $T_{ij}$ is the synchronizing parameter between Area $i$ and $j$. Note that $\Delta P_{agc_{i}}$ is the signal from AGC for the participated generators to track the load changes, and $\phi_{i,g}$ is the participating factor, i.e., $\sum_{g=1}^{G_{i}} \phi_{i,g} =1$.
After receiving the frequency and tie-line power measurements, the {\em area control error} (ACE) is computed for an integral action,
\begin{align}
ACE_{i} &= {B}_{i} \Delta \omega_{i} + \sum_{j \in \mathcal{E}_{i}} \Delta P_{tie_{i,j}}, \\
\Delta \dot{P}_{agc_{i}} &= - K_{I_{i}} ACE_{i}, \label{eq:ace_agc} %
\end{align}
\end{subequations}
where $B_{i}$ is the frequency bias and $K_{I_{i}}$ represents the integral gain. %
Based on the equations \eqref{eq:dynamics}, the linearized model of Area $i$ can be presented as the state equation
\begin{equation}\label{eq:spx_areai}
\dot{X}_{i}(t) = A_{ii} X(t) + B_{i,d}d_{i}(t) + \sum_{j \in \mathcal{E}_{i}} A_{ij} X_{j}(t), \\
\end{equation}
where $X_{i}$ is the state vector; $d_{i} := \Delta P_{l_{i}}$ denotes load deviations. Recall Remark~\ref{rem:dyn_feedback_ctrl} that \eqref{eq:spx_areai} is an augmented model for the closed-loop AGC system that $X_{i}$ consists of not only the electrical grid states (e.g., frequency, generator output and tie-line power) but also the controller state $\Delta {P}_{agc_{i}}$, i.e.,
\begin{equation}\label{eq:spx_xi}
X_{i} := \left[\begin{matrix} \{\Delta P_{tie_{i,j}}\}_{j \in \mathcal{E}_{i}} & \Delta \omega_{i} & \{\Delta {P}_{m_{i,g}}\}_{1:G_{i}} & \Delta P_{agc_{i}} \end{matrix}\right]^{\top}. \nonumber
\end{equation}
Besides in \eqref{eq:spx_areai}, $A_{ii}$ is the system matrix of Area $i$; $A_{ij}$ is a matrix whose only non-zero element is $-T_{ij}$ in row 1 or 2 and column 3; $B_{i,d}$ is the matrix for load deviations.
\begin{figure}[t!p]
\centering
\includegraphics[scale=0.47]{fig_39bus.pdf}
\caption{Three-area 39-bus system: the measurements of the tie-lines (in red) L1-3, L1-2, L2-3 are attacked.}
\label{fig:39bus}
\end{figure}
In addition to $\eqref{eq:spx_areai}$, we assume a measurement model with high redundancy that the measurements of each tie-line power ($\Delta P_{tie_{i,j}}$) and the total tie-lines' power ($\Delta P_{tie_{i}}$), the frequency ($\Delta \omega_{i}$), each generator output ($\Delta P_{m_{i,g}}$) and the total generated power ($\Delta P_{m_{i}}$), and the AGC controller output ($\Delta {P}_{agc_{i}}$) are all available. Besides, vulnerabilities within SCADA networks may allow cyber intrusions. Thus the output equation is%
\begin{equation}\label{eq:spy_areai_f}
Y_{i}(t) = C_{i}X(t) + D_{i,f}f_{i}(t),
\end{equation}
where $Y_{i}$ is the system output and $C_{i}$ is the output tall-matrix with full column rank. Here $f_{i}$ denotes multivariate attacks and the matrix $D_{i,f}$ quantifies which output is attacked.
In the aforementioned section, due to the feedback loop, attacks on the measurements would also affect the frequency dynamics. Hence the state equation \eqref{eq:spx_areai} during attacks becomes
\begin{equation}\label{eq:spx_areai_f}
\dot{X}_{i}(t) = A_{ii} X(t) + B_{i,d}d_{i}(t) + B_{i,f}f_{i}(t) + \sum_{j \in \mathcal{E}_{i}} A_{ij} X_{j}(t), \nonumber\\
\end{equation}
where $B_{i,f}$ is the matrix that relates attacks to system states. Using the state equations of each area, the continuous-time model of the three-area %
system can be obtained,
\begin{equation}\label{eq:spx_39}
\dot{X}(t) = \tilde{A}_{cl} X(t) + \tilde{B}_{d}d(t) + \tilde{B}_{f}f(t), \\
\end{equation}
where $X$ is the vector consisting of groups of dynamic states in each area; $d$ is the vector for all areas' load deviations; $f$ denotes all the attack signals in the three-area, namely,
\begin{gather}\label{eq:spx_39_x&d&f}
X= \left[\begin{matrix} X_{1}^{\top} & X_{2}^{\top} & X_{3}^{\top} \end{matrix}\right]^{\top}, \nonumber\\
d = \left[\begin{matrix} \Delta P_{l_{1}} & \Delta P_{l_{2}} & \Delta P_{l_{3}}\end{matrix}\right]^\top, \quad f= \left[\begin{matrix} f_{l}^\top & f_{2}^\top & f_{3}^\top \end{matrix}\right]^\top. \nonumber
\end{gather}
In \eqref{eq:spx_39}, $\tilde{A}_{cl}$ is the closed-loop system matrix; $\tilde{B}_{d}$, $\tilde{B}_{f}$ are constant matrices that relate load deviations and attacks to system states. %
For the three-area system, these matrices are
\begin{gather}\label{eq:spx_ABdBf}
\tilde{A}_{cl} = \left[\begin{matrix} A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33} \end{matrix}\right], \nonumber \\
\tilde{B}_{d} = \mbox{diag} \left[\begin{matrix}B_{1,d}, \ B_{2,d}, \ B_{3,d} \end{matrix}\right], \ \tilde{B}_{f} = \mbox{diag} \left[\begin{matrix}B_{1,f}, \ B_{2,f}, \ B_{3,f} \end{matrix}\right]. \nonumber
\end{gather}
We can also obtain the output equation of the system,
\begin{equation}\label{eq:spy_39}
Y(t) = CX(t) + D_{f}f(t),
\end{equation}
where $Y$ is the system output vector containing all the three areas' outputs; $C$ is the output matrix; $D_{f}$ quantifies all the vulnerable signals. Similarly, these matrices are
\begin{gather}\label{eq:spx_39_y&c&df}
Y= \left[\begin{matrix} Y_{1}^\top & Y_{2}^\top & Y_{3}^\top \end{matrix}\right]^\top, \nonumber\\
C = \mbox{diag} \left[\begin{matrix}C_{1}, \ C_{2}, \ C_{3} \end{matrix}\right], \ D_{f} = \mbox{diag} \left[\begin{matrix}D_{1,f}, \ D_{2,f}, \ D_{3,f} \end{matrix}\right]. \nonumber
\end{gather}
To obtain the sampled discrete-time model as \eqref{eq:dis_cls}, \eqref{eq:spx_39} and \eqref{eq:spy_39} must be discretized. We deploy a zero-order hold (ZOH)\footnote{The inputs signals $d(\cdot)$ and $f(\cdot)$ in \eqref{eq:spx_39} are assumed to be piecewise constant within the sampling periods.} discretization for a given sampling period $T_{s}$ \cite{Ogata1995},
\begin{equation}\label{eq:zoh}
A_{cl} = e^{\tilde{A}_{cl}T_{s}}, \quad B_{d} = \int_{0}^{T_s} e^{\tilde{A}_{cl}(T_{s}-t)}\tilde{B}_{d} \mathrm{d} t. \\
\end{equation}
Note that the attack matrix $\tilde{B}_{f}$ has the same matrix transformation as $\tilde{B}_{d}$, resulting $B_{f}$. The above approximation is exact for a ZOH and \eqref{eq:zoh} corresponds to the analytical solution of the discretization. Therefore, the above model can be described in the form of \eqref{eq:dis_cls} which again can be fitted into the DAE \eqref{eq:dae}.
In Appendix-B ~\ref{subsec:agc_39_sys_matrices} we provide the detailed description of the paramters and matrices in the three-area 39-bus system under cyber attacks on AGC.
\section{Robust Dynamic Detection}
\label{sec:detect}
\subsection{Preliminaries for Diagnosis Filter Construction}
\label{subsec:pre_att_detect}
An ideal detection aims to implement a non-zero mapping from the attack to the diagnostic signal while decoupled from system states and disturbances, given the available data $y[\cdot]$ in the control center. In the power system dynamics described via a set of DAE, we restrict the diagnosis filter to a type of dynamic residual generator in the form of linear transfer functions, i.e., $r_{D}[k] := R(q)y[k]$ where $r_{D}$ is the residual signal of the diagnosis filter and $R(q)$ is a transfer operator. %
Note that $y[\cdot]$ is associated with the polynomial matrix $L(q)$ in \eqref{eq:dae}. We propose a formulation of transform operator $R(q)$ as
\begin{equation}\label{filter}
R(q) := a(q)^{-1}N(q)L(q), \nonumber
\end{equation}
where $N(q)$ is a polynomial vector with the dimension of $n_{r}$ and a predefined order $d_{N}$. To make $R(q)$ physically realizable, stable dynamics $a(q)$ with sufficient order need to be added as the denominator where all the roots are strictly contained in the unit circle. Note that, unlike the observer-based methods, %
here $d_{N}$ can be much less than the dimension of system dynamics.
Then $N(q)$ and $a(q)$ are the two variables for a diagnosis filter design. By multiplying $a(q)^{-1}N(q)$ in the left of \eqref{eq:dae}, we have %
\begin{equation}\label{eq:residual_gen}
\begin{aligned}
r_{D}[k] &= a(q)^{-1}N(q)L(q)y[k] \\
&= -\underbrace{a(q)^{-1}N(q)H(q)x[k]}_{\text{(\RNum{1}})} - \underbrace{a(q)^{-1}N(q)F(q)f[k]}_{\text{(\RNum{2}})},
\end{aligned}
\end{equation}
where term $\text{(\RNum{1}})$ in \eqref{eq:residual_gen} is due to $x[\cdot]$ of system states and natural disturbances. Term $\text{(\RNum{2}})$ is the desired contribution from the attacks $f[\cdot]$. In view of this diagnosis filter description, we introduce a class of residual generator which is sensitive to disruptive stealthy attacks as defined in Definition~\ref{def:destruct_attack}.
\begin{Def}[Robust residual generator]\label{def:robust_detect}
Consider a linear residual generator represented via a polynomial vector~$N(q)$. This residual generator is robust with respect to disruptive stealthy attacks introduced in~Definition~\ref{def:destruct_attack} if
\begin{align}
\label{eq:robust-poly}
\left\{
\begin{array}{ll}
(I) & N(q)H(q) = 0, \\
(II) & N(q)F(q)F_{\mathrm b} \alpha \neq 0, \quad \text{for all } \alpha \in \mathcal{A},
\end{array}
\right.
\end{align}
where the basis matrix~$F_{\mathrm b}$ and the set $\mathcal A$ are the same as the ones in Definition~\ref{def:destruct_attack}.
\end{Def}
In the next step, we show that the polynomial equations~\eqref{eq:robust-poly} in Definition~\ref{def:robust_detect} can be characterized as a feasibility problem of a finite robust program.
\begin{Lem}[Linear program characterization]\label{lem:robust_scheme_reform}
Consider the polynomial matrices $H(q) = \sum_{i = 0}^{1}H_{i}q^{i}$, $N(q) := \sum_{i = 0}^{d_{N}}N_{i}q^{i}$ and $F(q) = F$, where $H_{i} \in \mathbb{R}^{n_{r} \times n_{x}}$, $N_{i} \in \mathbb{R}^{n_{r}}$, and $F \in \mathbb{R}^{n_{r} \times n_{f}}$ are constant matrices. Then, the family of robust residual generators in~\eqref{eq:robust-poly} is characterized b
%
\begin{align}\label{eq:robust-poly_bar}
\left\{
\begin{array}{ll}
(I) & \bar{N}\bar{H} = 0, \\
(II)& \big\| \bar{N}V(\alpha) \big \|_{\infty} > 0, \quad \text{for all } \alpha \in \mathcal{A},
\end{array}
\right.
\end{align}
where $\|\cdot\|_{\infty}$ denotes the infinite vector norm, and
%
%
\begin{equation}\label{eq:NHF_bar}
\begin{aligned}
\bar{N} &\coloneqq\left[\begin{matrix} N_{0} & N_{1} & \cdots & N_{d_{N}} \end{matrix}\right], \nonumber\\
\bar{H} &\coloneqq \left[\begin{matrix} H_{0} & H_{1} & 0 & \cdots & 0 \\ 0 & H_{0} & H_{1} & 0 & \vdots \\ \vdots & 0 & \ddots & \ddots & 0 \\ 0 & \cdots & 0 & H_{0} & H_{1} \end{matrix}\right], \nonumber\\
V(\alpha) &\coloneqq \left[\begin{matrix} FF_{\mathrm b}\alpha & 0 & \cdots & 0 \\ 0 & FF_{\mathrm b}\alpha & 0 & \vdots \\ \vdots & 0 & \ddots & 0 \\ 0 & \cdots & 0 & FF_{\mathrm b}\alpha \end{matrix}\right]. \nonumber
\end{aligned}
\end{equation}
\end{Lem}
\begin{proof}
The proof follows a similar line of arguments as \cite[Lemma~4.2]{Esfahani2016}.
The key step
is to observe that $N(q)H(q) = \bar{N}\bar{H} [I ,\ qI ,\ \cdots ,\ q^{d_N+1}I ]^\top$, and $N(q)FF_{\mathrm b}\alpha = \bar{N}V(\alpha) [I ,\ qI ,\ \cdots ,\ q^{d_N}I ]^\top$. The rest of the proof follows rather
straightforwardly, and we omit the details for
brevity.
\end{proof}
\subsection{Maximin Optimization-based Diagnosis Filter}
\label{subsec:maxmin_detect}
In light of \eqref{eq:robust-poly_bar}, we can define a symmetric set for the design variable $\bar{N}$ of the dynamic residual generator,
\begin{equation}\label{eq:sets_barN}
\mathcal{N} : = \{\bar{N} \in \mathbb{R}^{(d_{N}+1)n_{r}} \ | \ \bar{N}\bar{H} = 0, \ \|\bar{N}\|_{\infty} \leq \eta \}. \\
\end{equation}
The second constraint in the set is added to avoid possible unbounded solutions. To design a robust residual generator, we aim to find an $\bar{N} \in \mathcal{N}$ that for all $\alpha \in \mathcal{A}$, \eqref{eq:robust-poly_bar} can be satisfied. To this end, a natural reformulation of the residual synthesis is to consider an objective function as the second quantity in~\eqref{eq:robust-poly_bar} influenced by the parameters~$\mathcal{N}$ and the attacker action~$\alpha$, i.e., $\mathcal{J}(\bar{N},\alpha) := \| \bar{N}V(\alpha) \|_{\infty}$. A successful scenario from an attacker viewpoint is to minimize this objective function given a residual generator. Therefore, we take a rather conservative viewpoint where the attacker may have knowledge about the residual generator parameters and exploits it so as to synthesize a stealthy attack. We then reformulate the diagnosis filter
design as the robust optimization program,
\begin{align}\label{opt:max-min-opt}
\gamma^\star \coloneqq \max\limits_{ \bar{N} \in \mathcal{N} } \ \min\limits_{\alpha \in \mathcal{A} } \ \Big\{ \mathcal{J}(\bar{N},\alpha):= \| \bar{N}V(\alpha) \|_{\infty} \Big\}.
\end{align}
The optimal value~$\gamma^\star$ of the robust reformulation~\eqref{opt:max-min-opt} is indeed an indication whether the attack still remains stealthy in the dynamic setting, i.e., if $\gamma^\star > 0$ then the optimal solution~$\bar{N}^\star$ helps construct a diagnosis filter in the form of~\eqref{filter} which detects all the admissible attacks introduced in Definition~\ref{def:destruct_attack}. However, if $\gamma^\star = 0$, then it implies that for any possible detectors (static or dynamic) there exists a stationary disruptive attack that remains stealthy. In the next step, we show that the robust program~\eqref{opt:max-min-opt} can be equivalently reformulated as a finite (non-convex) optimization problem.
\begin{Thm}[Finite reformulation of robust design]\label{the:max-min-reform}
The robust optimization~\eqref{opt:max-min-opt} can be equivalently described via the finite optimization program
%
%
\begin{align}\label{opt:max-min-ref}
\gamma^\star = \max\limits_{\bar{N}, \ \beta, \ \lambda} \quad& b^{\top}\lambda \nonumber \\
\mbox{s.t.} \quad& \sum_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b} = \lambda^{\top}A, \\
& \mathbf{1}^{\top}\beta = 1, \ \beta \geq 0, \nonumber\\
& \bar{N} \in \mathcal{N}, \ \lambda \geq 0. \nonumber
\end{align}
where $\beta = [\beta_{0}, \ \beta_{1}, \ \cdots, \ \beta_{2d_{N}+1}]^\top$ is an $ \mathbb{R}^{2d_{N}+2}$-valued auxiliary variable.
\end{Thm}
\begin{proof}
See Appendix-A.
\end{proof}
The exact reformulation program~\eqref{opt:max-min-ref} for \eqref{opt:max-min-opt} is unfortunately non-convex due to the bilinearity between the variables $\beta$ and $N_{i}$ in the first constraint. In the following corollary, we suggest a convex relaxation of the program by restricting the feasible set of the variable~$\beta$ to a $2d_N+2$ finite possibilities where $\beta = [0, \ \cdots, \ 1, \ \cdots, \ 0]^\top$ in which the only non-zero element of the vector is the $i^{\rm th}$ element.
\begin{Cor}[Linear program relaxation]\label{cor:convex_rel}
Given $i \in \{1, \ \dots, \ 2d_{N}+2\}$, consider the linear program
%
\begin{align}\label{opt:max-min-relax}
\gamma^{'}_{i} := \max\limits_{\bar{N}, \, \lambda} \quad& b^{\top}\lambda \nonumber \\
\mbox{s.t.} \quad& (-1)^{i}N_{\lfloor i/2 \rfloor}FF_{\mathrm b} = \lambda^{\top}A, \tag{${\rm LP}_{i}$}\\
& \bar{N} \in \mathcal{N}, \ \lambda \geq 0, \nonumber
\end{align}
%
where ${\lfloor \cdot \rfloor}$ is the ceiling function that maps the argument to the least integer. Then, the solution to the program~\eqref{opt:max-min-relax} is a feasible solution to the exact robust design reformulation~\eqref{opt:max-min-ref}, and $\max_{\{i\le 2d_N+2\}} \gamma^{'}_{i} \le \gamma^\star$. In particular, if for any $i \in \{1,\ \dots, \ 2d_N+2\}$ we have $\gamma^{'}_{i} > 0$, then the solution to \ref{opt:max-min-relax} offers a robust residual generator
detecting all admissible disruptive attacks introduced by~Definition~\ref{def:destruct_attack}.
\end{Cor}
Corollary~\ref{cor:convex_rel} suggests that the maximum optimal value of $\{\gamma^{'}_{0}, \ \gamma^{'}_{1}, \ \cdots, \ \gamma^{'}_{2d_{N}+2}\}$ and the corresponding~$\bar{N}^{\star}$ provide a suboptimal solution to the original robust design~\eqref{opt:max-min-opt}.
The proposed robust design does not necessarily enforce a non-zero steady-state residual of the diagnosis filter under multivariate attacks. Indeed, the residual signal $r_{D}$ may become zero again after a successful diagnosis in a transient behavior. A more stringent perspective is to require a non-zero steady-state behavior under any plausible attack scenario in $\alpha \in \mathcal A$. This is addressed in the next remark.
\begin{Rem}[Non-zero steady-state residual]\label{rem:robust_detect_nonzero}
In order to design a diagnosis filter with non-zero steady-state residual ``alert'' when a multivariate attack occurs, the robust optimization~\eqref{opt:max-min-opt} can be modified by a more conservative (smaller) objective function~$\mathcal{J}(\bar{N},\alpha) \coloneqq | \bar{N} \bar{F} \alpha|$ where $\bar{F} \coloneqq\left[\begin{matrix} F F_{\mathrm b} & F F_{\mathrm b} & \cdots & F F_{\mathrm b} \end{matrix}\right]^{\top}$. A similar treatment as the one mentioned in Theorem~\ref{the:max-min-reform} and the relaxation in Corollary~\ref{cor:convex_rel} may be deployed for numerical purposes. We refer to Appendix-C for further details along this direction.
\end{Rem}
\section{Numerical Results}
\label{sec:results}
\subsection{Test System And Diagnosis Filter Description}
\label{subsec:sys_descrip}
In order to validate the effectiveness of the diagnosis filter with application to power system cyber security, we employed the IEEE 39-bus system which is well-known as a standard system for testing of new power system analysis. As shown in Figure~\ref{fig:39bus}, this system consists of 3 areas and 10 generators where 7 of them are equipped with AGC for frequency control. All the participating generators in each area are with equal participation factors. The total load of the three-area system is ${5.483}\ \mathrm{GW}$ for the base of ${100}\ \mathrm{MVA}$ and ${60}\ \mathrm{Hz}$. The generator specifications and AGC parameters of each area are referred to \cite{bevrani2008}, and the linear frequency dynamics model has been developed in the preceding Section~\ref{sec:powersys_model}. Thus we result in a 19-order model in the form of \eqref{eq:dis_cls}.
We apply the diagnosis filter proposed in Section~\ref{sec:detect} to detect multivariate disruptive attacks on the measurements of AGC system. In the following simulations, we set the degree of the dynamic residual generator $d_{N} = 3$ which is much less than the order of the dynamics model, the sampling time $T_s = {0.5}\ \mathrm{sec}$ and the finite time horizon ${60}\ \mathrm{sec}$. To design the filter, we set the denominator in the form $a(q) = (q - p)^{d_{N}}/{{(1-p)}^{d_{N}}}$ where $p$ is a user-defined variable acting as the {\em pole} of the transfer operator $R(q)$, and it is normalized %
in steady-state value for all feasible poles. The pole is fixed to be $p=0.8$ for a stable dynamic behaviour, and we have deployed the solver CPLEX to solve the corresponding optimization problems.
\subsection{Simulation Results}
\label{subsec:sim_results}
\begin{figure*}[t!p]
\centering
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig11ad_unstealth_p08_0403.pdf}
\caption{Load disturbance and basic attack}\label{subfig11:ad}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig21ad_stealth_p08_0403.pdf}
\caption{Load disturbance and stealthy attack}\label{subfig21:ad}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig14srn_unstealth_p08_0403.pdf}
\caption{Residual of static detector under basic attack}\label{subfig14:srn}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig24srn_stealth_p08_0403.pdf}
\caption{Residual of static detector under stealthy attack}\label{subfig24:srn}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig15rrn_unstealth_p08_0403.pdf}
\caption{Residual of dynamic detector under basic attack}\label{subfig15:rrn}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig25rrn_stealth_p08_0403.pdf}
\caption{Residual of dynamic detector under stealthy attack}\label{subfig25:rrn}
\end{subfigure}
\caption{Static detector in \eqref{eq:static_r} versus dynamic detector (diagnosis filter) from Corollary~\ref{cor:convex_rel} under basic and stealthy attacks.
\label{fig:resfig_(un)stealth}
\end{figure*}
To evaluate the performance of the diagnosis filter, the disturbances $d_{i} = \Delta P_{l_{i}}$ are modeled as stochastic load patterns. To capture its uncertainty, as shown in Figure~\ref{subfig11:ad} and Figure~\ref{subfig21:ad}, we mainly model $\Delta P_{l_{1}}$ in Area 1 as random zero-mean Gaussian signals. It should be noted that tie-line power flow measurements %
are much more vulnerable to cyber attacks, comparing with frequency measurements (e.g., the anomalies in frequency can be easily detected by comparing the corrupted reading with the normal one.) \cite{Chen2018}. Therefore as indicated in Figure~\ref{fig:39bus} we mainly focus on the scenario that there are 5 vulnerable tie-line power measurements, namely $\Delta P_{tie_{1,2}}$, $\Delta P_{tie_{1,3}}$, $\Delta P_{tie_{1}}$, $\Delta P_{tie_{2,3}}$ and $\Delta P_{tie_{2}}$. Recalling Definition~\ref{def:destruct_attack} for %
stealthy attack basis, thus there exist 3 basis vectors in the spanning set and we model them as follows: $f_{1}= [0.1 \ 0 \ 0.1 \ 0 \ 0]^T$, $f_{2}= [0.1 \ 0.15 \ 0.25 \ 0 \ 0]^T$, $f_{3}= [0 \ 0 \ 0 \ 0.1 \ 0.1]^T$ (all in $\mathrm{p.u.}$). Here each basis vector lies in the range space of the output matrix that the corrupted measurements still align with an actual physical state, bypassing the static detector $r_{S}[\cdot]$. %
Furthermore, without loss of generality we set $A=\mathbf{1}^\top$ and $b=1.5$ in the set $\mathcal{A}$ and $\eta = 10$ in the set $\mathcal{N}$. The design variable $\bar{N}$ of the robust residual generator is derived by solving \eqref{opt:max-min-opt} through $({\rm LP}_{i})$. The optimal value achieves maximum for $i=2$ that $\gamma^{'}_{2} = 300$, which implies a robust detection as Corollary~\ref{cor:convex_rel}. For the given $\bar{N}$, the multivariate attack coordinates $\alpha = [2.8 \ 1 \ -2.3]^{\top}$ is obtained by solving the inner minimization of \eqref{opt:max-min-opt}.
In the first simulation, we begin with a general scenario where the multivariate attack is not carefully coordinated, i.e., basic attack. Thus as shown in Figure~\ref{subfig11:ad}, only 4 of 5 vulnerable measurements are compromised that $f_{tie_{1,2}} = 0.38 p.u.$, $f_{tie_{1}} = 0.53 p.u.$, $f_{tie_{2,3}} = -0.23 p.u.$ and $f_{tie_{2}} = -0.23 p.u.$. Note that since the injected data on $\Delta P_{tie_{1,2}}$ and $\Delta P_{tie_{1}}$ are inconsistent, the static detector is also expected to be triggered. %
To test the detectors in a more realistic setup, we also consider the presence of process and measurements noises. %
The process noise term added to the state equation of Area 1 is zero-mean Gaussian noises with the covariance matrix $R_{X_{1}} = 0.03 \times \mbox{diag} (\left[ 1 \ 1 \ 0.03 \ 1 \ 1 \ 1 \ 1 \right]^\top)$, i.e., the covariance of the noise to the frequency is 0.009 and the covariance of other states' noise is 0.03 \cite{Ameli2018a}. Similarly, the measurement noise term added to the measurements of Area 1 is with the covariance matrix $R_{Y_{1}} = 0.03 \times \mbox{diag} (\left[ 1 \ 1 \ 1 \ 0.03 \ 1 \ 1 \ 1 \ 1 \ 1 \right]^\top)$, i.e., the covariance of the frequency measurement is 0.009 and the covariance of other measurements' noise is~0.03 \cite{Ameli2018a}. Note the residue $r_{S}$ of BDD in \eqref{eq:static_r} becomes $r_{S}[k] = (I - C({C}^\top R_{Y}^{-1} {C})^{-1}{C}^\top R_{Y}^{-1})Y[k]$ under the noisy system. The attacks are launched at $k_{\min} = {30}\ \mathrm{sec}$. In Figure~\ref{subfig14:srn} and Figure~\ref{subfig15:rrn}, results of the static detector in \eqref{eq:static_r} and the proposed dynamic detector (diagnosis filter) are presented. In Figure~\ref{fig:resfig_(un)stealth_ideal} of Appendix B ~\ref{subsec:sim_res_ideal}, we also present the simulation results under ideal scenarios where there is no noise in the process and measurements. Both detectors have succeeded to generate a diagnostic signal when attacks occurred, and the diagnosis filter residual $r_{D}$ is significantly decoupled from stochastic load disturbances, and keeps sensitive to the multivariate attacks for a successful detection under noisy system settings.
In the second simulation, to challenge the detectors, now the multivariate attacks have been launched on all the 5 vulnerable measurements and the derived attack coefficient $\alpha$ from the optimization results has been used for a more intelligent adversary. Thus in Figure~\ref{subfig21:ad}, the corruptions become $f_{tie_{1,2}} = 0.38 p.u.$, $f_{tie_{1,3}} = 0.15 p.u.$, $f_{tie_{1}} = 0.53 p.u.$, $f_{tie_{2,3}} = -0.23 p.u.$ and $f_{tie_{2}} = -0.23 p.u.$. This corresponds to the worst case for the diagnosis filter that the adversary is given the knowledge of the residual generator's parameter $\bar{N}$ that it tries to minimize the payoff function over $\mathcal{A}$. Besides, the noisy system settings have been considered. Figure~\ref{subfig24:srn} and Figure~\ref{subfig25:rrn} demonstrate all the simulation results. In Figure~\ref{subfig24:srn}, the static detector becomes totally blind to the occurrence of such an intelligent attack. However, as we can see in Figure~\ref{subfig25:rrn}, even in the worst case, the diagnosis filter works perfectly well under the noisy system, generate a residual ``alert'' for the presence of multivariate attacks. %
This proves the effectiveness and robustness of the proposed diagnosis filter design. To be noted in the end, the pole $p$ of the diagnosis filter affects its dynamics behavior that it has a faster response but becomes more sensitive to noise when the positive $p$ is close to zero, while it can be more immune to noise but the response time would increase when the positive $p$ is larger to be close to 1; See Appendix B ~\ref{subsec:sim_res_ideal} for the simulation results with different \em poles. %
\section{Conclusion and Further Discussion}
\label{sec:conclusion}
In this article, we investigated the problem of anomaly detection in the power system cyber security with a particular focus on exploiting the dynamics information where tempering multiple measurements data may be possible. Our study showed that a dynamical perspective to the detection task indeed offers powerful diagnosis tools to encounter attack scenarios that may remain stealthy from a static point of view. The effectiveness of this result was validated by simulations in the IEEE 39-bus system. Future research directions that we envision include an extension to nonlinear systems, as well as a setting exposed to certain ``dynamic'' (time-variant) attacks, as opposed to the linear models and stationary attack scenarios studied in this article.
\setcounter{section}{1}
\section*{Appendix-A: Technical Proofs}
\subsection{Proof of Theorem~\ref{the:max-min-reform}} \label{subsec:app_the_proof}
Let us recall that $\bar{N} V(\alpha) = \left[\begin{matrix} N_{0}FF_{\mathrm b}\alpha & N_{1}FF_{\mathrm b}\alpha & \cdots & N_{d_{N}} FF_{\mathrm b}\alpha \end{matrix}\right]$, and as such, the payoff function of the robust reformulation~\eqref{opt:max-min-opt} is $\mathcal{J}(\bar{N},\alpha)= \max_{i} |N_{i}FF_{\mathrm b}\alpha|$ where $i \in \{ 0, \cdots, d_{N} \}$. By introducing an auxiliary variable $\beta$ in the simplex set $\mathcal{B}\coloneqq\{\beta \in \mathbb{R}^{2d_{N}+2} \ | \ \beta \geq 0, \ \mathbf{1}^{\top}\beta = 1\}$, one can rewrite $\mathcal{J}$ as
$$\mathcal{J}(\bar{N},\alpha) = \max\limits_{\beta \in \mathcal{B}} \ \sum_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b}.$$
In this light, the original robust strategy~\eqref{opt:max-min-opt} can be equivalently described via
\begin{equation}\label{dual}
\max\limits_{ \bar{N} \in \mathcal{N} } \, \min\limits_{\alpha \in \mathcal{A} } \, \max\limits_{\beta \in \mathcal{B}} \left\{ \sum_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b}\alpha \right\}. \nonumber
\end{equation}
Note that given a fixed $\bar{N}$ the inner minimax optimization is indeed a bilinear objective in the decision variables and the respective feasible sets $\mathcal A$ and $\mathcal B$ are convex. Since one of the sets, $\mathcal B$, is also compact, then the zero-duality gap holds. Therefore, interchanging the optimization over $\alpha \in \mathcal A$ and $\beta \in \mathcal B$ yields
\begin{equation} \label{opt:max-min-beta}
\gamma^\star = \max\limits_{ \bar{N} \in \mathcal{N}, \ \beta \in \mathcal{B} } \ \left\{\min\limits_{\alpha \in \mathcal{A} } \ \sum_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b}\alpha \right\}.
\end{equation}
The inner minimization of \eqref{opt:max-min-beta} is a (feasible) linear program. We can use the duality again. To this end, let us assume that the decision variables~$\bar{N}$ and $\beta$ are fixed and consider the Lagrangian function
\begin{align}
\mathcal L(\alpha;\lambda) = b^\top\lambda + \Big(\sum_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b} - \lambda^{\top}A\Big)\alpha,
\end{align}
where optimizing over an unconstrained variable~$\alpha$ leads to
\begin{align*}
\min_{\alpha}\mathcal L(\alpha;\lambda) = \left\{
\begin{array}{ll}
\ b^\top\lambda & \mbox{if} ~ \left\{\begin{array}{l}\sum\limits_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b} = \lambda^{\top}A \\ \lambda \geq 0 \end{array} \right. \vspace{1mm}\\
-\infty & \mbox{otherwise,}
\end{array}
\right.\nonumber
\end{align*}
Using the above characterization as the most inner optimization program in \eqref{dual} leads to
\begin{equation}
\begin{aligned}\label{opt:innermin_dual}
\max\limits_{\lambda} \quad& b^{\top}\lambda \\
\mbox{s.t.} \quad& \sum_{i=0}^{d_{N}}(\beta_{2i}-\beta_{2i+1})N_{i}FF_{\mathrm b} = \lambda^{\top}A,\\
& \lambda \geq 0.\\
\end{aligned}
\end{equation}
It then suffices to combine maximizing over the auxiliary variable~$\lambda$ together with the variables $\bar N$ and $\beta$ to arrive at the main result in \eqref{opt:max-min-ref}.
\setcounter{section}{2}
\section*{Appendix-B: System Paramters and More Simulations}
\setcounter{subsection}{0}
\subsection{Dynamic Feedback Controller Modeling}
\label{subsec:app_rem_dyn_ctrl}
Consider a dynamical system (e.g., the electrical power system studied in Section~\ref{sec:powersys_model}). Suppose the control signal is implemented as a {\em dynamic} feedback controller described by the discrete-time dynamics
\begin{equation}\label{eq:dyn_ctrl}
\left\{
\begin{aligned}
& X_{c}[k+1] = A_{c}X_{c}[k] + B_{c}Y[k], \\
& u[k] = C_{c}X_{c}[k] + D_{c}Y[k],
\end{aligned}
\right.
\end{equation}
where the input is the dynamical system measurements~$Y[\cdot]$, the output the control signal~$u[\cdot]$, and the internal state of the controller is denoted by $X_{c} \in \mathbb{R}^{n_{c}}$. When an attack occurs on the measurements, it affects the dynamics of the controller and consequently the involved physical system. To study the control dynamics together with the original dynamical system, one can augment the states of the system~\eqref{eq:dis_sys} together with the controller's as $\hat{X}\coloneqq[X^{\top} \ X_{c}^{\top}]^{\top}$. Assuming that the control signal can also be measured, one can also introduce an augmented measurement signals as~$\hat{Y}=[Y^{\top} \ u^{\top}]^{\top}$. Following this procedure, the dynamics of the closed-loop system is described by
\begin{equation}\label{eq:full_sys}
\left\{
\begin{aligned}
& \hat{X}[k+1] = \hat{A}_{cl} \hat{X}[k] + \hat{B}_{d} d[k] + \hat{B}_{f} f[k], \\
& \hat{Y}[k] = \hat{C}\hat{X}[k] + \hat{D}_f f[k].
\end{aligned}
\right.
\end{equation}
where the involved matrices are defined as
\begin{equation}\label{eq:sys_matrix_def}
\begin{aligned}
&\hat{A}_{cl} \coloneqq \left[\begin{matrix} A_{x}+B_u D_c C & B_u C_c \\ B_c C & A_{c} \end{matrix}\right], \quad \hat{B}_{d} \coloneqq \left[\begin{matrix} B_{d} \\ 0 \end{matrix}\right], \quad \hat{B}_{f} \coloneqq \left[\begin{matrix} B_u D_c D_f \\ B_c D_f \end{matrix}\right], \nonumber\\
&\quad \quad \quad \quad \quad \hat{C} \coloneqq \left[\begin{matrix} C & 0 \\ D_c C & C_{c} \end{matrix}\right], \quad \hat{D}_f \coloneqq \left[\begin{matrix} D_f \\ D_c D_f \end{matrix}\right] \,. \nonumber
\end{aligned}
\end{equation}
In this view, the augmented system~\eqref{eq:full_sys} shares the same structure as \eqref{eq:dis_cls} studied in the main part of the article for the case of static feedback controller.
\subsection{AGC System Parameters of the Three-area 39-bus System}\label{subsec:agc_39_sys_matrices}
We take the matrices description of Area 1 in the three-area 39-bus system of Figure~\ref{fig:39bus} in the main part of the article as an instance,
\begin{equation} \label{eq:spx_B1d}
B_{1,d} = \left[\begin{matrix} 0 & 0 & -\frac{1}{2H_{1}} & 0 & 0 & 0 \end{matrix}\right]^{\top}, \nonumber
\end{equation}
\begin{gather}\label{eq:spx_A11}
A_{11} = \nonumber\\
\left[\begin{matrix} 0 & 0 & T_{12} & 0 & 0 & 0 \\ 0 & 0 & T_{13} & 0 & 0 & 0 \\ -\frac{1}{2H_{1}} & -\frac{1}{2H_{1}} & -\frac{D_{1}}{2H_{1}} & \frac{1}{2H_{1}} & \frac{1}{2H_{1}} & 0 \\ 0 & 0 & -\frac{1}{T_{ch_{1,1}}S_{1,1}} & -\frac{1}{T_{ch_{1,1}}} & 0 & \frac{\phi_{1,1}}{T_{ch_{1,1}}} \\ 0 & 0 & -\frac{1}{T_{ch_{1,2}}S_{1,2}} & 0 & -\frac{1}{T_{ch_{1,2}}} & \frac{\phi_{1,2}}{T_{ch_{1,2}}} \\ -K_{I_{1}} & -K_{I_{1}} & -K_{I_{1}}B_{1} & 0 & 0 & 0 \end{matrix}\right]. \nonumber
\end{gather}
As we have assumed a measurement model with high redundancy, the matric $C_{i}$ for Area 1 becomes
\begin{equation} \label{eq:spy_c1}
C_{1} = \left[\begin{matrix} 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 \\ 1 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 1 & 0\end{matrix}\right]^{\top}. \nonumber
\end{equation}
In Area 1, the vulneralbe measurements to cyber attacks are the ones of tie-line power flows $\Delta P_{tie_{1,2}}$, $\Delta P_{tie_{1,3}}$ and $\Delta P_{tie_{1}}$. Thus the AGC signal $\Delta P_{agc_{1}}$ would be corrupted into
\begin{equation}\label{eq:agc_f}
\Delta \dot{P}_{agc_{1}} = - k_{1}(B_{1} \Delta \omega_{1} + \Delta P_{tie_{1,2}} + f_{tie_{1,2}} + \Delta P_{tie_{1,3}} + f_{tie_{1,3}}). \nonumber
\end{equation}
Then the parameters regarding multivariate attacks are
\begin{equation} \label{eq:spy_f1}
f_{1} = \left[\begin{matrix} f_{tie_{1,2}} & f_{tie_{1,3}} & f_{tie_{1}}\end{matrix}\right]^{\top}, \nonumber
\end{equation}
\begin{equation} \label{eq:spy_D1f}
D_{1,f} = \left[\begin{matrix} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \end{matrix}\right]^{\top}, \nonumber
\end{equation}
\begin{equation}\label{eq:spx_B1f}
B_{1,f} = \left[\begin{matrix} 0 & 0 & 0 & 0 & 0 & -k_{1} \\ 0 & 0 & 0 & 0 & 0 & -k_{1} \\ 0 & 0 & 0 & 0 & 0 & 0 \end{matrix}\right]^{\top}. \nonumber
\end{equation}
\begin{figure*}[t!p]
\centering
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig11ad_unstealth_p08_0403.pdf}
\caption{Load disturbance and basic attack}\label{subfig11:ad_ideal}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig21ad_stealth_p08_0403.pdf}
\caption{Load disturbance and stealthy attack}\label{subfig21:ad_ideal}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig12sr_unstealth_p08_0403.pdf}
\caption{Residual of static detector under basic attack}\label{subfig12:sr}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig22sr_stealth_p08_0403.pdf}
\caption{Residual of static detector under stealthy attack}\label{subfig22:sr}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig13rr_unstealth_p08_0403.pdf}
\caption{Residual of dynamic detector under basic attack}\label{subfig13:rr}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig23rr_stealth_p08_0403.pdf}
\caption{Residual of dynamic detector under stealthy attack}\label{subfig23:rr}
\end{subfigure}
\caption{Static detector in (2) versus dynamic detector (diagnosis filter) from Corollary~IV.4 under basic and stealthy attacks.}
\label{fig:resfig_(un)stealth_ideal}
\end{figure*}
\subsection{Simulation Results of Ideal Scenarios and Diagnosis Filter with Different {\em poles}}\label{subsec:sim_res_ideal}
In the main part of the article, the simulation results of both detectors under noisy systems have been illustrated in Figure~\ref{fig:resfig_(un)stealth}. Next in Figure~\ref{fig:resfig_(un)stealth_ideal} we present the simulation results of detector residuals $r_{S}$, $r_{D}$ under ideal scenarios where there is no noise in the process and measurements.
In Figure~\ref{fig:resfig_diffp_unstealth} we present the simulation results of residual signal $r_{D}$ of the proposed diagnosis filter under different {\em poles} ($p=0.1, \ 0.2, \ 0.4, \ 0.6, \ 0.98$ respectively.)
\begin{figure}[t]
\centering
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig11ad_unstealth_p08_0403.pdf}
\caption{Load disturbance and basic attack}\label{subfig11:add_ideal}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig21ad_stealth_p08_0403.pdf}
\caption{Load disturbance and stealthy attack}\label{subfig21:add_ideal}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig3_unstealth_p01_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.1$}\label{subfig31:r_p01}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig4_stealth_p01_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.1$}\label{subfig41:r_p01}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig3_unstealth_p02_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.2$}\label{subfig31:r_p02}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig4_stealth_p02_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.2$}\label{subfig41:r_p02}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig3_unstealth_p04_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.4$}\label{subfig31:r_p04}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig4_stealth_p04_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.4$}\label{subfig41:r_p04}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig3_unstealth_p06_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.6$}\label{subfig31:r_p06}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig4_stealth_p06_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.6$}\label{subfig41:r_p06}
\end{subfigure}
\\
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig3_unstealth_p098_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.98$}\label{subfig31:r_p098}
\end{subfigure}
~
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[scale=0.49]{fig4_stealth_p098_0503.pdf}
\caption{Residual signal $r_{D}$ with pole $p=0.98$}\label{subfig41:r_p098}
\end{subfigure}
\\
\caption{Results of dynamic detector (diagnosis filter) with different {\em poles} under basic and stealthy attacks.}
\label{fig:resfig_diffp_unstealth}
\end{figure}
\setcounter{section}{3}
\section*{Appendix-C: Diagnosis Filter with Non-zero Steady-state Residual}
\setcounter{subsection}{0}
The diagnosis filter design proposed in Subsection~\ref{subsec:maxmin_detect} does not enforce a non-zero steady-state residual under multivariate attacks. In fact, as Figure~\ref{subfig23:rr} shows, the residual signal $r_{D}$ of the diagnosis filter under stealthy attacks may become zero, in this particular case after $k = 50 \ \mathrm{sec}$. In order to design a diagnosis filter with non-zero steady-state residual ``alerts'' when multivariate attacks occur, one can modify Lemma~\ref{lem:robust_scheme_reform} in the following fashion.
\begin{Lem}[Non-zero steady-state residual characterization]\label{lem:robust_scheme_nz}
For the polynomial matrices $H(q)$, $N(q)$ and $F(q)$, the family of dynamic residual generators in \eqref{eq:robust-poly_bar} but with non-zero steady-state residual under multivariate attacks can be characterized by the algebraic relations
%
\begin{align}\label{eq:robust-poly_bar_nz}
\left\{
\begin{array}{ll}
(I) & \bar{N}\bar{H} = 0, \\
(II)& | \bar{N} \bar{F} \alpha | > 0, \quad \text{for all } \alpha \in \mathcal{A},
\end{array}
\right.
\end{align}
where
%
\begin{equation}\label{eq:F_bar}
\begin{aligned}
\bar{F} \coloneqq\left[\begin{matrix} F F_{\mathrm b} & F F_{\mathrm b} & \cdots & F F_{\mathrm b} \end{matrix}\right]^{\top}. \nonumber\\
\end{aligned}
\end{equation}
and $\bar{N}$, $\bar{H}$ are the same to the ones defined in Lemma~\ref{lem:robust_scheme_reform} .
\end{Lem}
\begin{proof}
Recall that $N(q)H(q) = \bar{N}\bar{H} [I ,\ qI ,\ \cdots ,\ q^{d_{N} + 1}I ]^\top$. Thus if $\bar{N}\bar{H}=0$, the diagnosis filter becomes $r_{D}[k] = -a(q)^{-1}N(q)f[k]$. Note the steady-state value of the filter residual under attacks would be $-a(q)^{-1}N(q)F(q)f|_{q=1}$. Thus for the multivariate attack with $\alpha$, the steady-state value of the filter residual is $-a(1)^{-1}N(1)F(1)F_{\mathrm b} \alpha$. The proof concludes by noting that $N(1)F(1)F_{\mathrm b} \alpha = \bar{N}\bar{F} \alpha$.
\end{proof}
Similarly, we can have a robust optimization for the diagnosis filter design with the objective function~$\mathcal J(\bar{N},\alpha) \coloneqq | \bar{N} \bar{F} \alpha |$, representing the absolute steady state gain from the attacks to the filter residual. In particular, the aim is to find filter parameters $\bar N^\star$ such that $\mathcal J(\bar{N}^\star,\alpha) > 0$ for all $\alpha \in \mathcal{A}$. To this end, we define
\begin{align}\label{opt:max-min-opt-nz}
\mu^\star \coloneqq \max\limits_{ \bar{N} \in \mathcal{N} } \ \min\limits_{\alpha \in \mathcal{A} } \ \Big\{ \mathcal{J}(\bar{N},\alpha) \coloneqq | \bar{N} \bar{F} \alpha | \Big\}.
\end{align}
The next result is similar to Theorem~\ref{the:max-min-reform} but with the new objective function~\eqref{opt:max-min-opt-nz}.
\begin{Thm}[Reformulation of non-zero steady state gain]\label{the:max-min-reform-nz}
Consider the symmetric feasible set of the filter coefficients~$\mathcal{N}$ as defined in \eqref{eq:sets_barN}. The robust optimization~\eqref{opt:max-min-opt-nz} can be equivalently described via the linear optimization program
\begin{align}\label{opt:max-min-opt-ref-nz-lp}
\mu^\star = \max\limits_{\bar{N}, \ z} \quad& b^{\top} z \nonumber \\
\mbox{s.t.} \quad& \bar{N}\bar{F}= z^{\top}A, \\%\tag{${\rm LP}$}\\
& \bar{N} \in \mathcal{N}, \ z \geq 0. \nonumber
\end{align}
\end{Thm}
\begin{proof}
For a given $\bar{N} \in \mathcal N$, the inner minimization of \eqref{opt:max-min-opt-nz} can be equivalently translated as
%
\begin{align}\label{opt:max-min-nz-innermin}
\min\limits_{\alpha \in \mathcal{A}} \quad& r \nonumber \\
\mbox{s.t.} \quad& \bar{N}\bar{F}\alpha - r \leq 0, \nonumber \\
& -\bar{N}\bar{F}\alpha - r \leq 0. \nonumber
\end{align}
The Lagrangian of the inner minimization over the variable $\alpha$ reads as
%
\begin{equation}
\mathcal L(\alpha,r,v_{1},v_{2},z) = b^\top z + ((v_{1}-v_{2})\bar{N}\bar{F} - z^{\top}A)\alpha + (1-v_{1}-v_{2})r. \nonumber \\
\end{equation}
%
Optimizing over the variable~$\alpha \in \mathcal A$ yields the dual function
%
\begin{equation}
\min_{\alpha \in \mathcal A} \mathcal L(\alpha,r,v_{1},v_{2},z) = \left\{
\begin{aligned}
& \ b^\top z \quad\quad \mbox{if} \ (v_{1}-v_{2})\bar{N}\bar{F} = z^{\top}A, \ v_{1}+v_{2} \leq 1, \\
& \quad\quad \quad\ \ \, v_1 \geq 0, \ v_2 \geq 0, \ z \geq 0, \\
&\ -\infty \quad \ \ \mbox{otherwise} \,.
\end{aligned}
\right.\nonumber
\end{equation}
Then, combining maximization over the auxiliary variable $z$ together with $\bar{N}$ and $v_1$, $v_2$ arrives at the optimization program
%
\begin{align}\label{opt:max-min-opt-ref-nz}
\mu^\star = \max\limits_{\bar{N}, v_1, v_2, z} \quad& b^{\top} z \nonumber \\
\mbox{s.t.} \quad& (v_{1}-v_{2})\bar{N}\bar{F}= z^{\top}A, \\
& v_{1}+v_{2} \leq 1, \ v_1 \geq 0, \ v_2 \geq 0, \nonumber\\
& \bar{N} \in \mathcal{N}, \ z \in \mathbb{R}^{n_b}, \ z \geq 0. \nonumber
\end{align}
Note that the actual program~\eqref{opt:max-min-opt-ref-nz-lp} is a restriction of \eqref{opt:max-min-opt-ref-nz} where the variables~$v_1, v_2$ are restricted to $v_1 = 1$ and $v_2 = 0$. In the rest of the proof we show that this restriction is indeed without loss of generality. To this end, suppose the tuple ($v_1^\ast$, $v_2^\ast$, $\bar{N}^\ast$, $z^\ast$) is an optimal solution to the program~\eqref{opt:max-min-opt-ref-nz}.
Note that the optimal variables $v_{1}^\ast$ and $v_{2}^\ast$ may satisfy one of the following three properties:
%
\begin{itemize}
\item [(i)] $v_1^\ast = v_2^\ast$: In this case, $z^\ast = 0$, and therefore the optimal value $\mu^\star=0$. This optimal solution can be trivially achieved in the program~ \eqref{opt:max-min-opt-ref-nz-lp} by setting $\bar N = 0$.
\item [(ii)] $v_1^\ast > v_2^\ast$: Observe that the tuple~\big($v_{1}^{'}=1$, $v_{2}^{'}=0$, $\bar{N}^{'}=\bar{N}^\ast$, $z^{'}={z^\ast}/{(v_1^\ast - v_2^\ast)}$\big) is a feasible solution with the objective value~${b^\top z^\ast}/{(v_1^\ast - v_2^\ast)}$. Since $b^\top z^\ast \ge 0$ by optimality assumption and $v_1^\ast - v_2^\ast \in (0,1]$, then this feasible solution has a possibly higher optimal value, and therefore $v_1^\ast - v_2^\ast = 1$. That is, $v_1^\ast = 1$ and $v_2^\ast = 0$.
\item [(iii)] $v_1^\ast < v_2^\ast$: Following similar steps as the previous case together with the symmetric property of the feasible set~$\mathcal N$, one can show that the optimal value of the program~\eqref{opt:max-min-opt-ref-nz} also coincides with the restricted version in \eqref{opt:max-min-opt-ref-nz-lp}.
\end{itemize}
this concludes the proof.
\end{proof}
\iffalse
\subsection{Minimax Optimization and Two-player Zero-sum Game}
Next let us formulate the minimax game pair for \eqref{opt:max-min-opt-nz},
\begin{align}\label{opt:min-max-opt-nz}
\varphi^\star := \min\limits_{\alpha \in \mathcal{A}} \ \max\limits_{ \bar{N} \in \mathcal{N} } \ \Big\{ \mathcal{J}(\bar{N},\alpha) \coloneqq | \bar{N} \bar{F} \alpha | \Big\}.
\end{align}
In general, these two formulations \eqref{opt:max-min-opt-nz} and \eqref{opt:min-max-opt-nz} lead to different results, and the inequality $\varphi^\star \geq \mu^\star$ always holds \cite{Irle1985}.
However, in the case of this article, we show that a saddle point exists in \eqref{opt:max-min-opt-nz} and \eqref{opt:min-max-opt-nz}:
\begin{Thm}[Saddle point of \eqref{opt:max-min-opt-nz} and \eqref{opt:min-max-opt-nz}]\label{lem:NashEq}
For feasible zero-sum two-player games \eqref{opt:max-min-opt-nz} and \eqref{opt:min-max-opt-nz}, it admits a saddle point (Nash equilibrium) such that
%
\begin{align}\label{eq:nash_eq}
\max\limits_{ \bar{N} \in \mathcal{N}} \ \min\limits_{\alpha \in \mathcal{A}} \ \mathcal{J}(\bar{N},\alpha) \ = \min\limits_{\alpha \in \mathcal{A}} \ \max\limits_{\bar{N} \in \mathcal{N} } \ \mathcal{J}(\bar{N},\alpha). \nonumber
\end{align}
%
\end{Thm}
\begin{proof}
%
The idea here is to show that the maximin and minimax programs \eqref{opt:max-min-opt-nz} \eqref{opt:min-max-opt-nz} are dual of each other and strong duality holds for these two feasible programs. First, similar to the process from \eqref{opt:max-min-opt-nz} to \eqref{opt:max-min-opt-ref-nz}, we still resort to duality for the inner maximization of \eqref{opt:min-max-opt-nz}. Recall that $\mathcal{N}$ is a symmetric set. For a given $\alpha$, the Lagrangian of inner maximization becomes
%
\begin{equation}
L(\bar{N},u_{1}, u_{2}, w) = - (\mathbf{1}^{\top}u_{1} + \mathbf{1}^{\top}u_{2}) + (w^\top \bar{H}^\top + u_{1}^\top - u_{2}^\top - (\bar{F}\alpha)^\top)\bar{N}^{\top}. \nonumber \\
\end{equation}
%
where $u_{1}$, $u_{2}$, $w$ are dual variables. The Lagrangian dual function is
%
\begin{equation}
g(\bar{N}) = \left\{
\begin{aligned}
& -(\mathbf{1}^{\top}u_{1} + \mathbf{1}^{\top}u_{2}) \quad \mbox{if} \ \bar{H}w + u_{1} - u_{2} = \bar{F}\alpha, \ u_1 \geq 0, u_2 \geq 0,\\
& -\infty \quad \quad \quad \quad \quad \ \ \mbox{otherwise,}
\end{aligned}
\right.\nonumber
\end{equation}
%
Thus for the minimax strategy \eqref{opt:min-max-opt-nz}, it can be reformulated as the following linear program,
%
\begin{equation}
\begin{aligned}\label{opt:min-max-opt-ref-nz}
\varphi^\star = \min\limits_{u_{1}, u_{2}, w, \alpha} \quad & \mathbf{1}^{\top}u_{1} + \mathbf{1}^{\top}u_{2} \\
\mbox{s.t.} \quad & \bar{H}w + u_{1} - u_{2} = \bar{F}\alpha, \\
& u_{1} \geq 0, \ u_{2} \geq 0, \\
& A \alpha \geq b.
\end{aligned}
\end{equation}
%
Now we come to the duality of \eqref{opt:max-min-opt-nz}. Note that we have rewritten the program of \eqref{opt:max-min-opt-nz} into \eqref{opt:max-min-opt-ref-nz}, and finally we obtain an \eqref{opt:max-min-opt-ref-nz-lp}. Thus we can resort to the duality of \eqref{opt:max-min-opt-ref-nz-lp} instead. The Lagrangian of \eqref{opt:max-min-opt-ref-nz-lp} is
%
\begin{align}
L(\bar{N}, z, \alpha, u_1, u_2, w) & = (w^\top \bar{H}^\top + u_{1}^\top - u_{2}^\top - (\bar{F}\alpha)^\top)\bar{N}^{\top} \nonumber \\
& +(-b^{\top} + \alpha^\top A^{\top}) z -(\mathbf{1}^{\top}u_{1} + \mathbf{1}^{\top}u_{2}) . \nonumber
\end{align}
%
The Lagrangian dual function is
%
\begin{equation}
g(\bar{N},z) = \left\{
\begin{aligned}
& \ -(\mathbf{1}^{\top}u_{1} + \mathbf{1}^{\top}u_{2}) \quad \mbox{if} \ \bar{H}w + u_{1} - u_{2} = \bar{F}\alpha, \\
& \quad\quad\quad\quad \quad\quad\quad\ \ A\alpha \geq b, \ u_1 \geq 0, \ u_2 \geq 0 \\
&\ -\infty \quad \quad \quad \quad \quad \ \, \mbox{otherwise,}
\end{aligned}
\right.\nonumber
\end{equation}
%
%
It is easy to observe that the dual program of \eqref{opt:max-min-opt-ref-nz-lp} is exactly \eqref{opt:min-max-opt-ref-nz} for the minimax optimization. We conclude the proof by noting that strong duality holds for feasible linear programs and a saddle point (Nash equilibrium) exists for these two-player zero-sum games as the maximin and minimax problems are dual of each other.
\end{proof}
\begin{Rem}[Game-theoretical interpretation for the diagnosis filter with non-zero steady-state residual under multivariate attacks]
If one can find an optimal solution with a positive optimal value $\mu$ by solving \eqref{opt:max-min-opt-ref-nz-lp}, and thus $\varphi^\star = \mu^\star > 0$ as indicated by Theorem~\ref{lem:NashEq}, the diagnosis filter catches all the multivariate attacks and can have non-zero steady-state residual ``alert'' even if the adversary has full knowledge of the residual generator parameters. From the other side, if the linear programs are feasible but $\varphi^\star = \mu^\star = 0$, there is no diagnosis filter of such kind that can have non-zero steady-state residual ``alert'' when multivariate attacks occur, even if the adversary is totally blind to the diagnosis filter design.
\end{Rem}
\fi
\bibliographystyle{siam}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 2,698 |
A New Bill is Attempting to Increase Florida Courts Power Over Guardianships
A new bill is making its way through the Florida legislature that would potentially increase the power given to legal guardians in Florida.
Guardianship is a complex legal process where an individual is declared incapacitated, and a legal guardian is appointed to make decisions for them. This process is typically viewed as a last resort for individuals who are no longer able to make important choices. Guardians are able to sell an individual's property, manage their finances, and make healthcare decisions for the individual where the court sees fit. An individual who is declared incapacitated and in need of a guardian by the courts is known as a ward.
Currently, if a guardian finds that a ward is better suited in another state for healthcare or other care purposes, the guardianship courts in Florida and the other state will engage in a battle for control over the case. This may lead to a delay in the ward's relocation and confusion for the guardian while the courts determine who should control the case.
However, the new bill, known as the Guardianship Jurisdiction Act, would enter Florida into the Uniform Adult Guardianship and Protective Proceedings Jurisdiction Act. This would permit Florida courts to retain control over the ward even when they relocate to another state and likely lessen the confusion and delay of transitions.
There are 46 other states that participate in the Uniform Adult Guardianship and Protective Proceedings Jurisdiction Act, which has assisted courts in avoiding battles over control. Many proponents of Florida becoming the 47th participant have argued that adopting the Act would assist many seniors in Florida, especially those who are transient or have family members in another state. In addition, adoption of the Act has been endorsed by numerous associations, such as AARP and the Alzheimer's Association. Opponents feel as though adoption of the Act feel as though it would be predatory and entrap transient senior wards in the Florida legal system.
The bill has currently passed through a number of committees and is continuing to be debated by the Florida Senate. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 1,897 |
\section*{Acknowledgments}
The work presented in this paper has received funding from Pantos GmbH within the TAST research project.
\vspace{1mm}
\balance
\printbibliography
\end{document}
\section{Evaluation}
\label{sec:eval}
The approach presented in Section~\ref{sec:approach} introduces transactions which change the state of different blockchains within a blockchain ecosystem, according to given rules. This can be implemented using smart contracts, e.g., using the Solidity language~\cite{dannen2017introducing}---more specifically, the EVM---on the Ethereum blockchain. We use Solidity to create a reference implementation of the proposed protocol for evaluation\footnote{\url{https://github.com/pantos-io/dextt-prototype}}. However, other ways of implementing such transactions exist. For instance, instead of using smart contracts (e.g., when dealing with blockchains without such capabilities), one might add backwards-compatible layers on top of blockchains, providing the required capabilities for the transactions presented in this work. A similar approach is used by OmniLayer~\cite{omnilayer} or CounterParty~\cite{counterparty,counterparty-protocol}, which add such layers for enhanced features. For this work, however, we use our reference Solidity implementation of DeXTT for evaluation and cost analysis, postponing the integration of approaches such as OmniLayer or CounterParty to future work. Nevertheless, our current evaluation is sufficient to demonstrate the overall functionality of the DeXTT protocol using Solidity smart contracts and the conceptual applicability.
In order to evaluate our approach, we investigate its functionality, performance, and cost impact in an ecosystem of blockchains with agents performing repeated token transfers. We achieve these goals by using our reference implementation consisting of Solidity smart contracts, deploying these smart contracts on a number of private Ethereum-based blockchains, and using testing client software to perform transfers with a given rate.
We ensure a reproducible and uniform ecosystem of blockchains by using three \texttt{geth} nodes in Proof of Authority~(PoA) mode, creating three private blockchains. We choose PoA to achieve an energy-efficient testing and evaluation platform while being able to perform repeated experiments. Note that the consensus algorithm, i.e., PoW, Proof of Stake~(PoS), or PoA, defines the behavior of blockchain nodes between each other and maintains data consistency in the network of a given blockchain~\cite{zheng2017overview}. However, the smart contract layer is independent of the consensus algorithm. Therefore, our evaluation on PoA is directly applicable to blockchains with any consensus algorithm, including PoW.
The \texttt{geth} nodes used in our experiments can be configured, for instance, with regards to block time and Gas limit. We observe the behavior of the live Ethereum blockchain (January 2019) and configure our nodes to follow this behavior. Therefore, our nodes are configured to use a block time of 13~s on average, and a Gas limit of 8~million Ethereum Gas, mimicking the live Ethereum chain. We use private chains instead of the Ethereum main chain to enable a high number and low cost of repeatable experiments in an automated fashion without depending on external components, such as Ethereum nodes.
We use 10 clients constantly and simultaneously initiating transfers within the blockchain ecosystem. This number is chosen as a balance between feasible and reproducible experiments and expected real-world conditions. While it is small compared to evaluations of other classes of distributed systems, we note that the lack of scalability of blockchain technologies is a crucial issue in general, and is seen as one of the main challenges for existing blockchain technologies~\cite{10.1007/978-3-319-45656-0_3}. We refer to existing literature for a study on how scalability of blockchains can be improved~\cite{vukolic2015quest}.
In our experimental ecosystem, each client constantly transfers random amounts of PBT to random wallets. If a client owns too little PBT for a transaction, no transaction is performed until PBT are available again. After a successful transfer, the client waits for a random time between 15~s and 30~s. Afterwards, the process is repeated indefinitely throughout the entire experiment duration.
We perform two experiment series, as described in the following sections. The first series is used to evaluate DeXTT scalability and the impact of the transfer validity period, and consists of a series of 30-minute experiments, where each individual experiment uses an increased validity period. The second series consists of 20 experiments, again with a duration of 30~min each, used to measure the average cost of a DeXTT transfer.
\subsection{Scalability and Timing}
\label{sec:scalability}
The DeXTT protocol requires one \textsc{claim}\xspace transaction per transfer, and for each transfer, one \textsc{finalize}\xspace transaction per blockchain. In addition, each contestant posts one \textsc{contest}\xspace transaction to each blockchain. We assume that candidates which no longer have a chance to win the witness contest~(because a candidate with a lower signature $\omega$ for the given transaction has already posted a \textsc{contest}\xspace transaction) do not post \textsc{contest}\xspace transactions to avoid cost. Assuming uniform distribution of $\omega$ values, as defined in Section~\ref{sec:hashes}, on the average case, each \textsc{contest}\xspace transaction halves the space of remaining possible winning signatures $\omega$ (because the expected value of the uniform distribution is the arithmetic mean of the domain). Therefore, with each \textsc{contest}\xspace transaction, the likelihood of another candidate existing with a lower $\omega$ is halved. Following from this, on average, $\log_2 n$ candidates will post a \textsc{contest}\xspace transaction, where $n$ is the number of total observers.
Transfer time in the DeXTT protocol is directly impacted by the transfer validity period $[t_0, t_1]$ chosen by the sender. We therefore first evaluate the impact of the validity period. Using too short validity periods leads to corrupted transfers, i.e., transfers which cause permanently inconsistent balances, since observers cannot post \textsc{contest}\xspace transactions in time. In such scenarios, eventual consistency between blockchains is not guaranteed. As stated above, we use a block time of 13~s, therefore, we start our experiments with 10~s, and increase the period by 5~s with each experiment. We then run our blockchain ecosystem for 30~min using each validity period and record the number of corrupted transactions. Note that we have to reset the inconsistent balances for wallets participating in a corrupted transaction in order to be able to run the experiments for 30~min.
\begin{figure}
\centering
\includestandalone[width=0.8\columnwidth]{tikz/validity}
\caption{Impact of Validity Period on Transaction Success}
\label{fig:validity}
\end{figure}
Figure~\ref{fig:validity} shows the results of these experiments. Beyond 52~s, no corrupt transactions are observed. It becomes clear that using the reference implementation and waiting for 4 blocks~(52~s) is sufficient for ensuring consistency. Between 1 and 3 blocks~(13~s and 39~s, respectively), the amount of corrupted transactions declines with a varying rate.
From this experiment, we conclude that using a validity period with the length of at least 4 blocks~(52~s) is sufficient to maintain consistency using our reference implementation. Additional time may be required in order to accommodate slow network connectivity.
\subsection{Cost Analysis of DeXTT Transfers}
\label{sub:costanalysis}
To estimate the cost incurred by DeXTT transfers, we run the same experiment 20 times. Based on our previous experiment, we choose 65~s (5 blocks, well above the determined limit of 52~s) as the duration of the PoI validity period in each transaction. We record the average cost of each transaction. Table~\ref{tab:cost} shows an overview of the cost of the individual transactions involved in a DeXTT transfer. For each transaction, we show the mean cost, and its standard deviation, both in thousands of Ethereum Gas (kGas), and in USD. For this, we assume a Gas price of 10~Gwei (1 Ether = $10^9$~Gwei = $10^{18}$~wei) and a price of Ether of $115.71$~USD. These values were obtained from the Ethereum live chain in January 2019. Note that our implementation is optimized in that \textsc{claim}\xspace and \textsc{contest}\xspace both use the same smart contract function.
Nevertheless, we distinguish the semantic difference~(posting of new transfer for \textsc{claim}\xspace, and participating in a contest for \textsc{contest}\xspace) in the results.
\begin{table}
\centering
\caption{Cost Analysis}
\label{tab:cost}
\begin{tabular}{l r r c r r}
\toprule
& \multicolumn{2}{c}{Cost (kGas)} && \multicolumn{2}{c}{Cost (USD)} \\
\cmidrule{2-3} \cmidrule{5-6}
Transaction & Mean & $\sigma$ && Mean & $\sigma$\\
\midrule
\textsc{claim}\xspace & $57.7$ & $11.1$ && $0.0668$ & $0.0128$ \\
\textsc{contest}\xspace & $81.5$ & $64.2$ && $0.0943$ & $0.0743$ \\
\textsc{finalize}\xspace & $45.5$ & $0.1$ && $0.0527$ & $<0.0001$ \\
\textsc{veto}\xspace & $131.3$ & $91.9$ && $0.1520$ & $0.1063$ \\
\textsc{finalize-veto}\xspace & $48.6$ & $1.7$ && $0.0563$ & $0.0020$ \\
\bottomrule
\end{tabular}
\end{table}
In the following, we assume $m$ blockchains and $n$ total observers. For our calculation, we assume that all observers monitor all blockchains, and post \textsc{contest}\xspace transactions if it benefits them. A regular DeXTT transfer (i.e., one which does not contain a conflicting PoI, and therefore requires no veto) consists of one \textsc{claim}\xspace transaction (on the target chain), $\log_2 n$ \textsc{contest}\xspace transactions (as discussed in Section~\ref{sec:scalability}) on each blockchain, i.e., $m \log_2 n$ \textsc{contest}\xspace transactions, and $m$~\textsc{finalize}\xspace transactions. The \textsc{claim}\xspace transaction is posted by the receiver, and each \textsc{contest}\xspace transactions is posted by an observer (thus becoming a contestant). While the \textsc{finalize}\xspace transaction can be posted by any party, posting it is beneficial to the receiver~(because it finalizes the transfer to the receiver), and therefore it can be expected that the receiver will bear its cost to finalize the transfer.
The expected cost in kGas for a DeXTT transfer are as follows: The receiver bears the cost for one \textsc{claim}\xspace transaction~($57.7$~kGas) and $m$ \textsc{finalize}\xspace transactions ($45.5$~kGas each). Each of the $\log_2 n$ expected observers posting transactions bears the cost for $m$ \textsc{contest}\xspace transactions ($81.5$~kGas each). The sender does not bear any cost.
Assuming a blockchain ecosystem of 10~blockchains, the total transaction cost for the receiver is $0.59$~USD. Each of the $\log_2 n$ observers posting transactions bears cost of $0.94$~USD. These numbers represent our current reference implementation and can be regarded as an upper bound for DeXTT transfer cost. Any additional optimization to the smart contract code has the potential to further reduce the Gas cost of the individual transactions, and therefore, of the overall DeXTT transfer.
Additionally, these numbers allow us to reason about the economic impact of a currency using DeXTT transactions. Observers pay transaction cost of $0.94$~USD, and potentially receive a witness reward, currently defined as 1~PBT. The chance of an observer winning is $\frac{1}{n}$, however, according to the discussion in Section~\ref{sec:scalability} on average, only $\log_2 n$ out of all $n$ observers are expected to post \textsc{contest}\xspace transactions. Therefore, the likelihood for an observer posting a transaction to win the contest is $\frac{\log_2 n}{n}$.
Therefore, the investment for each observer is $0.94$~USD, the contest reward is 1~PBT, and the winning likelihood is $\frac{\log_2 n}{n}$. From this, it follows that in order for the observer to have incentive to post \textsc{contest}\xspace transactions in an ecosystem of $m = 10$ blockchains, the inequation shown in~(\ref{eq:ineq-p}) must hold, where $p$ is the price of PBT in USD.
\begin{equation}
\frac{\log_2 n}{n}\,p > 0.94\ \text{[USD]} \label{eq:ineq-p}
\end{equation}
In other words, the price of PBT in USD divided by the number of observers must be higher than $0.94$. Assuming $n = 10$ observers, the PBT price must be above $2.83$~USD. Assuming $n = 100$, the PBT price must be above $14.15$~USD. For $n = 1000$, the PBT price must be above $94.32$~USD.
Note that these number assume $m = 10$ blockchains, and a fixed reward of 1~PBT. A pro rata reward, e.g., $1\%$ of the transferred PBT, would reduce the required PBT price but increase the complexity of calculating the witness incentive. Furthermore, a dynamic reward adaption based on the number of observers, similar to the variable mining rewards in Bitcoin, or a value selected by the sender, similar to the Gas price in Ethereum, can also be used to reduce the required PBT price, and therefore incentivize observers. We note again that these numbers pose an upper boundary for the expected DeXTT transfer cost and PBT price requirements for witness incentive.
\section{Conclusion}
\label{sec:conclusion}
In this paper, we have presented DeXTT, a protocol for transferring cross-blockchain tokens, existing on a single blockchain, but tradeable on multiple blockchains. This reduces dependency on a single blockchain and risk, e.g., of selecting a blockchain which later suffers from a security breach. DeXTT ensures eventual consistency of balances across blockchains, and prohibits double spending. We have presented the protocol in detail, implemented it in Solidity, and provided an experimental evaluation, highlighting its performance with regards to time and cost.
Our evaluation shows that the reference implementation of DeXTT requires at least 4 blocks for maintaining consistent balances. Furthermore, we show that a DeXTT transfer using our reference implementation costs 103.2~kGas for the receiver, and 81.5~kGas for any contributing observer. We also provide an analysis of the economic impact of the witness rewards based on the parameters of the multi-blockchain ecosystem used.
In future work, we will address the main limitation of our current evaluation by implementing DeXTT using additional technologies such as OmniLayer or CounterParty and therefore evaluate the performance of DeXTT in a blockchain ecosystem consisting of mixed blockchain types. Furthermore, we aim to implement DeXTT on other native smart contract platforms such as EOS.IO~\cite{eosv2}. In addition, we aim to evaluate more refined approaches for the veto contest, which can be used to relax the currently strict requirement of not signing to outgoing PoIs with overlapping validity periods.
\section{Introduction}
\label{sec:intro}
Blockchains, the underlying technology of cryptocurrencies, have gained significant interest in both industry and research~\cite{zohar2015bitcoin}. After the feasibility of decentralized ledgers has been demonstrated by Bitcoin~\cite{nakamoto2008bitcoin}, significant investment into research and development related to blockchains and cryptocurrencies was sparked. Technologies range from adding new layers on top of existing blockchain implementations~\cite{counterparty,omnilayer}, improvements of Bitcoin itself~\cite{ltc}, to entirely new blockchains~\cite{ethereum-yellowpaper}, which provide novel concepts, such as smart contracts~\cite{7467408}.
The level of investment in the blockchain space is indicative for the technological impact and the broad range of potential use cases for blockchain technologies~\cite{fernandez2018review}. However, despite this positive momentum, structural problems exist within the blockchain field. Development so far is centered on the creation of new blockchains and currencies, or altering major blockchains like Bitcoin~\cite{yli2016current}. Furthermore, there is substantial research on potential use cases of blockchains in various economic, social, political, and engineering fields~\cite{fernandez2018review}. Nevertheless, the ways in which blockchains could potentially interact with each other remain mostly unexplored.
The constant increase in the number of independent, unconnected blockchain technologies causes significant fragmentation of the research and development field, and poses challenges for both users and developers of blockchain technologies. On the one hand, users have to choose which currency and which blockchain to use. Choosing novel, innovative blockchains enables users to utilize new features and take advantage of state-of-the-art technology. However, users also risk the loss of funds if the security of such a novel blockchain is subsequently breached, potentially leading to a total loss of funds~\cite{nofer2017blockchain}. Choosing mature, well-known blockchains reduces the risk of such loss, since these blockchains are more likely to have been analyzed in-depth~\cite{li2017survey}, but novel features remain unavailable.
On the other hand, when designing decentralized block\-chain-based applications, currently, developers must decide which blockchain to base their application on. This can form a substantial impedance to research and technical progress, since individual technologies form isolated solutions, and interoperability between blockchains is mostly not given.
We therefore aim to enable cross-blockchain interoperability. As an overarching goal, we seek to provide means of interaction between blockchains, including cross-blockchain data transmission, cross-blockchain smart contract interaction, or cross-blockchain currency transfer. As a first step to enable such cross-blockchain interoperability, we propose a protocol for cross-blockchain token transfers, where the transferred token is not locked within an individual blockchain. Instead, it can be used on any number of blockchains, and its transactions are autonomously synchronized across blockchains by the system in a decentralized manner. Our solution prevents double spending, is resilient to the cross-blockchain proof problem~(XPP)~\cite{tast-wp2}, and does not need external oracles or other means of cross-blockchain communication to function. We provide a reference implementation using Solidity, and evaluate its performance with regards to time and cost.
The contributions of this manuscript are as follows:
\begin{itemize}
\item We discuss how to use eventual consistency for cross-blockchain token transfers by utilizing concepts such as claim-first transactions and deterministic witnesses.
\item We formally define \emph{Deterministic Cross-Blockchain Token Transfers}~(DeXTT), a protocol which implements eventual consistency for cross-blockchain token transfers.
\item We provide a reference implementation in Solidity, presenting and evaluating DeXTT.
\end{itemize}
The remainder of this paper is structured as follows. In Section~\ref{sec:background}, we discuss underlying technologies, provide a brief discussion of blockchains and transaction types, claim-first transactions, and witness rewards, and define notation used throughout this work. Section~\ref{sec:approach} presents the transfer protocol in detail, and Section~\ref{sec:eval} provides an evaluation of our approach. Section~\ref{sec:rw} gives a brief overview of related work, and describes the relation of the work at hand to our own former work in the field of cross-blockchain interoperability. Finally, Section~\ref{sec:conclusion} concludes the paper.
\section{Related Work}
\label{sec:rw}
As discussed in Section~\ref{sec:intro}, cross-blockchain interoperability can be used to address the fragmentation of the blockchain research field. Yet, to the best of our knowledge, contemporary approaches provide only limited interoperability across blockchains.
Initial interoperability was limited to trading assets on centralized exchanges. Subsequently, decentralized exchanges such as Bisq~\cite{bisq} or 0x~\cite{0x} emerged. Most recently, the Republic protocol~\cite{republic} has been proposed, which includes a decentralized dark pool exchange, i.e., details about an exchange are kept secret.
All of these approaches, however, are concerned with the \emph{exchange} of assets, generally using atomic swaps~\cite{herlihy2018atomic} for trustless asset exchange. In such an atomic swap, one party might transfer, e.g., Bitcoin to another party, while the other party transfers, e.g., Ether to the first. In such an atomic swap, each asset remains on its blockchain. In contrast, we propose a protocol for trading assets independently of a specific blockchains. In our approach, the balance information for such assets is stored on all blockchains simultaneously.
Another approach for a multi-blockchain framework is presented in PolkaDot~\cite{polkadot}. PolkaDot aims to provide ``the bedrock relay-chain'' upon which data structures can be hosted. However, in contrast to our approach, no specifics about cross-blockchain asset transfers are provided. Instead, PolkaDot is explicitly not designed to be used as a currency~\cite{polkadot}. Furthermore, PolkaDot is meant to be used as a basis for future blockchains (and other decentralized data structures), while in our current approach, we aim to use existing blockchains and implement functionality on top of them. However, the concepts presented in the PolkaDot paper are complementary to techniques we used in our approach.
Decentralized cross-blockchain transfers allow users to fully utilize the existing variety of blockchains, instead of being locked to a single blockchain. To the best of our knowledge, the approach closest to the work at hand is Metronome~\cite{mtn}, which uses assets available on multiple blockchains. However, Metronome proposes that assets still lie on one specific blockchain at a time, while in our proposal, the assets are not bound to one blockchain.
The DeXTT protocol presented in this paper is based on our own former work. The XPP has been formally described in~\cite{tast-wp2}. Furthermore, in~\cite{tast-wp3}, we describe the deterministic witness selection approach conceptually. The work at hand significantly extends our former work by providing a concrete implementation of this approach within the DeXTT protocol. Furthermore, the work at hand is a significant enhancement of our earlier work, in which we also defined a token existing across blockchains. However, each wallet had a different balance on each blockchain (and all balances were recorded on all blockchains) \cite{tast-wp2}. In the work at hand, this concept is simplified, yielding only one balance per wallet~(which is recorded on all blockchains).
\section{Background}
\label{sec:background}
Our work aims at providing a protocol for cross-blockchain asset transfers, ensuring that such transfers are performed in a decentralized and trustworthy manner. Assets can be represented on blockchains in various ways. Apart from native currencies~(e.g., Ether on the Ethereum blockchain, or Bitcoin on the Bitcoin blockchain), there are other types of assets, commonly called \emph{tokens}. In the recent past, various asset types with different properties have been discussed, such as fungibility, divisibility, and types of implementation like the user-issued asset (UIA) and \emph{Unspent Transaction Output}~(UTXO) models. We refer to our previous work for a thorough analysis~\cite{tast-wp1}.
In the work at hand, we discuss a token that exists on a given number of blockchains simultaneously, i.e., a \emph{pan-blockchain token}~(denoted as \textit{PBT}). PBT are not locked to a single blockchain and can be traded using the DeXTT protocol, which ensured synchronization of token balances across blockchains. We refer to the set of blockchains participating in this protocol as an \emph{ecosystem of blockchains}. According to our protocol, a wallet $\mathcal{W}\xspace_w$ is holding PBT not only on a given blockchain, but on all blockchains in the ecosystem. Thus, a transfer from $\mathcal{W}\xspace_w$ to another wallet $\mathcal{W}\xspace_v$ is required to be recorded on all participating blockchains, and there must be consensus among all participating blockchains about the balance of each wallet.
Due to the XPP~\cite{tast-wp2}, strict consistency between blockchains is not possible using practical means, since any verification of data between two blockchains would essentially require the nodes of one blockchain to verify blocks of another blockchain. This requires both the data and the consensus protocol to be shared across blockchains, which is not possible in practice. Therefore, in our proposal, we relax this requirement to eventual consistency, i.e., we accept temporary disagreement with regard to balances, as we show in the following. In practice, blockchains themselves only provide eventual consistency, since there is no guarantee when data submitted to the network will be included in a block. Therefore, using eventual consistency for synchronizing data between blockchains is a feasible approach.
For the purpose of this paper, we follow the assumption that each party is generally interested in all the blockchains in an ecosystem, and specifically, in the consistency of their balance across all blockchains. This means that all interested parties (i.e., wallet holders) are monitoring all blockchains in the ecosystem, and if a party participates in the protocol on one blockchain, it also participates on all other blockchains. We support this assumption by defining later that any inconsistency in wallet balances between blockchains effectively renders the wallet useless.
DeXTT assumes that non-zero token balances already exist on the involved blockchains. We explicitly do not define the economic aspect of PBT, i.e., the lifecycle of tokens. Several minting strategies exist, and we provide an overview of such approaches (constant supply, minting rate, etc.) in previous work~\cite{tast-wp1}. Any of these approaches is usable together with DeXTT, since the protocol assumes that tokens already exist.
\subsection{Cross-Blockchain Balance Consistency}
\label{sec:consistency}
As outlined before, we require eventual consistency between blockchains participating in the proposed protocol. Since due to the XPP, we cannot directly propagate information across blockchains, we require an alternative way to reach consistency across blockchains.
For this, we propose to achieve eventual consistency using \emph{claim-first transactions}~\cite{tast-wp2}. While traditionally, blockchain transfers disallow claiming tokens before they have been marked as spent, we explicitly decouple the required temporal order of $\textsc{spend}\xspace \rightarrow \textsc{claim}\xspace$ and allow its reversal, i.e., claiming tokens before spending them. In our case, for a certain period of time, tokens are allowed to exist in the balance of both the sender and the receiver (on different blockchains), namely until the information is propagated to all blockchains. In the presented protocol, we provide a mechanism to enforce eventual spending of the tokens in the sender balance, as described in Section~\ref{sec:approach}.
In order to ensure such eventual consistency, we rely on parties observing a transfer to propagate this information across blockchains. These parties are denominated as \emph{witnesses}. A monetary incentive is provided for any witness in order to ensure propagation. We use part of the transferred PBT for these witness rewards. The main challenge of this approach is the decision which witness receives the reward. Using a first-come-first-serve basis is not feasible, since it is possible that on one blockchain, one witness is the first to propagate the transfer and claim the reward, while on another blockchain, another witness takes this place. This would lead to two different witnesses receiving a reward on two different blockchains, and therefore, to potentially inconsistent balances.
In this work, we address this problem by using \emph{deterministic witnesses}~\cite{tast-wp3}. In short, instead of using a first-come-first-serve reward distribution, we define a \emph{witness contest}. Its duration is fixed to a validity period, \emph{contestants} (i.e., reward candidates) can register for the contest, and the decision of who wins the contest is made deterministically and predictably by each blockchain at the end of the contest. In Section~\ref{sec:approach}, we propose an approach for deciding the winning witness in a way that is fair~(i.e., all contestants have the same chance of winning), while at the same time, it is purely deterministic, and---given the assumptions discussed above---assures all blockchains reach the same decision about assigning witness rewards.
Our approach therefore solves the problem of assigning witness rewards, which is required as an incentive for observers of a cross-blockchain transfer to propagate this transfer information, ensuring eventual consistency across the ecosystem of blockchains.
\subsection{Cryptographic Signatures and Hashes}
\label{sec:hashes}
In our approach, we make extensive use of cryptographic signatures and hashes, which are essential for blockchains themselves. For instance, the ECDSA algorithm~\cite{johnson2001elliptic} is used by Ethereum for creating and verifying signatures, and is also implemented natively and available to the Ethereum Virtual Machine~(EVM)~\cite{hirai2017defining}. We use Solidity, the smart contract language of Ethereum, for the reference implementation of DeXTT. However, we note that DeXTT is not limited to Solidity or the EVM, and other blockchains offering signatures and hash algorithms can very well be used. The only crucial property required by our approach is a distribution of hash values which is approximately uniform. \textsc{Keccak256}, the hash algorithm used by Ethereum, satisfies this requirement~\cite{gholipour2011pseudorandom}, as does the \textsc{Sha-256} algorithm used by Bitcoin~\cite{gilbert2003security}.
\subsection{Notations and Conventions}
In the following, we use particular notations for concise description of certain objects: We denote blockchains as $\mathcal{C}\xspace$ with a subscript letter, e.g., $\mathcal{C}\xspace_a$. Additionally, we denote wallets as $\mathcal{W}\xspace$ with a subscript letter, e.g., $\mathcal{W}\xspace_s$, $\mathcal{W}\xspace_d$, or $\mathcal{W}\xspace_w$. A wallet consists of a pair of corresponding keys, out of which one is a public key, and one is a private key. When referring to a token transfer in general, $\mathcal{W}\xspace_s$ is used to denote the source (sending) wallet, $\mathcal{W}\xspace_d$ is used to denote the destination (receiving) wallet, and $\mathcal{W}\xspace_w$ denotes a witness as discussed in Section~\ref{sec:consistency}. As discussed in Section~\ref{sec:intro} and demonstrated in Table~\ref{tab:initial}, the balance of a wallet is stored across all blockchains.
In this work, we use the concept of \emph{transactions} to denote actions executed on a blockchain which modify the blockchain state. We use the expression ``$\mathcal{W}\xspace_w$ posts the transaction \textsc{trans}\xspace on $\mathcal{C}\xspace_c$'' to describe the conceptual protocol. In a scenario where smart contracts are used, this translates to the key pair of $\mathcal{W}\xspace_w$ being used to sign a call to the smart contract on blockchain $\mathcal{C}\xspace_c$, where the function \texttt{trans()} is invoked. For certain transactions, we define preconditions (e.g., sufficient balances), which can be implemented as checks within the smart contract function. The transactions posted by wallets can either originate from the action of a user, or be initiated by a program (e.g., a wallet application) acting autonomously.
To denote our transactions, we use the notation as shown in~(\ref{eq:trans}), where \textsc{trans}\xspace is the transaction type used~(one out of \textsc{claim}\xspace, \textsc{contest}\xspace, \textsc{finalize}\xspace, \textsc{veto}\xspace, and \textsc{finalize-veto}\xspace), $\mathcal{W}\xspace_w$ is the wallet~(i.e., the pair of keys) used to sign and post the transaction, $a$, $b$, and $c$ denote data contained in the transaction (i.e., the arguments), and $\sigma$ is the signature when using the private key of $\mathcal{W}\xspace_w$ to sign the data $[a, b, c]$. For brevity, we use only $\sigma$ to denote a multivariate value, e.g., a three-variate ECDSA signature.
\begin{gather} \label{eq:trans}
\begin{aligned}
\mathcal{W}\xspace_w:\textsc{trans}\xspace~&\Big[~a,\,b,\,c~\Big]_{\sigma}
\end{aligned}
\end{gather}
We denote a transfer of $x$~PBT from $\mathcal{W}\xspace_s$ to $\mathcal{W}\xspace_d$ as \mbox{$\xfer{s}{d}{x}$}. Furthermore, we denote the PBT balance of $\mathcal{W}\xspace_w$ recorded on $\mathcal{C}\xspace_c$ as $\cwallet{c}{w}$.
\section{Discussion}
\section{Decentralized Cross-Blockchain Transfers}
\label{sec:approach}
In the following, we present the DeXTT protocol, together with an example transaction. In our example, we consider three blockchains participating in cross-blockchain transfers, $\mathcal{C}\xspace_a$, $\mathcal{C}\xspace_b$, and $\mathcal{C}\xspace_c$. Note, however, that our approach is applicable to an arbitrary number of blockchains. Furthermore, we consider the wallets $\mathcal{W}\xspace_s$, $\mathcal{W}\xspace_d$, $\mathcal{W}\xspace_u$, $\mathcal{W}\xspace_v$, and $\mathcal{W}\xspace_w$. We assume that initially, $\mathcal{W}\xspace_s$ has 80~PBT, and all other wallets have a balance of zero~(see Table~\ref{tab:initial}). We furthermore use a fixed reward of 1~PBT for the witness propagating this transaction across the blockchain ecosystem. Note that pro rata fees (e.g., 1\% of the transferred PBT, or an amount selected by the sender) are also possible and the exact fee model is an economic choice. We will discuss this in more detail in Section~\ref{sub:costanalysis}.
As discussed in Section~\ref{sec:consistency}, claim-first transactions require all blockchains within the ecosystem to maintain and synchronize token balances. Therefore, the initial situation is as depicted in Table~\ref{tab:initial}. Balances for $\mathcal{W}\xspace_u$ and $\mathcal{W}\xspace_v$ are not shown, as they will remain zero throughout the example.
\begin{table}
\caption{Initial State of the Involved Blockchains at $t = 0$}
\label{tab:initial}
\chains{16mm}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}}%
}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}}%
}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}}%
}
\end{table}
\subsection{Transfer Initiation}
In the following, we assume that $\mathcal{W}\xspace_s$ intends to transfer $20$~PBT to $\mathcal{W}\xspace_d$, i.e., reduce the PBT balance of $\mathcal{W}\xspace_s$ by $20$, increase the PBT balance of $\mathcal{W}\xspace_d$ by $19$ ($20$ reduced by $1$, the witness reward), and increase the PBT balance of a (yet to be decided) witness wallet by $1$. As stated in Section~\ref{sec:consistency}, we only require eventual consistency for this transfer, i.e., a temporary overlap is allowed where $\mathcal{W}\xspace_d$ has already received $19$~PBT, but the balance of $\mathcal{W}\xspace_s$ is still unchanged.
Therefore, $\mathcal{W}\xspace_s$ signs this intent, confirming that indeed, $20$~PBT---minus $1$~PBT of witness reward---are to be transferred to $\mathcal{W}\xspace_d$. Furthermore, we define a validity period for the transfer, which denotes the time during which the witness selection for the transfer has to take place. In our example scenario, this time span lasts for 1 minute, however, this time can be set significantly shorter or longer, depending on the use case. We provide an analysis of the impact of this parameter in Section~\ref{sec:scalability}.
We denote the entirety of the sender's intent using the notation shown in~(\ref{eq:proof1}), where $[t_0,t_1]$ is the validity period, and $\alpha$ denotes the signature of the entire content of the brackets by $\mathcal{W}\xspace_s$. The resulting signature itself is denoted as $\alpha$. We use the ECDSA algorithm, natively supported by the EVM, for all signatures. However, other algorithms can also be used, assuming that their verification is supported on all involved blockchains.
\begin{equation}
\Big[~\xfer{s}{d}{x},\,t_0,\,t_1~\Big]_{\alpha}
\label{eq:proof1}
\end{equation}
The data contained in~(\ref{eq:proof1}) is transferred to the receiving wallet $\mathcal{W}\xspace_d$. This transfer can happen on any blockchain within the ecosystem, or using an off-chain channel. Since all of the data contained in~(\ref{eq:proof1}) will be published throughout the DeXTT transaction, this channel does not need to be secure, and we do not specifically define any communication means. The receiving wallet then counter-signs the data from~(\ref{eq:proof1}) using its respective private key, yielding the entire \textit{Proof of Intent}~(\textit{PoI}), as shown in~(\ref{eq:poi}).
\begin{equation}
\Big[~\xfer{s}{d}{x},\,t_0,\,t_1,\,\alpha~\Big]_{\beta}
\label{eq:poi}
\end{equation}
The PoI contains all information necessary to prove to any blockchain (i.e., to its smart contracts and miners) that the transfer is authorized by the sender and accepted by the receiver. The receiver can now post this PoI using a transaction we call \textsc{claim}\xspace. This transaction allows the receiver to publish the PoI in order to later claim the transferred PBT. The receiver can post this on any blockchain within the ecosystem, and does not need to post it on more than one blockchain. The \textsc{claim}\xspace transaction is defined and noted as shown in~(\ref{eq:claim-g}).
\begin{gather} \label{eq:claim-g}
\begin{aligned}
\mathcal{W}\xspace_d:\textsc{claim}\xspace~&\Big[~\xfer{s}{d}{x},\,t_0,\,t_1,\,\alpha~\Big]_{\beta}
\end{aligned}
\end{gather}
The preconditions for the \textsc{claim}\xspace transaction are (i)~that the PoI is valid (i.e., that the signatures $\alpha$ and $\beta$ are correct), (ii)~that the balance of the source wallet $\mathcal{W}\xspace_s$ is sufficient, (iii)~that the PoI is not expired, i.e., that its $t_1$ has not yet passed ($t < t_1$), and (iv)~that no PoI is known to the blockchain on which it is posted with an overlapping validity period and the same source wallet $\mathcal{W}\xspace_s$. In other words, a wallet must not sign an outgoing PoI while another outgoing PoI is still pending. This is done in order to prevent a double spending attack, where two PoIs are signed which are conflicting, i.e., which, if both were executed, would reduce the sender's balance below zero.
The purpose of the \textsc{claim}\xspace transaction is the publishing of the PoI, which can then be propagated across the blockchain ecosystem as described later.
In our example, we assume that the receiver $\mathcal{W}\xspace_d$ posts the \textsc{claim}\xspace transaction (containing the PoI) on $\mathcal{C}\xspace_a$ as shown in~(\ref{eq:claim-x}), where 1 and 61 mark the validity period in seconds (i.e., one minute total validity), \texttt{0xAA} is assumed to be the signature~$\alpha$, and \texttt{0xBB} is assumed to be the signature $\beta$. For brevity, one-byte signatures are used for demonstration in this example. Naturally, in reality, the signature hashes are longer (e.g., 32 bytes for \textsc{Keccak256}).
\begin{gather} \label{eq:claim-x}
\begin{aligned}
\mathcal{W}\xspace_d:\textsc{claim}\xspace~&\Big[~\xfer{s}{d}{20},\,1,\,61,\,\texttt{0xAA}~\Big]_{\texttt{0xBB}}
\end{aligned}
\end{gather}
The \textsc{claim}\xspace transaction on $\mathcal{C}\xspace_a$ changes the blockchain state as shown in Table~\ref{tab:claim}. We see that the PoI has been stored within $\mathcal{C}\xspace_a$, which is referred to by its signature $\alpha$. The balances remain unchanged on $\mathcal{C}\xspace_a$ because the validity period is not yet concluded, i.e., $t_1$ is not yet reached. Naturally, since no information has been posted yet to $\mathcal{C}\xspace_b$ and $\mathcal{C}\xspace_c$, these blockchains also remain unchanged at this point.
\begin{table}
\caption{State after PoI Publication at $t = 1$}
\label{tab:claim}
\chains{30mm}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}} %
PoI \texttt{0xAA}: \\[1mm]
\hspace*{2mm} $\xfer{s}{d}{20}$ \\
\hspace*{2mm} $t_1 = 61$
}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}}%
}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}}%
}
\end{table}
\subsection{Witness Contest}
At this point, the information about the intended transfer~(the PoI) is only recorded on $\mathcal{C}\xspace_a$. However, this information must be propagated to all other blockchains as well to ensure consistency of balances across blockchains. We use the following mechanism, which we refer to as the \emph{witness contest}, to ensure this consistency.
Any party observing the \textsc{claim}\xspace transaction on $\mathcal{C}\xspace_a$ can become a contestant, i.e., a candidate for receiving a reward. In order to become a contestant, the party must propagate the PoI across all blockchains in the ecosystem. We define the transaction used for this as \textsc{contest}\xspace. This transaction is defined for any arbitrary wallet $\mathcal{W}\xspace_o$ as shown in~(\ref{eq:contest}), where the new signature $\omega$ is the result of the contestant $\mathcal{W}\xspace_o$ signing the PoI. This signature will later play a role in determining the winner of the witness contest, as described in Section~\ref{sec:deterministic-witness-selection}.
\begin{gather} \label{eq:contest}
\begin{aligned}
\mathcal{W}\xspace_o:\textsc{contest}\xspace~&\Big[~\xfer{s}{d}{x},\,t_0,\,t_1,\,\alpha,\,\beta~\Big]_{\omega}
\end{aligned}
\end{gather}
The \textsc{contest}\xspace transaction can be posted multiple times by various contestants during the validity period. The preconditions are the same as for the \textsc{claim}\xspace transaction, i.e., the PoI must be valid and must not violate any other PoI's validity period. The only effect of the \textsc{claim}\xspace transaction is that the PoI itself and the contestant's participation in the witness contest are recorded on the respective blockchain.
In our example, we assume that $\mathcal{W}\xspace_u$ is the first to post a \textsc{contest}\xspace transaction on $\mathcal{C}\xspace_b$ as shown in~(\ref{eq:contest-1}), where again, $1$ and $61$ denote the validity period, \texttt{0xAA} and \texttt{0xBB} are the PoI signatures, and \texttt{0xC2} is the signature resulting from $\mathcal{W}\xspace_u$ signing the PoI. The signature values in this example are chosen arbitrarily in order to demonstrate the subsequent witness contest. Again, one-byte signatures are used for brevity.
\begin{gather} \label{eq:contest-1}
\begin{aligned}
\mathcal{W}\xspace_u:\textsc{contest}\xspace~&\Big[~\xfer{s}{d}{20},\,1,\,61,\,\texttt{0xAA},\,\texttt{0xBB}~\Big]_{\texttt{0xC2}}
\end{aligned}
\end{gather}
Next, we assume that the other observers $\mathcal{W}\xspace_v$ and $\mathcal{W}\xspace_w$ become contestants by posting similar \textsc{contest}\xspace transactions. We assume that the resulting signature $\omega$ for $\mathcal{W}\xspace_v$ is \texttt{0xC3}, and that the signature for $\mathcal{W}\xspace_w$ is \texttt{0xC1}.
\begin{gather} \label{eq:contest-2}
\begin{aligned}
\mathcal{W}\xspace_v:\textsc{contest}\xspace~&\Big[~\xfer{s}{d}{20},\,1,\,61,\,\texttt{0xAA},\,\texttt{0xBB}~\Big]_{\texttt{0xC3}}
\end{aligned}
\end{gather}
\begin{gather} \label{eq:contest-3}
\begin{aligned}
\mathcal{W}\xspace_w:\textsc{contest}\xspace~&\Big[~\xfer{s}{d}{20},\,1,\,61,\,\texttt{0xAA},\,\texttt{0xBB}~\Big]_{\texttt{0xC1}}
\end{aligned}
\end{gather}
Transactions (\ref{eq:contest-1}--\ref{eq:contest-3}) are eventually posted to $\mathcal{C}\xspace_a$, $\mathcal{C}\xspace_b$, and $\mathcal{C}\xspace_c$. This is because every contestant participating in the contest is interested in participating in all blockchains in the ecosystem to maintain their own consistency.
The state resulting from the three contestants posting to $\mathcal{C}\xspace_a$, $\mathcal{C}\xspace_b$, and $\mathcal{C}\xspace_c$ is shown in Table~\ref{tab:contest}. The blockchain maintains a list of contestants together with their $\omega$ signature values.
\begin{table}
\caption{State During Witness Contest at $t = 2$}
\label{tab:contest}
\chains{44mm}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}} %
PoI \texttt{0xAA}: \\[1mm]
\hspace*{2mm} $\xfer{s}{d}{20}$ \\
\hspace*{2mm} $t_1 = 61$ \\
\hspace*{2mm} Contestants: \\
\hspace*{2mm} $\mathcal{W}\xspace_u$ (\texttt{0xC2}) \\
\hspace*{2mm} $\mathcal{W}\xspace_v$ (\texttt{0xC3}) \\
\hspace*{2mm} $\mathcal{W}\xspace_w$ (\texttt{0xC1})
}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}} %
PoI \texttt{0xAA}: \\[1mm]
\hspace*{2mm} $\xfer{s}{d}{20}$ \\
\hspace*{2mm} $t_1 = 61$ \\
\hspace*{2mm} Contestants: \\
\hspace*{2mm} $\mathcal{W}\xspace_u$ (\texttt{0xC2}) \\
\hspace*{2mm} $\mathcal{W}\xspace_v$ (\texttt{0xC3}) \\
\hspace*{2mm} $\mathcal{W}\xspace_w$ (\texttt{0xC1})
}{
\bbb{\va{80}}{\vaa{0}}{\vaa{0}} %
PoI \texttt{0xAA}: \\[1mm]
\hspace*{2mm} $\xfer{s}{d}{20}$ \\
\hspace*{2mm} $t_1 = 61$ \\
\hspace*{2mm} Contestants: \\
\hspace*{2mm} $\mathcal{W}\xspace_u$ (\texttt{0xC2}) \\
\hspace*{2mm} $\mathcal{W}\xspace_v$ (\texttt{0xC3}) \\
\hspace*{2mm} $\mathcal{W}\xspace_w$ (\texttt{0xC1})
}
\end{table}
\subsection{Deterministic Witness Selection}
\label{sec:deterministic-witness-selection}
After the expiration of $t_1$, the witness contest ends, a winning witness must be selected, and awarded the witness reward. This is performed by the \textsc{finalize}\xspace transaction, which must be triggered after $t_1$.
Conceptually, this transaction is purely time-based. It can be triggered by the receiver, by any other party, or using a decentralized solution like the \emph{Ethereum Alarm Clock}~\cite{berg2018chronos}. The latter approach has the advantage of being independent of any party's activity. However, for simplicity, in our current approach and the discussion below, we assume that the destination wallet $\mathcal{W}\xspace_d$ posts the \textsc{finalize}\xspace transaction on each blockchain. The \textsc{finalize}\xspace transaction is defined as shown in~(\ref{eq:finalize}).
\begin{gather} \label{eq:finalize}
\begin{aligned}
\textsc{finalize}\xspace~&\Big[~\alpha~\Big]
\end{aligned}
\end{gather}
The \textsc{finalize}\xspace transaction only requires the parameter $\alpha$, identifying the PoI, because the blockchain already contains all necessary information about the PoI. The precondition of $t_1$ being expired ($t > t_1$) is necessary for the \textsc{finalize}\xspace transaction to avoid premature finalization.
The effect of the \textsc{finalize}\xspace transaction is that the contest for the PoI referred to by its signature $\alpha$ is concluded. This means that the winning witness is awarded the witness reward, which, according to Section~\ref{sec:approach}, is 1~PBT in our current approach. Furthermore, the conclusion of the contest performs the actual transfer of PBT, i.e., $x$ PBT are deducted from the balance of $\mathcal{W}\xspace_s$, and $\mathcal{W}\xspace_d$ receives $x-1$~PBT ($x$ reduced by the witness reward). This action is executed on all blockchains, since \textsc{finalize}\xspace is posted on all blockchains.
We define the winning witness to be the contestant with the lowest signature $\omega$ (i.e., with its value closest to zero). Since this signature cannot be influenced by the contestants~(because it is only formed from the PoI data and the contestants' private key), they have no way of increasing their chances of winning a particular contest, except for creating a large number of wallets (private keys). Such ``mining for wallets'' is not a violation of our protocol and no threat to its fairness, since doing so is computationally expensive, and therefore creates cost on its own. There exists a break-even point of the witness reward and the cost created by the creation of a large number of wallets~\cite{tast-wp3}. Effectively, this challenge is comparable to mining in Proof of Work (PoW) in that resources, i.e., computing power, can be traded for rewards.
In our example above, the witness with the lowest $\omega$ is $\mathcal{W}\xspace_w$, with $\omega = \texttt{0xC1}$. Therefore, this witness is awarded the witness reward. The final blockchain state is shown in Table~\ref{tab:final}. The balances of the competing contestants $\mathcal{W}\xspace_u$ and $\mathcal{W}\xspace_v$ remain zero. The expired PoIs are no longer shown for brevity.
\begin{table}
\caption{Final State After Witness Contest at $t > 61$}
\label{tab:final}
\chains{16mm}{
\bbb{\va{60}}{\va{19}}{\vaa{1}}%
}{
\bbb{\va{60}}{\va{19}}{\vaa{1}}%
}{
\bbb{\va{60}}{\va{19}}{\vaa{1}}%
}
\end{table}
\subsection{Prevention of Double Spending}
A malicious sender might sign two different PoIs conflicting with each other. For instance, a sender owning $10$~PBT might create two PoIs, transferring $8$~PBT each, to two different wallets. Executing these transfers would reduce the sender's balance by $16$~PBT in total, resulting in $-6$~PBT.
In order to prevent such behavior, we introduce the \textsc{veto}\xspace transaction. The \textsc{veto}\xspace transaction can be called by any party noticing two conflicting PoIs (i.e., two PoIs with the same source, different destinations, and overlapping validity periods). Since such PoIs are forbidden by definition, the \textsc{veto}\xspace transaction is used to penalize the sender, and to protect the receiver from losing PBT due to inconsistent balances.
Since the \textsc{veto}\xspace transaction requires incentive, we propose to use the same technique as presented above, i.e., a contest. Any observer of a PoI conflict can report this conflict using the \textsc{veto}\xspace transaction, and after the expiration of the veto validity period, the observer with the lowest $\omega$ signature is assigned a reward.
We therefore define the \textsc{veto}\xspace transaction as shown in~(\ref{eq:veto}), where $\alpha$ refers to the original PoI, which is known to the blockchain because it has already been posted on a given blockchain, and the remaining data $\xfer{s}{d'}{x'}$ and $t_0', t_1', \alpha'$ describe the new, conflicting PoI.
\begin{gather} \label{eq:veto}
\begin{aligned}
\mathcal{W}\xspace_w:\textsc{veto}\xspace~&\Big[~\alpha,\,\xfer{s}{d'}{x'},\,t_0',\,t_1',\,\alpha'~\Big]_{\omega}
\end{aligned}
\end{gather}
The \textsc{veto}\xspace transaction, similar to \textsc{contest}\xspace, is posted on all participating blockchains. Note that multiple observers can be expected to concurrently post \textsc{veto}\xspace transactions. Therefore, it is possible that on one blockchain, a given PoI~(e.g., where $\alpha = \texttt{0x10}$) is posted first, and a second PoI~(e.g., where $\alpha' = \texttt{0x20}$) is presented as ``conflicting'' by a \textsc{veto}\xspace transaction, while on another blockchain, the PoI where $\alpha = \texttt{0x20}$ is posted first, and the PoI with $\alpha' = \texttt{0x10}$ is posted in the \textsc{veto}\xspace transaction as ``conflicting''. However, in the following, we define a behavior for the \textsc{veto}\xspace transaction that still maintains consistency, regardless of the order of PoIs.
The preconditions for \textsc{veto}\xspace are that $\alpha$ refers to a PoI already known to the blockchain, that the conflicting PoI is valid, and that the two PoIs are actually conflicting.
The effects of \textsc{veto}\xspace are as follows: (i)~The sender of the conflicting PoIs loses all PBT, i.e., the balance is set to zero to penalize such protocol-violating behavior. (ii)~Any PoI which has a non-expired validity period (i.e., every PoI where $t < t_1$) is canceled. This means that no $\textsc{finalize}\xspace$ transaction will be permitted for this PoI, the transfer itself will therefore not be executed, and no witness reward will be assigned. Finally, (iii)~a new contest is started, called the \emph{veto contest}. The veto contest is similar to a regular witness contest in that its purpose is the propagation of information (in this case, the information of conflicting PoIs).
In the following, we propose a possible implementation of such veto contest, however, its details (i.e., the definition of its validity period or the reward) are specifics which may be implemented differently.
We propose to use the same reward for the veto contest as for the regular witness contest (in our case, $1$~PBT). Since all PBT held by the sender are destroyed, and only $1$~PBT is assigned to the winner of the veto contest, all remaining PBT are lost. Furthermore, we propose the validity period expiration of the veto contest, $t_\textsc{veto}\xspace$, to be defined as shown in~(\ref{eq:veto-t1}).
\begin{equation}
t_\textsc{veto}\xspace = \max(t_1, t_1') + \max(t_1-t_0, t_1'-t_0') \label{eq:veto-t1}
\end{equation}
The definition shown in~(\ref{eq:veto-t1}) states that the veto contest is valid until a point in time which is found by taking the later expiration time of the conflicting PoIs~($\max(t_1, t_1')$) and adding the longer validity period~($\max(t_1-t_0, t_1'-t_0')$). This is done to ensure that sufficient time is available for the veto contest. Again, we note that this is an implementation detail and other approaches (e.g., a fixed period) are also possible.
The veto contest is concluded by a \textsc{finalize-veto}\xspace transaction, defined as shown in~(\ref{eq:finveto}).
\begin{gather} \label{eq:finveto}
\begin{aligned}
\textsc{finalize-veto}\xspace~&\Big[~\alpha,\,\alpha'~\Big]
\end{aligned}
\end{gather}
The effect of the \textsc{finalize-veto}\xspace transaction is similar to that of the \textsc{finalize}\xspace transaction, except that no actual transfer is executed. The witness reward is again assigned to the veto contestant---that is, a wallet posting a \textsc{veto}\xspace transaction---with the lowest $\omega$ signature in the \textsc{veto}\xspace transaction. Similar to the \textsc{finalize}\xspace, the \textsc{finalize-veto}\xspace transaction can be called by anyone, in particular, the winning veto contestant has monetary incentive in doing so.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 6,559 |
namespace Zone.UmbracoPersonalisationGroups.Criteria.Country
{
public interface IIpProvider
{
string GetIp();
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 1,886 |
About Beverly
ERSCHELL
Watch Beverly on SHOWCASE with Barbara Kellar on CET Arts. (info)
Episodes air:
Saturday, July 27, at 6:30pm
Sunday, July 28, at 8:30pm
Monday, July 29, at 8:30am, 1:30pm and 5:30pm
Tuesday, July 30, at 10:30am, 3:30pm and 10:30pm
The Art of Beverly Erschell
Beverly Erschell is a nationally known painter whose work is in galleries and collections throughout the United States. The Northern Kentucky resident is one of the most highly regarded painters in Greater Cincinnati, where she was trained and taught at the Art Academy of Cincinnati and University of Cincinnati. The Art of Beverly Erschell published by Cincinnati Book Publishers brings together representative examples of the artist's paintings and works on paper over four decades. Sue Ann Painter, an art and architectural historian, is the author. She draws upon interviews with Aaron Betsky and Phillip Long. Cincinnati painter and graphic artist Mark Eberhard designed the book, which was printed in full color on acid-free paper by Wendling Printing Co., Newport Kentucky. The book is organized thematically, with chapters highlighting her portraits, travels in Europe and the United States, and energetic cityscapes of Greater Cincinnati. Erschell is well known for colorful compositions depicting domestic interiors opening onto lyrical landscapes, and brimming with still life, portraits, and people. To purchase The Art of Beverly Erschell, click here.
The Lucky Greyhound
This book tells the story of Beverly s adopted greyhound, Maple. She was duel-owned and shared her life with two households. The story recounts entertaining events in Maple s life and the various careers that she had during her life, from racing to artistic model to household pet. The book briefly but accurately references the greyhound adoption movement in the United States and the physical and temperamental characteristics of this ancient breed. Whether the reader is an avid greyhound lover, a dog activist, or merely a parent looking for an entertaining and aesthetically pleasing book for a child, this is an engaging book. Erschell created more than thirty original artworks colorful paintings and whimsical drawings expressly for this publication. To purchase The Lucky Greyhound, click here. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,148 |
After several failed attempts to match availability in DC, his scheduling staff graciously slotted me the day after Memorial Day in Honolulu. We met in a windowless room, feeling more like a home than office setting. Some stuff, but no distractions. His friends called him Danny. To me he is Senator Inouye.
What unfolded was unexpected and wonderful beyond what I could have possibly imaged. A memorable hour with a very remarkable man who seemed fully present, comfortably engaged and willingly vulnerable in a way I've rarely experienced in a first encounter or for that matter with anyone at any time.
I plan to ask a writer friend, Bob Gilbert, to help me again (he helped edit my book and buff up several blog posts). If he agrees, this time to chronicle that special experience more fully for a future blog post. Watch for it in December. Hopefully around the time marking the first Pearl Harbor Day remembrance since the passing of this this Japanese-American man of peace and reconciliation. In the meantime, here are several snippets I thought might of interest, especially for my family and friends.
war changes everything for the warrior – everything – especially for those that are required to kill and see killing.
Inouye loved the people of Battle Creek, especially the nurses.
he formed life-long friendships among wounded veterans mending at the Percy Jones Hospital in Battle Creek; most notedly with two other future fellow senators, Phil Hart D-Michigan and Bob Dole R-Kansas with the later being THE catalyst for Inouye's decision to enter public service as a politician.
flipping through the book, the Senator paused at one of pictures entitled "From Defeat to Ultimate Victory" and said we have yet to achieve ultimate victory. We agree. Japan and the United States have yet to formally reconcile.
he gave me a tour of spacious office complex in the Federal Building. Some of the offices have beautiful views overlooking the Pacific and Aloha Tower. An interesting history – his office was a former CIA headquarters office (showed me one room saying "your cell phone won't work in there".
I brought my camera. He asked his chief of staff who sat in on our meeting to take our picture. He chose the backdrop. By the way, the Senator shared things in our conversation his chief of staff said had never heard before.
as we were wrapping up the brief walking tour at the close of my visit, we paused in his spacious main office, the one that overlooks the beautiful Pacific waters and the historical Aloha Tower waterfront area. The Senator shifted from upbeat tour guide to reflective statesman as he took me aside. With a quiet directness he spoke about the struggle he saw intensifying in already the most polarized times he'd ever seen as the best and worst of people are being revealed. Wondering about but not knowing which way America would go. I have no doubt about his preference. It's one we share with his old friend, Senator Bob Dole; one that has nothing to do with partisan politics.
Better is peace than forever war. Better is peace than always war. | {
"redpajama_set_name": "RedPajamaC4"
} | 4,694 |
namespace Euclidian
{
using System;
[AttributeUsage(AttributeTargets.Struct |
AttributeTargets.Class |
AttributeTargets.Interface,
AllowMultiple = true)]
public class VersionAttribute : Attribute
{
private int major;
private int minor;
public VersionAttribute(int major, int minor)
{
this.Major = major;
this.Minor = minor;
}
#region Properties
private int Major
{
get
{
return this.major;
}
set
{
if (value < 0)
{
throw new ArgumentException("Value must be positive");
}
else
{
this.major = value;
}
}
}
private int Minor
{
get
{
return this.minor;
}
set
{
if (value < 0)
{
throw new ArgumentException("Value must be positive");
}
else
{
this.minor = value;
}
}
}
public string Version
{
get
{
return string.Format("{0}.{1}", this.Major, this.Minor);
}
}
#endregion
}
} | {
"redpajama_set_name": "RedPajamaGithub"
} | 4,374 |
package com.amazonaws.services.apigateway.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.apigateway.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* GatewayResponse JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GatewayResponseJsonUnmarshaller implements Unmarshaller<GatewayResponse, JsonUnmarshallerContext> {
public GatewayResponse unmarshall(JsonUnmarshallerContext context) throws Exception {
GatewayResponse gatewayResponse = new GatewayResponse();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("responseType", targetDepth)) {
context.nextToken();
gatewayResponse.setResponseType(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("statusCode", targetDepth)) {
context.nextToken();
gatewayResponse.setStatusCode(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("responseParameters", targetDepth)) {
context.nextToken();
gatewayResponse.setResponseParameters(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context
.getUnmarshaller(String.class)).unmarshall(context));
}
if (context.testExpression("responseTemplates", targetDepth)) {
context.nextToken();
gatewayResponse.setResponseTemplates(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context
.getUnmarshaller(String.class)).unmarshall(context));
}
if (context.testExpression("defaultResponse", targetDepth)) {
context.nextToken();
gatewayResponse.setDefaultResponse(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return gatewayResponse;
}
private static GatewayResponseJsonUnmarshaller instance;
public static GatewayResponseJsonUnmarshaller getInstance() {
if (instance == null)
instance = new GatewayResponseJsonUnmarshaller();
return instance;
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 9,148 |
package edu.washington.maccoss.intensity_predictor.structures;
public class PeptideWithScores extends AbstractPeptide {
public static char[] aas="ACDEFGHIKLMNPQRSTVWY".toCharArray();
private final double[] scores;
public PeptideWithScores(String sequence, float intensity, Protein protein, double[] properties) {
super(sequence, intensity, protein);
this.scores=properties;
}
@Override
public double[] getScoreArray() {
return scores;
}
}
| {
"redpajama_set_name": "RedPajamaGithub"
} | 4,843 |
Home News Fix Our Computers: A Look Inside the Air Force's User-Fueled IT Modernization Push
Fix Our Computers: A Look Inside the Air Force's User-Fueled IT Modernization Push
Summer Myatt
News,Technology
https://www.govconwire.com/wp-content/uploads/2022/02/fix-our-computers-a.mp3
Rumblings of frustration surrounding the Department of Defense's information technology shortcomings quickly grew into a roar last month as military service branch operators, warfighters and federal leaders took to social media to shed light on the severity of the department's widespread IT issues and the urgency of solving them.
In January, Michael Kanaan, director of operations for the U.S. Air Force and MIT Artificial Intelligence Accelerator, penned an open letter titled "Fix Our Computers," which he posted publicly on LinkedIn, that outlined some of the daily IT challenges he faces.
"I wrote an email the other day that took over an hour to send," Kanaan said. "I opened an Excel file today…my computer froze and needed to be restarted."
Kanaan's post described how simple, yet essential computer tasks can take hours, and increasingly debilitating computer issues are contributing to the Defense Department's talent shortage.
The computer problems that service members and federal government employees face, Kanaan said, prevent them from effectively or efficiently carrying out their critical duties.
"Ultimately, we can't solve problems with the same tools that made them…and yet somehow fundamental IT funding is still an afterthought," posited Kanaan. "It's not a money problem, it's a priority problem."
The open letter quickly gained nearly 400 comments and over 2,000 reactions, garnering the attention of the DoD community and its high-ranking officials. Air Force Chief Information Officer Lauren Knausenberger, a 2022 Wash100 Award recipient, commented on the post, "I echo your open plea to fund IT. It's the foundation of our competitive advantage and also ensures every single person can maximize their time on mission."
Other DOD officials and employees joined the "Fix Our Computers" conversation with similar posts of their own. Artem Sherbinin, a U.S. Navy navigation officer released a statement urging the Defense Department to fix its software, too.
Sherbinin said hundreds of thousands of U.S. sailors are using decades-old software to complete daily administrative tasks. He said service members know what new technologies and software updates are needed, and some of them are even capable of building these innovations themselves.
"This isn't about quality-of-life improvements, it's about winning the next great power war," he said in the post.
In early February, the DOD Office of the Chief Information Officer released a statement, posted on LinkedIn, that addressed the "Fix Our Computers" letter and outlined some of the actions currently underway within the department to improve the user experience.
The co-authors of the post – Knausenberger, Army CIO Raj Iyer, DOD CIO John Sherman, Navy CIO Aaron Weis and Acting Principal Deputy CIO Dr. Kelly Fletcher – said the department is working to enable telework capabilities, provide users with higher-performing laptops and eliminate redundant cybersecurity policies.
"We're aiming to provide DoD users with secure, best-in-class performance so you can get your missions done," the post said. "We know we still have work to do, and rest assured that we're going to keep up the press. We value the candid feedback and, believe it or not, we remember what it was like before we were CIOs and on the user end of things."
The DOD's response coincided with the Pentagon's newly released Software Modernization Strategy, which is expected to help facilitate the delivery of software capabilities at "the speed of relevance."
Lauren Knausenberger, who has long championed IT and software modernization, is slated to keynote GovCon Wire Events' Second Annual Air Force: IT Plans and Priorities Forum on March 9.
Knausenberger will speak alongside other prominent figures within the Air Force and industry, who will convene to discuss some of the service branch's most urgent digital transformation initiatives.
Click here to register for the Air Force: IT Plans and Priorities Forum hosted by GovCon Wire Events. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 4,371 |
\section{\label{sec:introduction}Introduction}
The electric dipole moment (EDM) \cite{He:1990qa,Bernreuther:1990jx,Barr:1992dq,Jungmann:2013sga,NaviliatCuncic:2012zza,Khriplovich:1997ga,Ginges:2003qt,Pospelov:2005pr,Raidal:2008jk,Fukuyama:2012np,Engel:2013lsa,Yamanaka:2014,Roberts:2014bka,deVries:2015gea,Yamanaka:2016umw,Yamanaka:2017mef,Chang:2017wpl,Chupp:2017rkp,Safronova:2017xyt,Orzel:2018cui,Yamanaka:2019ifh}
is a very sensitive observable for the detection of the CP violation in many candidate models of new physics beyond the standard model (SM) such as the supersymmetry \cite{Ellis:1982tk,delAguila:1983dfr,Dugan:1984qf,Kizukuri:1992nj,Fischler:1992ha,Ibrahim:1997gj,Ibrahim:1998je,Chang:1998uc,Pokorski:1999hz,Lebedev:2002ne,Chang:2002ex,Pilaftsis:2002fe,Demir:2003js,ArkaniHamed:2004yi,Ellis:2008zy,Lee:2012wa,Yamanaka:2012hm,Yamanaka:2012ia,Yamanaka:2012ep,Dhuria:2014fba,Yamanaka:2014nba,Zhao:2014vga,Li:2015yla,Bian:2016zba,Nakai:2016atk,Cesarotti:2018huy,Zheng:2019knr,Yang:2019aao,Yang:2020ebs}, extended Higgs model \cite{Weinberg:1990me,Barr:1990vd,Leigh:1990kf,Kao:1992jv,Hayashi:1994ha,Barger:1996jc,BowserChao:1997bb,Jung:2013hka,Abe:2013qla,Inoue:2014nva,Bian:2014zka,Chen:2017com,Fontes:2017zfn,Alves:2018kjr,Egana-Ugrinovic:2018fpy,Panico:2018hal,Brod:2018pli,Brod:2018lbf,Okada:2018yrn,Cirigliano:2019vfc,Cheung:2019bkw,Oshimo:2019ylq,Chun:2019oix,Oredsson:2019mni,Fuyuto:2019svr,Eeg:2019eei,Fuchs:2020uoc,Cheung:2020ugr,Kanemura:2020ibp}, Majorana fermion \cite{Ng:1995cs,Archambault:2004td,Fukuyama:2019jiq,Chang:2017vzi},
and other interesting models~\cite{Appelquist:2004mn,Fuyuto:2018scm,Dekens:2018bci,Panico:2018hal,Abe:2019wku,Okawa:2019arp,Altmannshofer:2020ywf,Kirpichnikov:2020tcf,Pan:2020qqd,Kirpichnikov:2020lws}.
Among systems in which the EDM may be measured, the charged leptons are the most frequently studied experimentally.
The electron EDM is known to be enhanced by relativistic effect of heavy atomic and molecular systems \cite{Carrico:1968zz,sandars1,sandars2,Flambaum:1976vg,Sandars:1975zz,Labzovskii,Sushkovmolecule,kelly,Kozlov:1994zz,Kozlov:1995xz,flambaumfr1,nayak1,nayak3,nayak2,Natarajrubidium,Mukherjeefrancium,Dzuba:2009mw,Nataraj:2010vn,flambaumybftho,Porsev:2012zx,Roberts:2013zra,Chubukov:2014rba,abe,sunaga,Radziute:2015apa,Denis,Skripnikov,Sunaga:2018lja,Sunaga:2018pjn,Sunaga:2019pfo,Malika:2019jhn,Fazil:2019esp,Talukdar:2020ban}, and it is currently the object of a massive experimental competition \cite{Sandars:1964zz,Weisskopf:1968zz,Stein:1969zz,Player:1970zz,Murthy:1989zz,Abdullah:1990nh,Commins:1994gv,Chin:2001zz,Regan:2002ta,Hudson:2011zz,Sakemi:2011zz,Kara:2012ay,Baron:2013eja,Cairncross:2017fip,Kozyryev:2017cwq,Andreev:2018ayy,Andreev:2018ayy}.
The EDM of the muon is directly measureable in experiments using storage rings \cite{Bennett:2008dy}.
That of the $\tau$ lepton can be extracted by analyzing collider experimental data \cite{Chen:2018cxt,Koksal:2018env, Koksal:2018xyi,Koksal:2018vtt,Dyndal:2020yen}.
In the SM, the Cabibbo-Kobayashi-Maskawa (CKM) matrix \cite{Kobayashi:1973fv} has a CP violating complex phase, so it may generate the EDM.
In the search for new physics beyond the SM, this contribution must be assessed as the leading background.
It is known that, in most cases, it is unobservably much smaller than the experimental sensitivity \cite{Shabalin:1978rs,Shabalin:1980tf,Eeg:1982qm,Eeg:1983mt,Khriplovich:1985jr,Czarnecki:1997bu,Pospelov:1991zt,Booth:1993af,Pospelov:2013sca,Pospelov:1994uf,Khriplovich:1981ca,McKellar:1987tf,Seng:2014lea,Yamanaka:2015ncb,Yamanaka:2016fjj,Lee:2018flm}.
However, the hadronic contribution to the EDM of charged leptons has never been evaluated in the past.
This is just the aim of this paper to quantify it.
In this paper, we first prove that the contribution at the quark-gluon level is suppressed by a factor of $m_b^2 m_c^2 m_s^2$ at all orders of perturbation due to the
Glashow-Iliopoulos-Maiani (GIM) mechanism.
Next, we calculate the hadronic long distance contribution to the charged lepton EDM generated by vector mesons at one-loop level.
The $|\Delta S|=1$ weak hadronic interaction is derived using the factorization, while the strong interaction is given by the hidden local symmetry framework.
Part of the results have been briefly reported in~\cite{Yamaguchi:2020eub}.
A complete report of our study is given in this article.
This paper is organized as follows.
In the next section, we review the quark-gluon level calculation of the CKM contribution to the EDM of charged leptons and prove that it is actually suppressed by factors of quark masses at all orders of perturbation.
We then describe in Sec. \ref{ref:setup} the setup of the evaluation of the hadronic contribution to the EDMs of charged leptons in the hidden local symmetry framework, with the weak interaction derived with the factorization.
In Sec. \ref{sec:analysis}, we show the result of our calculation and analyze the theoretical uncertainty.
The final section gives the summary of this work.
\section{\label{sec:review}Quark level estimation of the EDM of charged leptons and the GIM mechanism}
Let us first review the previous works on the calculation of the short distance (quark-gluon level) effect to the EDM of charged leptons in the SM.
Since we are supposing that the CP violation is generated by the physical complex phase of the CKM matrix, the Feynman diagrams contributing to the lepton EDM must have at least a quark loop, with sufficient flavor changes so as to fulfill the Jarlskog combination \cite{Jarlskog:1985ht}.
The Jarlskog invariant is given by the product of four CKM matrix elements ($J = {\rm Im}[V_{us} V_{td} V^*_{ud} V^*_{ts}] = (3.18\pm 0.15 ) \times 10^{-5}$ \cite{Tanabashi:2018oca}), so the quark loop must have four $W$ boson-quark vertices.
By noting that the $W$ boson must also be connected to the electron, the two-loop level diagram which has only two vertices in the quark loop does not contribute to the EDM due to the cancellation of the complex phase.
\begin{figure}[htb]
\begin{center}
\includegraphics[scale=0.8]{WEDM.pdf}
\caption{
Two-loop level diagram contributing to the EDM of $W$ boson in the SM at the quark level.
The external photon field is attached to all possible propagators.
The sum of all diagrams vanishes, so
the EDM of charged leptons at the three-loop level, which is generated by attaching the two external $W$ boson lines to the lepton line, also cancels.
}
\label{fig:WEDM}
\end{center}
\end{figure}
The first plausible contribution appears then at the three-loop order~\cite{Hoogeveen:1990cb} (two-loop level diagrams of the EDM of $W$ boson as shown in Fig. \ref{fig:WEDM}, which is attached to the lepton line).
However, extensive three-loop level analyses revealed us that it exactly cancels due to the antisymmetry of the Jarlskog invariant under the flavor exchange (also called the GIM mechanism, a consequence of the CKM unitarity) \cite{Pospelov:1991zt,Booth:1993af,Pospelov:2013sca}.
The cancellation works as follows.
If we can find two quark propagators of the same type
(up type or down type)
in the diagram with identical momenta and sandwiched by $W$ boson vertices, the sum of the direct product of these two parts over the $d$-type quark flavors reads
\begin{eqnarray}
&& \hspace{-1em}
\sum_{D\neq D'}
{\rm Im } [V_{U' D} V^*_{U D} V_{U' D'} V^*_{U D'}]
P_L S_{D} \gamma^\mu P_L \otimes P_L S_{D'} \gamma^\nu P_L
\nonumber\\
&=&
{\rm Im } [V_{U' d} V^*_{U d} V_{U' s} V^*_{U s}]
( P_L S_{d} \gamma^\mu P_L \otimes P_L S_{s} \gamma^\nu P_L
-P_L S_{s} \gamma^\mu P_L \otimes P_L S_{d}\gamma^\nu P_L)
\nonumber\\
&&
+{\rm Im } [V_{U' s} V^*_{U s} V_{U' b} V^*_{U b}]
( P_L S_{s} \gamma^\mu P_L \otimes P_L S_{b} \gamma^\nu P_L
-P_L S_{b} \gamma^\mu P_L \otimes P_L S_{s}\gamma^\nu P_L)
\nonumber\\
&&
+{\rm Im } [V_{U' b} V^*_{U b} V_{U' d} V^*_{U d}]
( P_L S_{b} \gamma^\mu P_L \otimes P_L S_{d} \gamma^\nu P_L
-P_L S_{d} \gamma^\mu P_L \otimes P_L S_{b}\gamma^\nu P_L)
\nonumber\\
&=&
{\rm Im } [V_{U' d} V^*_{U d} V_{U' s} V^*_{U s}]
(P_L k\hspace{-0.45em}/\, \gamma^\mu P_L) \otimes (P_L k\hspace{-0.45em}/\, \gamma^\nu P_L )
\nonumber\\
&&
\times
\Biggl\{
\frac{ 1 }{k^2-m_s^2} \cdot \frac{1 }{k^2-m_d^2}
-\frac{1 }{k^2-m_d^2} \cdot \frac{1 }{k^2-m_s^2}
+\frac{1 }{k^2-m_b^2} \cdot \frac{1 }{k^2-m_s^2}
-\frac{1 }{k^2-m_s^2} \cdot \frac{1 }{k^2-m_b^2}
\nonumber\\
&& \hspace{2em}
+\frac{1}{k^2-m_d^2} \cdot \frac{1 }{k^2-m_b^2}
-\frac{1 }{k^2-m_b^2} \cdot \frac{1}{k^2-m_d^2}
\Biggr\}
\nonumber\\
&=&
0
, \ \ \
\end{eqnarray}
where $S_D \equiv \frac{i(k\hspace{-0.4em}/\,+m_D )}{k^2-m_D^2}$.
The projection $P_L \equiv \frac{1}{2} (1-\gamma_5)$ comes from the $W$ boson-quark vertices.
The mass insertions of $S_D$ cancel since odd number of chirality flips is not allowed when $S_D$ is sandwiched by $W$ boson-quark vertices.
It turns out that the pair of propagators with the same ($u$- or $d$-) type quarks can always be found in the two-loop level contribution to the EDM of $W$ boson, and consequently in the three-loop level diagrams of the EDM of charged leptons.
The most trivial ones are the symmetric diagrams with two quark propagators of the same type, but there are also diagrams which have nonsymmetric insertions of the external photon.
The latter ones can actually be recast into the symmetric form of quark propagators by using the Ward-Takahashi identity \cite{Pospelov:1991zt,Booth:1993af}.
Similar cancellation also occurs in the case of the quark EDM/chromo-EDM \cite{Shabalin:1978rs,Shabalin:1980tf,Eeg:1982qm,Eeg:1983mt,Khriplovich:1985jr,Czarnecki:1997bu} or the Weinberg operator (gluon chromo-EDM) \cite{Pospelov:1994uf}.
\begin{figure}[htb]
\begin{center}
\includegraphics[scale=0.8]{electron_EDM_SM_elementary.pdf}
\caption{
Example of four-loop level diagram contributing to the lepton EDM in the SM at the quark level.
}
\label{fig:electron_EDM_SM_elementary}
\end{center}
\end{figure}
\begin{figure}[htb]
\begin{center}
\includegraphics[scale=0.7]{GIM_suppression_v2.pdf}
\caption{
Boson emissions/absorptions of the quark loop with four flavor changing vertices respecting the Jarlskog combination.
The gluon, photon, and the neutral Higgs boson are denoted by the wiggly, wavy, and dashed lines, respectively, and the ellipses means that they each may be of arbitrary number.
The sum of the quark flavors removes the contribution without flip of chirality due to the GIM mechanism.
The emitted bosons have $O(m_W)\approx O(m_t)$ momenta, and they may also form loops, or be connected to other fermion loops, which are not interfering with the flavor structure of the one considered in this figure.
}
\label{fig:GIM_suppression}
\end{center}
\end{figure}
The first nonvanishing contribution which avoids the above symmetric cancellation appears at the four-loop level (see Fig. \ref{fig:electron_EDM_SM_elementary}).
Although the four-loop level contribution has never completely been calculated, it is possible to estimate its size by symmetry consideration.
It is indeed possible to prove that the GIM mechanism \cite{Glashow:1970gm,Ellis:1976fn} always brings additional suppression of quark mass factors $m_q^2$, independently of the order of perturbation.
Let us first consider the quark loop with several insertions of vertices of flavor unchanging (neutral) bosons, i.e. gluons, photons, or Higgs bosons (see Fig. \ref{fig:GIM_suppression}).
We focus on the direct product of the $U$ and $U'$ quark lines with vertex insertions of Fig. \ref{fig:GIM_suppression}, which may be expressed by the Taylor expansion in terms of the quark masses, as follows:
\begin{equation}
\sum_{U \neq U'}
{\rm Im } [V_{U' D} V^*_{U D} V_{U' D'} V^*_{U D'}]
\sum_{n=0}
a^{(1)}_n m_U^{2n}
\otimes
\sum_{n'=0}
a^{(2)}_{n'} m_{U'}^{2n'}
,
\label{eq:anbn}
\end{equation}
where $a^{(1)}_n$ and $a^{(2)}_{n'}$ are polynomials of the electric charge of up-type quarks, the strong coupling, the inverse of the Higgs vacuum expectation value (appearing from the Yukawa coupling of the Higgs boson after factoring out quark masses), and all momenta carried by the bosons attached to $U$ and $U'$, respectively, which depend on the diagram considered.
Here we took the direct product $\otimes$ to show that the above Taylor expansion also works for the case where Dirac matrices are involved.
We can actually prove that the terms involving $a^{(1)}_0$ and $a^{(2)}_0$ always vanish due to the GIM mechanism.
The case of $a^{(1)}_0 \otimes a^{(2)}_0$ is easy to show, since the sum is just proportional to the sum of Jarlskog invariants, which cancel due to the antisymmetry in the flavor exchange.
The remaining possibilities are $\sum_{n=1} a^{(1)}_n m_U^{2n} \otimes a^{(2)}_0$ and $a^{(1)}_0 \otimes \sum_{n'=1} a^{(2)}_{n'} m_{U'}^{2n'}$ which are also not difficult to treat.
For the former case, we have
\begin{eqnarray}
&&
\sum_{U \neq U'}
{\rm Im } [V_{U' D} V^*_{U D} V_{U' D'} V^*_{U D'}]
\sum_{n=0}
a^{(1)}_n m_U^{2n}
\otimes
a^{(2)}_0
\nonumber\\
&=&
{\rm Im } [V_{t D} V^*_{u D} V_{t D'} V^*_{u D'}]
\sum_{n=1}
a^{(1)}_n m_u^{2n}
\otimes
a^{(2)}_0
+{\rm Im } [V_{t D} V^*_{c D} V_{t D'} V^*_{c D'}]
\sum_{n=1}
a^{(1)}_n m_c^{2n}
\otimes
a^{(2)}_0
\nonumber\\
&&
+
{\rm Im } [V_{u D} V^*_{c D} V_{u D'} V^*_{c D'}]
\sum_{n=1}
a^{(1)}_n m_c^{2n}
\otimes
a^{(2)}_0
+
{\rm Im } [V_{u D} V^*_{t D} V_{u D'} V^*_{t D'}]
\sum_{n=1}
a^{(1)}_n m_t^{2n}
\otimes
a^{(2)}_0
\nonumber\\
&&
+
{\rm Im } [V_{c D} V^*_{t D} V_{c D'} V^*_{t D'}]
\sum_{n=1}
a^{(1)}_n m_t^{2n}
\otimes
a^{(2)}_0
+
{\rm Im } [V_{c D} V^*_{u D} V_{c D'} V^*_{u D'}]
\sum_{n=1}
a^{(1)}_n m_u^{2n}
\otimes
a^{(2)}_0
\nonumber\\
&=&
{\rm Im } [V_{c D} V^*_{u D} V_{c D'} V^*_{u D'}]
\Biggl[
\sum_{n=1}
a^{(1)}_n m_u^{2n}
-
\sum_{n=1}
a^{(1)}_n m_c^{2n}
+
\sum_{n=1}
a^{(1)}_n m_c^{2n}
-
\sum_{n=1}
a^{(1)}_n m_t^{2n}
+
\sum_{n=1}
a^{(1)}_n m_t^{2n}
-
\sum_{n=1}
a^{(1)}_n m_u^{2n}
\Biggr]
\otimes
a^{(2)}_0
\nonumber\\
&=&
0
.
\label{eq:Taylorzerothcancel}
\end{eqnarray}
We may repeat the same calculation to show the cancellation for the case of $a^{(1)}_0 \otimes \sum_{n'=1} a^{(2)}_{n'} m_{U'}^{2n'}$ as well.
We thus proved that the leading order CP violation of the quark loop is accompanied by two factors of squared mass of two different up-type quarks to all orders of perturbation in QED, QCD, and Higgs corrections.
We may also exactly repeat the above procedure for the down-type quark contribution which is independent of the up-type ones.
The CP violating part of the quark loop is then at least having a suppression factor of $m_t^2 m_b^2 m_c^2 m_s^2$, which of course persists even if some of the neutral or $W$ bosons are contracted each other or with other quark loops.
The appearance of this factor has actually been already discussed in the general case of the CP violation of
the CKM matrix~\cite{Jarlskog:1985cw}, and it also appeared in the result of the calculation of
the Weinberg operator which is also generated by a quark loop~\cite{Pospelov:1994uf}.
The presence of the suppression due to quark mass factors, i.e. the cancellation of the zeroth order terms of the Taylor expansion of the quark lines with neutral boson insertions, may also more elegantly be shown using the unitarity of the CKM matrix.
At the order of four $W$ boson-quark vertices, the general flavor structure of the quark loop, with the sum over the flavor taken, is expressed by the following trace
\begin{equation}
{\rm Tr}
[ V^\dagger Q_U^{(1)} V R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} ]
,
\label{eq:flavorstructureV4}
\end{equation}
where $V$ is the $3\times 3$ CKM matrix, and $Q_U^{(k)} \equiv \sum_{n_k=1} a^{(k)}_{n_k} m_{U}^{2n_k}$, $R_D^{(l)} \equiv \sum_{n_l=1} b^{(l)}_{n_l} m_{D}^{2n_l}$ ($k,l = 1,2$) are the down-type and up-type quark lines with arbitrary number of neutral boson insertions, respectively.
We note that $Q_U^{(k)}$ and $R_D^{(l)}$ are $3\times 3$ matrices
that only have diagonal components.
By taking the zeroth order term of $Q_U^{(1)}$, we have
\begin{eqnarray}
{\rm Tr}
[ V^\dagger a_0^{(1)} V R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} ]
&=&
a_0^{(1)}
{\rm Tr}
[ V^\dagger V R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} ]
\nonumber\\
&=&
a_0^{(1)}
{\rm Tr}
[ R_D^{(2)} R_D^{(1)} V^\dagger Q_U^{(2)} V ]
\, = \, a_0^{(1)}
\sum_{i,j=1}^3
(R_D^{(2)})_i (R_D^{(1)})_i | V_{ij}|^2 (Q_U^{(2)} )_j
.
\end{eqnarray}
Here we used the unitarity of the CKM matrix $V^\dagger V = 1$, the fact that $R_D^{(2)}, R_D^{(1)}$, and $Q_U^{(2)}$ are diagonal, and that $a_0^{(1)}$ is flavor blind, i.e. proportional to the unit matrix.
The above trace is therefore purely real and the zeroth order terms of the Taylor expansion of the quark lines with neutral boson insertions does not contribute to the EDM.
This expression is exactly equivalent with Eq. (\ref{eq:Taylorzerothcancel}), and at this order $O(V^4)$ the imaginary part only survives when the flavors of all quarks are different, to avoid the appearance of the squared absolute values of the CKM matrix elements.
Next, we have to see higher order corrections with $W$ boson-quark vertices which may be treated in a similar manner.
Here again the unitarity of the CKM matrix plays a crucial role.
Let us consider the case with six $W$ boson-quark vertices.
The general flavor structure of this quark loop, with the flavor summed, looks like
\begin{equation}
{\rm Tr}
[ V^\dagger Q_U^{(1)} V R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} V^\dagger Q_U^{(3)} V R_D^{(3)} ]
.
\end{equation}
We now show that the correction at this order ($V^6$) is not larger than that of $O(V^4)$ which has the quark mass factors $m_t^2 m_b^2 m_c^2 m_s^2$.
A potentially large contribution may arise from the zeroth order terms of the Taylor expansion $a^{(k)}_{0}$ and $b^{(l)}_{0}$.
For example, by considering one such insertion,
\begin{eqnarray}
{\rm Tr}
[ V^\dagger a^{(1)}_{0} V R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} V^\dagger Q_U^{(3)} V R_D^{(3)} ]
&=&
a^{(1)}_{0}
{\rm Tr}
[ V^\dagger V R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} V^\dagger Q_U^{(3)} V R_D^{(3)} ]
\nonumber\\
&=&
a^{(1)}_{0}
{\rm Tr}
[ R_D^{(3)} R_D^{(1)} V^\dagger Q_U^{(2)} V R_D^{(2)} V^\dagger Q_U^{(3)} V ]
,
\end{eqnarray}
where we again used the unitarity of the CKM matrix.
By noting that $R_D^{(3)} R_D^{(1)}$ is also a diagonal matrix with each component depending only on the mass of one quark flavor, we see that the flavor structure of this contribution is exactly the same as that of the $O(V^4)$ process with neutral boson insertions discussed previously in this section [Fig. \ref{fig:GIM_suppression}, Eqs. (\ref{eq:Taylorzerothcancel}) and (\ref{eq:flavorstructureV4})].
This means that the
the $O(V^6)$ quark loop having one zeroth order term of the Taylor expansion
is also having the quark mass factor $m_t^2 m_b^2 m_c^2 m_s^2$.
We also note that the contribution with the three up-type quarks being all top quarks, which may potentially be larger than the $O(V^4)$ terms, has no effect to the EDM, since it will be proportional to three factors of the absolute values of squared CKM matrix elements $|V_{tD}|^2$, i.e. at least a factor of $m_c^2$ or $m_u^2$ is needed.
This analysis may be extended to arbitrary higher orders recursively, since the zeroth order terms $a^{(k)}_{0}$ or $b^{(l)}_{0}$, proportional to the unit matrix, contract two CKM matrix elements $V$ and $V^\dagger$ to form another unit matrix, reducing the flavor trace of $O(V^{2N})$ to $O(V^{2N-2})$.
Since the $O(V^4)$ contribution is having a factor of $m_t^2 m_b^2 m_c^2 m_s^2$, this is also so at $O(V^6)$ and at all other higher orders of $W$ boson-quark vertices ($V$).
We can also show with the above approach the
cancellation of the quark loop at $O(V^2)$ and at the two-loop level in a more elegant manner.
At $O(V^2)$, we have
\begin{equation}
{\rm Tr}
[ V^\dagger Q_U^{(1)} V R_D^{(1)} ] = \sum_{i=1}^3 H_{ii} (R_D^{(1)})_i
,
\end{equation}
where $H \equiv V^\dagger Q_U^{(1)} V$ is an Hermitian matrix.
Since $R_D^{(1)}$ is diagonal and real, its trace with $H$ is taking only the diagonal elements, which are also real.
There is no room for the imaginary part, so CP is conserved at $O(V^2)$, even accounting for all order corrections of neutral bosons.
At the two-loop level (of the quark loop), we previously saw that we can always find a symmetric set of either up or down-type propagators with the same momentum argument \cite{Pospelov:1991zt,Booth:1993af,Pospelov:2013sca}.
We may then write the trace as
\begin{equation}
{\rm Tr}
[ V S_{D} V^\dagger Q_U^{(1)} V S_{D} V^\dagger Q_U^{(2)} ]
= \sum_{i,j=1}^3 H'_{ij} (Q_U^{(1)})_j H'_{ji} (Q_U^{(2)})_i
= \sum_{i,j=1}^3 |H'_{ij}|^2 (Q_U^{(1)})_j (Q_U^{(2)})_i
,
\end{equation}
where we used the
Hermiticity of $H' \equiv V S_D V^\dagger$.
Due to the absolute value, there is no CP violation, and there is thus no contribution to the EDM of charged leptons at the three-loop level.
We also see that, if the symmetry between the two $S_D$ is destroyed, the two $H'$ will no longer be complex conjugates, and the imaginary part will be generated.
Let us now estimate the EDM of charged leptons according to the above discussion.
The correct dimensional analysis of the four-loop level contribution according to the above proof therefore yields
\begin{equation}
d_l
\sim
\frac{e J \alpha_s
\alpha_{\rm QED}^3
m_l m_b^2 m_c^2 m_s^2}{\sin^6 \theta_W m_t^8 (4\pi)^4}
,
\end{equation}
which is transcribed to
\begin{eqnarray}
d_e
&=&
O(10^{-50}) e \, {\rm cm}
,
\label{eq:eEDMquark}
\\
d_\mu
&=&
O(10^{-48}) e \, {\rm cm}
,
\label{eq:muEDMquark}
\\
d_\tau
&=&
O(10^{-47}) e \, {\rm cm}
.
\label{eq:tauEDMquark}
\end{eqnarray}
Here we did not consider the logarithmic enhancement which may enlarge the above values by one or two orders of magnitude.
Nevertheless, these results are actually telling us that the short distance contribution is extremely small.
From this analysis, we see that the enormous suppression of the EDM of charged leptons is not due to the fact that it appears at the four-loop level, but rather due to the
cancellation by the GIM mechanism.
We stress that this suppression mechanism does apply only when all momenta involved are of $O(m_W \sim m_t)$.
In the case where nonperturbative physics is relevant in the infrared region, the coefficients $a_n$, $b_{n'}$ of Eq. (\ref{eq:anbn}) may be enhanced by $O(1/\Lambda_{\rm QCD}^2 ) = O({\rm GeV}^{-2})$ factors.
In the next section, we recast the soft momentum physics into phenomenological hadron physics where the weak interacting hard part is given by low energy constants, which are also calculated with phenomenological models.
\section{\label{ref:setup}Setup of the calculation}
\subsection{The long distance effect}
The leading order contribution of the CKM matrix to the lepton EDM is constructed with at least two $W$ boson exchanges.
To avoid severe GIM cancellation as we saw in the previous section, we have to split the short distance flavor changing process at least into two parts at the hadron level (the long distance effect), while keeping the Jarlskog combination of the CKM matrix elements.
The largest long distance contribution should involve unflavored and $|S|=1$ mesons rather than
the heavy flavored ($c,b$) ones.
Another important condition is that the charged lepton EDM is generated by one-loop level diagrams involving vector mesons, because the interaction of pseudoscalar mesons with the lepton will change the chirality, suppressing the EDM by at least by a factor of $m_l^2$ ($l=e, \mu , \tau$)
(for an example of a one-loop level diagram with pseudoscalar mesons
suppressed by chirality flips, see Fig.~\ref{fig:electron_EDM_pseudoscalar_loop}).
The charged lepton EDM is then generated by diagrams involving a $K^*$ meson.
The one-loop level diagrams must not have a neutrino in the intermediate state of the long distance process, since the small neutrino mass will not provide sufficient chirality flip required in the generation of the EDM.
Moreover, if the process contains two weak $K^*$-charged lepton vertices, the chirality selection will not allow an EDM.
The $K^*$ meson must therefore change to an unflavored meson which in turn becomes a photon which will be absorbed by the charged lepton.
Under such restrictions,
we may draw diagrams shown in Fig. \ref{fig:electron_EDM_long-distance}.
We note that diagrams with external photons attached to internal lepton propagator cancel when transposed diagrams are summed.
\begin{figure}[htb]
\begin{center}
\includegraphics[width=0.4\linewidth]{electron_EDM_pseudoscalar_loop.pdf}
\caption{Example of a one-loop level contribution to the EDM of the charged
lepton $l$ generated by pseudoscalar mesons ($\pi, K$).
The grey and black blobs denote the weak interaction.
This
na\"ively leading diagram is suppressed by the chirality flips of the
pseudoscalar meson-lepton vertices (grey blobs).
}
\label{fig:electron_EDM_pseudoscalar_loop}
\end{center}
\end{figure}
\begin{figure}[htb]
\begin{center}
\includegraphics[width=1.0\linewidth]{Amplitude-fig-ab_v3.pdf}
\caption{
Long distance contribution to the EDM of charged lepton $l$ ($=e,\mu , \tau$) in the SM.
The diagrams $(a)$ and $(a^\prime)$ ($(b)$ and $(b^\prime)$) are the contribution with the weak (strong) three vector meson interactions.
There are also diagrams with the $\bar{K}^\ast$ propagator, which are not displayed.
The grey blob denotes the $|\Delta S|=1$
semileptonic effective interaction, while the black one is the $|\Delta S|=1$ (two- and three-point) vector meson interactions which combine each other to form the Jarlskog invariant.
}
\label{fig:electron_EDM_long-distance}
\end{center}
\end{figure}
\subsection{Hidden local symmetry}
Let us now give the interactions to calculate the diagrams of Fig. \ref{fig:electron_EDM_long-distance}.
It is convenient to describe the $|\Delta S|=0$ vector meson interactions with the hidden local symmetry (HLS) \cite{Bando:1984ej,Bando:1984pw,Fujiwara:1984mp,Bando:1985rf,Bando:1987br,Meissner:1987ge,Kaiser:1990yf,Harada:1992np,Klingl:1996by,Harada:2000kb,Harada:2003jx}.
The HLS is a framework introduced to extend the domain of applicability of chiral perturbation to include vector meson resonances, and it is successful in phenomenology \cite{Harada:2003jx}.
The effective Lagrangian for three vector mesons is given by
\begin{align}
{\cal L}_{3V}&=ig{\rm tr}
\left[\left(\partial_\mu V_\nu-\partial_\nu V_\mu\right) V^\mu V^\nu\right],
\label{eq:LVVV}
\end{align}
where the vector meson matrix $V^\mu$ is given by
\begin{align}
V^\mu&=\left(
\begin{array}{ccc}
\frac{\rho^0}{\sqrt{2}}+\frac{\omega}{\sqrt{2}}&\rho^+ &K^{\ast+} \\
\rho^-&-\frac{\rho^0}{\sqrt{2}}+\frac{\omega}{\sqrt{2}} &K^{\ast 0} \\
K^{\ast -}& \bar{K}^{\ast 0}&\phi \\
\end{array}
\right)^\mu,
\end{align}
where $g=m_\rho/(2f_\pi)$ with the pion decay constant $f_\pi=93$ MeV.
The effective Lagrangian for vector meson and photon
is given by~\cite{Klingl:1996by}
\begin{align}
{\cal L}_{\gamma V}&=-\sqrt{2}\frac{em^2_\rho}{g_\gamma}A_\mu {\rm tr}(QV^\mu)
=-\frac{em^2_\rho}{g_\gamma}A_\mu
\left(\rho^{0\mu}+\frac{1}{3}\omega^\mu-\frac{\sqrt{2}}{3}\phi^\mu \right),
\end{align}
where $g_\gamma=5.7$
and
\begin{align}
Q&=\left(
\begin{array}{ccc}
\frac{2}{3}&0 &0 \\
0&-\frac{1}{3} &0 \\
0& 0& -\frac{1}{3}\\
\end{array}
\right).
\end{align}
\subsection{$K^*$-lepton interaction}
Let us now model the weak interaction at the hadron level.
From Fig. \ref{fig:electron_EDM_long-distance}, the $|\Delta S|=1$ weak interaction appears in the $K^*$-lepton interaction and in the interacting vertices between $K^*$ and other vector mesons.
Since the neutrino cannot appear in Fig. \ref{fig:electron_EDM_long-distance}, the interaction between $K^*$ and the charged lepton must be at least a one-loop level process at the quark level.
Then the best solution is to attribute the CKM matrix elements $V_{cs}V_{cd}^*$ or $V_{ts}V_{td}^*$ to the $K^*$-lepton interaction, and $V_{ud}V_{us}^*$ to the $K^*$-vector meson interactions.
The latter attribution will maximize the $|\Delta S|=1$ vector meson interactions, since $V_{ud}V_{us}^*$ is given from the tree level $|\Delta S|=1$ four-quark interaction.
\begin{figure}[htb]
\begin{center}
\includegraphics[width=15cm]{semileptonic_one-loop.pdf}
\caption{
Short distance contribution to the $\Delta S=-1$
semileptonic ($K^*$-charged lepton) interaction.
Here we have $l=e,\mu , \tau$.
}
\label{fig:semileptonic_one-loop}
\end{center}
\end{figure}
The parity violating effective interaction between $K^*$ and the charged lepton is given by
\begin{equation}
{\cal L}_{K^*ll}
=
g_{K^*ll}
K^{*}_\mu
\bar l \gamma^\mu \gamma_5 l
+ {\rm (H.c.)}
,
\end{equation}
where $K^*_\mu$ is the field operators of the $K^*$ meson.
In the zero momentum exchange limit, the coupling constant is given by
\begin{equation}
{\rm Im} ( g_{K^*ll} ) \varepsilon^{K^{*}}_\mu
=
{\rm Im} ( V_{ts}^*V_{td} )
\langle 0 | \bar s \gamma_\mu d | K^* \rangle
I_{dsll}
,
\end{equation}
where we fixed the complex phases of $V_{ud}V_{us}^*$ to be real.
The $K^*$ meson matrix element is given by
\begin{equation}
\langle 0 | \bar s \gamma_\mu d | K^* \rangle = m_{K^*} f_{K^*} \varepsilon^{K^{*}}_\mu
,
\end{equation}
where $\varepsilon^{K^{*}}_\mu $, $m_{K^*}=890$ MeV and $f_{K^*}= 204$ MeV \cite{Neubert:1997uc,Grossmann:2015lea,Straub:2015ica,Chang:2018aut} are the polarization vector, the mass, and the decay constant of $K^*$, respectively.
The quark level amplitude $I_{dsll}$ can be obtained by calculating the one-loop level diagrams of Fig. \ref{fig:semileptonic_one-loop}.
By neglecting all external momenta [which are $O(\Lambda_{\rm QCD})$] and imposing $m_t, m_W \gg m_c$, the amplitude of the diagrams of Fig. \ref{fig:semileptonic_one-loop} is given by
\begin{widetext}
\begin{eqnarray}
{\rm Im} ({\cal M}_{\rm (a)}^{K^\ast ll})
&\approx&
\frac{ - \alpha_{\rm QED}^2 {\rm Im} (V_{ts} V_{td}^* )}{
16
\sin^4 \theta_W}
\frac{m_t^2}{m_t^2-m_W^2}
\Biggl\{
\frac{1}{m_W^2}
+\frac{1}{m_t^2-m_W^2} \ln \,
\Biggl(
\frac{m_W^2}{m_t^2}
\Biggr)
\Biggr\}
\bar u_e \, \gamma^\mu \gamma_5 u_e \cdot
\bar u_d \, \gamma_\mu (1-\gamma_5) u_s
,
\label{eq:semileptonicamplitude1}
\\
{\rm Im} ({\cal M}_{\rm (b)}^{K^\ast ll})
&\approx &
\frac{-\alpha_{\rm QED}^2 {\rm Im} (V_{ts}V_{td}^*)
}{16 \sin^4 \theta_W \cos^2 \theta_W m_Z^2}
\bar u_e \gamma^\mu \gamma_5 u_e \, \bar u_d\gamma_\mu (1-\gamma_5) u_s
\nonumber\\
&&
\times
\frac{m_t^2}{m_t^2-m_W^2}
\left\{
\Biggl( \frac{1}{2} -\frac{2}{3} \sin^2 \theta_W \Biggr)
\ln \Biggl(\frac{m_W^2}{m_t^2} \Biggr)
-
\Biggl( \frac{1}{2} +\frac{2}{3} \sin^2 \theta_W \Biggr)
\Biggl[
1
+\frac{m_W^2}{m_t^2-m_W^2} \ln \,
\Biggl(
\frac{m_W^2}{m_t^2}
\Biggr)
\Biggr]
\right\}
,
\label{eq:semileptonicamplitude2}
\\
{\rm Im} ({\cal M}_{\rm (c)}^{K^\ast ll})
&\approx &
\frac{
3 \alpha_{\rm QED}^2 {\rm Im} (V_{ts}V_{td}^*)
}{
16
\sin^4 \theta_W m_Z^2}
\frac{m_t^2}{(m_W^2-m_t^2)^2}
\Biggl\{
m_W^2
-m_t^2
\Biggl[
1+\ln \,
\Biggl(
\frac{m_W^2}{m_t^2}
\Biggr)
\Biggr]
\Biggr\}
\,
\bar u_e \gamma^\mu \gamma_5 u_e
\cdot
\bar u_d \, \gamma_\mu (1-\gamma_5) u_s
,
\label{eq:semileptonicamplitude3}
\end{eqnarray}
\end{widetext}
where $\sin^2\theta_W = 0.23122$~\cite{Tanabashi:2018oca}.
The diagram (c) is the largest, but all of them are of the same order.
The numerical value of the total $I_{dsll}$ is
\begin{equation}
I_{dsll}
=
3.2 \times 10^{-8}\, {\rm GeV}^{-2}
,
\end{equation}
which is quite consistent in absolute value with that of the
na\"ive dimensional analysis
$I_{dsll} \sim \frac{\alpha_{\rm QED}^2}{4\sin^4 \theta_W m_W^2} \sim 4.3 \times 10^{-8}\, {\rm GeV}^{-2}$.
We note that Eqs. (\ref{eq:semileptonicamplitude1}), (\ref{eq:semileptonicamplitude2}), and (\ref{eq:semileptonicamplitude3}) all contain a factor of $\frac{m_t^2}{m_W^2-m_t^2}$ which is due to the GIM cancellation.
This shows that if we invert the up-type and down-type quarks, the resulting meson-charged lepton couplings will be suppressed by a factor of $m_D^2/m_W^2$ ($D=d,s,b$).
\subsection{
$|\Delta S|=1$ vector meson transition and three-vector meson interaction
}
We now model the $|\Delta S|=1$ vector meson transition and three-vector meson interaction using the factorization.
For that, we have to determine the Wilson coefficients of the quark level $|\Delta S|=1$ processes.
We chose the $|\Delta S|=1$ case because it is the only allowed flavor change at low energy scale.
At the scale just below the $W$ boson mass ($m_W = 80.4$ GeV), we have the following $|\Delta S| =1$ effective
Hamiltonian
\begin{eqnarray}
{\cal H}_{eff} (\mu = m_W)
&=&
\frac{G_F}{\sqrt{2}}
\Biggl\{
\sum_{i=1,2} C_i (\mu = m_W) [ V_{us}^* V_{ud} Q_i + V_{cs}^* V_{cd} Q_i^c ]
- \sum_{j=3}^6 C_j (\mu = m_W) V_{ts}^* V_{td} Q_j
\Biggr\}
+{\rm H.c.}
,\ \ \ \
\label{eq:effhamimw}
\end{eqnarray}
with the Fermi constant $G_F = 1.16637 \times 10^{-5} {\rm GeV}^{-2}$ \cite{Tanabashi:2018oca}.
Here $Q^q_1$, $Q^c_1$, $Q^q_2$, $Q^c_2$, and $Q_j$ ($j=3 \sim 6$) are defined as \cite{Buras:1991jm,Buchalla:1995vs}
\begin{eqnarray}
Q_1
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) u_\beta
\,
\bar u_\beta \gamma_\mu (1-\gamma_5) d_\alpha
,
\label{eq:q1}
\\
Q_1^c
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) c_\beta
\,
\bar c_\beta \gamma_\mu (1-\gamma_5) d_\alpha
,
\label{eq:q1c}
\\
Q_2
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) u_\alpha
\,
\bar u_\beta \gamma_\mu (1-\gamma_5) d_\beta
,
\label{eq:q2}
\\
Q_2^c
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) c_\alpha
\,
\bar c_\beta \gamma_\mu (1-\gamma_5) d_\beta
,
\label{eq:q2c}
\\
Q_3
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) d_\alpha
\,
\sum_q^{N_f} \bar q_\beta \gamma_\mu (1-\gamma_5) q_\beta
,
\label{eq:q3}
\\
Q_4
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) d_\beta
\,
\sum_q^{N_f} \bar q_\beta \gamma_\mu (1-\gamma_5) q_\alpha
,
\label{eq:q4}
\\
Q_5
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) d_\alpha
\,
\sum_q^{N_f} \bar q_\beta \gamma_\mu (1+\gamma_5) q_\beta
,
\label{eq:q5}
\\
Q_6
&\equiv &
\bar s_\alpha \gamma^\mu (1-\gamma_5) d_\beta
\,
\sum_q^{N_f} \bar q_\beta \gamma_\mu (1+\gamma_5) q_\alpha
,
\label{eq:q6}
\end{eqnarray}
where $\alpha$ and $\beta$ are the fundamental color indices, and the summation over $N_f$ goes up to the allowed flavors at the given scale.
The Hamiltonian of Eq. (\ref{eq:effhamimw}) keeps the same form down to $\mu = m_c$, but the Wilson coefficients run in the change of the scale.
The running is calculated in the next-to-leading order logarithmic approximation (NLLA) \cite{Buras:1991jm,Buchalla:1995vs,Yamanaka:2015ncb}.
Below $\mu = m_c$, the charm quark is integrated out.
The resulting $|\Delta S| =1$ effective Hamiltonian
becomes
\begin{equation}
{\cal H}_{eff} (\mu)
=
\frac{G_F}{\sqrt{2}} V_{us}^* V_{ud}
\sum_{i=1}^6
z_i (\mu) Q_i (\mu)
+ {\rm H.c.}
.
\label{eq:effhamibelowmc}
\end{equation}
Here we quote the values of Refs. \cite{Yamanaka:2015ncb,Yamanaka:2016fjj}:
\begin{equation}
{\bf z} (\mu = 1 \, {\rm GeV})
=
\left(
\begin{array}{c}
-0.107 \cr
1.02 \cr
1.76 \times 10^{-5} \cr
-1.39 \times 10^{-2} \cr
6.37 \times 10^{-3} \cr
-3.45 \times 10^{-3} \cr
\end{array}
\right)
.
\end{equation}
We see that the Wilson coefficient of $Q_2$ is the largest.
This is because $Q_2$ is the sole tree level operator at $\mu =m_W$, and the others were radiatively generated.
Here we point that the coefficient of $Q_1$ is also important since the contribution of $Q_2$ obtains a factor of $1/N_c$ after the Fierz rearrangement of the color (see below).
The operators $Q_i$ ($i=3,\cdots 6$) cannot be neglected either, because they generate the $\phi$ meson which is impossible with $Q_1$ and $Q_2$.
We also note that $Q_5$ and $Q_6$, after Fierz transformation, couple to the chiral condensate which may enhance the overall effect (see below).
For the calculation of the crossing symmetric contribution, it is convenient to Fierz transform the $|\Delta S|=1$ four-quark operators $Q_i$ ($i=1,\cdots 6$).
The Fierz transform of Eqs. (\ref{eq:q1}), (\ref{eq:q2}), (\ref{eq:q3}), (\ref{eq:q4}), (\ref{eq:q5}), and (\ref{eq:q6}) are
\begin{eqnarray}
Q_1
&=&
\frac{1}{3}
\bar s \gamma^\mu (1-\gamma_5) u \, \bar u \gamma_\mu (1-\gamma_5) d
+2
\sum_a \bar s \gamma^\mu (1-\gamma_5) t_a u \, \bar u \gamma_\mu (1-\gamma_5) t_a d
\nonumber\\
&=&
\bar s \gamma_\mu (1-\gamma_5) d \, \bar u \gamma^\mu (1-\gamma_5) u
,
\label{eq:q1fierz}
\\
Q_2
&=&
\frac{1}{3} \bar s \gamma_\mu (1-\gamma_5) d \, \bar u \gamma^\mu (1-\gamma_5) u
+ 2 \sum_{a=1}^8 \bar s \gamma_\mu (1-\gamma_5) t_a d \, \bar q \gamma^\mu (1-\gamma_5) t_a q
,
\label{eq:q2fierz}
\\
Q_3
&=&
\frac{1}{3} \sum_{q=u,d,s} \bar s \gamma_\mu (1-\gamma_5) q \, \bar q \gamma^\mu (1-\gamma_5) d
+ 2 \hspace{-0.5em} \sum_{q=u,d,s} \sum_{a=1}^8 \bar s \gamma_\mu (1-\gamma_5) t_a q \, \bar q \gamma^\mu (1-\gamma_5) t_a d
,
\ \ \ \ \
\label{eq:q3fierz}
\\
Q_4
&=&
\frac{1}{3}
\bar s \gamma^\mu (1-\gamma_5) d \, \sum_{q=u,d,s} \bar q \gamma_\mu (1-\gamma_5) q
+2
\sum_a \bar s \gamma^\mu (1-\gamma_5) t_a d \, \sum_{q=u,d,s} \bar q \gamma_\mu (1-\gamma_5) t_a q
\nonumber\\
&=&
\sum_{q=u,d,s} \bar s \gamma_\mu (1-\gamma_5) q \, \bar q \gamma^\mu (1-\gamma_5) d
,
\label{eq:q4fierz}
\\
Q_5
&=&
-\frac{2}{3} \sum_{q=u,d,s} \bar s (1+\gamma_5) q \, \bar q (1-\gamma_5) d
- 4 \sum_{q=u,d,s} \sum_a \bar s (1+\gamma_5) t_a q \, \bar q (1-\gamma_5) t_a d
,
\label{eq:q5fierz}
\\
Q_6
&=&
\frac{1}{3}
\bar s \gamma^\mu (1-\gamma_5) d \sum_{q=u,d,s} \bar q \gamma_\mu (1+\gamma_5) q
+2
\sum_a \bar s \gamma^\mu (1-\gamma_5) t_a d \sum_{q=u,d,s} \bar q \gamma_\mu (1+\gamma_5) t_a q
\nonumber\\
&=&
-2 \sum_{q=u,d,s} \bar s (1+\gamma_5) q \, \bar q (1-\gamma_5) d
,
\label{eq:q6fierz}
\end{eqnarray}
where $t_a$ is the generator of the color $SU(3)_c$ group.
The summation over the fundamental color indices runs inside each Dirac bilinear, so the indices ($\alpha$ and $\beta$) have been omitted.
As for Eqs. (\ref{eq:q1fierz}), (\ref{eq:q4fierz}), and (\ref{eq:q6fierz}), we also displayed in the first equalities the Fierz rearrangement of the fundamental color indices to form color singlet Dirac bilinears.
We note that an additional minus sign contributes due to the anticommutation of fermion operators.
This sign change is important since there may be interference with crossing symmetric graphs.
\begin{figure}[htb]
\begin{center}
\includegraphics[width=18cm]{factorization_full.pdf}
\caption{
Factorization of the $|\Delta S|=1$ vector meson vertices ($|\Delta S|=1$ meson transition), with (a) the two-quark process, (b) the one-quark process, and (c) three-meson interaction.
The double crosses with "$\langle \bar q q \rangle$" denote the chiral condensate $\langle 0 | \bar q q |0 \rangle$ ($q=d,s$).
The black blob denotes the $|\Delta S| =1$ four-quark interaction.
There are similar diagrams with the $\rho$ meson replaced by $\omega$ and $\phi$ mesons.
}
\label{fig:factorization}
\end{center}
\end{figure}
We use the standard factorization to derive the $|\Delta S| =1$ vector meson interaction from the $|\Delta S| =1$ four-quark interaction of Eq. (\ref{eq:effhamibelowmc}).
We first construct the $|\Delta S| =1$ meson transition in the factorization with vacuum saturation approximation \cite{Lee:1972px,Shrock:1978dm}.
It works as
\begin{eqnarray}
\langle \rho | \bar s \gamma^\mu d \, \bar q \gamma_\mu q | K^* \rangle
&\approx&
\langle 0 | \bar s \gamma^\mu d | K^* \rangle \langle \rho | \bar q \gamma_\mu q | 0 \rangle
,
\label{eq:vacuumsaturation1}
\\
\langle \rho | \bar s d \, \bar d d | K^* \rangle
&\approx&
\langle \rho | \bar s d | K^* \rangle \langle 0 | \bar d d | 0 \rangle
,
\label{eq:vacuumsaturation2}
\end{eqnarray}
where $q=u,d$.
We note that the vacuum saturation approximation gives the leading contribution in the large $N_c$ expansion in the mesonic sector.
The $|\Delta S| =1$ four-quark interaction has two distinct contributions, as shown in
Figs. \ref{fig:factorization}(a) and \ref{fig:factorization}(b).
The first contribution (a) is the factorization into two meson tadpoles [see Eq. (\ref{eq:vacuumsaturation1})].
It requires the decay constants of vector mesons, as
\begin{eqnarray}
\langle 0 | \bar u \gamma_\mu u | \rho \rangle
&=&
\frac{1}{\sqrt{2}} \varepsilon_\mu m_\rho f_\rho
,
\\
\langle 0 | \bar d \gamma_\mu d | \rho \rangle
&=&
-\frac{1}{\sqrt{2}}\varepsilon_\mu m_\rho f_\rho
,
\\
\langle 0 | \bar q \gamma_\mu q | \omega \rangle
&=&
\frac{1}{\sqrt{2}}\varepsilon_\mu m_\omega f_\omega
\ \ \ (q=u,d)
,
\\
\langle 0 | \bar s \gamma_\mu s | \phi \rangle
&=&
\varepsilon_\mu m_\phi f_\phi
,
\end{eqnarray}
where $\varepsilon_\mu$ is the polarization of the vector meson, and $m_\rho = 770$ MeV, $ f_\rho = 216$ MeV, $m_\omega = 783$ MeV, $ f_\omega = 197$ MeV, $m_\phi = 1020$ MeV, and $ f_\phi = 233$ MeV \cite{Neubert:1997uc,Jansen:2009hr,Grossmann:2015lea,Straub:2015ica,Chang:2018aut,Sun:2018cdr}.
The second contribution [Fig. \ref{fig:factorization} (b)] is the factorization into scalar matrix elements [see Eq. (\ref{eq:vacuumsaturation2})].
It appears from the Fierz transformation of $Q_5$ and $Q_6$.
The chiral condensates relevant in this regard are
$\langle 0 | \bar ss | 0 \rangle \approx \langle 0 | \bar dd | 0 \rangle \approx -\frac{m_\pi^2 f_\pi^2}{m_u+m_d} \approx -(269\, {\rm MeV})^3$ \cite{McNeile:2012xh}.
They are obtained at the appropriate renormalization scale $\mu = 1$ GeV with $m_u \approx 2.7$ MeV and $m_d \approx 5.9$ MeV \cite{Tanabashi:2018oca}, calculated in the two-loop level renormalization group evolution \cite{Tarasov:1980au,Gorishnii:1983zi}.
The scalar matrix element of the vector meson is derived by using the result of the calculation of the chiral extrapolation of the vector meson mass in lattice QCD \cite{Leinweber:2001ac,Rios:2008zr,Bavontaweepanya:2018yds,Guo:2018zvl,Molina:2020xxx}.
As derived in Appendix~\ref{sec:scalar_matrix_elements},
we obtain
\begin{align}
B_{\rho K^\ast} &\equiv \langle \rho^0 |\bar{s}d|K^{\ast 0}\rangle =-1.14 \,\, \text{GeV}, \\
B_{\omega K^\ast} &\equiv \langle \omega |\bar{s}d|K^{\ast 0}\rangle=1.88 \,\, \text{GeV}, \\
B_{\phi K^\ast} &\equiv \langle \phi |\bar{d}s|K^{\ast 0}\rangle=2.14 \,\, \text{GeV}.
\end{align}
By using the above parameters,
the lagrangian of the weak vector meson transition is given by
\begin{eqnarray}
{\cal L}_{V K^*}
&=&
V_{ud}V_{us}^*
\hspace{-0.5em}
\sum_{V = \rho , \omega , \phi}
\hspace{-0.5em}
g_{ V K^*} {V}^\nu K^*_\nu
+{\rm H.c.}
,
\label{eq:meson-transition}
\end{eqnarray}
where $\rho^\nu$, $\omega^\nu$ and $\phi^\nu$ are the field operators of the
$\rho^0$, $\omega$, and $\phi$ mesons, respectively.
The coupling constants are given by
\begin{eqnarray}
g_{ \rho K^*}
&=&
\frac{G_F}{\sqrt{2}}
\biggl[
\biggl(
z_1 +\frac{1}{3}z_2
-\frac{1}{3}z_3 - z_4
\biggr)
m_{K^*} f_{K^*}
m_\rho \frac{f_\rho}{\sqrt{2}}
-
\biggl(
\frac{2}{3} z_5 + 2 z_6
\biggr)
B_{\rho K^\ast}
\langle 0 | \bar s s+\bar dd | 0 \rangle
\biggr]
\nonumber\\
&=&
4.4 \times 10^{-8} {\rm GeV}^2
,
\\
g_{ \omega K^*}
&=&
\frac{G_F}{\sqrt{2}}
\biggl[
\biggl(
z_1 +\frac{1}{3}z_2
+\frac{7}{3}z_3 +\frac{5}{3}z_4
+2 z_5 + \frac{2}{3} z_6
\biggr)
m_{K^*} f_{K^*}
m_\omega \frac{f_\omega}{\sqrt{2}}
-\biggl(
\frac{2}{3} z_5 + 2 z_6
\biggr)
B_{\omega K^\ast}
\langle 0 | \bar s s+\bar dd | 0 \rangle
\biggr]
\nonumber\\
&=&
3.4 \times 10^{-8} {\rm GeV}^2
,
\\
g_{ \phi K^*}
&=&
\frac{G_F}{\sqrt{2}}
\biggl[
\biggl(
\frac{4}{3}z_3 +\frac{4}{3}z_4
+z_5 + \frac{1}{3} z_6
\biggr)
m_{K^*} f_{K^*}
m_\phi f_\phi
-\biggl(
\frac{2}{3} z_5 + 2 z_6
\biggr)
B_{\phi K^\ast}
\langle 0 | \bar s s+\bar dd | 0 \rangle
\biggr]
\nonumber\\
&=&
-6.6 \times 10^{-9} {\rm GeV}^2
.
\end{eqnarray}
Let us also construct the weak three-meson interactions.
Again by using the vacuum saturation approximation, we have
\begin{eqnarray}
\langle \rho \, | \bar q \gamma_\mu q\, \bar s \gamma^\mu d | K^* \rho \rangle
&\approx&
\langle 0 | \bar q \gamma_\mu q | \rho \rangle \langle \rho | \bar s \gamma^\mu d | K^* \rangle
,
\ \ \ \
\label{eq:vacuumsaturation3}
\end{eqnarray}
with $q=u,d$.
The weak three-vector meson interaction is then
\begin{eqnarray}
&&
{\cal L}^V_{V' K^*}
=
V_{ud} V_{us}^*
\hspace{-1em}
\sum_{V,V'=\rho , \omega , \phi}
\hspace{-1em}
g^V_{ V' K^*} V_\mu {V'}^\nu i \overleftrightarrow \partial^\mu K^*_\nu
+{\rm H.c.}
, \ \ \
\label{eq:three-meson}
\end{eqnarray}
where $A \overleftrightarrow \partial^\mu B \equiv A (\partial^\mu B) - (\partial^\mu A) B$.
The coupling constants are given by
\begin{eqnarray}
g^\rho_{ V' K^*}
&=&
\frac{G_F}{\sqrt{2}}
\biggl[
z_1 +\frac{1}{3} z_2
-\frac{1}{3}z_3 - z_4
\biggr]
m_{\rho} \frac{f_{\rho}}{\sqrt{2}} c_{V^\prime K^\ast}
\nonumber\\
&=&
( 2.4 \times 10^{-7} ) \times c_{V^\prime K^\ast}
,
\\
g^\omega_{ V' K^*}
&=&
\frac{G_F}{\sqrt{2}}
\biggl[
z_1 +\frac{1}{3} z_2
+\frac{7}{3}z_3 + \frac{5}{3} z_4
+2 z_5 +\frac{2}{3} z_6
\biggr]
m_{\omega} \frac{f_{\omega}}{\sqrt{2}} c_{V^\prime K^\ast}
\nonumber\\
&=&
( 2.0 \times 10^{-7} ) \times c_{V^\prime K^\ast}
,
\\
g^\phi_{ V' K^*}
&=&
\frac{G_F}{\sqrt{2}}
\biggl[
\frac{4}{3} z_3 +\frac{4}{3} z_4
+z_5 + \frac{1}{3} z_6
\biggr]
m_{\phi} f_{\phi} c_{V^\prime K^\ast}
\nonumber\\
&=&
( -2.6 \times 10^{-8} )\times c_{V^\prime K^\ast}
,
\label{eq:three-meson-coupling}
\end{eqnarray}
where $V' = \rho , \omega , \phi$.
The coefficients $c_{V^\prime K^\ast}$ are obtained as
the relative strength of the meson transition ${\rm Tr}[V^\mu T^\dagger V_\mu + V^{\mu\dagger} T V^\dagger_\mu]$,
where $T$ is the SU(3) ladder operator given by the Gell-Mann matrices
$\lambda_a$ $(a=1,...,8)$ as
$T=\frac{1}{2\sqrt{2}}(\lambda_6+i\lambda_7)$.
As a result, we obtain $c_{\rho K^\ast}=1/\sqrt{2}$, $c_{\omega K^\ast}=-1/\sqrt{2}$ and $c_{\phi K^\ast} = -1$.
For the amplitudes of the weak three-vector meson interaction,
we used the approximate relation $\langle \rho (p') | \bar s \gamma^\mu d | K^* (p) \rangle \approx -(p^\mu + p'^\mu)\varepsilon^{(\rho)\nu} \varepsilon^{(K^*)*}_\nu$.
\subsection{One-loop level calculation of the EDM of charged leptons}
In this subsection, we
perform the one-loop level calculation of the lepton EDM which is given by the amplitudes
shown in Fig.~\ref{fig:electron_EDM_long-distance}.
The diagrams in
Figs.~\ref{fig:electron_EDM_long-distance}(a) and \ref{fig:electron_EDM_long-distance}(a$^\prime$)
are the contribution with the weak interaction of three vector mesons, while the diagrams in Figs.~\ref{fig:electron_EDM_long-distance} (b) and (b$^\prime$) are that with the strong interaction.
The scattering amplitudes with the weak three-meson interaction
in Figs.~\ref{fig:electron_EDM_long-distance} (a) and (a$^\prime$)
are given by
\begin{align}
i{\cal M}^{K^\ast}_{(a)}
=&
- ieJm_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho,\omega,\phi}
\frac{c_Vc_{V^\prime} }{q^2-m^2_{V}}
\notag\\
& \times
\int\frac{d^4 k}{(2\pi)^4}
\frac{\bar{u}_{l}(p-q)\gamma_\mu[({p\hspace{-5pt}/}-{k\hspace{-6pt}/})+m_l]
\left[g^{V}_{V^\prime K^\ast}(2k-q)\cdot\varepsilon\gamma^\mu +g^{V^\prime}_{V K^\ast}(k+q)^\mu{{\varepsilon}\hspace{-5pt}/}\right]\gamma_5u_{l}(p)}{(k-q)^2[(p-k)^2-m^2_{l}] [(k-q)^2-m^2_{V^\prime}][k^2-m^2_{K^\ast}]}, \label{eq:amp_a_Kast} \\
i{\cal M}^{K^\ast}_{(a^\prime)}=&
+ ieJm_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho,\omega,\phi}
\frac{c_Vc_{V^\prime} }{q^2-m^2_{V}}
\notag\\
& \times
\int\frac{d^4 k}{(2\pi)^4}
\frac{\bar{u}_{l}(p-q)\gamma_\mu[({p\hspace{-5pt}/}-{k\hspace{-6pt}/})-m_l]
\left[g^{V}_{V^\prime K^\ast}(2k-q)\cdot\varepsilon\gamma^\mu +g^{V^\prime}_{V K^\ast}(k-2q)^\mu{{\varepsilon}\hspace{-5pt}/}\right]\gamma_5u_{l}(p)}{k^2[(p-k)^2-m^2_{l}] [k^2-m^2_{V^\prime}][(k-q)^2-m^2_{K^\ast}]} . \label{eq:amp_aprime_Kast}
\end{align}
The masses of leptons ($l=e,\mu,\tau$) are given by
$m_e = 0.510 998 950$ MeV,
$m_\mu = 0.105658$ GeV, and $m_\tau = 1.77686$ GeV~\cite{Tanabashi:2018oca}.
The coefficients $c_V, c_{V^\prime}$ are $c_\rho=1$, $c_\omega=1/3$, $c_\phi=-\sqrt{2}/3$.
In the soft photon limit ($q^2 \sim 0$, $p\cdot q\sim 0$), the denominators of the integrands
in Eqs.~\eqref{eq:amp_a_Kast}-\eqref{eq:amp_aprime_Kast} are rewritten as
\begin{align}
&\frac{1}{(k-q)^2[(p-k)^2-m^2_{l}] [(k-q)^2-m^2_{V^\prime}][k^2-m^2_{K^\ast}]}
=\Gamma(4) \int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\frac{1}{[\ell^2_a-\Delta_a]^4}, \\
&\frac{1}{k^2[(p-k)^2-m^2_{l}] [k^2-m^2_{V^\prime}][(k-q)^2-m^2_{K^\ast}]}
=\Gamma(4) \int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\frac{1}{[\ell^2_{a^\prime}-\Delta_a]^4},
\end{align}
where
\begin{align}
\ell^\mu_a&=k^\mu-z_3p^\mu-(z_1-z_3)q^\mu, \\
\ell^\mu_{a^\prime}&=k^\mu-z_3p^\mu-(1-
z_1
)q^\mu , \\
\Delta_a&=
m^2_{K^\ast}+(m^2_{V^\prime}-m^2_{K^\ast})z_1-m^2_{V^\prime}z_2+m^2_{l}z^2_3 .
\end{align}
The numerators of the integrands in Eqs.~\eqref{eq:amp_a_Kast}-\eqref{eq:amp_aprime_Kast} are reduced to
\begin{align}
&\bar{u}_l(p-q)\gamma_\mu [({p\hspace{-5pt}/}-{k\hspace{-6pt}/})+
m_l ]
\left[g^{V}_{V^\prime K^\ast}(2k-q)\cdot\varepsilon\gamma^\mu
+g^{V^\prime}_{V K^\ast}(k+q)_\mu {{\varepsilon}\hspace{-5pt}/}
\right]\gamma_5u_{l}(p) \notag\\
&=\bar{u}_l(p-q)
\left[ 4 g^{V}_{V^\prime K^\ast} m_l z_3 (3-2z_1+z_3) p\cdot\varepsilon
+ g^{V^\prime}_{V K^\ast} m_l z_3 \left(2 p\cdot\varepsilon +{q\hspace{-5pt}/}{{\varepsilon}\hspace{-5pt}/}\right)
\right]
\gamma_5u_{l}(p) + \cdots \\
& \bar{u}_{l}(p-q)\gamma_\mu[({p\hspace{-5pt}/}-{k\hspace{-6pt}/})-m_l]
\left[g^{V}_{V^\prime K^\ast}(2k-q)\cdot\varepsilon\gamma^\mu +g^{V^\prime}_{V K^\ast}(k-2q)^\mu{{\varepsilon}\hspace{-5pt}/}\right]\gamma_5u_{l}(p) \notag\\
&=
-\bar{u}_{l}(p-q) \left[
4g^{V}_{V^\prime K^\ast} m_l z_3(3-2z_1+z_3)p\cdot\varepsilon
+g^{V^\prime}_{V K^\ast} m_l (3z_3-2z_1-2){q\hspace{-5pt}/}{{\varepsilon}\hspace{-5pt}/}
\right] \gamma_5u_{l}(p) + \cdots
\end{align}
where the terms which do not contribute to the EDM are suppressed.
By performing the integrals with respect to $\ell_a$ and $\ell_{a^\prime}$
for Eqs.~\eqref{eq:amp_a_Kast}-\eqref{eq:amp_aprime_Kast},
the amplitudes for Eqs.~\eqref{eq:amp_a_Kast}-\eqref{eq:amp_aprime_Kast}
are reduced to
\begin{align}
i{\cal M}^{K^\ast}_{(a)}=& - \frac{i}{(4\pi)^2}em_l Jm_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho,\omega,\phi}\frac{c_V c_{V^\prime}}{m^2_V}\bar{u}_{l}(p-q) \notag\\
&\times \left[
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3
\frac{2g^{V}_{V^\prime K^\ast}
z_3(3-2z_1+z_3)
+2g^{V^\prime}_{V K^\ast}
z_3
}{\Delta^2_a}\right]
\sigma^{\mu\nu}q_\nu\varepsilon_\mu\gamma_5 u_{l}(p) , \label{eq:amp_a_final} \\
i{\cal M}^{K^\ast}_{(a^\prime)}=& - \frac{i}{(4\pi)^2}em_l Jm_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho,\omega,\phi}\frac{c_V c_{V^\prime}}{m^2_V}\bar{u}_{l}(p-q) \notag\\
&\times \left[
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3
\frac{2g^{V}_{V^\prime K^\ast}
z_3(3-2z_1+z_3)
+g^{V^\prime}_{V K^\ast}
(3z_3-2z_1-2)
}{\Delta^2_a}\right]
\sigma^{\mu\nu}q_\nu\varepsilon_\mu\gamma_5 u_{l}(p) , \label{eq:amp_aprime_final}
\end{align}
respectively, where we use the Gordon identity
\begin{align}
\bar{u}_l(p-q)\left[(2p-q)^\mu-i\sigma^{\mu\nu}q_\nu\right]\gamma_5u_l(p)=0 .
\end{align}
The integrals in Eqs.~\eqref{eq:amp_a_final} and \eqref{eq:amp_aprime_final},
\begin{align}
I^{(a)}_1 &=
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\frac{z_3(3-2z_1+z_3)}{\Delta^2_a} \label{eq:I(a)_1} \\
I^{(a)}_2 &=
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\frac{z_3}{\Delta^2_a} \label{eq:I(a)_2} \\
I^{(a^\prime)}_2 &=
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3
\frac{3z_3-2z_1-2}{\Delta^2_a}
\label{eq:I(aprime)_2}
\end{align}
are performed numerically, with the results summarized in Table~\ref{table:Numerical_integral_a}.
For $I^{(a)}_2$, the analytic form is obtained as shown in Appendix~\ref{sec:Ia2}.
\begin{table}[htbp]
\caption{\label{table:Numerical_integral_a} Numerical values of the integrals in Eqs.~\eqref{eq:I(a)_1}-\eqref{eq:I(aprime)_2} for the leptons
$l=e,\mu,\tau$ and the vector mesons $V^\prime=\rho^0,\omega,\phi$,
given in units of GeV$^{-4}$.}
\begin{center}
\begin{tabular}{c|ccc||c|ccc||c|ccc}
\hline
$I^{(a)}_1$&$\rho^0$ &$\omega$ &$\phi$
&$I^{(a)}_{2}$ &$\rho^0$ &$\omega$ &$\phi$
&$I^{(a^\prime)}_{2}$ &$\rho^0$ &$\omega$ &$\phi$
\\ \hline
$e$& 23.3&22.6 &13.6
& $e$& 14.1& 13.6& 8.20
& $e$& -82.1& -79.6& -47.6
\\
$\mu$& 4.82 & 4.70& 3.03
& $\mu$& 2.97& 2.89& 1.85
& $\mu$& -25.9& -25.2& -15.5
\\
$\tau$& 0.209& 0.206& 0.153
& $\tau$& 0.137& 0.134& 0.0972
& $\tau$& -4.68& -4.56& -2.96
\\ \hline
\end{tabular}
\end{center}
\end{table}
The amplitudes $i{\cal M}^{K^\ast}_{(a)}$ and $i{\cal M}^{K^\ast}_{(a^\prime)}$ are for the contributions with the $K^\ast$ propagator.
In addition, the amplitudes with the $\bar{K}^\ast$ propagator, denoted by $i{\cal M}^{\bar{K}^\ast}_{(a)}$ and $i{\cal M}^{\bar{K}^\ast}_{(a^\prime)}$,
also contribute to the EDM.
If we restrict to the CP violation, we have
$i{\cal M}^{\bar{K}^\ast}_{(a)} = i{\cal M}^{K^\ast}_{(a)}$ and $i{\cal M}^{\bar{K}^\ast}_{(a^\prime)} = i{\cal M}^{K^\ast}_{(a^\prime)}$.
Thus the total scattering amplitude with the weak three-vector meson interactions is given by
\begin{align}
i{\cal M}^{\rm SM}_{(a)} & = i{\cal M}_{(a)} + i{\cal M}_{(a^\prime)}, \label{eq:amp_MaSM}
\end{align}
where
\begin{align}
i{\cal M}_{(a)}
&=i{\cal M}^{K^\ast}_{(a)} + i{\cal M}^{\bar{K}^\ast}_{(a)}
= 2i{\cal M}^{K^\ast}_{(a)} , \label{eq:amp_Ma} \\
i{\cal M}_{(a^\prime)}
&=i{\cal M}^{K^\ast}_{(a^\prime)} + i{\cal M}^{\bar{K}^\ast}_{(a^\prime)}
= 2i{\cal M}^{K^\ast}_{(a^\prime)}. \label{eq:amp_Maprime}
\end{align}
In a similar manner,
the charged lepton EDM contributions with the strong three-vector meson interactions
shown in
Figs.~\ref{fig:electron_EDM_long-distance}$(b)$ and \ref{fig:electron_EDM_long-distance}($b^\prime$)
are also calculated.
The scattering amplitudes of the diagrams $(b)$ and $(b^\prime)$ are obtained as
\begin{align}
i{\cal M}^{K^\ast}_{(b)} = i{\cal M}^{\bar{K}^\ast}_{(b)}
=& - ieJm_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho^0,\omega,\phi}
\frac{c_Vc_{V^\prime} }{q^2-m^2_{V}} g_V g_{V^\prime K^\ast}
\notag\\
& \times
\int\frac{d^4 k}{(2\pi)^4}
\frac{\bar{u}_{l}(p-q)\gamma_\mu[({p\hspace{-5pt}/}-{k\hspace{-6pt}/})+m_l]
\left[
(2k-q)\cdot\varepsilon \gamma^\mu +\varepsilon^\mu (2{q\hspace{-5pt}/}-{k\hspace{-6pt}/})
-(k+q)^\mu{{\varepsilon}\hspace{-5pt}/}
\right]\gamma_5u_{l}(p)}{(k-q)^2[(p-k)^2-m^2_{l}] [(k-q)^2-m^2_{V^\prime}]
[(k-q)^2-m^2_{K^\ast}][k^2-m^2_{K^\ast}]}, \label{eq:amp_b_Kast} \\
i{\cal M}^{K^\ast}_{(b^\prime)} = i{\cal M}^{\bar{K}^\ast}_{(b^\prime)} =&
ieJm_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho^0,\omega,\phi}
\frac{c_Vc_{V^\prime} }{q^2-m^2_{V}} g_V g_{V^\prime K^\ast}
\notag\\
& \times
\int\frac{d^4 k}{(2\pi)^4}
\frac{\bar{u}_{l}(p-q)\gamma_\mu[({p\hspace{-5pt}/}-{k\hspace{-6pt}/})-m_l]
\left[
(2k-q)\cdot\varepsilon \gamma^\mu +\varepsilon^\mu (2{q\hspace{-5pt}/}-{k\hspace{-6pt}/})
-(k+q)^\mu{{\varepsilon}\hspace{-5pt}/}
\right]\gamma_5u_{l}(p)}{k^2[(p-k)^2-m^2_{l}] [k^2-m^2_{V^\prime}]
[(k-q)^2-m^2_{K^\ast}][k^2-m^2_{K^\ast}]} .
\label{eq:amp_bprime_Kast}
\end{align}
The coupling constant $g_V$ ($V=\rho^0, \omega, \phi$) is defined as
$\sqrt{2}g_\rho = -\sqrt{2}g_\omega = g_\phi = g$.
In the soft photon limit,
the denominators of the integrands
in Eqs.~\eqref{eq:amp_b_Kast}-\eqref{eq:amp_bprime_Kast} are rewritten as
\begin{align}
&\frac{1}{(k-q)^2[(p-k)^2-m^2_{l}] [(k-q)^2-m^2_{V^\prime}][(k-q)^2-m^2_{K^\ast}][k^2-m^2_{K^\ast}]}
=\Gamma(5) \int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\int_{0}^{z_3}dz_4
\frac{1}{[\ell^2_b-\Delta_b]^5}, \\
&\frac{1}{k^2[(p-k)^2-m^2_{l}] [k^2-m^2_{V^\prime}][(k-q)^2-m^2_{K^\ast}][k^2-m^2_{K^\ast}]}
=\Gamma(5) \int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\int_{0}^{z_3}dz_4
\frac{1}{[\ell^2_{b^\prime}-\Delta_b]^5},
\end{align}
where
\begin{align}
\ell^\mu_b&=k^\mu-z_4p^\mu-(z_1-z_4)q^\mu, \\
\ell^\mu_{b^\prime}&=k^\mu-z_4p^\mu-(z_1-z_2)q^\mu, \\
\Delta_b&=
m^2_{K^\ast}+(m^2_{V^\prime}-m^2_{K^\ast})z_2-m^2_{V^\prime}z_3+m^2_{l}z^2_4 .
\end{align}
Performing the integrals with respect to $\ell_b$ and $\ell_{b^\prime}$,
Eqs.~\eqref{eq:amp_b_Kast}-\eqref{eq:amp_bprime_Kast} are reduced to
\begin{align}
i{\cal M}^{K^\ast}_{(b)}=& - \frac{ 4 i}{(4\pi)^2}eJ
m_l
m_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho^0,\omega,\phi}\frac{c_V c_{V^\prime}}{m^2_V} g_Vg_{V^\prime K^\ast}
\bar{u}_{l}(p-q) \notag\\
&\times \left[
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\int_{0}^{z_3}dz_4
\frac{
(1-z_1)(1-2z_4)+1-z_4^2
}{\Delta^3_b}\right]
\sigma^{\mu\nu}q_\nu\varepsilon_\mu\gamma_5 u_{l}(p) , \label{eq:amp_b_final} \\
i{\cal M}^{K^\ast}_{(b^\prime)}=& - \frac{ 4 i}{(4\pi)^2}eJ
m_l m_{K^\ast}f_{K^\ast}I_{dsll}\left(\frac{em^2_\rho}{g_\gamma}\right)^2
\sum_{V,V^\prime=\rho^0,\omega,\phi}\frac{c_V c_{V^\prime}}{m^2_V} g_Vg_{V^\prime K^\ast}
\bar{u}_{l}(p-q) \notag\\
&\times \left[
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\int_{0}^{z_3}dz_4
\frac{
(z_1-z_2)(1- 2 z_4) + 1-z_4^2
}{
\Delta^3_b
}\right]
\sigma^{\mu\nu}q_\nu\varepsilon_\mu\gamma_5 u_{l}(p) . \label{eq:amp_bprime_final}
\end{align}
The numerical results of the integrals
\begin{align}
I^{(b)} &=
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\int_{0}^{z_3}dz_4
\frac{
(1-z_1)(1-2z_4)+1-z_4^2
}{\Delta^3_b} , \label{eq:I(b)} \\
I^{(b^\prime)} & =
\int_{0}^{1}dz_1\int_{0}^{z_1}dz_2\int_{0}^{z_2}dz_3\int_{0}^{z_3}dz_4
\frac{
(z_1-z_2)(1- 2 z_4) + 1-z_4^2
}{\Delta^3_b} \label{eq:I(bprime)}
,
\end{align}
are summarized in Table~\ref{table:Numerical_integral_b}.
\begin{table}[htbp]
\caption{\label{table:Numerical_integral_b} Numerical values of the integrals in Eqs.~\eqref{eq:I(b)}-\eqref{eq:I(bprime)} for the leptons
$l=e,\mu,\tau$ and the vector mesons $V^\prime=\rho^0,\omega,\phi$,
given in units of GeV$^{-6}$.}
\begin{center}
\begin{tabular}{c|ccc||c|ccc}
\hline
$I^{(b)}$ &$\rho^0$ &$\omega$ &$\phi$
&$I^{(b^\prime)}$ &$\rho^0$ &$\omega$ &$\phi$
\\ \hline
$e$& 13.7&13.3 &7.93
& $e$& 13.7&13.3 &7.93
\\
$\mu$& 4.32 & 4.19& 2.56
& $\mu$& 4.32 & 4.19& 2.56
\\
$\tau$& 0.714& 0.697& 0.447
& $\tau$& 0.714& 0.697& 0.447
\\ \hline
\end{tabular}
\end{center}
\end{table}
Finally, the total scattering amplitude with the strong three-vector meson interactions is obtained as
\begin{align}
i{\cal M}^{\rm SM}_{(b)} & = i{\cal M}_{(b)} + i{\cal M}_{(b^\prime)}, \label{eq:amp_MbSM} \\
i{\cal M}_{(b)}
&=i{\cal M}^{K^\ast}_{(b)} + i{\cal M}^{\bar{K}^\ast}_{(b)}
= 2i{\cal M}^{K^\ast}_{(b)} , \label{eq:amp_Mb} \\
i{\cal M}_{(b^\prime)}
&=i{\cal M}^{K^\ast}_{(b^\prime)} + i{\cal M}^{\bar{K}^\ast}_{(b^\prime)}
= 2i{\cal M}^{K^\ast}_{(b^\prime)} . \label{eq:amp_Mbprime}
\end{align}
\section{\label{sec:analysis}Results and analysis}
\subsection{\label{sec:result}Numerical results}
From the scattering amplitudes derived in the previous section,
we obtain the hadronic long distance contributions to the EDMs of charged leptons.
From the amplitudes $ i{\cal M}_{(a)}$ and $ i{\cal M}_{(a^\prime)}$ of Eqs.~\eqref{eq:amp_Ma} and \eqref{eq:amp_Maprime},
we obtain the EDMs generated by the weak three-vector meson interactions
as
\begin{align}
d^{\rm SM}_{(a)e} &=d_{(a)e}+d_{(a^\prime)e}
=
3.67 \times 10^{-40 }
\, e\, {\rm cm}, \label{eq:dSM_ae} \\
d^{\rm SM}_{(a)\mu}&=d_{(a)\mu}+d_{(a^\prime)\mu}
=
-1.04 \times 10^{-40 }
\, e\, {\rm cm}, \label{eq:dSM_amu} \\
d^{\rm SM}_{(a)\tau}&=d_{(a)\tau}+d_{(a^\prime)\tau}
=
- 1.12 \times 10^{-37}
\, e\, {\rm cm}. \label{eq:dSM_atau}
\end{align}
Similarly,
the amplitudes $i{\cal M}_{(b)}$ and $i{\cal M}_{(b^\prime)}$ of Eqs.~\eqref{eq:amp_Ma} and \eqref{eq:amp_Maprime}
give the contribution from the strong three-vector meson interaction:
\begin{align}
d^{\rm SM}_{(b)e} &
=
2.13 \times 10^{-40}
\, e\, {\rm cm}, \label{eq:dSM_be}\\
d^{\rm SM}_{(b)\mu}&
=
1.39 \times 10 ^{-38}
\, e\, {\rm cm}, \label{eq:dSM_bmu}\\
d^{\rm SM}_{(b)\tau}&
=
3.89 \times 10^{-38}
\, e\, {\rm cm}. \label{eq:dSM_btau}
\end{align}
We finally obtain the EDMs of $e,\mu$, and $\tau$ generated by the hadronic long distance contributions
as
\begin{eqnarray}
d_e^{\rm SM}
&=& d^{\rm SM}_{(a)e} + d^{\rm SM}_{(b)e} =
5.80 \times 10^{-40} e \, {\rm cm}
,
\\
d_\mu^{\rm SM}
&=& d^{\rm SM}_{(a)\mu} + d^{\rm SM}_{(b)\mu} =
1.38 \times 10^{-38}
e \, {\rm cm}
,
\\
d_\tau^{\rm SM}
&=& d^{\rm SM}_{(a)\tau} + d^{\rm SM}_{(b)\tau} =
-7.32 \times 10^{-38}
e \, {\rm cm}
.
\end{eqnarray}
These values are much larger than the estimation at the four-loop level (\ref{eq:eEDMquark}), (\ref{eq:muEDMquark}), and (\ref{eq:tauEDMquark}).
The most important reason of this enhancement is due to the relevance of the typical hadronic momenta in the loop.
We recall that the elementary (quark) level contribution only had a typical momentum of $O(m_W) \sim O(m_t)$, and this feature, together with the GIM mechanism, forced the EDM of charged leptons to have a suppression factor $m_b^2 m_c^2 m_s^2$ due to the cancellation between terms with very close values.
We note that the GIM mechanism is also working at the hadron level.
However, the cancellation among contributions with different flavors becomes much milder thanks to the fact that the typical momentum is replaced by the mass of the heaviest hadrons of each diagram.
This is probably a general property of the hadronic CP violation in the SM, as similar enhancement is also relevant for the case of the EDM of neutron \cite{Czarnecki:1997bu,McKellar:1987tf,Seng:2014lea,Pospelov:2013sca} or nuclei \cite{Yamanaka:2015ncb}.
In this sense, the fact that the elementary contribution to the EDM appears only at the four-loop level is not truly essential in this strong suppression, but rather the GIM mechanism (or the antisymmetry of the Jarlskog invariant) is the main cause \cite{Pospelov:2013sca}.
We should also comment on the observable effect of the electron EDM in experiments.
The EDM of the electron is usually measured through the paramagnetic atomic or molecular systems, since the relativistic effect enhances its effect \cite{Carrico:1968zz,sandars1,sandars2,Flambaum:1976vg,Sandars:1975zz,Labzovskii,Sushkovmolecule,kelly,Kozlov:1994zz,Kozlov:1995xz,flambaumfr1,nayak1,nayak3,nayak2,Natarajrubidium,Mukherjeefrancium,Dzuba:2009mw,Nataraj:2010vn,flambaumybftho,Porsev:2012zx,Roberts:2013zra,Chubukov:2014rba,abe,sunaga,Radziute:2015apa,Denis,Skripnikov,Sunaga:2018lja,Sunaga:2018pjn,Malika:2019jhn,Fazil:2019esp}.
However, these systems also receive contribution from other CP violating mechanisms such as the CP-odd electron-nucleon interaction or the nuclear Schiff moment.
Previously, the EDM of charged lepton was believed to be extremely small and the CP-odd electron-nucleon interaction was thought to be the dominant effect, with a benchmark value equivalent to the electron EDM as $d_e^{(eN)}\sim (10^{-39}-10^{-37} ) e$ cm for paramagnetic systems
\cite{Pospelov:2013sca,Yamanaka:2015ncb,Yamanaka:2017mef,PhysRevA.93.062503} .
By considering the strong enhancement at the hadronic level, we just obtained a value of the electron EDM which lies in this range.
It is then an interesting question to quantify which one, between the electron EDM and the CP-odd electron-nucleon interaction, gives the leading contribution at the atomic level.
\subsection{\label{sec:error}Error bar analysis}
We now assess the uncertainty of our calculation.
The first important source of systematics is the nonperturbative effect of the renormalization of the $|\Delta S|=1$ four-quark operators.
This was quantified to be about 10\%, by looking at the variation of the Wilson coefficient of $Q_2$ in the NLLA in the range of the scale $\mu = 0.6$ GeV to $\mu = m_c = 1.27$ GeV \cite{Buras:1991jm,Buchalla:1995vs,Yamanaka:2015ncb}.
Another major systematics comes from the factorization of the vector meson matrix elements.
According to the large $N_c$ analysis, the vacuum saturation approximation should work up to $O(N_c^{-1})$ correction.
To be conservative, we set the error bar associated to it to 40\%.
\begin{figure}[t]
\begin{center}
\includegraphics[width=18cm]{HLS_higher.pdf}
\caption{ Higher order contributions to the EDM of charged leptons within the HLS. Here $V=\rho^0, \omega, \phi$ is the neutral vector meson, and $s$ is the would-be Nambu-Goldstone boson of the HLS.}
\label{fig:HLS_higer}
\end{center}
\end{figure}
Let us now see the uncertainty related to the use of the HLS.
The important point is that the one-loop level diagrams we evaluated are not divergent, so that the uncertainty due to the counterterms is absent and the stability of the coupling constants is guaranteed.
However, we have to comment on the contribution from higher order terms.
The first process to be noted is the two-loop level diagram with pseudoscalar mesons [see Fig.~\ref{fig:HLS_higer} (a)].
This contribution is the most straightforward higher order effect of the HLS.
The second type of higher order process is the mixing of vector mesons with photons [see Fig.~\ref{fig:HLS_higer} (b)].
In the mass eigenstate basis, it is possible to take into account this mixing to all orders,
but if we restrict the analysis to the leading order, as done in this work, our particle basis and the mass one coincide.
The third contribution is the would-be Nambu-Goldstone mode which may appear
as scalar propagator insertions
in between vector meson propagations due to the choice of Feynman gauge [see Fig.~\ref{fig:HLS_higer} (c)].
This is again a higher order effect in the HLS, just like the mixing between photons and vector mesons.
We also note that the explicit flavor SU(3) breaking effect is a higher order of the HLS,
which has already partially been included in our calculations by introducing the physical meson masses and decay constants.
We also have to comment on the contribution from the
other heavier hadrons which were overlooked in this paper.
Here we consider the axial vector meson $K_1$(1270) which, in the viewpoint of the mass difference, should be the most important hadron among the neglected ones, and show that its contribution is likely to be subleading.
First, the decay constant of $K_1$ is not particularly enhanced, $f_{K_1} \sim 170$ MeV \cite{Nardulli:2005fn}.
Regarding the other hadron matrix elements, the values do not exist in the literature, but it is possible to show that they are not enhanced either.
The axial vector matrix element $\langle \rho | \bar d \gamma_\mu \gamma_5 s | K_1 \rangle$ corresponds to the quark spin, so there should be a suppression due to the destructive interference generated by successive gluon emissions/absorptions \cite{Yamanaka:2013zoa,Yamanaka:2014lva}.
The pseudoscalar matrix element $\langle \rho | \bar d \gamma_5 s | K_1 \rangle$ has also no reasons to be enhanced, since this receives contribution from the Nambu-Goldstone boson pole, which is suppressed by the $K$ meson mass in the present case.
We can consider that the effect of $K_1$(1270) and other heavier hadrons is part of the higher order contribution of the HLS.
We associate
the theoretical uncertainty coming from the entire higher order process mentioned above with the expansion parameter, estimated to be $\sim 50\%$~\cite{Harada:1992np}.
In all, we conclude that the theoretical uncertainty is $ 70\%$.
A potentially interesting way to quantify the hadronic contribution to the electron EDM is to calculate the hadronic three-point correlator on lattice and then attach it to
a lepton line to form the EDM amplitude.
This approach is actually used to quantify the hadronic light-by-light scattering contribution to the muon anomalous magnetic moment \cite{Blum:2019ugy}.
Of course the calculation will not be easy since the three-point correlator must have a $|\Delta S|=1$ four-quark operator in the intermediate state, but this kind of analysis was already done in the context of $K \to \pi \pi$ decay \cite{Bai:2015nea}, so it should not be impossible.
\section{Conclusion}
\begin{figure}[htb]
\begin{center}
\includegraphics[width=0.7\linewidth,clip]{electronEDM_record_20201030.pdf}
\caption{
Plot of the SM predictions of the electron EDM compared with the history of the records of the experimental upper limits \cite{Sandars:1964zz,Weisskopf:1968zz,Player:1970zz,Murthy:1989zz,Abdullah:1990nh,Commins:1994gv,Regan:2002ta,Hudson:2011zz,Baron:2013eja,Andreev:2018ayy}.
The pink band is denoting the uncertainty of the hadronic contribution.
}
\label{fig:electronEDM_record}
\end{center}
\end{figure}
In conclusion, we evaluated for the first time the hadron level contribution to the EDM of charged leptons in the SM, where the CP violation is generated by the physical complex phase of the CKM matrix.
As a result, we found that this long distance effect is much larger than the previously known one, which was estimated at the elementary level.
We could also rigorously show that, in the perturbative elementary level calculation at all orders, the EDM of charged leptons is always suppressed by quark mass factors due to the GIM mechanism.
The main reason of the enhancement at the hadronic level is because
we could avoid additional factors of $m_{b,c,s}^2/m_{W,t}^2$ by embedding the heavy $W$ boson or top quark contribution into the $|\Delta S|=1$ low energy constants while keeping loop momenta of $O(\Lambda_{\rm QCD})\sim 1$ GeV.
In Fig. \ref{fig:electronEDM_record}, we plot the EDM of the electron in the SM compared with the progress of the experimental accuracy.
The electron EDM obtained in this work is $d_e \sim 10^{-39}e$ cm, which is still well below the current sensitivity of molecular beam experiments.
The EDM experiments are however improving very fast, and we have to be very sensitive to their progress and to proposals with new ideas, with some of them claiming to be able to go beyond the level of $O(10^{-35})e$ cm in statistical sensitivity \cite{Vutha:2017pej}.
Our next object would be to extend this analysis to
the flavor violation disagreeing with the SM, recently suggested by the measurements of the decay of $B$ mesons at several $B$ factory experiments \cite{Lees:2012xj,Lees:2013uzd,Huschle:2015rga,Sato:2016svk,Hirose:2016wfn,Hirose:2017dxl,Aaij:2015yra,Aaij:2017uff,Aaij:2017deq,Aaij:2014ora,Aaij:2015oid,Wehle:2016yoi,Aaij:2017vbb,Aaij:2019wad,Hiller:2003js,Crivellin:2019qnh,Ikeno:2019tkh}, and that of $K$ meson decay of KOTO experiment \cite{KOTOresult,Kitahara:2019lws}.
In the analysis of the conjunction of the EDM with the $B$ meson decay, we also have to include the effect of heavy quarks, which has been omitted in this work.
\begin{acknowledgments}
The authors thank T. Kugo for useful discussions.
They also thank T. Morozumi for pointing out the contribution of the semi-leptonic penguin diagram.
A part of the numerical computation in this work was carried out at the Yukawa Institute Computer Facility.
This work is supported in part by the Special Postdoctoral
Researcher Program (SPDR) of RIKEN (Y.Y.).
\end{acknowledgments}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 35 |
\section{Introduction}
An important goal of quantum chemistry is the more accurate and routine treatment of strongly correlated systems. For weakly correlated systems, low-order coupled cluster (CC) theory is well motivated and extremely successful\cite{ccsd_t, Bartlett2007}, now pushing to larger systems through adaptations to reduce the scaling of the method\cite{Riplinger2013, Piecuch2009, Eriksen2015}. An ultimate goal is a similarly successful polynomial scaling method for strong correlation, and much work continues in this direction. There is a crucial need for better benchmarks to aid such development.
For this task, methods such as the density matrix renormalization group (DMRG) algorithm\cite{White1992, Chan2004, Olivares2015}, selected configuration interaction (SCI)\cite{Huron1973, Schriber2016, Tubman2016, Holmes2016_2, Garniron2017, Loos2018} and full configuration interaction quantum Monte Carlo (FCIQMC)\cite{Booth2009, Cleland2010, Spencer2012} are important tools. Although they are relatively expensive compared to low-order CC, they are systematically improvable, and capable of providing near-exact benchmarks in regimes where other methods give unsatisfactory results. They are also useful beyond providing benchmarks, for example as complete active space (CAS) solvers in CASPT2 (CAS plus second-order perturbation theory) approaches\cite{Dominika2008, Debashree2008, Thomas2015_3, Manni2016, Smith2017}, or in the case of DMRG, as the method of choice in 1D or quasi-1D systems. Approaches based on coupled cluster theory by including high-order clusters also show promise for this task\cite{Xu2018}.
The current FCIQMC algorithm is time limited far more than it is memory limited. On a large-scale cluster, a large FCIQMC simulation may take multiple days to run, yet use a small fraction of the memory available. Moreover, we usually encounter the situation where the final statistical error is multiple orders of magnitude smaller than systematic error [for example, see Table II of Ref.~(\onlinecite{Blunt2015_3})]. This suggests that it may be possible to devise a faster FCIQMC algorithm in exchange for larger statistical noise, which would be a very desirable trade-off, and there are good reasons to believe that FCIQMC can be made substantially faster than the current algorithm.
We recently demonstrated that it is possible to calculate a second-order perturbative correction to initiator error in FCIQMC\cite{Blunt2018}. This correction can often remove over $85\%$ of initiator error in weakly correlated systems, and can be accumulated from existing information in FCIQMC, and therefore has little extra cost. However for large systems or small walker populations, we find that the associated statistical noise can be very large (the opposite situation to the noise on traditional FCIQMC estimators, described above, where statistical noise is small).
Here we propose a modified algorithm where this situation is greatly improved. Specifically, it is shown that FCIQMC can be performed with preconditioning, as commonly performed in quantum chemistry (and optimization problems generally), which allows the use of a much larger time step. This is achieved at the expense of performing multiple spawning attempts per walker, which limits the savings in computer time overall. However, this regime is highly beneficial for the calculation of the perturbative corrections, often reducing statistical noise by an order of magnitude or more, resulting in a far more efficient algorithm. As such, we show that preconditioning has limited benefits to convergence time in FCIQMC, but significantly helps the calculations of perturbatively-corrected estimators.
In addition, we introduce a more simple and efficient approach to sampling the variational energy, and also demonstrate that it is possible to sample the variance of the energy in FCIQMC, as commonly performed in variational Monte Carlo.
We recap FCIQMC in Section~\ref{sec:fciqmc}. The use of preconditioning in FCIQMC is introduced in Section~\ref{sec:precond_fciqmc}, and then contrasted with the traditional approach in Section~\ref{sec:comparison}. A new approach to calculating estimators is discussed in Section~\ref{sec:estimators_theory}. Lastly, results are given in Section~\ref{sec:results}, investigating perturbative estimators and the preconditioned FCIQMC approach, with an application to benzene.
\section{FCIQMC}
\label{sec:fciqmc}
In FCIQMC the ground-state wave function is converged upon by performing imaginary-time evolution\cite{Booth2009}, where the wave function $| \Psi(\tau) \rangle$ obeys
\begin{equation}
| \Psi (\tau + \Delta \tau) \rangle = | \Psi (\tau) \rangle - \Delta \tau (\hat{H} - E_S\mathbb{1}) | \Psi(\tau) \rangle,
\end{equation}
where $\hat{H}$ is the Hamiltonian, $\tau$ denotes imaginary-time and $E_S$ is a shift which is slowly varied to control the walker population. This evolution is performed in a basis, $\{ |D_i\rangle \}$, in which the components of $| \Psi (\tau) \rangle = \sum_i C_i (\tau) |D_i \rangle$ obey
\begin{equation}
C_i(\tau + \Delta \tau) = C_i(\tau) - \Delta \tau \sum_j ( H_{ij} - E_S \delta_{ij} ) C_j(\tau).
\end{equation}
In FCIQMC, as in other QMC approaches, the wave function coefficients $\bs{C}$ are sampled by a collection of walkers. If we define the number of walkers on $| D_j \rangle$ as $N_j \in \mathbb{N}$, then the amplitude of each walker can be defined as $C_j / N_j$. A stochastic algorithm to perform the above evolution can then be realized by the following steps:
\begin{enumerate}
\small{
\item \emph{Spawning:} Loop over all occupied determinants, $|D_j\rangle$. For each walker on $|D_j\rangle$, choose one connected determinant, $|D_i\rangle$ ($i \ne j$ and $H_{ij} \ne 0$), with some probability ${P_{\textrm{gen}}}(i \leftarrow j)$. Then create a spawned walker on $|D_i\rangle$ with amplitude $ - \Delta \tau \times ( H_{ij} / {P_{\textrm{gen}}}(i \leftarrow j) ) \times ( C_j / N_j ) $.
\item \emph{Death:} Loop over all occupied determinants. Each determinant $|D_i\rangle$ spawns to itself with amplitude $ - \Delta \tau ( H_{ii} - E_S ) C_i $.
\item \emph{Annihilation:} Sum together all current and spawned walkers on each occupied determinant to get the new coefficients, $C_i$.
\item \emph{Rounding:} For all determinants with an absolute amplitude, $|C_i|$, less than $1$, stochastically round the absolute amplitude down to $0$ (kill the walker) with probability $1 - |C_i|$, or up to $1$ with probability $|C_i|$.
}
\end{enumerate}
It can be seen that the death step exactly includes the diagonal contribution to $- \Delta \tau \sum_j ( H_{ij} - E_S \delta_{ij} ) C_j$, while the spawning step corresponds to stochastically sampling off-diagonal terms. Rather than looping over all off-diagonal elements in the above summation, precisely one element is chosen for each walker, with some probability ${P_{\textrm{gen}}}(i \leftarrow j)$. The size of the spawned amplitude must then be divided by this probability to keep the algorithm unbiased, so that the average spawned weight is correct.
The shift, $E_S$, is updated slowly to oppose changes in the walker population. This is done every $A$ iterations by
\begin{equation}
E_S(\tau + A\Delta\tau) = E_S(\tau) - \frac{\xi}{A \Delta\tau} \textrm{ln}\left( \frac{N_{\textrm{w}}(\tau+A\Delta\tau)}{N_{\textrm{w}}(\tau)} \right),
\label{eq:shift_update}
\end{equation}
where $\xi$ is a damping parameter, and $N_{\textrm{w}} = \sum_i |C_i|$ is the total walker population.
Note that the above definition of the FCIQMC algorithm uses non-integer walker amplitudes, $C_i$, as first suggested by Umrigar and co-workers\cite{Petruzielo2012}. This differs from the original FCIQMC presentation\cite{Booth2009}, where integer values of $C_i$ were enforced. The use of non-integer coefficients improves the efficiency of the method. In the same work\cite{Petruzielo2012}, Umrigar and co-workers also introduced a semi-stochastic adaptation, in which the projection operator is applied exactly within an important subspace (the \emph{deterministic} or \emph{core} space) and by the above stochastic algorithm otherwise, further reducing stochastic noise.
The energy is commonly estimated by
\begin{align}
{E_{\textrm{ref}}} &= \frac{ \langle D_0 | \hat{H} | \Psi \rangle }{ \langle D_0 | \Psi \rangle }, \\
&= \frac{ \sum_j H_{0j} C_j }{ C_0 },
\label{eq:hf_estimator}
\end{align}
where the subscript `$0$' refers to the Hartree--Fock determinant or other reference state. A related estimator has been used\cite{Petruzielo2012} where $|D_0\rangle$ is replaced by a multi-determinant trial wave function, which again reduces stochastic noise in the estimates.
\subsection{The initiator approximation and walker blooms}
\label{sec:init_approx}
The above algorithm allows the exact FCI wave function to be sampled without bias. However, in practice a population plateau appears in the simulation, below which the fermion sign problem leads to uncontrollable noise\cite{Spencer2012}. This plateau height therefore sets a minimum memory requirement on the simulation, which is typically much smaller than that required to store the FCI space, but which nonetheless grows exponentially with the system size. As such, the FCIQMC algorithm as stated above is still restricted to small systems.
To overcome this, Cleland \emph{et al.} introduced the initiator approximation to FCIQMC, known as i-FCIQMC\cite{Cleland2010, Cleland2011}. In this, all determinants with a weight greater than $n_a$ are defined as initiators (with $n_a$ equal to $2$ or $3$, typically). Initiators are allowed to spawn to any determinant, while non-initiators may only spawn to already-occupied determinants. Attempted spawnings from non-initiators to unoccupied determinants are removed from the simulation. An exception occurs if two non-initiators spawn to the same determinant in the same iteration, in which case the spawnings are allowed (the `coherent spawning rule'). When the semi-stochastic adaptation\cite{Petruzielo2012, Blunt2015} is used, all determinants within the deterministic space are also made initiators. We note that in some cases this deterministic space may be large, in which case the initiator error can change significantly.
This initiator approach significantly reduces the sign problem in the method, allowing arbitrarily-small walker populations to be used. In exchange, an approximation is introduced, as the Hamiltonian is effectively truncated; the above approximation is equivalent to setting Hamiltonian elements between non-initiators and unoccupied determinants to zero. As the walker population is increased, the number of initiators and occupied determinants both increase, and i-FCIQMC tends towards the exact solution. Therefore, i-FCIQMC provides a systematic way to converge to the FCI limit.
An important concept in i-FCIQMC is that of a ``walker bloom''. A bloom is defined as a spawning event with weight greater than $n_a$, such that the new determinant instantly becomes an initiator. Such events should be avoided, as they lead to essentially random determinants being made initiators. Furthermore, with enough bloom events we find that the initiator space grows exponentially in $\tau$, and a sign problem returns. This criterion is often used to set the time step, $\Delta \tau$, which is chosen so as to prevent bloom events (or to allow only a small number to occur each iteration).
\section{FCIQMC with preconditioning}
\label{sec:precond_fciqmc}
\subsection{Algorithm definition}
Imaginary-time evolution as described in Section~\ref{sec:fciqmc} will converge to the ground state of $\hat{H}$ only if $\Delta \tau$ is chosen to obey
\begin{equation}
\Delta \tau < \frac{2}{E_{\textrm{max}} - E_0},
\end{equation}
where $E_{\textrm{max}}$ and $E_0$ are the highest and lowest energy eigenvalues of $\hat{H}$, respectively. For large systems and basis sets, we find that this condition restricts the time step to be of order $\Delta \tau \sim 10^{-3}$ au, or even smaller. Typically, FCIQMC may take on the order of $\sim 10^{3} - 10^{5}$ iterations for the initial transient to decay, allowing sampling of the ground state to begin.
Preconditioning is a commonly-used approach to speed up the iterative solution of a system of linear equations\cite{axelsson1994, Beauwens2004, Saad2011}. For an eigenvalue problem $\bs{H} \bs{C} = E \bs{C}$, an iterative solution may be obtained by
\begin{equation}
\bs{C}_{n+1} = \bs{C}_n - \gamma_n \bs{P}^{-1} ( \bs{H} \bs{C}_n - E_n \bs{C}_n ),
\end{equation}
where $\bs{P}$ (or often $\bs{P}^{-1}$) is referred to as the preconditioner, $\bs{C}_n$ and $E_n$ are best estimates of $\bs{C}$ and $E$ from iteration $n$, and $\gamma_n$ is a step size. Setting $\bs{P} = \bs{I}$ and $\gamma_n = \Delta \tau$ returns imaginary-time propagation as in FCIQMC. However, for an appropriate choice of $\bs{P}^{-1}$, convergence can be sped up considerably. The most common choice is the Jacobi preconditioner, defined as $P_{ij} = (H_{ii} -E)\delta_{ij}$, which is widely used throughout quantum chemistry, such as in the Davidson method\cite{Saad2011}. It should also be noted that the update coefficients are essentially equal to those obtained through first-order perturbation theory.
We therefore suggest the following update equation for the FCIQMC:
\begin{equation}
C_i(\tau + \Delta \tau) = C_i(\tau) - \frac{\Delta \tau}{H_{ii} - E} \sum_{j} ( H_{ij} - E \delta_{ij} ) C_j(\tau).
\label{eq:precond_2}
\end{equation}
For consistency, we have again used $\Delta \tau$ to denote the step size. However, it should be emphasized that taking the limit $\Delta \tau \to 0$ does not result in the imaginary-time Schr{\"o}dinger equation, and equal values of $\Delta \tau$ do not give equal rates of convergence with and without preconditioning, so care should be taken in comparisons.
Exactly as has been done for FCIQMC with imaginary-time propagation, it is simple to write down an FCIQMC algorithm for the above preconditioned evolution:
\begin{enumerate}
\item \emph{Spawning:} Loop over all occupied determinants, $|D_j\rangle$, and for each walker perform $N_{\textrm{spawn}}$ spawning attempts. For each spawning attempt from $|D_j\rangle$, choose one connected determinant, $|D_i\rangle$ ($i \ne j$ and $H_{ij} \ne 0$), with some probability ${P_{\textrm{gen}}}(i \leftarrow j)$. Then create a spawned walker on $|D_i\rangle$ with amplitude $ - \Delta \tau \times ( H_{ij} / {P_{\textrm{gen}}}(i \leftarrow j) ) \times ( C_j / N_{\textrm{spawn}} N_j ) $.
\item \emph{Apply the preconditioner to spawnings:} Loop over determinants to which spawnings have occured. For a spawned walker on $|D_i\rangle$, multiply its amplitude by $1/(H_{ii} - E)$.
\item \emph{Death:} Loop over all occupied determinants. Multiply each determinant's amplitude by $1 - \Delta \tau$.
\item \emph{Annihilation:} Sum together all current and spawned walkers on each occupied determinant to get the new coefficients, $C_i$.
\item \emph{Rounding:} For all determinants with an absolute amplitude, $|C_i|$, less than $1$, stochastically round the absolute amplitude down to $0$ (kill the walker) with probability $1 - |C_i|$, or up to $1$ with probability $|C_i|$.
\end{enumerate}
Most of the algorithm is the same as for FCIQMC with imaginary-time evolution, and we will compare the two algorithms in Section~\ref{sec:comparison}. In particular, the annihilation and rounding steps are identical. The main differences are that spawned walkers now have the preconditioner $1/(H_{ii} - E)$ applied, and the death step is also appropriately modified (simplified, in fact) to account for this same factor. We have also chosen to allow each walker to make ${N_{\textrm{spawn}}}$ spawning attempts, so that the amplitude of each spawned walker must be divided by the same factor to keep the algorithm unbiased. Here, ${N_{\textrm{spawn}}}$ is some integer equal to $1$ or greater. In previous applications of FCIQMC, this has always been taken as ${N_{\textrm{spawn}}} = 1$.
One may ask precisely when the evolution of Eq.~(\ref{eq:precond_2}) converges. Fixed points of this evolution are when $\bs{H} \bs{C} - E \bs{C} = \bs{0}$, as desired. Theoretically, convergence is guaranteed provided the iteration matrix has a spectral radius less than $1$, which is met for diagonally-dominant matrices (although this is not necessary). In practice, the proposed evolution is well established as being extremely successful. We have tested this for a range of systems, including both molecular and model systems with both weak and strong correlation, and have always found convergence to occur for $\Delta \tau = 0.5$ au or smaller, and often with $\Delta \tau = 1.0$ au.
The use of much larger time steps has an important consequence, which must be emphasized: the size of each spawned walker is proportional to $\Delta \tau$, so that larger spawned walkers will be created with larger time steps. Having very large spawning events (i.e., larger than $4$ or so) can significantly increase the stochastic noise in a simulation. The use of multiple spawning attempts per walker (${N_{\textrm{spawn}}} > 1$) was introduced above as a way to counter this. The size of each spawned walker will be proportional to $\Delta \tau / {N_{\textrm{spawn}}}$, giving a way to reduce the maximum spawning size by increasing ${N_{\textrm{spawn}}}$. This will increase the cost per iteration, therefore reducing the savings of using a large $\Delta \tau$, a point which we will return to.
We typically choose to initialize the wave function using configuration interaction singles and doubles (CISD), which is always feasible for systems currently amenable to FCIQMC. However, this is not required in general.
We note that this preconditioned approach is similar to a previous modification to FCIQMC and coupled cluster Monte Carlo\cite{Thom2012, Franklin2016}, changing the step taken by a quasi-Newton approach\cite{NeufeldThom_unpublished}, which though implemented\cite{HANDEv1.1,HANDE} has yet to be widely used. An alternative approach within a deterministic framework was considered by Zhang and Evangelista\cite{Zhang2016}, who considered a Chebyshev expansion of the exponential propagator.
\subsection{Population control: intermediate normalization}
As described in Section~\ref{sec:fciqmc}, with imaginary-time evolution the walker population is typically controlled by a shift, $E_S(\tau)$, which is updated by Eq.~(\ref{eq:shift_update}).
With preconditioning, a more natural choice is intermediate normalization. Consider the projected energy estimator, ${E_{\textrm{ref}}}$, defined in Eq.~(\ref{eq:hf_estimator}), which is equally valid both with and without preconditioning. If we set the energy in the preconditoner to equal this estimate ($E = {E_{\textrm{ref}}}$) then it can be seen that $\sum_{j} ( H_{0j} - E \delta_{0j} ) C_j = 0$. If evolving with Eq.~(\ref{eq:precond_2}), it is then simple to check that the coefficient $C_0$ on $| D_0 \rangle$ remains exactly constant throughout. We note that $|D_0\rangle$ need not be the Hartree--Fock determinant, and can also be updated during a simulation to match the most populated determinant. This choice of population control does not restrict the method to weakly correlated systems.
For $C_0$ to remain exactly constant, the estimate $\sum_{j} H_{0j} C_j$ must be obtained from the spawnings made to $|D_0\rangle$ from the latest iteration. It is helpful to use a deterministic space containing $|D_0 \rangle$ and its most important connections, to avoid the situation where no spawnings are made to $|D_0 \rangle$ in an iteration.
With this choice of population control, the walker population will grow in the early iterations of the simulation, settling down and fluctuating about a final value once convergence has been achieved. This makes choosing a final walker population more difficult than in the original scheme. However, this can usually be achieved by performing a preliminary test with a small initial population, and then scaling appropriately.
The above modification has an effect on the projected energy estimator, defined in Eq.~(\ref{eq:hf_estimator}), which should be noted: the population $C_0$ now remains exactly constant, and so is not a random variable. Typically in FCIQMC, one would average the numerator and denominator of Eq.~(\ref{eq:hf_estimator}) separately, and perform the required division \emph{after} this averaging. Now that the denominator is constant, this separate averaging makes no difference. This deserves consideration, as in the original approach this estimator can theoretically be biased if performed as $\langle x/y \rangle$ rather than $\langle x \rangle / \langle y \rangle$ (although any such bias is essentially negligible, in our experience). Does this preconditioned approach remove all such bias? We suspect that the answer is ``no'', and that this theoretical bias is transferred to the sampling of $| \Psi(\tau) \rangle$, due to the applications of $1/(H_{ii} - E)$ in the propagation (where $E$ is a random variable), and population control bias\cite{Vigor2015} due to the aggressive updates to $E$. However, we emphasize that any such bias seems to be essentially negligible in practice.
We note that this intermediate normalization approach has recently been used in a related QMC approach to coupled cluster theory\cite{Scott2019}. A related approach to population control has also been used recently by Alavi and co-workers in FCIQMC with imaginary-time propagation\cite{fixed_n0_unpublished}.
\begin{figure*}[t]
\includegraphics{c2_converge.eps}
\caption{An example comparison of convergence between the traditional and preconditioned FCIQMC approaches. The system is C$_2$ in a cc-pVQZ basis set, at equilibrium geometry. Without preconditioning, ${N_{\textrm{spawn}}}=1$ and $\Delta \tau = 8 \times 10^{-4}$ au. With preconditioning, ${N_{\textrm{spawn}}}=200$ and $\Delta \tau = 0.4$ au. It must be emphasized that each iteration in the preconditioned approach is $\sim 200$ times more expensive than in the traditional method, because of the difference in ${N_{\textrm{spawn}}}$.}
\label{fig:converge_comp}
\end{figure*}
\subsection{The initiator approximation}
\label{sec:precond_init}
In preconditioned FCIQMC, the initiator adaptation is largely unchanged: initiators are defined as determinants with an absolute amplitude $|C_i|$ greater than $n_a$, which is set to $2$ or $3$, typically. Attempted spawnings from initiators are always accepted, but spawnings from non-initiators are only accepted if made to already-occupied determinants, else they are removed from the simulation. We again use the semi-stochastic adaptation, where all deterministic states are also defined as initiators.
We again emphasize the importance of avoiding bloom events in the initiator approximation. Given that $\Delta \tau$ can be made much larger compared to the original FCIQMC approach, it is important then to increase ${N_{\textrm{spawn}}}$ appropriately in order to avoid walker blooms. Avoiding these large spawning events is important in any QMC approach to control statistical noise, but is perhaps particularly important in the initiator adaptation, where such blooms lead to random determinants being given initiator status.
Lastly, we note that with large ${N_{\textrm{spawn}}}$ it is necessary to remove the `coherent spawning' rule of the i-FCIQMC. That is, we do \emph{not} allow simultaneous spawnings to an unoccupied determinant from two non-initiators to survive. For large ${N_{\textrm{spawn}}}$, such events become a frequent occurrence, and we often encounter a sign problem re-emerging. Removing this rule has only a very small effect on the accuracy of the initiator approximation.
\section{Comparison of FCIQMC with and without preconditioning}
\label{sec:comparison}
\subsection{Algorithm}
Here we state the differences between the original and preconditioned FCIQMC approaches. Specifically, changes relative to the original FCIQMC algorithm are:
\begin{enumerate}
\item Once spawned walkers have been generated, the preconditioner $1/(H_{ii} - E)$ must be applied to each.
\item In the death step, a factor of $1 - \Delta \tau$ is applied to each walker coefficient, rather than shifting each coefficient by $ - \Delta \tau ( H_{ii} - E_S ) C_i $
\item The shift $E_S$ is replaced by a separate energy estimate, which is obtained from Eq.~(\ref{eq:hf_estimator}). This energy is not needed in the death step, but is instead required in the preconditioner.
\item In order to reduce the size of spawned walkers in the presence of a very large $\Delta \tau$, we allow each walker to make ${N_{\textrm{spawn}}}$ spawning attempts. In the original approach, each walker only makes $1$ spawning attempt (i.e., ${N_{\textrm{spawn}}} = 1$).
\end{enumerate}
\subsection{Implementation}
The use of preconditioning does not significantly change the implementation of FCIQMC, and only a few changes may be required to implement preconditioning in an existing FCIQMC code. In particular, all communication of spawned walkers is performed in the same manner. In both approaches, spawned walkers are held in a separate array to the current walkers. These spawned walkers are communicated to their parent process and annihilated to give a final merged spawning array, which we denote $\bs{S}$. This spawning array may then be annihilated with the main walker list, $\bs{C}$, to give the new walker coefficients. One can write down an expression for the expectation value of the spawning array $\bs{S}$,
\begin{align}
S_i &= - \Delta \tau \langle D_i | \hat{H}_{\textrm{off}} | \Psi \rangle \\
S_i &= - \Delta \tau \sum_{j \ne i} H_{ij} C_j,
\label{eq:spawn_array}
\end{align}
where $\hat{H}_{\textrm{off}}$ contains only off-diagonal elements in the basis set used. Importantly, $\bs{S}$ only contains off-diagonal elements of $\hat{H}$ because diagonal elements are accounted for separately by the death step. Note also that we have dropped the $\tau$ dependence in $\bs{S}(\tau)$ and $|\Psi(\tau)\rangle$ for notational clarity later. This identification of the spawning array will be crucial in Section~\ref{sec:estimators_theory} for constructing more efficient energy estimators in FCIQMC.
In the preconditioned case, the factors of $1/(H_{ii} - E)$ are then applied directly to the spawning array $\bs{S}$ after it has been communicated and merged across processors, but before it is merged with the previous walker, list $\bs{C}$.
The diagonal Hamiltonian element $H_{ii}$ can be calculated for the new determinant $|D_i\rangle$ in $\mathcal{O}(N)$ time from the value $H_{jj}$ of the parent walker on $|D_j\rangle$, which is always stored. Therefore, it is \emph{not} required to perform a full $\mathcal{O}(N^2)$ construction of $H_{ii}$ for each spawned walker, which would be expensive.
\subsection{An example: C$_2$ cc-pVQZ}
As a simple demonstration, in Fig.~(\ref{fig:converge_comp}) we compare the convergence of C$_2$ at equilibrium bond length, in a cc-pVQZ basis and with a frozen core, both with and without preconditioning. In both cases the simulation is initialized from the CISD wave function. For FCIQMC without preconditioning, we choose ${N_{\textrm{spawn}}}=1$, and set the time step so as to prevent bloom events (giving $\Delta \tau = 8 \times 10^{-4}$ au), which is the standard protocol in most current FCIQMC calculations. For FCIQMC with preconditioning, we first choose a time step of $\Delta \tau = 0.4$ au and then choose ${N_{\textrm{spawn}}}=200$ so as to prevent bloom events. Note that the energy estimator used here is the projected energy estimator, ${E_{\textrm{ref}}}$, defined in Eq.~(\ref{eq:hf_estimator}).
It can be seen that, while FCIQMC without preconditioning requires $\sim 3 \times 10^4$ iterations to fully converge, convergence with preconditioning is achieved within $30$ iterations. It is very important to emphasize, however, that the iteration time is roughly proportional to ${N_{\textrm{spawn}}}$. Therefore, each iteration with ${N_{\textrm{spawn}}}=200$ is roughly $200$ times more expensive than without. Even with this taken into account, convergence is quicker with preconditioning than without, at least in this case. More careful comparison and discussion is given in Section~\ref{sec:convergence}.
\section{Improved estimators in FCIQMC}
\label{sec:estimators_theory}
Separately from the above discussion of preconditioning in FCIQMC, we now discuss the calculation of improved energy estimators in FCIQMC, including perturbative corrections to initiator error. We emphasize that all of the following estimators can be calculated identically in both the original and preconditioned FCIQMC approaches. Although the following section is separate from the previous section on preconditioning in FCIQMC, we will show in Section~\ref{sec:error_reduction} that the preconditioned approach greatly benefits the calculation of PT2-based estimators in FCIQMC, and so we will ultimately be interested in their application together.
\subsection{Sampling variational energies without reduced density matrices}
In addition to the projected energy estimators (comprising both projections onto single determinants and multi-determinant trial solutions), variational energy estimators have also been used in FCIQMC\cite{Overy2014, Blunt2017}:
\begin{equation}
{E_{\textrm{var}}} = \frac{ \langle \Psi | \hat{H} | \Psi \rangle }{ \langle \Psi | \Psi \rangle }.
\end{equation}
Consider the numerator. Because $| \Psi \rangle$ is a stochastic estimate, the replica trick must be used to ensure that this estimator is unbiased, as has been described elsewhere\cite{Zhang1993, Overy2014, Blunt2014, Blunt2015_2}. In this, two independent FCIQMC simulations are performed, which we label $ | \Psi^1 \rangle = \sum_i C_i^1 |D_i \rangle $ and $| \Psi^2 \rangle = \sum_i C_i^2 |D_i \rangle $. Then the variational estimate can be obtained as
\begin{equation}
{E_{\textrm{var}}} = \frac{ \big\langle \; \sum_{ij} C_i^1 H_{ij} C_j^2 \; \big\rangle }{ \big\langle \; \sum_i C_i^1 C_i^2 \; \big\rangle },
\label{eq:var_energy_def}
\end{equation}
where $\big\langle \ldots \big\rangle$ denotes an average over the simulation after convergence, and we assume real coefficients throughout. We drop this averaging notation for clarity, but it should be understood that the numerator and denominator of each estimator is averaged (separately) over the simulation from convergence onwards.
In previous FCIQMC studies, Eq.~(\ref{eq:var_energy_def}) has been calculated as $\textrm{Tr}(\hat{\Gamma} \hat{H})$, where $\hat{\Gamma}$ is the two-particle density matrix (2-RDM), whose calculation in FCIQMC was described in Refs.~(\onlinecite{Overy2014}) and (\onlinecite{Blunt2017}). The efficient implementation of 2-RDMs in FCIQMC is involved, and their accumulation can slow the simulation down by a significant factor. In this study we therefore calculate ${E_{\textrm{var}}}$ and related quantities directly.
The two main large arrays in an FCIQMC implementation are $\bs{C}$ (with components $C_i^r = \langle D_i | \Psi^r \rangle$) and $\bs{S}$ (with components $S_i^r = -\Delta \tau \sum_{j \ne i} H_{ij} C_j^r$) as defined already. $\bs{S}$ is distributed across processes with the same mapping as $\bs{C}$, such that it is easy to take a dot product between $\bs{C}$ and $\bs{S}$. In the following, we therefore write all estimators in terms of $\bs{C}$ and $\bs{S}$, showing how they are efficiently calculated in practice. Again we emphasize that these arrays are constructed in the same manner for both original and preconditioned algorithms, so that all of the following applies for both approaches. In the preconditioned case, the preconditioner is applied to $\bs{S}$ only \emph{after} the following estimators are constructed.
${E_{\textrm{var}}}$ may be calculated as
\begin{align}
{E_{\textrm{var}}} &= \frac{ \sum_i C_i^1 [ \sum_{j \ne i} H_{ij} C_j^2 + H_{ii} C_i^2 ] }{\sum_i C_i^1 C_i^2 }, \\
&= \frac{ \sum_i C_i^1 [ -S_i^2 / \Delta \tau + H_{ii} C_i^2 ] }{ \sum_i C_i^1 C_i^2 },
\end{align}
and statistical errors can be reduced by making use of spawnings from both replicas:
\begin{equation}
{E_{\textrm{var}}} = \frac{ \sum_i C_i^1 H_{ii} C_i^2 }{ \sum_i C_i^1 C_i^2 } - \frac{1}{2 \Delta \tau} \frac{ \sum_i [ C_i^1 S_i^2 + S_i^1 C_i^2 ] }{ \sum_i C_i^1 C_i^2 }.
\label{eq:var_energy}
\end{equation}
Note that only the expectation value of this estimator is variational. Instantaneous estimates are not.
\subsection{Perturbative corrections to initiator error}
\label{sec:pt2_estimators}
Given that the variational energy estimator ${E_{\textrm{var}}}$ is based on an inexact wave function subject to the initiator approximation, we recently suggested\cite{Blunt2018} a second-order perturbative correction to this estimator
\begin{equation}
\Delta E_2 = \frac{1}{(\Delta\tau)^2} \sum_a \frac{ S^1_a S^2_a }{ E - H_{aa} },
\label{eq:en2_original}
\end{equation}
where the summation is performed over all spawnings which are cancelled due to the initiator criterion, and there is a normalization factor of $\langle \Psi^1 | \Psi^2 \rangle$. From this, a total energy estimate can be defined as
\begin{equation}
{E_{\textrm{var+PT2}}} = {E_{\textrm{var}}} + \Delta E_2.
\label{eq:evar_pt}
\end{equation}
The above formula for $\Delta E_2$ was constructed by analogy with SCI+PT2, where configuration interaction is performed within a truncated space, beyond which a second-order Epstein-Nesbet perturbative correction can be constructed. Initiator FCIQMC can also be loosely seen as a truncated method, which allows the above estimator to be written down by analogy, making use of spawned walkers which are otherwise thrown away without use. However, a truncated space for i-FCIQMC is somewhat poorly defined, first because the space of occupied and initiator determinants is non-constant, and second because some unoccupied determinants are connected to both initiators and non-initiators (as such, the truncation is more precisely on the Hamiltonian, not the space).
To make this perturbative correction more rigorous, we consider a slightly different estimator, which we call ${E_{\textrm{var+PT2}}^{\textrm{new}}}$, which can then be compared to ${E_{\textrm{var+PT2}}}$ for any deviations. Given the wave function within the initiator approximation, $|\Psi\rangle$, it is possible to write down a more accurate wave function which we denote $|\Phi\rangle = \sum_i \Phi_i |D_i\rangle$,
\begin{equation}
| \Phi \rangle = [ E - \hat{H}_{\textrm{d}} ]^{-1} \hat{H}_{\textrm{off}} | \Psi \rangle,
\label{eq:projected_wf}
\end{equation}
\begin{equation}
\Phi_i = \frac{1}{ E - H_{ii} } \sum_{j \ne i} H_{ij} C_j,
\label{eq:projected_wf_comp}
\end{equation}
where $\hat{H}_{\textrm{d}} = \sum_i H_{ii} |D_i \rangle \langle D_i|$. An energy estimator based upon this improved wave function can then be written down as
\begin{align}
{E_{\textrm{var+PT2}}^{\textrm{new}}} &= \frac{ \langle \Phi | \hat{H} | \Psi \rangle }{ \langle \Phi | \Psi \rangle }, \\
&= \frac{ \langle \Psi | \hat{H}_{\textrm{off}} \; [ E - \hat{H}_{\textrm{d}} ]^{-1} \hat{H} | \Psi \rangle }{ \langle \Psi | \hat{H}_{\textrm{off}} \; [ E - \hat{H}_{\textrm{d}} ]^{-1} | \Psi \rangle }.
\end{align}
This expression can be expanded in terms of $\bs{C}$ and $\bs{S}$ components to give an estimator for use in FCIQMC. First the numerator,
\begin{align}
\langle \Phi^1 | \hat{H} | \Psi^2 \rangle &= \sum_i \frac{1}{E - H_{ii}} \sum_{k \ne i} C_k^1 H_{ki} \sum_j H_{ij} C_j^2, \\
&= \sum_i \frac{ [ -S_i^1 / \Delta\tau] [ -S_i^2/\Delta\tau + H_{ii}C_i^2] }{E - H_{ii}}, \\
&= \frac{1}{(\Delta\tau)^2} \sum_i \frac{ S_i^1 S_i^2 }{ E - H_{ii} } - \frac{1}{\Delta\tau} \sum_i \frac{S_i^1 H_{ii} C_i^2 }{ E - H_{ii} },
\label{eq:precond_energy}
\end{align}
and similarly the denominator by
\begin{align}
\langle \Phi^1 | \Psi^2 \rangle &= \sum_i \frac{ \sum_{j \ne i} C_j^1 H_{ji} C_i^2 }{ E - H_{ii} }, \\
&= \frac{-1}{\Delta\tau} \sum_i \frac{ S_i^1 C_i^2 }{ E - H_{ii} }.
\label{eq:precond_denom}
\end{align}
As for ${E_{\textrm{var}}}$, the cross terms including $C_i$ and $S_i$ can be averaged with both combinations of replicas $1$ and $2$, both in the numerator and denominator.
It can be seen that all of the terms in ${E_{\textrm{var+PT2}}}$ are also included in ${E_{\textrm{var+PT2}}^{\textrm{new}}}$. The connection of ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ with perturbation theory is made precise in Appendix~(\ref{sec:appendix}). However, a simple way to see this connection is to note that $| \Phi \rangle$ can be expressed as $| \Psi_0 \rangle + | \Psi_1 \rangle$, where $ | \Psi_1 \rangle $ is the first-order Epstein-Nesbet correction to an appropriate zeroth-order wave function, $ | \Psi_0 \rangle $. It is then simple to show that ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ includes a second-order perturbative correction.
The estimator ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ has the advantage that is requires no partitioning between a variational and non-variational space. Furthermore, ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ takes the form $\langle \Phi | \hat{H} | \Psi \rangle / \langle \Phi | \Psi \rangle$, where $|\Psi\rangle$ and $|\Phi\rangle$ are both wave functions accessible from FCIQMC. This is the form of a traditional estimator in a QMC method, and avoids explicitly adding a perturbative correction. On the other hand ${E_{\textrm{var+PT2}}}$ usually has smaller statistical noise, and so is often more useful in practice.
Note that in Eq.~(\ref{eq:en2_original}), (\ref{eq:precond_energy}) and (\ref{eq:precond_denom}), we calculate $E$ using the projected energy estimator, ${E_{\textrm{ref}}}$. We could also use ${E_{\textrm{var}}}$, but find that this makes little difference in practice [as $E$ is well separated from any $H_{ii}$, particularly for Eq.~(\ref{eq:en2_original})].
\subsection{Sampling the variance of the energy}
Finally, we point out that it is simple to write the energy variance, $\sigma^2$, as efficient operations involving $\bs{C}$ and $\bs{S}$, and therefore to sample in FCIQMC. Ignoring normalization,
\begin{equation}
\sigma^2 = \langle \Psi | \hat{H}^2 | \Psi \rangle - \langle \Psi | \hat{H} | \Psi \rangle^2.
\label{eq:variance}
\end{equation}
We emphasize that this is the standard energy variance, and not some measure of statistical error. The calculation of $\langle \Psi | \hat{H} | \Psi \rangle$ has been discussed already. The calculation of $\langle \Psi | \hat{H}^2 | \Psi \rangle$ is performed (using replica sampling) as:
\begin{align}
\langle \Psi^1 | \hat{H}^2 | \Psi^2 \rangle &= \sum_{ijk} C_i^1 H_{ij} H_{jk} C_k^2, \\
&= \sum_j \sum_i C_i^1 H_{ij} \sum_k H_{jk} C_k^2, \\
&= \sum_j \Big( [ C_j^1 H_{jj} + \sum_{i \ne j} C_i^1 H_{ij} ] \nonumber \\
&\;\;\;\;\;\;\;\; \times [ H_{jj} C_j^2 + \sum_{k \ne j} H_{jk} C_k^2 ] \Big), \\
&= \sum_j C_j^1 H_{jj}^2 C_j^2 \nonumber \\
&\;\;\; - \frac{1}{\Delta\tau} \sum_j [ C_j^1 H_{jj} S_j^2 + S_j^1 H_{jj} C_j^2 ] \nonumber \\
&\;\;\; + \frac{1}{\Delta\tau^2} \sum_j S_j^1 S_j^2.
\label{eq:h_squared}
\end{align}
Note that the expression for $\sigma^2$ involves squaring the estimate of $\langle \Psi | \hat{H} | \Psi \rangle$. However, this operation can be performed \emph{after} averaging over the simulation, such that bias is not a concern here.
The energy variance could be useful as a measure of initiator error in i-FCIQMC. It could also be used to calculate improved excitation energies in i-FCIQMC by variance matching\cite{Robinson2017}. In previous applications of excited-state FCIQMC\cite{Blunt2015_3}, the same walker population was used for ground and excited states. Since excited states require larger walker populations for similar accuracy, this leads to an imbalance in accuracy between the two states. We expect that variance matching could improve this situation, and could perhaps also benefit model space QMC\cite{Ten-no2013, Ohtsuka2015} in the same way.
Figure~(\ref{fig:variance}) shows convergence of $\sigma^2$ with iteration number (with preconditioning and $\Delta \tau = 1.0$ au) and walker population per replica (${N_{\textrm{w}}}$) for the Hubbard model at $U/t=4$, on a periodic two-dimensional $18$-site lattice at half-filling. The lattice is the same as that presented in Supplemental Material of Ref.~(\onlinecite{Blunt2015_2}). As expected, $\sigma^2$ tends to $0$ as the walker population is increased and initiator error removed.
\begin{figure}[t]
\includegraphics{var_figure.eps}
\caption{The variance of the energy ($\sigma^2$) from FCIQMC for the Hubbard model with $U/t=4$, for a periodic, two-dimensional $18$-site lattice at half-filling. Initiator error is converged by increasing ${N_{\textrm{w}}}$. Preconditioning was used with a time step of $\Delta \tau = 1.0$ au. The stated populations (${N_{\textrm{w}}}$) are the final average values per replica. As expected, $\sigma^2$ tends to $0$ as initiator error is removed.}
\label{fig:variance}
\end{figure}
\section{Results}
\label{sec:results}
\begin{table*}[t]
\begin{center}
{\footnotesize
\begin{tabular}{@{\extracolsep{4pt}}lcccccc@{}}
\hline
\hline
& & \multicolumn{1}{c}{${E_{\textrm{var}}}$} & \multicolumn{2}{c}{${E_{\textrm{var+PT2}}}$} & \multicolumn{2}{c}{${E_{\textrm{var+PT2}}^{\textrm{new}}}$} \\
\cline{3-3} \cline{4-5} \cline{6-7}
System & $N_{\textrm{w}}$ & Error/$\textrm{m}{E_{\textrm{h}}}$ & Error/$\textrm{m}{{E_{\textrm{h}}}}$ & \% corrected & Error/$\textrm{m}{{E_{\textrm{h}}}}$ & \% corrected \\
\hline
C$_2$ (equilibrium, cc-pVQZ) & $1.75 \times 10^5$ & 2.20(5) & 0.10(5) & 95(4) & 0.05(5) & 97(4) \\
C$_2$ (stretched, cc-pVQZ) & $1.23 \times 10^5$ & 3.0(1) & 0.3(1) & 89(6) & 0.5(1) & 82(5) \\
Formaldehyde (aug-cc-pVDZ) & $3.0 \times 10^5$ & 4.0(1) & 0.3(1) & 93(4) & 0.02(22) & 100(6) \\
Formamide (cc-pVDZ) & $4.8 \times 10^6$ & 7.2(3) & 0.8(3) & 112(8) & 0.6(4) & 108(8) \\
Butadiene $(22\textrm{e},82\textrm{o})^a$ & $8.8 \times 10^7$ & 12.9(4) & 0.4(7) & 97(6) & 1.0(10) & 92(8) \\
Hubbard model ($U/t=2$) & $1.1 \times 10^4$ & 4.6(1) & 0.6(1) & 87(4) & 0.51(5) & 89(3) \\
Hubbard model ($U/t=4$) & $2.5 \times 10^5$ & 66.49(9) & 23.73(9) & 64.3(2) & 23.7(1) & 64.3(2) \\
\hline
\hline
\end{tabular}
}
\caption{Example improvements of ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ relative to ${E_{\textrm{var}}}$, for a variety of systems. The frozen-core approximation and Hartree--Fock orbitals are used for molecular systems. The walker population is chosen deliberately small so that there is substantial initiator error in ${E_{\textrm{var}}}$. ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ have almost identical accuracy, but ${E_{\textrm{var+PT2}}}$ typically has smaller noise. Hubbard model calculations are performed at half filling on an $18$-site lattice, and errors here are calculated relative to FCI values. Errors for other systems are calculated relative to very accurate extrapolated benchmarks (see the main text for details). Equilibrium and stretched nuclear distances for C$_2$ are $R=1.24253$ \AA and $R=2.0$ \AA, respectively. ${}^a$The basis set for butadiene is ANO-L-VDZP$[3s2p1d]/[2s1p]$, as used previously\cite{Daday2012,Olivares2015,Chien2018,Guo2018_1}.}
\label{tab:examples}
\end{center}
\end{table*}
The results are structured as follows. Example results for the perturbatively-corrected estimators are presented in Section~\ref{sec:examples}. In Section~\ref{sec:error_reduction} it is shown that the efficiency of such estimators is greatly increased by performing multiple spawning attempts per walker (large ${N_{\textrm{spawn}}}$). The effect of correlation of QMC data on perturbative corrections is discussed in Section~\ref{sec:corr_length}, and the convergence time of FCIQMC with preconditioning is considered in Section~\ref{sec:convergence}. Finally, we show application to a larger example, benzene.
All molecular geometries are presented in supporting information. The geometry of formamide and benzene were taken from Ref.~(\onlinecite{Schreiber2008}). The geometry for butadiene was taken from Ref.~(\onlinecite{Daday2012}).
The initiator threshold $n_a$ was set to $3.0$ for all systems except for C$_2$, where it was set to $2.0$ (for consistency with results in Ref.~[\onlinecite{Blunt2015_3}]).
The preconditioned approach was implemented in NECI\cite{NECI_github}, which was used for all FCIQMC results. Integral files were generated with PySCF\cite{pyscf}. CC benchmarks were obtained with MRCC\cite{mrcc, Bomble2005, Kallay2005}. SCI+PT2 benchmarks were obtained using the SHCI approach\cite{Holmes2016_2, Sharma2017} with Dice\cite{Dice}.
\subsection{Results for perturbative corrections to initiator error}
\label{sec:examples}
Table~\ref{tab:examples} shows examples of the correction made by ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ relative to ${E_{\textrm{var}}}$, for a variety of systems. Walker populations are chosen so that substantial initiator error exists in ${E_{\textrm{var}}}$. Hubbard model calculations are performed at half-filling on the same lattice as used in Fig.~(\ref{fig:variance}). Hartree--Fock orbitals were used for molecular systems. Each error is calculated relative to either the exact FCI energy (for Hubbard model examples) or a very accurate extrapolated estimate (for molecular examples). Benchmarks for C$_2$ are extrapolated SCI+PT2 values from Ref.~(\onlinecite{Holmes2017}). We also obtained benchmarks for formaldehyde and formamide using extrapolated SCI+PT2 (for formamide, these SCI+PT2 calculations used orbitals optimized by performing active-active rotations in an SHCI calculation with a threshold of $\epsilon = 2 \times 10^{-4}$, as described in Ref.~[\onlinecite{Smith2017}]). The benchmark for butadiene is an extrapolated DMRG+PT2 result of $-155.557567$ ${E_{\textrm{h}}}$ from Ref.~(\onlinecite{Guo2018_1}).
The molecular systems considered are weakly correlated and so the PT2 correction is expected to be effective, which is found to be the case. The correction here is typically $> 85\%$, as was found in Ref.~(\onlinecite{Blunt2018}). The correction is less effective for the Hubbard model as the coupling strength is increased.
\begin{figure}[t]
\includegraphics{formamide_converge.eps}
\caption{Convergence of FCIQMC for formamide, in a cc-pVDZ basis with a frozen core $(18\textrm{e}, 54\textrm{o})$. The FCIQMC wave function is initialized from the CISD wave function, and parameters of $\Delta \tau = 0.03$ au and $60$ spawns per walker were used. The dashed line is an extrapolated SCI benchmark (obtained using optimized orbitals\cite{Smith2017}), which is essentially exact. ${E_{\textrm{ref}}}$, ${E_{\textrm{var}}}$ and ${E_{\textrm{var+PT2}}}$ all begin from the CISD energy, while ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ is substantially more accurate before any further convergence. ${E_{\textrm{ref}}}$, as usually used in FCIQMC, converges slower than other estimators. ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ converge to the same value, although ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ has larger noise. These trends are seen across all systems.}
\label{fig:formamide_converge}
\end{figure}
Results for ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ are seen to be essentially identical within error bars. This is expected for the reasons discussed in Section~\ref{sec:pt2_estimators}. However, the statistical error on ${E_{\textrm{var+PT2}}}$ is usually smaller than that on ${E_{\textrm{var+PT2}}^{\textrm{new}}}$, so that ${E_{\textrm{var+PT2}}}$ is generally preferable (although some exceptions occur, particularly for model systems, as seen for the Hubbard model at $U/t=2$ in Table~\ref{tab:examples}). ${E_{\textrm{var+PT2}}}$ has the disadvantage that its derivation involves a somewhat poorly-defined definition of a zeroth-order space within the initiator approximation. In practice, however, it gives essentially identical results to ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ with a smaller noise.
It is also interesting to consider the convergence of each estimator in a simulation. An example is shown in Fig.~(\ref{fig:formamide_converge}) for formamide in a cc-pVDZ basis and with a frozen core $(18\textrm{e}, 54\textrm{o})$. Preconditioning was used with parameters $\Delta \tau = 0.03$ au and ${N_{\textrm{spawn}}} = 60$. The walker population was initialized from $10^6$ and grew to a final value of $6.3 \times 10^7$. It is found that ${E_{\textrm{ref}}}$ converges more slowly than ${E_{\textrm{var}}}$. Note also that ${E_{\textrm{var+PT2}}}$ is equal to ${E_{\textrm{var}}}$ at initialization. This is because this definition of the PT2 correction only has contributions from spawnings cancelled due to the initiator criterion. All walkers are initialized within the deterministic space and therefore are initiators, and so the PT2 correction as defined in Eq.~(\ref{eq:en2_original}) is initially $0$. Meanwhile ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ initializes from a much lower energy since it takes the form $\langle \Phi | \hat{H} | \Psi \rangle / \langle \Phi | \Psi \rangle$, where $| \Phi \rangle$ is immediately a much better estimate than $ | \Psi \rangle$. However, both ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ and ${E_{\textrm{var+PT2}}}$ converge to the same value once the simulation has equilibrated.
\subsection{Statistical error on perturbative corrections}
\label{sec:error_reduction}
Although ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ typically have a much smaller systematic (initiator) error than ${E_{\textrm{ref}}}$ and ${E_{\textrm{var}}}$, they tend to have a much larger statistical error (noise). This is sometimes manageable, but becomes severe for large systems and small walker populations. To see why, consider the PT2 correction as it appears in ${E_{\textrm{var+PT2}}}$:
\begin{equation}
\Delta E_2 = \frac{1}{(\Delta\tau)^2} \sum_a \frac{ S^1_a S^2_a }{ E - H_{aa} }.
\end{equation}
The summation is over all spawnings cancelled due to the initiator criteria. A similar term appears in estimators ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ and $\sigma^2$ (where the summation is performed over all spawnings, which does not affect the following argument).
The space sampled by the spawnings $S^1_a$ and $S^2_a$ contains up to double excitations from the occupied space, which is very large in general. Because replica sampling is required, a contribution to $\Delta E_2$ can only be made if spawnings from both replicas occur to the same determinant in the same iteration. As the space sampled becomes larger, or the number of spawned walkers becomes smaller, this becomes increasingly rare.
The preconditioned approach here allows one to perform fewer iterations (${N_{\textrm{iterations}}}$) with a larger number of spawning attempts per walker (${N_{\textrm{spawn}}}$). It can be shown that this approach leads to smaller noise on ${E_{\textrm{var+PT2}}}$, ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ and $\sigma^2$, and improved efficiency overall. This can be seen by the following argument. Roughly, we expect the statistical error on an estimator such as $\Delta E_2$ to obey
\begin{equation}
\sigma_{\Delta E_2} \appropto \frac{1}{\sqrt{N_{\textrm{contribs}}}},
\end{equation}
where $N_{\textrm{contribs}}$ is the number of contributions to an estimate. Since a contribution is made only if two spawnings occur to the same determinant from two independent replicas, the number of contributions is roughly proportional to the density of spawnings,
\begin{equation}
N_{\textrm{contribs}} \appropto ({N_{\textrm{spawn}}})^2.
\end{equation}
This is an upper limit which will become less accurate as the space spawned to becomes saturated, i.e. for large ${N_{\textrm{spawn}}}$ or a small number of orbitals. Assuming this holds, then
\begin{equation}
\sigma_{\Delta E_2} \appropto \frac{1}{{N_{\textrm{spawn}}}}.
\end{equation}
However, for a total real simulation time $T$ the number of iterations performed scales as ${N_{\textrm{iterations}}} \appropto T / {N_{\textrm{spawn}}} $. Since $\Delta E_2$ is averaged over all iterations, we also have $\sigma_{\Delta E_2} \propto 1/\sqrt{{N_{\textrm{iterations}}}}$. So for a constant simulation time $T$, as ${N_{\textrm{spawn}}}$ is increased,
\begin{equation}
\sigma_{\Delta E_2} \appropto \frac{1}{\sqrt{{N_{\textrm{spawn}}}}}
\label{eq:error_scaling}
\end{equation}
and the efficiency (with respect to estimation of $\Delta E_2$) follows
\begin{equation}
\epsilon_{\Delta E_2} = \frac{1}{\sigma^2 \times T} \appropto {N_{\textrm{spawn}}}.
\end{equation}
Therefore, performing multiple spawning attempts per walker provides one way to greatly reduce the error on ${E_{\textrm{var+PT2}}}$, ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ and $\sigma^2$. It should be emphasized that the following argument holds in FCIQMC both with and without preconditioning. However, preconditioning allows $\Delta \tau$ to be increased such that using a large value of ${N_{\textrm{spawn}}}$ will not lead to slow convergence or a long autocorrelation time, which is critical. Therefore, preconditioning with large values of ${N_{\textrm{spawn}}}$ and $\Delta \tau$ leads to a far more efficient algorithm overall.
\begin{figure}[t]
\includegraphics{error_scaling.eps}
\caption{Scaling of the statistical error estimate on ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ as ${N_{\textrm{spawn}}}$ is increased, while keeping ${N_{\textrm{spawn}}} \times {N_{\textrm{iterations}}}$ fixed. (a) C$_2$ in a cc-pVQZ basis set at equilibrium bond length. (b) Water in a cc-pVQZ basis set. (c) Ne in a cc-pV5Z basis set. The frozen core approximation is used in each case. Ideal fits use the scaling motivated in the main text, relative to the value at ${N_{\textrm{spawn}}}=1$.}
\label{fig:error_scaling}
\end{figure}
Fig.~(\ref{fig:error_scaling}) demonstrates the scaling of the statistical error estimate on ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ for three systems: C$_2$, cc-pVQZ at equilibrium bond length; Water, cc-pVQZ at equilibrium geometry; Ne, cc-pV5Z. Core electrons are frozen for each system. In each case ${N_{\textrm{spawn}}}$ is increased while holding ${N_{\textrm{spawn}}} \times {N_{\textrm{iterations}}}$ constant and also holding $\Delta \tau \times {N_{\textrm{iterations}}}$ constant (so that the final value of $\tau$ is fixed, and the total simulation time is approximately fixed). The reference population is held fixed as ${N_{\textrm{spawn}}}$ is increased, leading to final walker populations that are very similar. It is seen that increasing ${N_{\textrm{spawn}}}$ does indeed reduce the noise on ${E_{\textrm{var+PT2}}^{\textrm{new}}}$. For example, with ${N_{\textrm{spawn}}}=1$ the error estimate for C$_2$ is almost $5$ ${\textrm{m}E_{\textrm{h}}}$, which is reduced to $0.6$ ${\textrm{m}E_{\textrm{h}}}$ with ${N_{\textrm{spawn}}}=100$, and the scaling of Eq.~(\ref{eq:error_scaling}) is approximately followed. This scaling is less accurate for Ne, where the number of orbitals is smaller (and so the space spawned to is smaller) and becomes saturated with spawned walkers more quickly.
\begin{figure*}[t]
\includegraphics{c2_corr.eps}
\includegraphics{h2o_corr.eps}
\caption{Scaling of the statistical error estimate on the projected energy (${E_{\textrm{ref}}}$), variational energy (${E_{\textrm{var}}}$), perturbatively corrected energy (${E_{\textrm{var+PT2}}}$), and preconditioned energy (${E_{\textrm{var+PT2}}^{\textrm{new}}}$) estimators. Errors are estimated by a blocking procedure (see the main text). For ${E_{\textrm{ref}}}$, the error is significantly underestimated with an uncorrelated analysis (a block length of $1$). For ${E_{\textrm{var}}}$ this effect is lessened, but the error is nonetheless underestimated by a factor of $\sim 2$. In contrast, an accurate error estimate for perturbative quantities is obtained even with a block length of $1$ iteration. (a) C$_2$ at equilibrium bond length in a cc-pVQZ basis set. (b) Water in a cc-pVQZ basis set. The frozen core approximation is used for both systems.}
\label{fig:corr_length}
\end{figure*}
\subsection{Autocorrelation length on estimators}
\label{sec:corr_length}
Although ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ have larger noise than ${E_{\textrm{ref}}}$ and ${E_{\textrm{var}}}$, they have a significant advantage regarding the correlation of QMC data. This is demonstrated in Fig.~(\ref{fig:corr_length}) where the two systems studied are C$_2$ and water, as defined in Section~\ref{sec:error_reduction}. To investigate the correlation of each estimator, we average each simulation into blocks of increasing length, and perform an uncorrelated error analysis using these blocks. This is simply the reblocking procedure, as described by Flyvbjerg and Petersen\cite{Flyvbjerg1989}. Note that for the simulations of C$_2$ and water, we took a total of $2^{18}$ and $2^{19}$ iterations to average over, respectively. Therefore even with a block length of $2^{14}$, we used $2^{4}$ or $2^{5}$ data points to construct error estimates, to ensure that these estimates are reliable.
If the data is correlated then the error estimate grows with increasing block length, eventually plateauing when subsequent blocks become approximately uncorrelated. This effect is seen to be most significant for ${E_{\textrm{ref}}}$, where for water performing an uncorrelated analysis gives an error estimate of $2.1 \times 10^{-6}$ ${E_{\textrm{h}}}$, compared to a more realistic estimate of $1.2 \times 10^{-4}$ ${E_{\textrm{h}}}$. An uncorrelated analysis of ${E_{\textrm{var}}}$ gives an error estimate of $1.1 \times 10^{-4}$ ${E_{\textrm{h}}}$ compared to an accurate estimate of $2.0 \times 10^{-4}$ ${E_{\textrm{h}}}$, a much smaller but still non-negligible difference. We observe similar behavior across all systems investigated: an uncorrelated analysis typically underestimates the statistical error on ${E_{\textrm{var}}}$ by a factor of $\sim 2$, while for ${E_{\textrm{ref}}}$ this factor is typically much larger.
For ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$, the error estimate remains roughly constant as the block length is increased, indicating that data is approximately uncorrelated. We observe this across all systems studied. This is helpful, as a reliable error estimate on ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ may be obtained after a relatively small number of converged iterations. We suspect the reason for this is that the error on ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ is dominated by the term such as that in Eq.~(\ref{eq:en2_original}), involving a weighted dot product across the two spawning arrays. Although the FCIQMC wave function is heavily correlated from iteration to iteration, spawned walkers are essentially uncorrelated from each other. They are only correlated through their underlying dependence on the FCIQMC wave function, which should approximately cancel out in the denominator of the estimator. This seems to be very accurate based on our observations across many systems, although we would expect this observation to be only approximate theoretically. For example, ${E_{\textrm{var+PT2}}}$ is formed as the sum of ${E_{\textrm{var}}}$ and the PT2 correction; clearly an uncorrelated analysis is not exact for the former estimate (though ${E_{\textrm{var}}}$ typically has a much smaller error than the PT2 term, perhaps explaining why this is not noticeable). We would therefore still recommend a protocol of performing many FCIQMC iterations when possible, but the situation is dramatically improved compared to that for ${E_{\textrm{ref}}}$.
Note that the above arguments do not depend using a large time step or preconditioning. A time step of $\Delta \tau = 10^{-3}$ au was used for both examples in Fig.~(\ref{fig:corr_length}). This small autocorrelation length on ${E_{\textrm{var+PT2}}}$ and ${E_{\textrm{var+PT2}}^{\textrm{new}}}$ is a property of the estimators themselves, and not the use of preconditioning.
\subsection{Convergence time in the preconditioned approach}
\label{sec:convergence}
As demonstrated in Figs.~(\ref{fig:converge_comp}) and (\ref{fig:variance}), the use of preconditioning allows a large time step to be used in FCIQMC. Typically one can set $\Delta \tau = 0.5$ au and achieve convergence without issue, which usually allows convergence within $20$ - $30$ iterations in our experience. Meanwhile, the original algorithm usually requires at least several thousand iterations to converge, and sometimes many more.
However, as discussed in Section~\ref{sec:precond_init}, setting a large time step also requires setting ${N_{\textrm{spawn}}}$ to be very large. The simulation time in FCIQMC is dominated by the generation and processing of spawned walkers, such that iteration time is roughly proportional to ${N_{\textrm{spawn}}}$. So for a fair comparison, we should instead look at convergence speed as a function of ${N_{\textrm{iterations}}} \times {N_{\textrm{spawn}}}$, rather than ${N_{\textrm{iterations}}}$.
\begin{figure}[t]
\includegraphics{c2_comparison.eps}
\caption{An example comparison of convergence with and without preconditioning in FCIQMC, for C$_2$ in a cc-pVQZ basis, with a frozen core and at equilibrium bond length. Because the cost of each iteration is roughly proportional to the number of spawning attempts per walker (${N_{\textrm{spawn}}}$), convergence is plotted against the iteration number multiplied by ${N_{\textrm{spawn}}}$. ${N_{\textrm{spawn}}}=200$ with preconditioning, and ${N_{\textrm{spawn}}} = 1$ without. The time step is set and updated to avoid bloom events, as implemented in NECI; the final values of $\Delta \tau$ with and without preconditioning are $0.34$ and $6.4 \times 10^{-4}$ au, respectively.}
\label{fig:c2_eq_converge}
\end{figure}
Another requirement for a fair comparison is that the time step should be chosen in a consistent manner. For this, we use the automatic system for choosing $\Delta \tau$, implemented in NECI. As discussed already, it is important that there are few bloom events, defined as an event where a spawned walker is created with weight greater than the initiator threshold ($n_a$). Allowing a large number of bloom events can greatly increase statistical noise and lower the efficiency of the algorithm. The automatic system in NECI looks for the largest bloom event from the previous iteration (if any), and reduces $\Delta \tau$ so that this spawning will have weight less than $n_a$ in future occurrences. The time step reaches a final value during convergence.
In Fig.~(\ref{fig:c2_eq_converge}), convergence is considered for the same system as in Fig.~(\ref{fig:converge_comp}) (C$_2$, cc-pVQZ, equilibrium geometry), but plotted against ${N_{\textrm{iterations}}} \times {N_{\textrm{spawn}}}$. With preconditioning we take parameters ${N_{\textrm{spawn}}}=200$ and an initial time step of $\Delta \tau = 0.5$ au. For the original algorithm, we take ${N_{\textrm{spawn}}}=1$ and an initial time step of $\Delta \tau = 0.0025$ au (so that the initial value of $\Delta \tau / {N_{\textrm{spawn}}}$ is consistent). It can be seen that the benefit of preconditioning is now rather limited. In this case, the use of preconditioning speeds up convergence by only a small factor. We have tested this across a range of systems (including various basis set sizes, and both equilibrium and stretched regimes), and find that convergence is typically very similar between the two algorithms, by this metric.
It is important to understand why this is. Clearly, preconditioning is well established as improving the convergence rate considerably. As a function of number of iterations, convergence \emph{is} greatly sped up in FCIQMC. However in this stochastic setting the cost of each iteration scales strongly with the step size. This is dictated by the need to avoid large bloom events, to prevent large noise. Therefore, it is important to investigate bloom events more carefully. The unsigned weight of a spawned walker in the original algorithm is proportional to $\frac{1}{{P_{\textrm{gen}}}(j \leftarrow i)} | H_{ji} |$, where ${P_{\textrm{gen}}}(j \leftarrow i)$ is the probability of choosing determinant $| D_j \rangle$, given spawning from $| D_i \rangle $. With preconditioning this becomes proportional to $ \frac{ 1 }{ {P_{\textrm{gen}}}(j \leftarrow i) } \, | \frac{H_{ji}}{E - H_{jj}} | $. Therefore the choice of ${P_{\textrm{gen}}}(j \leftarrow i)$ is critical in determining the number of bloom events. In the original algorithm, the best choice of ${P_{\textrm{gen}}}(j \leftarrow i)$ (allowing the maximum $\Delta \tau$ without bloom events) is given by
\begin{equation}
{P_{\textrm{gen}}}(j \leftarrow i) = \frac{ |H_{ji}| }{ \sum_k |H_{ki}| }.
\label{eq:heat_bath}
\end{equation}
It is far too expensive to achieve this distribution exactly, but several schemes have been proposed to achieve this approximately. These include the heat bath approach of Holmes \emph{et al.}\cite{Holmes2016_1}, and approaches based on the Cauchy-Schwarz inequality (suggested by Alavi and co-workers\cite{smart_unpublished} and investigated recently by Neufeld and Thom\cite{Neufeld2018}). For preconditioned FCIQMC, the optimal choice of ${P_{\textrm{gen}}}(j \leftarrow i)$ will be
\begin{equation}
{P_{\textrm{gen}}}(j \leftarrow i) = \frac{ | \frac{ H_{ji} }{ E - H_{jj} } | }{ \sum_k | \frac{ H_{ki} }{ E - H_{kk} } | }.
\label{eq:precond_dist}
\end{equation}
Therefore, optimal preconditioning requires a very different excitation generator to the original approach. In this study we have used Cauchy-Schwarz-based excitation generators implemented in NECI, designed to approximately achieve Eq.~(\ref{eq:heat_bath}), and so the above comparison gives a significant advantage to the original scheme. To see the problem, consider the simple example of water in a cc-pVDZ basis set with a frozen core. In this case, the correlation energy is $-0.215$ ${E_{\textrm{h}}}$, and so any walker spawned to the HF determinant is amplified by a factor of $\sim 5$ by the preconditioner. Meanwhile, the largest value of $|E - H_{jj}|$ from a test simulation was $\sim 23$. Therefore the ratio of largest to smallest value of $|E - H_{jj}|$ is $\sim 100$ , and ideally we would like to make spawning to low-energy determinants $\sim 10$ times more likely, and spawning to high-energy determinants $\sim 10$ times less likely, relative to the current scheme. Doing so would allow the time step to be larger, and therefore convergence and autocorrelation times shorter, by this same factor (which will be system dependent). Alternatively, one could keep the time step fixed and reduce ${N_{\textrm{spawn}}}$ by this factor, which would be particularly useful when the correlation length is short, or $\Delta \tau$ close to $1$ already.
Therefore, there is substantial potential to speed up the FCIQMC algorithm by modifying excitation generators for the preconditioned case. The design and optimization of excitation generators is an extensive task, which we do not consider here. Nonetheless, there is clearly a benefit to be gained in future work through this approach.
Lastly, in the above analysis we assumed that the iteration time scaled proportionally to ${N_{\textrm{spawn}}}$. Actually, a large value of ${N_{\textrm{spawn}}}$ is often more efficient than this. This is because some parts of the algorithm (such as the death step and deterministic projection) are independent of ${N_{\textrm{spawn}}}$. For example, for benzene as studied in Section~\ref{sec:benzene}, the average iteration time divided by ${N_{\textrm{spawn}}}$ is equal to 0.56 seconds without preconditioning and ${N_{\textrm{spawn}}}=1$, while with preconditioning and ${N_{\textrm{spawn}}}=150$ this value is equal to 0.41 seconds (with ${N_{\textrm{w}}} = 1.28 \times 10^7$ in both cases). There are further ways in which large-${N_{\textrm{spawn}}}$ FCIQMC can be made more efficient, as discussed in the conclusion.
\begin{figure}[t]
\includegraphics{benzene.eps}
\caption{Results for benzene in a cc-pVDZ basis with a frozen core $(30\textrm{e},108\textrm{o})$. Top: FCIQMC without preconditioning, with a time step of $1.9 \times 10^{-4}$ au and performing $1$ spawning attempt per walker. The inset shows the projected energy (${E_{\textrm{ref}}}$) alone, with the dashed line showing the CCSDT(Q) result. Bottom: FCIQMC with preconditioning, with a time step of $0.1$ au and performing $150$ spawning attempts per walker. The walker population was ${N_{\textrm{w}}} = 1.28 \times 10^7$ in both cases.}
\label{fig:benzene}
\end{figure}
\begin{table}[t]
\begin{center}
{\footnotesize
\begin{tabular}{@{\extracolsep{4pt}}lcc@{}}
\hline
\hline
Method & Estimator & Energy / ${E_{\textrm{h}}}$ \\
\hline
CCSD(T) & & -0.5813 \\
CCSDT & & -0.5817 \\
CCSDT[Q] & & -0.5826 \\
CCSDT(Q) & & -0.5845 \\
\hline
FCIQMC & ${E_{\textrm{ref}}}$ & -0.5609(3) \\
\: (${N_{\textrm{spawn}}} = 1$) & ${E_{\textrm{var}}}$ & -0.5420(5) \\
& ${E_{\textrm{var+PT2}}}$ & -0.597(14) \\
\hline
FCIQMC & ${E_{\textrm{ref}}}$ & -0.5612(3) \\
\: (preconditioned, & ${E_{\textrm{var}}}$ & -0.5435(5) \\
\: ${N_{\textrm{spawn}}} = 150$) & ${E_{\textrm{var+PT2}}}$ & -0.5833(10) \\
\hline
\hline
\end{tabular}
}
\caption{Energies (shifted by $+231$ ${E_{\textrm{h}}}$) for benzene in a cc-pVDZ basis set with a frozen core $(30\textrm{e},108\textrm{o})$. FCIQMC was performed without preconditioning (${N_{\textrm{spawn}}}=1$, $\Delta \tau = 1.9 \times 10^{-4}$ au), and with preconditioning (${N_{\textrm{spawn}}}=150$, $\Delta \tau = 0.1$ au). The FCIQMC simulations are those plotted in Fig.~(\ref{fig:benzene}). Relative to CCSDT(Q), ${E_{\textrm{ref}}}$ is too high by $\sim 23$ ${\textrm{m}E_{\textrm{h}}}$ and ${E_{\textrm{var}}}$ by $\sim 41$ ${\textrm{m}E_{\textrm{h}}}$. For ${E_{\textrm{var+PT2}}}$, the noise with ${N_{\textrm{spawn}}}=1$ is too large for the estimate to be useful. With ${N_{\textrm{spawn}}}=150$, a result similar to those from CCSDT[Q] and CCSDT(Q) is obtained. Note that initiator error in ${E_{\textrm{var+PT2}}}$ is not fully removed here.}
\label{tab:benzene}
\end{center}
\end{table}
\subsection{Benzene}
\label{sec:benzene}
As an application of this approach to a larger system, we consider benzene in a cc-pVDZ basis set with a frozen core $(30\textrm{e},108\textrm{o})$, using the geometry of Ref.~(\onlinecite{Schreiber2008}). This is an example that would have been too challenging to study accurately with FCIQMC previously, even with significant computational resources, and so provides a good test.
Without preconditioning, parameters $\Delta \tau = 1.9 \times 10^{-4}$ au and ${N_{\textrm{spawn}}}=1$ are chosen. With preconditioning, we take $\Delta \tau = 0.1$ au and ${N_{\textrm{spawn}}}=150$. Both simulations used $1.28 \times 10^7$ walkers and were run for $11$ hours on $10$ $32$-core nodes, with $384$GB of RAM per node. These resources are modest compared to large-scale FCIQMC, which can be scaled up to more than $10^9$ walkers and $\sim 10^4$ CPU cores with appropriate load balancing\cite{HANDE}. Fig.~(\ref{fig:benzene}) presents the convergence of ${E_{\textrm{ref}}}$, ${E_{\textrm{var}}}$ and ${E_{\textrm{var+PT2}}}$ in both approaches. Table~\ref{tab:benzene} presents final estimates, averaged from convergence onwards, and compared to high-order coupled cluster.
Initiator error (relative to CCSDT(Q)) on ${E_{\textrm{ref}}}$ and ${E_{\textrm{var}}}$ is roughly unchanged by the use of preconditioning. The estimate from ${E_{\textrm{ref}}}$ is too high by $\sim 23$ ${\textrm{m}E_{\textrm{h}}}$, while the estimate from ${E_{\textrm{var}}}$ is too high by $\sim 41$ ${\textrm{m}E_{\textrm{h}}}$. With ${N_{\textrm{spawn}}}=1$, the noise on ${E_{\textrm{var+PT2}}}$ is too large to be useful. This is clear from Fig.~(\ref{fig:benzene}), where fluctuations from iteration to iteration are of size $\sim$ $20{E_{\textrm{h}}}$. The final averaged value in Table~\ref{tab:benzene} has a stochastic error of $14$ ${\textrm{m}E_{\textrm{h}}}$, and no reliable conclusion can be made. Using ${N_{\textrm{spawn}}}=150$, the noise is reduced substantially. Sensible convergence is seen, and the final estimate from ${E_{\textrm{var+PT2}}}$ has an statistical error of $1$ ${\textrm{m}E_{\textrm{h}}}$. This energy is between the CCSDT[Q] and CCSDT(Q) results. Continuing the preconditioned simulation for a further $11$ hours increases the ${E_{\textrm{var+PT2}}}$ estimate to $-231.5825(7)$ ${E_{\textrm{h}}}$. Therefore, we suspect that the true ${E_{\textrm{var+PT2}}}$ estimate (in the limit of zero statistical error) is slightly higher than that given in Table~\ref{tab:benzene}. The results here are not intended to be accurately converged FCI benchmarks, but estimates to assess the improvement made by ${E_{\textrm{var+PT2}}}$ and the large-${N_{\textrm{spawn}}}$ approach. In this respect the approach described here makes a significant improvement over the previous method.
\section{Conclusion}
\label{sec:conclusion}
It has been demonstrated that FCIQMC can be performed with a preconditioner, in contrast to the traditional imaginary-time propagation, allowing time steps close to unity to be used. This results in a method which can typically converge within $20$ - $30$ iterations, while the original method typically requires at least several thousand iterations. In practice, the requirement that bloom events be avoided means that a large ${N_{\textrm{spawn}}}$ must also be chosen. As a result, reductions in simulation time to convergence are rather more limited. This can be traced to the fact that currently-used excitation generators are optimized for imaginary-time propagation, and must be modified in the presence of a preconditioner. This will be an area for future work, and could greatly improve the speed of the method.
However, it has been shown that the use of a large ${N_{\textrm{spawn}}}$ is a dramatic benefit for the calculations of perturbative corrections to initiator error. Such perturbative corrections improve the accuracy of the method dramatically, yet are almost free to calculate from rejected spawned walkers, so that we regard this as a clear improvement to FCIQMC. These improvements have been demonstrated for benzene $(30\textrm{e},108\textrm{o})$, which is certainly not feasible with the original i-FCIQMC algorithm, and where the PT2 correction was too noisy in the previous approach. Thus, while the preconditioned approach does not speed up convergence as one might expect, it is a significant benefit in the calculation of PT2 corrections to initiator error.
In practice, we also find that performing multiple spawning attempts per walker is more efficient in terms of iteration time per spawned walker. In future work, there are obvious ways in which the algorithm could be made more efficient in the large-${N_{\textrm{spawn}}}$ case. For example:
\begin{itemize}
\item In semi-stochastic FCIQMC, the deterministic projection is performed once per iteration. When performing a large number of cheap iterations (small $\Delta \tau$ and ${N_{\textrm{spawn}}}$) this projection becomes too expensive beyond a deterministic space size of order $\sim 10^5$ or so. Using a small number of expensive iterations (large $\Delta \tau$ and ${N_{\textrm{spawn}}}$), a much larger deterministic space could be used without this projection becoming the limiting cost.
\item The use of large ${N_{\textrm{spawn}}}$ should make it more efficient to perform more of the algorithm deterministically, beyond the semi-stochastic approach. For example, for a determinant with $|C_i|$ walkers, it may be more efficient to generate all connected determinants and create spawnings accordingly, rather than calling the excitation generator $|C_i| \times {N_{\textrm{spawn}}}$ times, particularly if this number is similar to or larger than the number of connected determinants (as is sometimes the case).
\end{itemize}
Combined with an excitation generator optimized for the preconditioned algorithm, such modifications could lead to a much faster algorithm. The use of perturbative estimators already allows a new range of systems to be studied accurately by the method. The implementation of these additional developments should allow the method to push further still in the near future.
\begin{acknowledgments}
N.S.B is grateful to St John's College, Cambridge for funding and supporting this work through a Research Fellowship. A.J.W.T. thanks the Royal Society for a University Research Fellowship under grant UF160398. C.J.C.S is grateful to the Sims Fund for a studentship. This study made use of the CSD3 Peta4 CPU cluster.
\end{acknowledgments}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 7,306 |
In this scenario, Abdul is a Pakistani living in New York and driving a taxi. He entered the United States on a tourist visa, which has since expired. From his job as a taxi driver, he has saved $5,000 that he wants to send to his brother, Mohammad, who is lives in Pakistan.
The bank will charge $25 to issue a bank draft.
As shown in the table above, the process of sending money via traditional banks would not only be more expensive for Abdul but could also raise issues around his migration status. If he uses the hawala system, his brother in Pakistan receives more money, and it is delivered faster and more reliably. The following diagram illustrates in more detail how hawala transactions work. Hawaladars settle their debt by matching "people who want to get money into the country with those who need to get it out," so no money is actually transferred internationally.
This diagram is an original creation of the author, Catarina Santos using a map under Creative Commons Attribution-Share Alike 3.0 Unported, and photos under public license.
It is often the case that for domestic transactions in developing countries, hawaladars operate openly. For example, a local grocery shop in Kabul, Afghanistan, will have a staff person that is also a hawaladar full-time. However, this scenario has become less frequent since 9/11, as is explained below.
Does hawala represent a security threat? Like most remittance systems, it can be used to sponsor illicit activities. The fact that hawala has no paper trail and does not require proof of identity from lenders has led many individuals to use it to conduct money laundering and sponsor terrorist activities. Some examples of hawala use listed in the Financial Crimes Enforcement Network report are Al Qaeda's funding for the attacks on 9/11 and the bombings in Bombay, India in 1993. Despite the security risks associated with this system, it is premature to disregard the potential hawala holds for international development.
Hawala networks can be used as a development tool. Since hawala is largely based on in-person transactions, it is able to reach remote areas that otherwise do not have access to formal banking systems. It is also important to emphasize that most hawala users have "low levels of literacy, no bank accounts or credit cards and sometimes no identification documents." This becomes especially relevant in post-conflict states and countries where the formal economy is not established or accessible.
In Afghanistan and Somalia, small humanitarian aid and relief agencies have chosen to use hawala to deliver emergency response to remote areas because the costs of establishing other methods of money distribution are too high. It was the method chosen by Action Against Hunger (AAH), a global humanitarian organization operating in Afghanistan, because it was the only way that aid would reach the most remote areas. In Afghanistan, hawala was for a long time the safest and most established way to circulate money domestically, and especially in rural villages.
Additionally, as Transparency International highlighted on the Expert Answer in 2008, "remittances are very important sources of income for many impoverished households and may play an important role in promoting growth and development." Remittances become a crucial form of subsistence for thousands of impoverished households, and can be used for investment in small businesses that otherwise might not have access to capital.
How should hawala be regulated?
The Financial Action Task Force (FATF) and the International Monetary Fund (IMF) have released reports suggesting how hawala services can and should be regulated. While Western countries want to regulate this service given the existence of well-established banking and financial systems, the same cannot be said for fragile states. In the example of Afghanistan, the State Department said in 2015 that "there is no clear division between the hawala system and the formal financial sector." Even banks will occasionally use hawaladars to "transmit funds to hard-to-reach areas." In the absence of formal institutions, hawala enables people to have equal access to financial transactions.
That being said, since 9/11, most shops worldwide that provided hawala transactions have had to register their businesses, identify their clients and keep records of transactions. A helpful case to examine is that of Dahabshiil, the largest international money transfer firm in Africa. Dahabshiil initially provided an untracked hawala service butstarted keeping records of all transactions after 9/11, as required by law. In case clients do not possess passports or other forms of identification, the company relies on "tight-knit clan networks and references to prove identities" in order to keep track of all users.
This company represents a leading example of how to keep the benefits of the hawala system while at the same time deterring the illicit crimes associated with it. The idea of in-person money transaction is useful, and it should be regulated to the extent that every person sending and receiving money has to be identified and registered. The records should be kept private like any other private entity, and only disclosed in case of a criminal investigation.
Western money transfer companies have learned from the effectiveness of hawala and, with the help of technology, have cut the costs of international money transfers. For example, Transferwise, a London based company, matches people in the same country that want to send or receive money and then transfer the funds between their accounts. This type of innovative service, while allowing for fast-paced transactions, is limited to those with internet access and bank accounts. When pushing for tougher policies, it is important to bear in mind that to regulate transfer systems, the assumption is that there is a formal banking system available. That is only true for some parts of the world. Where there is no infrastructure, technology, or identification documents, hawala might be the only viable option.
Remittances are the main provider of subsistence for many impoverished households and a source of business capital, whether that comes through a formal banking system or not. Hawala provides many benefits for the developing world and even for migrants in developed nations that do not yet have access to formal banking. To reduce the risk of hawala for criminal activities, the hawaladars should keep a record of all the users, and have records ready to be disclosed in case of a criminal investigation. This is not a proactive but rather a reactive solution – it will not prevent money laundering; it would only allow the criminals to be identified after the crime is committed. Thus, there is much room for research on how hawala can be reformed to have less risk but still retain its clear benefits. Until then, where infrastructure and official banking systems are altogether nonexistent in developing countries, hawala remains an efficient system for money transfer. | {
"redpajama_set_name": "RedPajamaC4"
} | 367 |
Home / Charities / Children & Young People
Over 83,000 young people (aged 16-25) experience homelessness in the UK every year, and it's getting worse. In just four years, the number of young people sleeping rough in London alone has doubled. These young people have no home and nobody to support them.
Centrepoint is the UK's leading youth homelessness charity. Our vision is to end youth homelessness but our mission, every day, is to give homeless young people a job, a home and ultimately a positive future.
Typically, homeless young people have faced severe emotional or physical abuse and neglect. Many are care leavers or refugees escaping violence. Our priority is giving these young people a safe place to stay and for many, Centrepoint is the first place they've been able to call 'home'. But our work extends way beyond providing a place to live. Our programmes of support – including counselling and therapy, healthy living and relationship advice, education, training and our award-winning WorkWise programme – means that 80% of the young people we support move on successfully from Centrepoint leaving homelessness behind. Since 1969, we have helped over 104,000 homeless young people to turn their lives around. With your support we can help thousands more. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 4,484 |
Q: Conflicting user defined class name with inbuilt class name - C# I have the following code, where I am using the inbuilt C# Stack class in my own user defined Stack1 class.
Everything works well with this user defined nomenclature. But, as soon as I change all references of my user defined Stack1 class, and call it as a Stack class - the compiler gets confused, and the C# inbuilt Stack classes that I am using inside my user defined Stack class no longer correspond to the inbuilt Systems.Collections.Stack class. But, fall back to the user defined StackHavingPopPushAndMinO1_2.Stack class.
Do you know why this is happening, and is there any way I can keep my user defined Stack class name as Stack and still use the inbuilt Systems.Collections.Stack class inside it?
Please see: I already solved the issue by using the System.Collections.Generic.Stack<int> classes inside my user defined Stack class. But my intention here is that I don't want to change the name of my user defined Stack class - and still use the inbuilt Systems.Collection.Stack class inside it.
Please see: I also created an alias for System.Collections and appended it to the inbuild Stack classes I am using. But I was just wondering if there is some other way I can use my user defined Stack class which has the inbuilt Systems.Collections.Stackclasses in it.
Following is the code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StackHavingPopPushAndMinO1_2
{
class Stack1
{
Stack mainStack = new Stack();
Stack supportingStack = new Stack();
public void Push(int value)
{
mainStack.Push(value);
if(supportingStack.Count==0 || value <= (int) supportingStack.Peek())
{
supportingStack.Push(value);
}
}
public int Pop()
{
int value = -1;
if(mainStack.Count>0)
{
value = (int) mainStack.Pop();
if (value == (int) supportingStack.Peek())
supportingStack.Pop();
}
return value;
}
public int Min()
{
if (supportingStack.Count > 0)
return (int) supportingStack.Peek();
return -1;
}
}
class Program
{
static void Main(string[] args)
{
Stack1 stack = new Stack1();
stack.Push(60);
stack.Push(10);
stack.Push(50);
Console.WriteLine(stack.Min());
stack.Push(80);
stack.Push(9);
stack.Push(11);
Console.WriteLine(stack.Min());
}
}
}
Everything works fine with the user defined class Stack1. But, as soon as I change the name of Stack1 to Stack, the compiler gets confused, and we get errors due to name conflict. Any light on this will be greatly helpful. Why does not the C# Compiler know the difference between the user defined Stack class, and the inbuilt Stack class?
A:
Why does not the C# Compiler know the difference between the user defined Stack class, and the inbuilt Stack class?
How would you expect it to do so? When it encounters a declaration of a variable like this:
Stack stack = null;
... which class should that refer to? I suspect that in some cases you'd want that to refer to StackHavingPopPushAndMinO1_2.Stack, and in other cases you'd want it to refer to System.Collections.Stack. The C# compiler follows very strict name lookup rules to determine the meaning of a name. You can find those rules in the C# specification, and I suspect that you'd be hard-pressed to design better rules.
In particular, looking at your class, you have:
class Stack // After renaming
{
Stack mainStack = new Stack();
...
Presumably, you want the type of mainStack to be System.Collections.Stack, otherwise you'll end up with infinite recursion - but what rules would you expect to determine that?
Your options are:
*
*Avoid the naming collision, which is generally the best approach
*Use aliases to be explicit
*Use fully-qualified names, e.g. System.Collections.Stack stack = null; instead of just the unqualified name
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 5,990 |
Q: Get rows of a first array matching rows of a second one Suppose I have an array A of shape (M, K) and another B of shape (N, K).
The rows of B are all the possible patterns that can be encountered (each pattern is thus a 1D array of size K).
I thus would like to get an array C of shape (M,) where C[i] is the indice of the pattern (in B) of row i in A.
I am currently doing this in a loop (i.e. looping over all the possible patterns) but I would end up using vectorization.
Here is an example:
A = np.array([[0, 1], [0, 1], [1, 0]])
B = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
I am expecting:
C = np.array([1, 1, 2])
A: Based on this solution, here's a vectorized solution using np.searchsorted -
dims = B.max(0)+1
A1D = np.ravel_multi_index(A.T,dims)
B1D = np.ravel_multi_index(B.T,dims)
sidx = B1D.argsort()
out = sidx[np.searchsorted(B1D,A1D,sorter=sidx)]
Sample run -
In [43]: A
Out[43]:
array([[72, 89, 75],
[72, 89, 75],
[93, 38, 61],
[47, 67, 50],
[47, 67, 50],
[93, 38, 61],
[72, 89, 75]])
In [44]: B
Out[44]:
array([[47, 67, 50],
[93, 38, 61],
[41, 55, 27],
[72, 89, 75]])
In [45]: out
Out[45]: array([3, 3, 1, 0, 0, 1, 3])
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 9,686 |
<?php
if(!defined('INCLUDE_DIR')) die('403');
include_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.ajax.php');
require_once(INCLUDE_DIR.'class.note.php');
include_once INCLUDE_DIR . 'class.thread_actions.php';
class TicketsAjaxAPI extends AjaxController {
function lookup() {
global $thisstaff;
$limit = isset($_REQUEST['limit']) ? (int) $_REQUEST['limit']:25;
$tickets=array();
// Bail out of query is empty
if (!$_REQUEST['q'])
return $this->json_encode($tickets);
$visibility = Q::any(array(
'staff_id' => $thisstaff->getId(),
'team_id__in' => $thisstaff->teams->values_flat('team_id'),
));
if (!$thisstaff->showAssignedOnly() && ($depts=$thisstaff->getDepts())) {
$visibility->add(array('dept_id__in' => $depts));
}
$hits = TicketModel::objects()
->filter($visibility)
->values('user__default_email__address')
->annotate(array(
'number' => new SqlCode('null'),
'tickets' => SqlAggregate::COUNT('ticket_id', true)))
->limit($limit);
$q = $_REQUEST['q'];
if (strlen($q) < 3)
return $this->encode(array());
global $ost;
$hits = $ost->searcher->find($q, $hits)
->order_by(new SqlCode('__relevance__'), QuerySet::DESC);
if (preg_match('/\d{2,}[^*]/', $q, $T = array())) {
$hits = TicketModel::objects()
->values('user__default_email__address', 'number')
->annotate(array(
'tickets' => new SqlCode('1'),
'__relevance__' => new SqlCode(1)
))
->filter($visibility)
->filter(array('number__startswith' => $q))
->limit($limit)
->union($hits);
}
elseif (!count($hits) && preg_match('`\w$`u', $q)) {
// Do wild-card fulltext search
$_REQUEST['q'] = $q.'*';
return $this->lookup();
}
foreach ($hits as $T) {
$email = $T['user__default_email__address'];
$count = $T['tickets'];
if ($T['number']) {
$tickets[] = array('id'=>$T['number'], 'value'=>$T['number'],
'info'=>"{$T['number']} — {$email}",
'matches'=>$_REQUEST['q']);
}
else {
$tickets[] = array('email'=>$email, 'value'=>$email,
'info'=>"$email ($count)", 'matches'=>$_REQUEST['q']);
}
}
return $this->json_encode($tickets);
}
function acquireLock($tid) {
global $cfg, $thisstaff;
if(!$cfg || !$cfg->getLockTime() || $cfg->getTicketLockMode() == Lock::MODE_DISABLED)
Http::response(418, $this->encode(array('id'=>0, 'retry'=>false)));
if(!$tid || !is_numeric($tid) || !$thisstaff)
return 0;
if (!($ticket = Ticket::lookup($tid)) || !$ticket->checkStaffPerm($thisstaff))
return $this->encode(array('id'=>0, 'retry'=>false, 'msg'=>__('Lock denied!')));
//is the ticket already locked?
if ($ticket->isLocked() && ($lock=$ticket->getLock()) && !$lock->isExpired()) {
/*Note: Ticket->acquireLock does the same logic...but we need it here since we need to know who owns the lock up front*/
//Ticket is locked by someone else.??
if ($lock->getStaffId() != $thisstaff->getId())
return $this->json_encode(array('id'=>0, 'retry'=>false,
'msg' => sprintf(__('Currently locked by %s'),
$lock->getStaff()->getAvatarAndName())
));
//Ticket already locked by staff...try renewing it.
$lock->renew(); //New clock baby!
} elseif(!($lock=$ticket->acquireLock($thisstaff->getId(),$cfg->getLockTime()))) {
//unable to obtain the lock..for some really weired reason!
//Client should watch for possible loop on retries. Max attempts?
return $this->json_encode(array('id'=>0, 'retry'=>true));
}
return $this->json_encode(array(
'id'=>$lock->getId(), 'time'=>$lock->getTime(),
'code' => $lock->getCode()
));
}
function renewLock($id, $ticketId) {
global $thisstaff;
if (!$id || !is_numeric($id) || !$thisstaff)
Http::response(403, $this->encode(array('id'=>0, 'retry'=>false)));
if (!($lock = Lock::lookup($id)))
Http::response(404, $this->encode(array('id'=>0, 'retry'=>'acquire')));
if (!($ticket = Ticket::lookup($ticketId)) || $ticket->lock_id != $lock->lock_id)
// Ticket / Lock mismatch
Http::response(400, $this->encode(array('id'=>0, 'retry'=>false)));
if (!$lock->getStaffId() || $lock->isExpired())
// Said lock doesn't exist or is is expired — fetch a new lock
return self::acquireLock($ticket->getId());
if ($lock->getStaffId() != $thisstaff->getId())
// user doesn't own the lock anymore??? sorry...try to next time.
Http::response(403, $this->encode(array('id'=>0, 'retry'=>false,
'msg' => sprintf(__('Currently locked by %s'),
$lock->getStaff->getAvatarAndName())
))); //Give up...
// Ensure staff still has access
if (!$ticket->checkStaffPerm($thisstaff))
Http::response(403, $this->encode(array('id'=>0, 'retry'=>false,
'msg' => sprintf(__('You no longer have access to #%s.'),
$ticket->getNumber())
)));
// Renew the lock.
// Failure here is not an issue since the lock is not expired yet.. client need to check time!
$lock->renew();
return $this->encode(array('id'=>$lock->getId(), 'time'=>$lock->getTime(),
'code' => $lock->getCode()));
}
function releaseLock($id) {
global $thisstaff;
if (!$id || !is_numeric($id) || !$thisstaff)
Http::response(403, $this->encode(array('id'=>0, 'retry'=>true)));
if (!($lock = Lock::lookup($id)))
Http::response(404, $this->encode(array('id'=>0, 'retry'=>true)));
// You have to own the lock
if ($lock->getStaffId() != $thisstaff->getId()) {
return 0;
}
// Can't be expired
if ($lock->isExpired()) {
return 1;
}
return $lock->release() ? 1 : 0;
}
function previewTicket ($tid) {
global $thisstaff;
if(!$thisstaff || !($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, __('No such ticket'));
include STAFFINC_DIR . 'templates/ticket-preview.tmpl.php';
}
function viewUser($tid) {
global $thisstaff;
if(!$thisstaff
|| !($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'No such ticket');
if(!($user = User::lookup($ticket->getOwnerId())))
Http::response(404, 'Unknown user');
$info = array(
'title' => sprintf(__('Ticket #%s: %s'), $ticket->getNumber(),
Format::htmlchars($user->getName()))
);
ob_start();
include(STAFFINC_DIR . 'templates/user.tmpl.php');
$resp = ob_get_contents();
ob_end_clean();
return $resp;
}
function updateUser($tid) {
global $thisstaff;
if(!$thisstaff
|| !($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff)
|| !($user = User::lookup($ticket->getOwnerId())))
Http::response(404, 'No such ticket/user');
$errors = array();
if($user->updateInfo($_POST, $errors, true))
Http::response(201, $user->to_json());
$forms = $user->getForms();
$info = array(
'title' => sprintf(__('Ticket #%s: %s'), $ticket->getNumber(),
Format::htmlchars($user->getName()))
);
ob_start();
include(STAFFINC_DIR . 'templates/user.tmpl.php');
$resp = ob_get_contents();
ob_end_clean();
return $resp;
}
function changeUserForm($tid) {
global $thisstaff;
if(!$thisstaff
|| !($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'No such ticket');
$user = User::lookup($ticket->getOwnerId());
$info = array(
'title' => sprintf(__('Change user for ticket #%s'), $ticket->getNumber())
);
return self::_userlookup($user, null, $info);
}
function _userlookup($user, $form, $info) {
global $thisstaff;
ob_start();
include(STAFFINC_DIR . 'templates/user-lookup.tmpl.php');
$resp = ob_get_contents();
ob_end_clean();
return $resp;
}
function manageForms($ticket_id) {
global $thisstaff;
if (!$thisstaff)
Http::response(403, "Login required");
elseif (!($ticket = Ticket::lookup($ticket_id)))
Http::response(404, "No such ticket");
elseif (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_EDIT))
Http::response(403, "Access Denied");
$forms = DynamicFormEntry::forTicket($ticket->getId());
$info = array('action' => '#tickets/'.$ticket->getId().'/forms/manage');
include(STAFFINC_DIR . 'templates/form-manage.tmpl.php');
}
function updateForms($ticket_id) {
global $thisstaff;
if (!$thisstaff)
Http::response(403, "Login required");
elseif (!($ticket = Ticket::lookup($ticket_id)))
Http::response(404, "No such ticket");
elseif (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_EDIT))
Http::response(403, "Access Denied");
elseif (!isset($_POST['forms']))
Http::response(422, "Send updated forms list");
// Add new forms
$forms = DynamicFormEntry::forTicket($ticket_id);
foreach ($_POST['forms'] as $sort => $id) {
$found = false;
foreach ($forms as $e) {
if ($e->get('form_id') == $id) {
$e->set('sort', $sort);
$e->save();
$found = true;
break;
}
}
// New form added
if (!$found && ($new = DynamicForm::lookup($id))) {
$f = $new->instanciate();
$f->set('sort', $sort);
$f->setTicketId($ticket_id);
$f->save();
}
}
// Deleted forms
foreach ($forms as $idx => $e) {
if (!in_array($e->get('form_id'), $_POST['forms']))
$e->delete();
}
Http::response(201, 'Successfully managed');
}
function cannedResponse($tid, $cid, $format='text') {
global $thisstaff, $cfg;
if (!($ticket = Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'Unknown ticket ID');
if ($cid && !is_numeric($cid)) {
if (!($response=$ticket->getThread()->getVar($cid)))
Http::response(422, 'Unknown ticket variable');
// Ticket thread variables are assumed to be quotes
$response = "<br/><blockquote>{$response->asVar()}</blockquote><br/>";
// Return text if html thread is not enabled
if (!$cfg->isRichTextEnabled())
$response = Format::html2text($response, 90);
else
$response = Format::viewableImages($response);
// XXX: assuming json format for now.
return Format::json_encode(array('response' => $response));
}
if (!$cfg->isRichTextEnabled())
$format.='.plain';
$varReplacer = function (&$var) use($ticket) {
return $ticket->replaceVars($var);
};
include_once(INCLUDE_DIR.'class.canned.php');
if (!$cid || !($canned=Canned::lookup($cid)) || !$canned->isEnabled())
Http::response(404, 'No such premade reply');
return $canned->getFormattedResponse($format, $varReplacer);
}
function transfer($tid) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid)))
Http::response(404, __('No such ticket'));
if (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_TRANSFER))
Http::response(403, __('Permission denied'));
$errors = array();
$info = array(
':title' => sprintf(__('Ticket #%s: %s'),
$ticket->getNumber(),
__('Transfer')),
':action' => sprintf('#tickets/%d/transfer',
$ticket->getId())
);
$form = $ticket->getTransferForm($_POST);
if ($_POST && $form->isValid()) {
if ($ticket->transfer($form, $errors)) {
$_SESSION['::sysmsgs']['msg'] = sprintf(
__('%s successfully'),
sprintf(
__('%s transferred to %s department'),
__('Ticket'),
$ticket->getDept()
)
);
Http::response(201, $ticket->getId());
}
$form->addErrors($errors);
$info['error'] = $errors['err'] ?: __('Unable to transfer ticket');
}
$info['dept_id'] = $info['dept_id'] ?: $ticket->getDeptId();
include STAFFINC_DIR . 'templates/transfer.tmpl.php';
}
function assign($tid, $target=null) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid)))
Http::response(404, __('No such ticket'));
if (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_ASSIGN)
|| !($form = $ticket->getAssignmentForm($_POST,
array('target' => $target))))
Http::response(403, __('Permission denied'));
$errors = array();
$info = array(
':title' => sprintf(__('Ticket #%s: %s'),
$ticket->getNumber(),
sprintf('%s %s',
$ticket->isAssigned() ?
__('Reassign') : __('Assign'),
!strcasecmp($target, 'agents') ?
__('to an Agent') : __('to a Team')
)),
':action' => sprintf('#tickets/%d/assign%s',
$ticket->getId(),
($target ? "/$target": '')),
);
if ($ticket->isAssigned()) {
if ($ticket->getStaffId() == $thisstaff->getId())
$assigned = __('you');
else
$assigned = $ticket->getAssigned();
$info['notice'] = sprintf(__('%s is currently assigned to <b>%s</b>'),
__('This ticket'),
Format::htmlchars($assigned)
);
}
if ($_POST && $form->isValid()) {
if ($ticket->assign($form, $errors)) {
$_SESSION['::sysmsgs']['msg'] = sprintf(
__('%s successfully'),
sprintf(
__('%s assigned to %s'),
__('Ticket'),
$form->getAssignee())
);
Http::response(201, $ticket->getId());
}
$form->addErrors($errors);
$info['error'] = $errors['err'] ?: __('Unable to assign ticket');
}
include STAFFINC_DIR . 'templates/assign.tmpl.php';
}
function claim($tid) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid)))
Http::response(404, __('No such ticket'));
// Check for premissions and such
if (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_ASSIGN)
|| !$ticket->isOpen() // Claim only open
|| $ticket->getStaff() // cannot claim assigned ticket
|| !($form = $ticket->getClaimForm($_POST)))
Http::response(403, __('Permission denied'));
$errors = array();
$info = array(
':title' => sprintf(__('Ticket #%s: %s'),
$ticket->getNumber(),
__('Claim')),
':action' => sprintf('#tickets/%d/claim',
$ticket->getId()),
);
if ($ticket->isAssigned()) {
if ($ticket->getStaffId() == $thisstaff->getId())
$assigned = __('you');
else
$assigned = $ticket->getAssigned();
$info['error'] = sprintf(__('%s is currently assigned to <b>%s</b>'),
__('This ticket'),
$assigned);
} else {
$info['warn'] = sprintf(__('Are you sure you want to CLAIM %s?'),
__('this ticket'));
}
if ($_POST && $form->isValid()) {
if ($ticket->claim($form, $errors)) {
$_SESSION['::sysmsgs']['msg'] = sprintf(
__('%s successfully'),
sprintf(
__('%s assigned to %s'),
__('Ticket'),
__('you'))
);
Http::response(201, $ticket->getId());
}
$form->addErrors($errors);
$info['error'] = $errors['err'] ?: __('Unable to claim ticket');
}
$verb = sprintf('%s, %s', __('Yes'), __('Claim'));
include STAFFINC_DIR . 'templates/assign.tmpl.php';
}
function massProcess($action, $w=null) {
global $thisstaff, $cfg;
$actions = array(
'transfer' => array(
'verbed' => __('transferred'),
),
'assign' => array(
'verbed' => __('assigned'),
),
'claim' => array(
'verbed' => __('assigned'),
),
'delete' => array(
'verbed' => __('deleted'),
),
'reopen' => array(
'verbed' => __('reopen'),
),
'close' => array(
'verbed' => __('closed'),
),
);
if (!isset($actions[$action]))
Http::response(404, __('Unknown action'));
$info = $errors = $e = array();
$inc = null;
$i = $count = 0;
if ($_POST) {
if (!$_POST['tids'] || !($count=count($_POST['tids'])))
$errors['err'] = sprintf(
__('You must select at least %s.'),
__('one ticket'));
} else {
$count = $_REQUEST['count'];
}
switch ($action) {
case 'claim':
$w = 'me';
case 'assign':
$inc = 'assign.tmpl.php';
$info[':action'] = "#tickets/mass/assign/$w";
$info[':title'] = sprintf('Assign %s',
_N('selected ticket', 'selected tickets', $count));
$form = AssignmentForm::instantiate($_POST);
$assignCB = function($t, $f, $e) {
return $t->assign($f, $e);
};
$assignees = null;
switch ($w) {
case 'agents':
$depts = array();
$tids = $_POST['tids'] ?: array_filter(explode(',', $_REQUEST['tids']));
if ($tids) {
$tickets = TicketModel::objects()
->distinct('dept_id')
->filter(array('ticket_id__in' => $tids));
$depts = $tickets->values_flat('dept_id');
}
$members = Staff::objects()
->distinct('staff_id')
->filter(array(
'onvacation' => 0,
'isactive' => 1,
)
);
if ($depts) {
$members->filter(Q::any( array(
'dept_id__in' => $depts,
Q::all(array(
'dept_access__dept__id__in' => $depts,
Q::not(array('dept_access__dept__flags__hasbit'
=> Dept::FLAG_ASSIGN_MEMBERS_ONLY))
))
)));
}
switch ($cfg->getAgentNameFormat()) {
case 'last':
case 'lastfirst':
case 'legal':
$members->order_by('lastname', 'firstname');
break;
default:
$members->order_by('firstname', 'lastname');
}
$prompt = __('Select an Agent');
$assignees = array();
foreach ($members as $member)
$assignees['s'.$member->getId()] = $member->getName();
if (!$assignees)
$info['warn'] = __('No agents available for assignment');
break;
case 'teams':
$assignees = array();
$prompt = __('Select a Team');
foreach (Team::getActiveTeams() as $id => $name)
$assignees['t'.$id] = $name;
if (!$assignees)
$info['warn'] = __('No teams available for assignment');
break;
case 'me':
$info[':action'] = '#tickets/mass/claim';
$info[':title'] = sprintf('Claim %s',
_N('selected ticket', 'selected tickets', $count));
$info['warn'] = sprintf(
__('Are you sure you want to CLAIM %s?'),
_N('selected ticket', 'selected tickets', $count));
$verb = sprintf('%s, %s', __('Yes'), __('Claim'));
$id = sprintf('s%s', $thisstaff->getId());
$assignees = array($id => $thisstaff->getName());
$vars = $_POST ?: array('assignee' => array($id));
$form = ClaimForm::instantiate($vars);
$assignCB = function($t, $f, $e) {
return $t->claim($f, $e);
};
break;
}
if ($assignees != null)
$form->setAssignees($assignees);
if ($prompt && ($f=$form->getField('assignee')))
$f->configure('prompt', $prompt);
if ($_POST && $form->isValid()) {
foreach ($_POST['tids'] as $tid) {
if (($t=Ticket::lookup($tid))
// Make sure the agent is allowed to
// access and assign the task.
&& $t->checkStaffPerm($thisstaff, Ticket::PERM_ASSIGN)
// Do the assignment
&& $assignCB($t, $form, $e)
)
$i++;
}
if (!$i) {
$info['error'] = sprintf(
__('Unable to %1$s %2$s'),
__('assign'),
_N('selected ticket', 'selected tickets', $count));
}
}
break;
case 'transfer':
$inc = 'transfer.tmpl.php';
$info[':action'] = '#tickets/mass/transfer';
$info[':title'] = sprintf('Transfer %s',
_N('selected ticket', 'selected tickets', $count));
$form = TransferForm::instantiate($_POST);
if ($_POST && $form->isValid()) {
foreach ($_POST['tids'] as $tid) {
if (($t=Ticket::lookup($tid))
// Make sure the agent is allowed to
// access and transfer the task.
&& $t->checkStaffPerm($thisstaff, Ticket::PERM_TRANSFER)
// Do the transfer
&& $t->transfer($form, $e)
)
$i++;
}
if (!$i) {
$info['error'] = sprintf(
__('Unable to %1$s %2$s'),
__('transfer'),
_N('selected ticket', 'selected tickets', $count));
}
}
break;
case 'delete':
$inc = 'delete.tmpl.php';
$info[':action'] = '#tickets/mass/delete';
$info[':title'] = sprintf('Delete %s',
_N('selected ticket', 'selected tickets', $count));
$info[':placeholder'] = sprintf(__(
'Optional reason for deleting %s'),
_N('selected ticket', 'selected tickets', $count));
$info['warn'] = sprintf(__(
'Are you sure you want to DELETE %s?'),
_N('selected ticket', 'selected tickets', $count));
$info[':extra'] = sprintf('<strong>%s</strong>',
__('Deleted tickets CANNOT be recovered, including any associated attachments.')
);
// Generic permission check.
if (!$thisstaff->hasPerm(Ticket::PERM_DELETE, false))
$errors['err'] = sprintf(
__('You do not have permission %s'),
__('to delete tickets'));
if ($_POST && !$errors) {
foreach ($_POST['tids'] as $tid) {
if (($t=Ticket::lookup($tid))
&& $t->checkStaffPerm($thisstaff, Ticket::PERM_DELETE)
&& $t->delete($_POST['comments'], $e)
)
$i++;
}
if (!$i) {
$info['error'] = sprintf(
__('Unable to %1$s %2$s'),
__('delete'),
_N('selected ticket', 'selected tickets', $count));
}
}
break;
default:
Http::response(404, __('Unknown action'));
}
if ($_POST && $i) {
// Assume success
if ($i==$count) {
$msg = sprintf(__('Successfully %s %s.'),
$actions[$action]['verbed'],
sprintf('%1$d %2$s',
$count,
_N('selected ticket', 'selected tickets', $count))
);
$_SESSION['::sysmsgs']['msg'] = $msg;
} else {
$warn = sprintf(
__('%1$d of %2$d %3$s %4$s'
/* Tokens are <x> of <y> <selected ticket(s)> <actioned> */),
$i, $count,
_N('selected ticket', 'selected tickets',
$count),
$actions[$action]['verbed']);
$_SESSION['::sysmsgs']['warn'] = $warn;
}
Http::response(201, 'processed');
} elseif($_POST && !isset($info['error'])) {
$info['error'] = $errors['err'] ?: sprintf(
__('Unable to %1$s %2$s'),
__('process'),
_N('selected ticket', 'selected tickets', $count));
}
if ($_POST)
$info = array_merge($info, Format::htmlchars($_POST));
include STAFFINC_DIR . "templates/$inc";
// Copy checked tickets to the form.
echo "
<script type=\"text/javascript\">
$(function() {
$('form#tickets input[name=\"tids[]\"]:checkbox:checked')
.each(function() {
$('<input>')
.prop('type', 'hidden')
.attr('name', 'tids[]')
.val($(this).val())
.appendTo('form.mass-action');
});
});
</script>";
}
function changeTicketStatus($tid, $status, $id=0) {
global $thisstaff;
if (!$thisstaff)
Http::response(403, 'Access denied');
elseif (!$tid
|| !($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'Unknown ticket #');
$role = $thisstaff->getRole($ticket->getDeptId());
$info = array();
$state = null;
switch($status) {
case 'open':
case 'reopen':
$state = 'open';
break;
case 'close':
if (!$role->hasPerm(TicketModel::PERM_CLOSE))
Http::response(403, 'Access denied');
$state = 'closed';
// Check if ticket is closeable
if (is_string($closeable=$ticket->isCloseable()))
$info['warn'] = $closeable;
break;
case 'delete':
if (!$role->hasPerm(TicketModel::PERM_DELETE))
Http::response(403, 'Access denied');
$state = 'deleted';
break;
default:
$state = $ticket->getStatus()->getState();
$info['warn'] = sprintf(__('%s: Unknown or invalid'),
__('status'));
}
$info['status_id'] = $id ?: $ticket->getStatusId();
return self::_changeTicketStatus($ticket, $state, $info);
}
function setTicketStatus($tid) {
global $thisstaff, $ost;
if (!$thisstaff)
Http::response(403, 'Access denied');
elseif (!$tid
|| !($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'Unknown ticket #');
$errors = $info = array();
if (!$_POST['status_id']
|| !($status= TicketStatus::lookup($_POST['status_id'])))
$errors['status_id'] = sprintf('%s %s',
__('Unknown or invalid'), __('status'));
elseif ($status->getId() == $ticket->getStatusId())
$errors['err'] = sprintf(__('Ticket already set to %s status'),
__($status->getName()));
elseif (($role = $thisstaff->getRole($ticket->getDeptId()))) {
// Make sure the agent has permission to set the status
switch(mb_strtolower($status->getState())) {
case 'open':
if (!$role->hasPerm(TicketModel::PERM_CLOSE)
&& !$role->hasPerm(TicketModel::PERM_CREATE))
$errors['err'] = sprintf(__('You do not have permission %s'),
__('to reopen tickets'));
break;
case 'closed':
if (!$role->hasPerm(TicketModel::PERM_CLOSE))
$errors['err'] = sprintf(__('You do not have permission %s'),
__('to resolve/close tickets'));
break;
case 'deleted':
if (!$role->hasPerm(TicketModel::PERM_DELETE))
$errors['err'] = sprintf(__('You do not have permission %s'),
__('to archive/delete tickets'));
break;
default:
$errors['err'] = sprintf('%s %s',
__('Unknown or invalid'), __('status'));
}
} else {
$errors['err'] = __('Access denied');
}
$state = strtolower($status->getState());
if (!$errors && $ticket->setStatus($status, $_REQUEST['comments'], $errors)) {
if ($state == 'deleted') {
$msg = sprintf('%s %s',
sprintf(__('Ticket #%s'), $ticket->getNumber()),
__('deleted sucessfully')
);
} elseif ($state != 'open') {
$msg = sprintf(__('%s status changed to %s'),
sprintf(__('Ticket #%s'), $ticket->getNumber()),
$status->getName());
} else {
$msg = sprintf(
__('%s status changed to %s'),
__('Ticket'),
$status->getName());
}
$_SESSION['::sysmsgs']['msg'] = $msg;
Http::response(201, 'Successfully processed');
} elseif (!$errors['err']) {
$errors['err'] = __('Error updating ticket status');
}
$state = $state ?: $ticket->getStatus()->getState();
$info['status_id'] = $status
? $status->getId() : $ticket->getStatusId();
return self::_changeTicketStatus($ticket, $state, $info, $errors);
}
function changeSelectedTicketsStatus($status, $id=0) {
global $thisstaff, $cfg;
if (!$thisstaff)
Http::response(403, 'Access denied');
$state = null;
$info = array();
switch($status) {
case 'open':
case 'reopen':
$state = 'open';
break;
case 'close':
if (!$thisstaff->hasPerm(TicketModel::PERM_CLOSE, false))
Http::response(403, 'Access denied');
$state = 'closed';
break;
case 'delete':
if (!$thisstaff->hasPerm(TicketModel::PERM_DELETE, false))
Http::response(403, 'Access denied');
$state = 'deleted';
break;
default:
$info['warn'] = sprintf('%s %s',
__('Unknown or invalid'), __('status'));
}
$info['status_id'] = $id;
return self::_changeSelectedTicketsStatus($state, $info);
}
function setSelectedTicketsStatus($state) {
global $thisstaff, $ost;
$errors = $info = array();
if (!$thisstaff || !$thisstaff->canManageTickets())
$errors['err'] = sprintf('%s %s',
sprintf(__('You do not have permission %s'),
__('to mass manage tickets')),
__('Contact admin for such access'));
elseif (!$_REQUEST['tids'] || !count($_REQUEST['tids']))
$errors['err']=sprintf(__('You must select at least %s.'),
__('one ticket'));
elseif (!($status= TicketStatus::lookup($_REQUEST['status_id'])))
$errors['status_id'] = sprintf('%s %s',
__('Unknown or invalid'), __('status'));
elseif (!$errors) {
// Make sure the agent has permission to set the status
switch(mb_strtolower($status->getState())) {
case 'open':
if (!$thisstaff->hasPerm(TicketModel::PERM_CLOSE, false)
&& !$thisstaff->hasPerm(TicketModel::PERM_CREATE, false))
$errors['err'] = sprintf(__('You do not have permission %s'),
__('to reopen tickets'));
break;
case 'closed':
if (!$thisstaff->hasPerm(TicketModel::PERM_CLOSE, false))
$errors['err'] = sprintf(__('You do not have permission %s'),
__('to resolve/close tickets'));
break;
case 'deleted':
if (!$thisstaff->hasPerm(TicketModel::PERM_DELETE, false))
$errors['err'] = sprintf(__('You do not have permission %s'),
__('to archive/delete tickets'));
break;
default:
$errors['err'] = sprintf('%s %s',
__('Unknown or invalid'), __('status'));
}
}
$count = count($_REQUEST['tids']);
if (!$errors) {
$i = 0;
$comments = $_REQUEST['comments'];
foreach ($_REQUEST['tids'] as $tid) {
if (($ticket=Ticket::lookup($tid))
&& $ticket->getStatusId() != $status->getId()
&& $ticket->checkStaffPerm($thisstaff)
&& $ticket->setStatus($status, $comments, $errors))
$i++;
}
if (!$i) {
$errors['err'] = $errors['err']
?: sprintf(__('Unable to change status for %s'),
_N('the selected ticket', 'any of the selected tickets', $count));
}
else {
// Assume success
if ($i==$count) {
if (!strcasecmp($status->getState(), 'deleted')) {
$msg = sprintf(__( 'Successfully deleted %s.'),
_N('selected ticket', 'selected tickets',
$count));
} else {
$msg = sprintf(
__(
/* 1$ will be 'selected ticket(s)', 2$ is the new status */
'Successfully changed status of %1$s to %2$s'),
_N('selected ticket', 'selected tickets',
$count),
$status->getName());
}
$_SESSION['::sysmsgs']['msg'] = $msg;
} else {
if (!strcasecmp($status->getState(), 'deleted')) {
$warn = sprintf(__('Successfully deleted %s.'),
sprintf(__('%1$d of %2$d selected tickets'),
$i, $count)
);
} else {
$warn = sprintf(
__('%1$d of %2$d %3$s status changed to %4$s'),$i, $count,
_N('selected ticket', 'selected tickets',
$count),
$status->getName());
}
$_SESSION['::sysmsgs']['warn'] = $warn;
}
Http::response(201, 'Successfully processed');
}
}
return self::_changeSelectedTicketsStatus($state, $info, $errors);
}
function triggerThreadAction($ticket_id, $thread_id, $action) {
$thread = ThreadEntry::lookup($thread_id);
if (!$thread)
Http::response(404, 'No such ticket thread entry');
if ($thread->getThread()->getObjectId() != $ticket_id)
Http::response(404, 'No such ticket thread entry');
$valid = false;
foreach ($thread->getActions() as $group=>$list) {
foreach ($list as $name=>$A) {
if ($A->getId() == $action) {
$valid = true; break;
}
}
}
if (!$valid)
Http::response(400, 'Not a valid action for this thread');
$thread->triggerAction($action);
}
private function _changeSelectedTicketsStatus($state, $info=array(), $errors=array()) {
$count = $_REQUEST['count'] ?:
($_REQUEST['tids'] ? count($_REQUEST['tids']) : 0);
$info['title'] = sprintf(__('Change Status — %1$d %2$s selected'),
$count,
_N('ticket', 'tickets', $count)
);
if (!strcasecmp($state, 'deleted')) {
$info['warn'] = sprintf(__(
'Are you sure you want to DELETE %s?'),
_N('selected ticket', 'selected tickets', $count)
);
$info['extra'] = sprintf('<strong>%s</strong>', __(
'Deleted tickets CANNOT be recovered, including any associated attachments.')
);
$info['placeholder'] = sprintf(__(
'Optional reason for deleting %s'),
_N('selected ticket', 'selected tickets', $count));
}
$info['status_id'] = $info['status_id'] ?: $_REQUEST['status_id'];
$info['comments'] = Format::htmlchars($_REQUEST['comments']);
return self::_changeStatus($state, $info, $errors);
}
private function _changeTicketStatus($ticket, $state, $info=array(), $errors=array()) {
$verb = TicketStateField::getVerb($state);
$info['action'] = sprintf('#tickets/%d/status', $ticket->getId());
$info['title'] = sprintf(__(
/* 1$ will be a verb, like 'open', 2$ will be the ticket number */
'%1$s Ticket #%2$s'),
$verb ?: $state,
$ticket->getNumber()
);
// Deleting?
if (!strcasecmp($state, 'deleted')) {
$info['placeholder'] = sprintf(__(
'Optional reason for deleting %s'),
__('this ticket'));
$info[ 'warn'] = sprintf(__(
'Are you sure you want to DELETE %s?'),
__('this ticket'));
//TODO: remove message below once we ship data retention plug
$info[ 'extra'] = sprintf('<strong>%s</strong>',
__('Deleted tickets CANNOT be recovered, including any associated attachments.')
);
}
$info['status_id'] = $info['status_id'] ?: $ticket->getStatusId();
$info['comments'] = Format::htmlchars($_REQUEST['comments']);
return self::_changeStatus($state, $info, $errors);
}
private function _changeStatus($state, $info=array(), $errors=array()) {
if ($info && isset($info['errors']))
$errors = array_merge($errors, $info['errors']);
if (!$info['error'] && isset($errors['err']))
$info['error'] = $errors['err'];
include(STAFFINC_DIR . 'templates/ticket-status.tmpl.php');
}
function tasks($tid) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'Unknown ticket');
include STAFFINC_DIR . 'ticket-tasks.inc.php';
}
function addTask($tid) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid)))
Http::response(404, 'Unknown ticket');
if (!$ticket->checkStaffPerm($thisstaff, Task::PERM_CREATE))
Http::response(403, 'Permission denied');
$info=$errors=array();
if ($_POST) {
Draft::deleteForNamespace(
sprintf('ticket.%d.task', $ticket->getId()),
$thisstaff->getId());
// Default form
$form = TaskForm::getInstance();
$form->setSource($_POST);
// Internal form
$iform = TaskForm::getInternalForm($_POST);
$isvalid = true;
if (!$iform->isValid())
$isvalid = false;
if (!$form->isValid())
$isvalid = false;
if ($isvalid) {
$vars = $_POST;
$vars['object_id'] = $ticket->getId();
$vars['object_type'] = ObjectModel::OBJECT_TYPE_TICKET;
$vars['default_formdata'] = $form->getClean();
$vars['internal_formdata'] = $iform->getClean();
$desc = $form->getField('description');
if ($desc
&& $desc->isAttachmentsEnabled()
&& ($attachments=$desc->getWidget()->getAttachments()))
$vars['cannedattachments'] = $attachments->getClean();
$vars['staffId'] = $thisstaff->getId();
$vars['poster'] = $thisstaff;
$vars['ip_address'] = $_SERVER['REMOTE_ADDR'];
if (($task=Task::create($vars, $errors)))
Http::response(201, $task->getId());
}
$info['error'] = __('Error adding task - try again!');
}
$info['action'] = sprintf('#tickets/%d/add-task', $ticket->getId());
$info['title'] = sprintf(
__( 'Ticket #%1$s: %2$s'),
$ticket->getNumber(),
__('Add New Task')
);
include STAFFINC_DIR . 'templates/task.tmpl.php';
}
function task($tid, $id) {
global $thisstaff;
if (!($ticket=Ticket::lookup($tid))
|| !$ticket->checkStaffPerm($thisstaff))
Http::response(404, 'Unknown ticket');
// Lookup task and check access
if (!($task=Task::lookup($id))
|| !$task->checkStaffPerm($thisstaff))
Http::response(404, 'Unknown task');
$info = $errors = array();
$note_attachments_form = new SimpleForm(array(
'attachments' => new FileUploadField(array('id'=>'attach',
'name'=>'attach:note',
'configuration' => array('extensions'=>'')))
));
$reply_attachments_form = new SimpleForm(array(
'attachments' => new FileUploadField(array('id'=>'attach',
'name'=>'attach:reply',
'configuration' => array('extensions'=>'')))
));
if ($_POST) {
$vars = $_POST;
switch ($_POST['a']) {
case 'postnote':
$attachments = $note_attachments_form->getField('attachments')->getClean();
$vars['cannedattachments'] = array_merge(
$vars['cannedattachments'] ?: array(), $attachments);
if (($note=$task->postNote($vars, $errors, $thisstaff))) {
$msg=__('Note posted successfully');
// Clear attachment list
$note_attachments_form->setSource(array());
$note_attachments_form->getField('attachments')->reset();
Draft::deleteForNamespace('task.note.'.$task->getId(),
$thisstaff->getId());
} else {
if (!$errors['err'])
$errors['err'] = __('Unable to post the note - missing or invalid data.');
}
break;
case 'postreply':
$attachments = $reply_attachments_form->getField('attachments')->getClean();
$vars['cannedattachments'] = array_merge(
$vars['cannedattachments'] ?: array(), $attachments);
if (($response=$task->postReply($vars, $errors))) {
$msg=__('Update posted successfully');
// Clear attachment list
$reply_attachments_form->setSource(array());
$reply_attachments_form->getField('attachments')->reset();
Draft::deleteForNamespace('task.reply.'.$task->getId(),
$thisstaff->getId());
} else {
if (!$errors['err'])
$errors['err'] = __('Unable to post the reply - missing or invalid data.');
}
break;
default:
$errors['err'] = __('Unknown action');
}
}
include STAFFINC_DIR . 'templates/task-view.tmpl.php';
}
}
?>
| {
"redpajama_set_name": "RedPajamaGithub"
} | 4,119 |
Jean Hersholt Humanitarian Award är en speciell Oscar som delas ut med ojämna mellanrum av Amerikanska filmakademien till individer som har lämnat stora humanitära bidrag till världen. Priset är uppkallat efter den dansk-amerikanska skådespelaren och humanitären Jean Hersholt, som var chef över Motion Picture Relief Fund i 18 år.
Pristagare
29:e — Y. Frank Freeman
30:e — Samuel Goldwyn
32:a — Bob Hope
33:e — Sol Lesser
34:e — George Seaton
35:e — Steve Broidy
38:e — Edmond L. DePatie
39:e — George Bagnall
40:e — Gregory Peck
41:a — Martha Raye
42:a — George Jessel
43:e — Frank Sinatra
45:e — Rosalind Russell
46:e — Lew Wasserman
47:e — Arthur B. Krim
48:e — Jules C. Stein
50:e — Charlton Heston
51:a — Leo Jaffe
52:a — Robert Benjamin †
54:e — Danny Kaye
55:e — Walter Mirisch
56:e — Mike Frankovich
57:e — David L. Wolper
58:e — Charles "Buddy" Rogers
62:a — Howard W. Koch
65:e — Audrey Hepburn †
65:e — Elizabeth Taylor
66:e — Paul Newman
67:e — Quincy Jones
74:e — Arthur Hiller
77:e — Roger Mayer
79:e — Sherry Lansing
81:a — Jerry Lewis
84:e — Oprah Winfrey
85:e — Jeffrey Katzenberg
86:e — Angelina Jolie
87:e — Harry Belafonte
88:e — Debbie Reynolds
† — postum vinnare
Referenser
Se även
Oscar
Irving G. Thalberg Memorial Award
Gordon E. Sawyer Award
Oscar | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 1,684 |
package me.ycdev.android.demo.dbtest.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class TestDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "test.db";
private static final int DB_VERSION = 1;
public TestDbOpenHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
TestTable.createTableIfNeeded(db);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// nothing to do now
}
public static void clearDbRecords(Context cxt) {
SQLiteDatabase db = new TestDbOpenHelper(cxt).getWritableDatabase();
TestTable table = new TestTable(db);
table.clearRecords();
db.close();
}
} | {
"redpajama_set_name": "RedPajamaGithub"
} | 144 |
DEDICATION, a compilation of newly recorded works by composer Howard Quilling, features two sonatas for violin and piano, a suite for saxophone and wind orchestra, and a trio for violin, cello, and piano.
Fresh Dimensions
The modern romanticism of composer Craig Morris is one simultaneously deeply personal and broadly meaningful. His albums DREAMS (2011) and CIRCLE OF LOVE (2015), both on the Ravello Records label, in large part deal directly with musical representations of universal emotional states and concepts.
Music from the Ethereal Side of Paradise
John A. Carollo's fourth PARMA release, and follow up to 2017's THE TRANSFIGURATION of GIOVANNI BAUDINO, is a wondrous musical journey through the world of desire. With MUSIC FROM THE ETHEREAL SIDE OF PARADISE, Carollo makes an impassioned plea for the power of romance.
While speaking on Édouard Lalo's Symphonie Espagnole, Op.21, Pyotr Tchaikovsky posited that his colleague "does not strive after profundity, but carefully avoids routine, seeks out new forms, and thinks about musical beauty more than observing established traditions." Acclaimed violinist Moonkyung Lee endeavors to emulate this approach on her Navona debut TCHAIKOVSKY – WORKS FOR VIOLIN AND ORCHESTRA, in which she presents several performances of beloved Tchaikovsky alongside the London Symphony Orchestra under the baton of Miran Vaupotić. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 4,326 |
Youenn Drezen (Yves Le Drézen, Pont-l'Abbé, 1899 -An Oriant, 1972 fou escriptor bretó, conegut com a Corentin Cariou o Tin Gariou. Fill d'una família modesta, de jovenet marxà com a seminarista a Castella. Més tard conegué Jakez Riou i s'interessà pels estudis literaris, científics i reliosos, alhora que descobrien les facetes literàries del bretó. Abandonà la formació religiosa, va fer el servei militar a Rennes i s'afilià a l'Unvaniezh Yaouankiz Breiz tot col·laborant al seu diari, Breiz atao, des del 1924. També va escriure altres publicacions com Courrier du Finistère, Gwalarn de Roparz Hemon i Olier Mordrel, la Liberté du Morbihan. El 1924 fou corresponsal del Courrier du Finistère i en va fer venir Jakez Riou. Participà en el Congrés Pancèltic de Quimper de 1924, amb François Debeauvais, Yann Sohier, Jakez Riou, Abeozen, Marcel Guieysse, sota la bandera de Breiz Atao. També col·laborà a Gwalarn, revista literària creada el 1922 per Roparz Hemon i Olier Mordrel, i publicà traduccions de l'espanyol(("Ar vuhez a zo un huñvre" gant Calderon, del grec Esquil i altres. Fou considerat un dels millors escriptors en bretó del seu temps i participà en l'organització bretona Seiz Breur.
Durant l'Ocupació nazi va escriure a lL'Heure bretonne, òrgan del Partit Nacional Bretó, a Stur (dirigit per Olier Mordrel), Galv (dirigit per Henri Le Hello rickco) i La Bretagne de Yann Fouéré. El 1941 va escriure peces radiofòniques per a Radio Rennes Bretagne i el 1943 idirigí el diari bilingue Arvor. Hi va escriure alguns texts antiamericans després dels bombardejos de Nantes. Fou arrestat el 1944, però l'alliberaren uns mesos després. Després de la guerra residí a Nantes, on va regentar un cafè i col·laborà a Al Liamm.
Obres
Narrativa
Mintin Glas. (Matí verd), novel·la, Gwalarn, Brest, 1927.
Per ar c'honikl. (levriou ar Vugalé). Savet e Saozneg gant Beatrix Potter lakaet e brezoneg gant Y. Drezen. Gwalarn, Brest, 1928
An Dour an-dro d'an Inizi. (L'aigua al voltant de les illes) novel·la, Gwalarn, Brest, 1932.
Les chroniques de l'Heure bretonne han estat editades Mouladurioù Hor Yezh dirigides per Per Denez, vicepresident de l'Institut Cultural de Bretanya.
Itron Varia Garmez (Mare de Déu de les Carmelites), Skrid ha Skeudenn, La Baule 1941. .
Kan da Gornog (Cant a Occident), il·lustrat per René-Yves Creston.
Sizhun ar Breur Arturo, (La setmana del frare Artur), novel·la. Al Liamm, Brest,1971
Skol Louarn Veïg Trebern, (L'escola senglar del petit Hervé Trebern), prefaci de P.J.Hélias. Al Liamm, 1972-1974.
Teatre
Youenn Vras hag e leue (El gran Joan i el seu veí). Skrid ha skeudenn, Nantes, 1947, il·lustrat per Bourlaouen, Frañsez Kervella, R.-Y. Creston, Xavier de Langlais, i Pierre Péron.
Traduccions
Prometheus ereet, Ar Bersed, gant Aesc'hulos, Gwalarn, 1928
Bibliografia
http://www.communautarisme.net/grib/Le-racisme-et-l-antisemitisme-de-Youenn-Drezen,-d-apres-ses-articles-publies-dans-le-journal-Arvor-dirige-par-Roparz_a22.html
Persones de Finisterre
Morts a Bretanya
Escriptors bretons en bretó
Traductors al bretó | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,245 |
{"url":"http:\/\/projects.iq.harvard.edu\/testcindy3\/book\/chapter-1","text":"# Chapter 1\n\nThis is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript. This is chapter 1 of manuscript.","date":"2016-12-07 18:50:43","metadata":"{\"extraction_info\": {\"found_math\": false, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.8247128129005432, \"perplexity\": 345.50821066533877}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 20, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2016-50\/segments\/1480698542244.4\/warc\/CC-MAIN-20161202170902-00382-ip-10-31-129-80.ec2.internal.warc.gz\"}"} | null | null |
Biografia
Al momento della sua nascita era il secondo nella linea di successione al trono dopo suo fratello maggiore Muhammed Akbar Khan, principe ereditario dell'Afghanistan. Tuttavia, in seguito alla morte di suo fratello, il 26 novembre 1942, divenne il primo della linea di successione, erede apparente e principe ereditario.
Ha frequentato l'Università di Oxford, l'Istituto di studi politici di Parigi e poi ha lavorato presso il Ministero degli Affari Esteri a Kabul.
Il regno di suo padre terminò il 17 luglio 1973, quando fu espulso da un colpo di stato, con l'Afghanistan dichiarata repubblica. Il principe ereditario era uno dei quattordici membri della famiglia reale arrestati dopo il colpo di stato. Gli è stato permesso di lasciare il paese per Roma il 26 luglio. Dopo il rovesciamento della monarchia, il principe ereditario si stabilì nello stato di Virginia, negli Stati Uniti, e prese a scrivere poesie.
Dalla morte di suo padre, il 23 luglio 2007, è l'erede maschio più anziano tra i figli sopravvissuti dell'ultimo re dell'Afghanistan.
A differenza di suo padre, egli non possiede il titolo ufficiale "Baba-i-Millet-i-Afghanistan" (Padre della Patria dell'Afghanistan).
Vita privata
Si è sposato a Kabul nel 1961 con la principessa Khatul Begum, figlia di Sardar Muhammad Umar Khan Zikeria e di sua moglie, la principessa Sultana Begum. Ha due figli e una figlia:
Principe Muhammad Zahir Khan (nato nel 1962).
Principe Muhammad Emel Khan (nato nel 1969).
Principessa Hawa Khanum (nata nel 1963).
Note
Studenti dell'Università di Oxford
Pretendenti al trono | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,480 |
Q: Where is the documentation for build.gradle's `android` block? In a build.gradle, we have the android block. From my limited understanding of Android Gradle Plugin (and Groovy/ Kotlin), this is a method/ (or function?) called android which accepts 1 argument, a closure.
android {
compileSdkVersion(AppConfig.compileSdkVersion)
buildToolsVersion(AppConfig.buildToolsVersion)
}
I was not able to find any documentation about android, both on the Google Developer website and Gradle.org. It doesn't help that the function has the same name as the whole operating system. Any documentation about Android Gradle plugin would be helpful, as it seems like information about it is pepperred all over Android docs. So far, I can search what each property means (e.g. applicationId, testInstrumentationRunner), but I want to see all the properties which android has, which is where the documentation comes in handy.
What sparked all these questions was this "Introduction to Groovy and Gradle"
I was able to get the "package name" (maybe) for the android method with autocomplete in Android Studio: com.android.build.gradle.internal.dsl.BaseAppModule, but cannot find source code or documentation...
A: It is described in android gradle plugin documentation under the class name AppExtension. Here's a link //google.github.io/android-gradle-dsl/3.3/com.android.build.gradle.AppExtension.html
A: Please note that the android keyword mentioned in your question is not a function / method.
The android { } is an android block is where you configure all your Android-specific build options.
Also, as of now there is no specific document dedicated to this block.
However, just to assist you, I have identified following attributes which can be placed inside this block.
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
}
buildTypes {
}
compileOptions {
}
kotlinOptions {
}
packagingOptions {
}
}
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 5,873 |
Joseph Coulon de Villiers (1718-1754) – militare francese
Nicolas-Antoine Coulon de Villiers (1683-1733) – militare francese | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 9,889 |
{"url":"https:\/\/www.iitianacademy.com\/ib-dp-maths-topic-8-7-the-operation-table-of-a-group-is-a-latin-square-but-the-converse-is-false-hl-paper-3\/","text":"# IB DP Maths Topic 8.7 The operation table of a group is a Latin square, but the converse is false. HL Paper 3\n\n## Question\n\n(a) \u00a0 \u00a0 Write down why the table below is a Latin square.\n\n$\\begin{gathered} \\begin{array}{*{20}{c}} {}&d&e&b&a&c \\end{array} \\\\ \\begin{array}{*{20}{c}} d \\\\ e \\\\ b \\\\ a \\\\ c \\end{array}\\left[ {\\begin{array}{*{20}{c}} c&d&e&b&a \\\\ d&e&b&a&c \\\\ a&b&d&c&e \\\\ b&a&c&e&d \\\\ e&c&a&d&b \\end{array}} \\right] \\\\ \\end{gathered}$\n\n(b) \u00a0 \u00a0 Use Lagrange\u2019s theorem to show that the table is not a group table.\n\n## Markscheme\n\n(a) \u00a0 \u00a0 Each row and column contains all the elements of the set. \u00a0 \u00a0 A1A1\n\n[2 marks]\n\n(b) \u00a0 \u00a0 There are 5 elements therefore any subgroup must be of an order that is a factor of 5 \u00a0 \u00a0 R2\n\nBut there is a subgroup $$\\begin{gathered} \\begin{array}{*{20}{c}} {}&e&a \\end{array} \\\\ \\begin{array}{*{20}{c}} e \\\\ a \\end{array}\\left( {\\begin{array}{*{20}{c}} e&a \\\\ a&e \\end{array}} \\right) \\\\ \\end{gathered}$$ of order 2 so the table is not a group table \u00a0 \u00a0 R2\n\nNote: Award R0R2 for \u201ca is an element of order 2 which does not divide the order of the group\u201d.\n\n[4 marks]\n\nTotal [6 marks]\n\n## Examiners report\n\nPart (a) presented no problem but finding the order two subgroups (Lagrange\u2019s theorem was often quoted correctly) was beyond some candidates. Possibly presenting the set in non-alphabetical order was the problem.\n\n## Question\n\nAssociativity and commutativity are two of the five conditions for a set S with\u00a0the binary operation $$*$$ to be an Abelian group; state the other three conditions.\n\n[2]\na.\n\nThe Cayley table for the binary operation $$\\odot$$\u00a0defined on the set T = {p, q, r, s, t}\u00a0is given below.\n\n(i) \u00a0 \u00a0 Show that exactly three of the conditions for {T , $$\\odot$$} to be an Abelian\u00a0group are satisfied, but that neither associativity nor commutativity are\u00a0satisfied.\n\n(ii) \u00a0 \u00a0 Find the proper subsets of T that are groups of order 2, and comment on\u00a0your result in the context of Lagrange\u2019s theorem.\n\n(iii) \u00a0 \u00a0 Find the solutions of the equation $$(p \\odot x) \\odot x = x \\odot p$$\u00a0.\n\n[15]\nb.\n\n## Markscheme\n\nclosure, identity, inverse \u00a0 \u00a0 A2\n\nNote: Award A1 for two correct properties, A0 otherwise.\n\n[2 marks]\n\na.\n\n(i) \u00a0 \u00a0\u00a0closure: there are no extra elements in the table \u00a0 \u00a0 R1\n\nidentity: s is a (left and right) identity \u00a0 \u00a0 R1\n\ninverses: all elements are self-inverse \u00a0 \u00a0 R1\n\ncommutative: no, because the table is not symmetrical about the leading diagonal, or by counterexample \u00a0 \u00a0 R1\n\nassociativity: for example, $$(pq)t = rt = p$$ \u00a0 \u00a0 M1A1\n\nnot associative because $$p(qt) = pr = t \\ne p$$ \u00a0 \u00a0 R1\n\nNote: Award M1A1 for 1 complete example whether or not it shows\u00a0non-associativity.\n\n(ii) \u00a0 \u00a0 $$\\{ s,\\,p\\} ,{\\text{ }}\\{ s,\\,q\\} ,{\\text{ }}\\{ s,\\,r\\} ,{\\text{ }}\\{ s,\\,t\\}$$ \u00a0 \u00a0 A2\n\nNote: Award A1 for 2 or 3 correct sets.\n\nas 2 does not divide 5, Lagrange\u2019s theorem would have been contradicted if T had been a group \u00a0 \u00a0 R1\n\n(iii) \u00a0 \u00a0 any attempt at trying values \u00a0 \u00a0 (M1)\n\nthe solutions are q, r, s and t \u00a0 \u00a0 A1A1A1A1\n\nNote: Deduct A1 if p is included.\n\n[15 marks]\n\nb.\n\n## Examiners report\n\nThis was on the whole a well answered question and it was rare for a candidate not to obtain full marks on part (a). In part (b) the vast majority of candidates were able to show that the set\u00a0satisfied the properties of a group apart from associativity which they were also familiar with. Virtually all candidates knew the difference between commutativity and associativity and were able to distinguish between the two. Candidates were familiar with Lagrange\u2019s Theorem and many were able to see how it did not apply in the case of this problem. Many candidates found a solution method to part (iii) of the problem and obtained full marks.\n\na.\n\nThis was on the whole a well answered question and it was rare for a candidate not to obtain full marks on part (a). In part (b) the vast majority of candidates were able to show that the set\u00a0satisfied the properties of a group apart from associativity which they were also familiar with. Virtually all candidates knew the difference between commutativity and associativity and were able to distinguish between the two. Candidates were familiar with Lagrange\u2019s Theorem and many were able to see how it did not apply in the case of this problem. Many candidates found a solution method to part (iii) of the problem and obtained full marks.\n\nb.\n\n## Question\n\nThe following Cayley table for the binary operation multiplication modulo 9, denoted by $$*$$, is defined on the set $$S = \\{ 1,{\\text{ }}2,{\\text{ }}4,{\\text{ }}5,{\\text{ }}7,{\\text{ }}8\\}$$.\n\nCopy and complete the table.\n\n[3]\na.\n\nShow that $$\\{ S,{\\text{ }} * \\}$$\u00a0is an Abelian group.\n\n[5]\nb.\n\nDetermine the orders of all the elements of $$\\{ S,{\\text{ }} * \\}$$.\n\n[3]\nc.\n\n(i) \u00a0 \u00a0 Find the two proper subgroups of $$\\{ S,{\\text{ }} * \\}$$.\n\n(ii) \u00a0 \u00a0 Find the coset of each of these subgroups with respect to the element 5.\n\n[4]\nd.\n\nSolve the equation $$2 * x * 4 * x * 4 = 2$$.\n\n[4]\ne.\n\n## Markscheme\n\nA3\n\nNote: \u00a0 \u00a0\u00a0Award A3 for correct table, A2 for one or two errors, A1 for three or four errors and A0 otherwise.\n\n[3 marks]\n\na.\n\nthe table contains only elements of $$S$$, showing closure \u00a0 \u00a0 R1\n\nthe identity is 1 \u00a0 \u00a0 A1\n\nevery element has an inverse since 1 appears in every row and column, or a complete list of elements and their correct inverses \u00a0 \u00a0 A1\n\nmultiplication of numbers is associative \u00a0 \u00a0 A1\n\nthe four axioms are satisfied therefore $$\\{ S,{\\text{ }} * \\}$$\u00a0is a group\n\nthe group is Abelian because the table is symmetric (about the leading diagonal) \u00a0 \u00a0 A1\n\n[5 marks]\n\nb.\n\nA3\n\nNote: \u00a0 \u00a0\u00a0Award A3 for all correct values, A2 for 5 correct, A1 for 4 correct and A0 otherwise.\n\n[3 marks]\n\nc.\n\n(i) \u00a0 \u00a0 the subgroups are $$\\{ 1,{\\text{ }}8\\}$$; $$\\{ 1,{\\text{ }}4,{\\text{ }}7\\}$$\u00a0\u00a0 \u00a0 A1A1\n\n(ii) \u00a0 \u00a0 the cosets are $$\\{ 4,{\\text{ }}5\\}$$; $$\\{ 2,{\\text{ }}5,{\\text{ }}8\\}$$\u00a0\u00a0 \u00a0 A1A1\n\n[4 marks]\n\nd.\n\nMETHOD 1\n\nuse of algebraic manipulations \u00a0 \u00a0 M1\n\nand at least one result from the table, used correctly \u00a0 \u00a0 A1\n\n$$x = 2$$ \u00a0 \u00a0A1\n\n$$x = 7$$ \u00a0 \u00a0A1\n\nMETHOD 2\n\ntesting at least one value in the equation \u00a0 \u00a0 M1\n\nobtain $$x = 2$$\u00a0\u00a0 \u00a0 A1\n\nobtain $$x = 7$$\u00a0\u00a0 \u00a0 A1\n\nexplicit rejection of all other values \u00a0 \u00a0 A1\n\n[4 marks]\n\ne.\n\n## Examiners report\n\nThe majority of candidates were able to complete the Cayley table correctly.\n\na.\n\nGenerally well done. However, it is not good enough for a candidate to say something along the lines of \u2018the operation is closed or that inverses exist by looking at the Cayley table\u2019. A few candidates thought they only had to prove commutativity.\n\nb.\n\nOften well done. A few candidates stated extra, and therefore incorrect subgroups.\n\nc.\n\n[N\/A]\n\nd.\n\nThe majority found only one solution, usually the obvious $$x = 2$$, but sometimes only the less obvious $$x = 7$$.\n\ne.\n\n## Question\n\nThe binary operation $$*$$ is defined by\n\n$$a * b = a + b \u2013 3$$ for $$a,{\\text{ }}b \\in \\mathbb{Z}$$.\n\nThe binary operation $$\\circ$$ is defined by\n\n$$a \\circ b = a + b + 3$$ for $$a,{\\text{ }}b \\in \\mathbb{Z}$$.\n\nConsider the group $$\\{ \\mathbb{Z},{\\text{ }} \\circ {\\text{\\} }}$$ and the bijection $$f:\\mathbb{Z} \\to \\mathbb{Z}$$ given by $$f(a) = a \u2013 6$$.\n\nShow that $$\\{ \\mathbb{Z},{\\text{ }} * \\}$$ is an Abelian group.\n\n[9]\na.\n\nShow that there is no element of order 2.\n\n[2]\nb.\n\nFind a proper subgroup of $$\\{ \\mathbb{Z},{\\text{ }} * \\}$$.\n\n[2]\nc.\n\nShow that the groups $$\\{ \\mathbb{Z},{\\text{ }} * \\}$$ and $$\\{ \\mathbb{Z},{\\text{ }} \\circ \\}$$ are isomorphic.\n\n[3]\nd.\n\n## Markscheme\n\nclosure: $$\\{ \\mathbb{Z},{\\text{ }} * \\}$$ is closed because $$a + b \u2013 3 \\in \\mathbb{Z}$$\u00a0\u00a0\u00a0\u00a0 R1\n\nidentity: $$a * e = a + e \u2013 3 = a$$\u00a0\u00a0\u00a0\u00a0 (M1)\n\n$$e = 3$$\u00a0\u00a0\u00a0\u00a0 A1\n\ninverse: $$a * {a^{ \u2013 1}} = a + {a^{ \u2013 1}} \u2013 3 = 3$$\u00a0\u00a0\u00a0\u00a0 (M1)\n\n$${a^{ \u2013 1}} = 6 \u2013 a$$\u00a0\u00a0\u00a0\u00a0 A1\n\nassociative: $$a * (b * c) = a * (b + c \u2013 3) = a + b + c \u2013 6$$\u00a0\u00a0\u00a0\u00a0 A1\n\n$$\\left( {a{\\text{ }}*{\\text{ }}b} \\right){\\text{ }}*{\\text{ }}c{\\text{ }} = \\left( {a{\\text{ }} + {\\text{ }}b{\\text{ }} \u2013 {\\text{ }}3} \\right)*{\\text{ }}c{\\text{ }} = {\\text{ }}a{\\text{ }} + {\\text{ }}b{\\text{ }} + {\\text{ }}c{\\text{ }} \u2013 {\\text{ }}6$$\u00a0\u00a0 \u00a0A1\n\nassociative because $$a * (b * c) = (a * b) * c$$\u00a0\u00a0\u00a0\u00a0 R1\n\n$$b * a = b + a \u2013 3 = a + b \u2013 3 = a * b$$ therefore commutative hence Abelian\u00a0\u00a0\u00a0\u00a0 R1\n\nhence $$\\{ \\mathbb{Z},{\\text{ }} * \\}$$ is an Abelian group\u00a0\u00a0\u00a0\u00a0 AG\n\n[9 marks]\n\na.\n\nif $$a$$ is of order 2 then $$a * a = 2a \u2013 3 = 3$$ therefore $$a = 3$$\u00a0\u00a0\u00a0\u00a0 A1\n\nsince $$e = 3$$ and has order 1\u00a0\u00a0\u00a0\u00a0 R1\n\nNote:\u00a0\u00a0\u00a0\u00a0 R1 for recognising that the identity has order 1.\n\n[2 marks]\n\nb.\n\nfor example $$S = \\{ \u2013 6,{\\text{ }} \u2013 3,{\\text{ }}0,{\\text{ }}3,{\\text{ }}6 \\ldots \\}$$ or $$S = \\{ \\ldots ,{\\text{ }} \u2013 1,{\\text{ }}1,{\\text{ }}3,{\\text{ }}5,{\\text{ }}7 \\ldots \\}$$\u00a0\u00a0\u00a0\u00a0 A1R1\n\nNote:\u00a0\u00a0\u00a0\u00a0 R1 for deducing, justifying or verifying that $$\\left\\{ {S, * } \\right\\}$$ is indeed a proper subgroup.\n\n[2 marks]\n\nc.\n\nwe need to show that $$f(a * b) = f(a) \\circ f(b)$$\u00a0\u00a0\u00a0\u00a0 R1\n\n$$f(a * b) = f(a + b \u2013 3) = a + b \u2013 9$$\u00a0\u00a0\u00a0\u00a0 A1\n\n$$f(a) \\circ f(b) = (a \u2013 6) \\circ (b \u2013 6) = a + b \u2013 9$$\u00a0\u00a0\u00a0\u00a0 A1\n\nhence isomorphic\u00a0\u00a0\u00a0\u00a0 AG\n\nNote:\u00a0\u00a0\u00a0\u00a0 R1 for recognising that $$f$$ preserves the operation; award R1A0A0 for an attempt to show that $$f(a \\circ b) = f(a) * f(b)$$.\n\n[3 marks]\n\nd.\n\n[N\/A]\n\na.\n\n[N\/A]\n\nb.\n\n[N\/A]\n\nc.\n\n[N\/A]\n\nd.\n\n## Question\n\nThe binary operation multiplication modulo 10, denoted by \u00d710, is defined on the set\u00a0T = {2 , 4 , 6 , 8} and represented in the following Cayley table.\n\nShow that {T, \u00d710} is a group. (You may assume associativity.)\n\n[4]\na.\n\nBy making reference to the Cayley table, explain why T is Abelian.\n\n[1]\nb.\n\nFind the order of each element of {T, \u00d710}.\n\n[3]\nc.i.\n\nHence show that {T, \u00d710} is cyclic and write down all its generators.\n\n[3]\nc.ii.\n\nThe binary operation multiplication modulo 10, denoted by \u00d710 , is defined on the set\u00a0V = {1, 3 ,5 ,7 ,9}.\n\nShow that {V, \u00d710} is not a group.\n\n[2]\nd.\n\n## Markscheme\n\nclosure: there are no new elements in the table\u00a0 \u00a0 \u00a0 A1\n\nidentity: 6 is the identity element\u00a0 \u00a0 \u00a0 A1\n\ninverse: every element has an inverse because there is a 6\u00a0in every row and column (2\u22121\u00a0= 8, 4\u22121\u00a0= 4, 6\u22121\u00a0= 6, 8\u22121\u00a0= 2)\u00a0 \u00a0 \u00a0 A1\n\nwe are given that (modulo) multiplication is associative\u00a0 \u00a0 \u00a0 R1\n\nso {T, \u00d710} is a group\u00a0 \u00a0 \u00a0 AG\n\n[4 marks]\n\na.\n\nthe Cayley table is symmetric (about the main diagonal)\u00a0 \u00a0 \u00a0 R1\n\nso T is Abelian\u00a0 \u00a0 \u00a0 AG\n\n[1 mark]\n\nb.\n\nconsidering powers of elements\u00a0 \u00a0 \u00a0 (M1)\n\nA2\n\nNote: Award A2 for all correct and A1 for one error.\n\n[3 marks]\n\nc.i.\n\nEITHER\n\n{T, \u00d710}\u00a0is cyclic\u00a0because there is an element of order 4\u00a0 \u00a0 \u00a0 R1\n\nNote: Accept \u201cthere are elements of order 4\u201d.\n\nOR\n\n{T, \u00d710}\u00a0is cyclic\u00a0because there is\u00a0generator\u00a0 \u00a0 \u00a0 R1\n\nNote: Accept \u201cbecause there are generators\u201d.\n\nTHEN\n\n2 and 8 are generators\u00a0 \u00a0 \u00a0\u00a0A1A1\n\n[3 marks]\n\nc.ii.\n\nEITHER\n\nconsidering singular elements\u00a0 \u00a0 \u00a0 (M1)\n\n5 has no inverse (5\u2009\u00d710 a = 1, a\u2208V has no solution)\u00a0 \u00a0 \u00a0 R1\n\nOR\n\nconsidering Cayley table for {V, \u00d710}\n\nM1\n\nthe Cayley table is not a Latin square (or equivalent)\u00a0 \u00a0 \u00a0 R1\n\nOR\n\nconsidering cancellation law\n\neg, 5\u2009\u00d7109\u00a0= 5\u2009\u00d710\u20091 = 5\u00a0 \u00a0 \u00a0\u00a0M1\n\nif\u00a0{V, \u00d710}\u00a0is a group the cancellation law gives 9\u00a0= 1\u00a0 \u00a0 \u00a0 R1\n\nOR\n\nconsidering order of subgroups\n\neg, {1, 9} is a subgroup\u00a0 \u00a0 \u00a0 M1\n\nit is not possible to have a subgroup of order 2 for a group of\u00a0order 5 (Lagrange\u2019s theorem)\u00a0 \u00a0 \u00a0\u00a0R1\n\nTHEN\n\nso {V, \u00d710}\u00a0is not a group\u00a0 \u00a0 \u00a0AG\n\n[2 marks]\n\nd.\n\n[N\/A]\n\na.\n\n[N\/A]\n\nb.\n\n[N\/A]\n\nc.i.\n\n[N\/A]\n\nc.ii.\n\n[N\/A]\n\nd.","date":"2021-12-03 04:27:38","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.8523464798927307, \"perplexity\": 2867.2632694413414}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 20, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2021-49\/segments\/1637964362589.37\/warc\/CC-MAIN-20211203030522-20211203060522-00565.warc.gz\"}"} | null | null |
Алмайра () е град в окръг Линкълн, щата Вашингтон, САЩ. Алмайра е с население от 302 жители (2000) и обща площ от 1,3 km². Намира се на 585 m надморска височина. ЗИП кодът му е 99103, а телефонният му код е 509.
Бележки
Градове във Вашингтон
Окръг Линкълн (Вашингтон) | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 2,273 |
SSRC 2022: Sustainable Development Goals and Socio Economic Change: Learning & Practice Opportunities
SCMS Cochin School of Business
Ernakulam, India, April 21-22, 2022
Conference website https://www.scms.edu.in/SSResearch
Submission link https://easychair.org/conferences/?conf=ssrc2022
Abstract registration deadline March 25, 2022
Submission deadline April 15, 2022
Topics: sustainable development goal 3 sustainable development goal 4 sustainable development goal 9 sustainable development goal 11
Social Science Research Colloquium 2022
"Sustainable Development Goals and Socioeconomic Change: Learning and Practice Opportunities"
21st and 22nd April 2022
The SCMS Cochin School of Business has been conducting the Social Science Research Colloquium since 2019. We focus on the emerging trends in Management Practices. In its fourth edition given the pandemic persistence, SSRC 2022 proposes to focus on the concept of Sustainable Development Goals revisiting the Agenda 2030 'People, Planet and Prosperity.
The Sustainable Development Goals is initiated as a means to achieve universal development in a unique format. Comprehensive and sustainable development focusing on social, economic and environmental aspects of life and living is what is envisioned. The proposed Social Science Research Colloquium 2022(SSRC 2022) is being organized by SCMS Cochin School of Business in collaboration with Kochi Municipal Corporation on the 21st and 22nd of April, 2022.
The colloquium plans to focus on four of the seventeen SDGs proposed by the UN. They are Good Health and Wellbeing (Goal 3), Quality Education (Goal 4), Industry Innovation and Infrastructure (Goal 9) and Sustainable Cities and Communities (Goal 11). The proposed target audience include, however, are not restricted to policymakers, participants from academia, international organisations, civil society organisations and other relevant stakeholders. Special consideration will be given to researchers in the field of Management and other Social Science domains. The experience they garner from this event will help them in developing ideas regarding inserting new content and relevant interdisciplinary angles and learning methods to achieve the Sustainable Development Goals. This will also help in developing commitment to and act in support of SDGs.
Collaboration with Kochi Municipal Corporation is an essential extension that SCMS should think of when taking SDGs as the focus of this year's colloquium. The Sustainable Development Goals, even though created at a macro level, effective implementation will be possible only through actions at the local level. Hence, localising SDGs is the only way to carry the goals forward to achievement. Collaboration with Kochi Municipal Corporation will assure discussions from a practitioners' angle in the colloquium, thus rendering it more comprehensive.
The driving idea of the colloquium is SDG Agenda 2030 'People, Planet and Prosperity. The colloquium calls for papers in the following areas:
SDG 3 – Global Health and Well-being. Topics suggested are:
Challenges of health promotion and health care management during a public health emergency, preparedness and response towards building healthier societies.
COVID pandemic - experiments and experiences with innovative health care management practices
Health care financing – challenges and opportunities
Recent trends in emergency medical care management
SDG 4 – Quality Education. The topics suggested are:
The new normal of online education- opportunities and challenges
Online system of education and impact on the cognitive development and mental health of children in the school-going age
How the digital divide was addressed by the State during the pandemic.
Pandemic induced changes in the financing of education.
SDG 9 – Industry, Innovation and Infrastructure. Topics suggested are:
Entrepreneurs and market-ready innovations during the COVID times
COVID induced 'employees' family and wellbeing' concerns of employers
Challenges of 'work from home' management in organisations
Cross-sectoral collaborations, social and economic change and SDGs – challenges and opportunities.
SDG 11 – Sustainable cities and communities
Expanding public transit in developing cities- realities, opportunities and challenges.
Master plans and city space development.
Understanding values of Culture, Heritage and Identity
Submission Guidelines: Manuscript to be submitted as a single file, in Word or PDF format. Font size for the body of the text should be 12 point Times New Roman. The submission should contain the title, name(s) of the author(s), affiliation(s), keywords, and email address of the corresponding author.
The Best Paper Award will be presented for outstanding research work. The awardee will be decided by a committee of experts.
In order for a paper to be considered for presentation at the conference, at least one/both authors (s) must register for the conference. To participate in the conference, however, each author willing to participate must register, either onsite or online. The details of the registration fees are as follows
Students: 500 INR, Early Bird: 250
Research Scholars: 1000 INR, Early Bird: 750
Faculty & Corporates: 1500 INR, Early Bird: 1000
International Participants: $25
Paper in Absentia: 500 INR
April 15th, 2022: Paper submission deadline
April 18th, 2022: Author notification
April 20th, 2022: Camera-ready submission and conference registration
"Best/selected paper will be considered for publication in the SCMS Journal of Indian Management (Scopus Indexed and UGC approved) subject to the Journal's standard editorial and review processes."
CONFERENCE LINK
https://www.scms.edu.in/SSResearch
CONFERENCE REGISTRATION LINK
https://docs.google.com/forms/d/e/1FAIpQLSe9RoJYTV5b7lyNXRryAkfYpnFLvrcKV4Bg8LqBIPNhnIMPzQ/viewform?usp=pp_url
CONFERENCE CONVENERS
DR. POORNIMA NARAYANAN, poornima@scmsgroup.org
DR. AJITH SUNDARAM, ajithsundaram@scmsgroup.org
Payment Details (Domestic)
Name of Account: SCHOOL OF COMMUNICATION AND MANAGEMENT STUDIES
Account Number: 30553830085
Name of the Bank: SBI
IFSC: SBIN0010110
Branch Name: KALAMASSERY
Payment Details (International)
Beneficiary Account Name: SCHOOL OF COMMUNICATION AND MANAGEMENT STUDIES
Beneficiary Account Number: 30553830085
Beneficiary Bank Name: SBI, Kalamassery
Beneficiary Bank SWIFT Code: SBININBBT30
Beneficiary Bank Address: Appolo Junction, Kalamassery
Address: Prathap Nagar, Muttom, Alwaye, Cochin - 683106, Kerala, India
Give us a call: Tel: +91 484 2623803, +91 484 2623800
Or send us an email: scmsssrc@scmsgroup.org | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 9,491 |
\section{Introduction}
\label{sec:intro}
\IEEEPARstart{E}{stimating} in real-time the derivatives of a signal affected by noise is a fundamental problem in control theory and continues to be an active area of research, see, e.g., the special issue~\cite{Reichhartinger2018SpecialDifferentiators}, the comparative analysis~\cite{RasoolMojallizadeh2021Discrete-timeAnalysis}, and the references therein.
Differentiators are often used, for instance, for state estimation~\cite{Shtessel2014ObservationObservers}, Proportional-Derivative controllers, fault detection~\cite{Rios2015fault,Efimov2012ApplicationDetection}, and unknown input observers~\cite{Bejarano2010HighInputs}.
Popular existing methods for differentiation include linear high-gain observers~\cite{Vasiljevic2008ErrorObservers}, linear algebraic differentiators~\cite{Mboup2007AControl,Othmane2020AnalysisDisturbances}, and sliding mode differentiators~\cite{Levant1998RobustTechnique,Levant2003}.
These differ in terms of their convergence properties; while high-gain differentiators converge exponentially~\cite{Vasiljevic2008ErrorObservers}, algebraic and sliding-mode differentiators exhibit convergence in finite or fixed time~\cite{Mboup2007AControl,Levant1998RobustTechnique}, and they converge exactly for different classes of noise-free signals~\cite{Levant2003,Othmane2020AnalysisDisturbances}.
With measurement noise, the accuracy, i.e., the achievable worst-case differentiation error, is limited for all differentiators.
Linear differentiators may be tuned to minimize the bound on the differentiation error when the noise amplitude and a bound on the derivative's Lipschitz constant are known~\cite{Vasiljevic2008ErrorObservers}, whereas the tuning of sliding mode differentiators only requires knowledge about the Lipschitz constant but not about the noise~\cite{Levant1998RobustTechnique,Fraguela2012}.
In practice, differentiation is typically performed on a digital computer using sampled signals. Hence, the use of continuous-time differentiators requires discretization, which is particularly challenging for sliding-mode differentiators because an explicit (forward) Euler discretization may lead to reduced accuracy, numerical chattering, and even instability \cite{Polyakov2019ConsistentSystems,Levant2013OnControl}.
Several techniques for that purpose have therefore been proposed, cf. \cite{RasoolMojallizadeh2021Discrete-timeAnalysis,Carvajal-Rubio2021ImplicitDifferentiators,Koch2018DiscreteDifferentiators}.
In any case, the inherent performance limitations of continuous-time differentiators cannot be surpassed in the discrete domain via discretization.
The present paper proposes a differentiator that considers the information available in the sampled signal in the form of a linear program.
This approach also yields upper and lower bounds for the derivative, similar to interval observers~\cite{Mazenc2011IntervalDisturbances}.
Interval observers, however, have seldom been applied to differentiation, see e.g., ~\cite{Guerra2017IntervalAccuracy}, and they are limited in terms of accuracy by their underlying observer.
In contrast to other observers, the present approach is shown to have the best possible worst-case accuracy among all causal differentiators.
This best possible worst-case accuracy is shown to be achieved using a fixed number of samples, thus providing a limit on the computational complexity of the linear program and guaranteeing convergence in a fixed time, similarly to algebraic and some sliding-mode differentiators.
Moreover, implementing the algorithm only requires knowledge of the derivative's Lipschitz constant and the noise bound but, unlike other differentiators, yields such an estimate without requiring any further tuning.
\textbf{Notation:} ${\mathbb N}$, ${\mathbb N}_0$, ${\mathbb R}$ and ${\mathbb R}_{\ge 0}$ denote the positive and nonnegative integers, and the reals and nonnegative reals, respectively. If $\alpha\in{\mathbb R}$, then $|\alpha|$ denotes its absolute value.
For $x,y\in{\mathbb R}^n$, inequalities and absolute value operate componentwise, so that $|x|\in{\mathbb R}_{\ge 0}^n$ denotes the vector with components $|x_i|$, and $x\le y$ the set of inequalities $x_i \le y_i$, for $i=1,\ldots,n$. For a (differentiable) function $f : D\subset{\mathbb R} \to {\mathbb R}$, $f^{(i)}$ denotes its $i$-th order derivative. For $a\in{\mathbb R}$, the greatest integer not greater than $a$ is denoted by $\lfloor a \rfloor$. The symbols $\mathbf{0}$, $\mathbf{I}$ and $\mathbf{1}$ denote the zero vector or matrix, the identity matrix and a vector all of whose components are equal to one, respectively.
\section{Problem Statement and Formulation}
\label{sec:preliminaries}
\subsection{Problem statement}
Consider a differentiable function $\mathfrak{f} : {\mathbb R}_{\ge 0} \to {\mathbb R}$ of which we know that its derivative $\mathfrak{f}^{(1)}$ is globally Lipschitz continuous with Lipschitz constant $L$, i.e.
\begin{align}
\label{eq:fddotbnd}
|\mathfrak{f}^{(2)}(t)| &\le L,\quad \text{for almost all }t\in{\mathbb R}_{\ge 0}.
\end{align}
Suppose that a noisy measurement $m_k$ of the value $\mathfrak{f}(kT)$ becomes available at each time instant $t_k = kT$, with $k \in {\mathbb N}_0$, and that a bound $N$ on the noise is known, so that
\begin{align}
\label{eq:basemnf}
m_j &= \mathfrak{f}_j + \eta_j, & \mathfrak{f}_j &:= \mathfrak{f}(jT), &|\eta_j| &\le N,
\end{align}
for $j = 0,1,\ldots,k$.
The problem to be addressed is to design an algorithm that, at every time instant $t_k$ when a new measurement $m_k$ becomes known, gives all available information on the current value
\begin{align}
\label{eq:dersample}
\mathfrak{f}_k^1 := \mathfrak{f}^{(1)}(t_k),\quad t_k := kT,
\end{align}
of the derivative of $\mathfrak{f}$. The more specific problem to be solved is as follows.
\begin{prob}
\label{prob:main}
Devise an algorithm that, given the constants $L\ge 0$ (bound on 2nd-order derivative), $N\ge 0$ (noise bound), $T>0$ (sampling period) and $k\in{\mathbb N}$, provides all possible values of $\mathfrak{f}^1_k$ based on knowledge of the bound \eqref{eq:fddotbnd} and the measurements $m_j$ for $j=0,1,\ldots,k$.
\end{prob}
\subsection{Possible values for the derivative}
Let $\mathcal{F}_k^1(\mathbf{m}_k)$ denote the set of possible values for $\mathfrak{f}_k^1 = \mathfrak{f}^{(1)}(t_k)$ that are consistent with the bound \eqref{eq:fddotbnd} and the measurements
\begin{align}
\label{eq:defmk}
\mathbf{m}_k &:= [m_0,\ m_1,\ \ldots,\ m_k]^T
\end{align}
that satisfy~\eqref{eq:basemnf}. The set $\mathcal{F}_k^1(\mathbf{m}_k)$ can be defined as
\begin{align*}
\mathcal{F}^1_k(\mathbf{m}_k) := \{ \mathfrak{f}_k^1 \in {\mathbb R} : \exists \mathfrak{f}(\cdot) \text{ satisfying }\eqref{eq:fddotbnd}, \eqref{eq:basemnf}, \eqref{eq:dersample}\}.
\end{align*}
The set $\mathcal{F}_k^1(\mathbf{m}_k)$ is convex and hence, whenever nonempty, it will have the form of an interval. Problem~\ref{prob:main} can thus be posed as finding the extreme values
\begin{align}
\label{eq:trueworst}
\overline{\mathcal{F}}_k^1(\mathbf{m}_k) &:= \sup \mathcal{F}_k^1(\mathbf{m}_k), &\underline{\mathcal{F}}_k^1(\mathbf{m}_k) &:= \inf \mathcal{F}_k^1(\mathbf{m}_k).
\end{align}
For future reference, define $\mathcal{X}_k(\mathfrak{f})$ as the vector
\begin{align}
\label{eq:defXkf}
\mathcal{X}_k(\mathfrak{f}) := [\mathfrak{f}(t_0),\ldots,\mathfrak{f}(t_k), \mathfrak{f}^{(1)}(t_0),\ldots,\mathfrak{f}^{(1)}(t_k)]^T.
\end{align}
\subsection{Samples and measurements}
Since the derivative $\mathfrak{f}^{(1)}$ is globally Lipschitz continuous, then $\mathfrak{f}^{(2)}$ exists almost everywhere and
\begin{align*}
\mathfrak{f}^{(1)}(\tau) &= \mathfrak{f}^{1}_{j} - \int\limits_{\tau}^{t_j} \mathfrak{f}^{(2)}(s) ds,
& \mathfrak{f}(t) &= \mathfrak{f}_j - \int\limits_{t}^{t_j} \mathfrak{f}^{(1)}(\tau) d\tau.
\end{align*}
From these expressions one can obtain the bounds
\begin{align}
\label{eq:ff1const}
|\mathfrak{f}_{j-1} - \mathfrak{f}_j + \mathfrak{f}_j^1 T| &\le L \frac{T^2}{2},\\
\label{eq:f1const}
|\mathfrak{f}_j^1 - \mathfrak{f}_{j-1}^1| &\le LT,\\
\text{and from~\eqref{eq:basemnf}, also \quad}
\label{eq:fmbnd}
|\mathfrak{f}_j - m_j| &\le N.
\end{align}
At time $t_k = kT$, every function $\mathfrak{f}$ that satisfies the bound~\eqref{eq:fddotbnd} for almost all $t \in [0,t_k]$ will have associated values $\mathcal{X}_k(\mathfrak{f})$ that must satisfy the constraints~\eqref{eq:ff1const}--\eqref{eq:f1const} for $j=1,2,\ldots,k$. In addition, given the noise bound $N$, the corresponding measurements must satisfy~\eqref{eq:fmbnd} for $j=0,1,\ldots,k$.
\section{Main Results}
\label{sec:mainresults}
\subsection{Derivation of the proposed differentiator}
Consider a vector $\mathbf{x}_k$ of $2k+2$ \emph{optimization variables}
\begin{align}
\label{eq:defxk}
\mathbf{x}_k &:= [(f_{0:k})^T,\ (f_{0:k}^1)^T]^T \in {\mathbb R}^{2k+2}\\
f_{0:k} &:= [f_0,\ f_1,\ \ldots,\ f_k]^T, \quad
f_{0:k}^1 := [f_0^1,\ f_1^1,\ \ldots,\ f_k^1]^T,\notag
\end{align}
where $f_i$ and $f^1_i$ model possible (hypothetical) values for $\mathfrak{f}_i$ and $\mathfrak{f}^1_i$, respectively.
For every $\mathbf{m}\in{\mathbb R}^{k+1}$, consider the set
\begin{align}
\label{eq:cset}
&\mathcal{C}_k(\mathbf{m}) := \{ \mathbf{x} \in {\mathbb R}^{2k+2} : |A_k \mathbf{x} + M_k \mathbf{m}| \le \mathbf{b}_k \},\\
&A_k =
\begin{bmatrix}
\mathbf{0} & D_k\\
D_k & -T[\mathbf{0}\ \mathbf{I}]\\
\mathbf{I} & \mathbf{0}
\end{bmatrix},\quad
M_k =
\begin{bmatrix}
\mathbf{0} \\ \mathbf{0} \\ \mathbf{I}
\end{bmatrix},\quad
\mathbf{b}_k =
\begin{bmatrix}
LT \mathbf{1} \\ L\dfrac{T^2}{2} \mathbf{1} \\ N \mathbf{1}
\end{bmatrix}
\notag
\end{align}
where $D_{k} \in {\mathbb R}^{k\times k+1}$ is a Toeplitz matrix with first row and column given by $[-1, 1, 0, \ldots, 0]$ and $[-1, 0, \ldots, 0]^T$, respectively.
The set $\mathcal{C}_k(\mathbf{m})$ is defined so that whenever a function $\mathfrak{f}$ satisfies~\eqref{eq:fddotbnd} and produces the measurements $\mathbf{m}_k$ satisfying \eqref{eq:basemnf}, then $\mathcal{X}_k(\mathfrak{f}) \in \mathcal{C}_k(\mathbf{m}_k)$. This is so because
the rows of the matrices $A_k,M_k$ and the vector $\mathbf{b}_k$ are grouped into 3 blocks, of $k$, $k$ and $k+1$ rows, where the first block corresponds to \eqref{eq:f1const}, the second to \eqref{eq:ff1const}, and the third to \eqref{eq:fmbnd}.
\begin{rem}
\label{rem:bgg}
Although $\mathcal{X}_k(\mathfrak{f}) \in \mathcal{C}_k(\mathbf{m}_k)$ holds for all admissible functions $\mathfrak{f}$ and corresponding measurements $\mathbf{m}_k$, given an arbitrary vector $\mathbf{m}_k\in {\mathbb R}^{k+1}$ with nonempty $\mathcal{C}_k(\mathbf{m}_k)$ it may not be true that a function $\mathfrak{f}$ exists satisfying \eqref{eq:fddotbnd}--\eqref{eq:basemnf} with $\mathcal{X}_k(\mathfrak{f}) \in \mathcal{C}_k(\mathbf{m}_k)$ (see the Appendix for a counterexample).
\end{rem}
The proposed differentiator provides an estimate $\hat{\mathfrak{f}}_k^1$ for the derivative $\mathfrak{f}_k^1 = \mathfrak{f}^{(1)}(t_k)$ by solving the optimization problems \eqref{eq:bndmax}--\eqref{eq:bndmin} and computing \eqref{eq:estimate}:
\begin{subequations}
\label{eq:bounds}
\begin{align}
\label{eq:bndmax}
\overline{f}_k^1(\mathbf{m}_k) &:= \max \{c_k^T \mathbf{x}_k \ : \mathbf{x}_k \in \mathcal{C}_k(\mathbf{m}_k)\},\\
\label{eq:bndmin}
\underline{f}_k^1(\mathbf{m}_k) &:= \min \{c_k^T \mathbf{x}_k \ : \mathbf{x}_k \in \mathcal{C}_k(\mathbf{m}_k)\},\\
\label{eq:estimate}
\hat\mathfrak{f}_k^1 &:= \left( \overline{f}_k^1(\mathbf{m}_k) + \underline{f}_k^1(\mathbf{m}_k) \right)/2,
\end{align}
\end{subequations}
with
$
c_k = [0,\ \ldots,\ 0,\ 1]^T \in {\mathbb R}^{2k+2}.
$
Note that $c_k^T \mathbf{x}_k = f_k^1$, according to \eqref{eq:defxk}.
From Remark~\ref{rem:bgg}, it follows that the set of possible values for the derivative of $\mathfrak{f}$ at time $t_k$, namely $\mathcal{F}_k^1(\mathbf{m}_k)$, satisfies $\mathcal{F}_k^1(\mathbf{m}_k) \subseteq [\underline{f}_k^1(\mathbf{m}_k),\overline{f}_k^1(\mathbf{m}_k)]$ and thus
\begin{align}
\label{eq:truelpineq}
\underline{f}_k^1(\mathbf{m}_k) \le \underline{\mathcal{F}}_k^1(\mathbf{m}_k) \le \overline{\mathcal{F}}_k^1(\mathbf{m}_k) \le \overline{f}_k^1(\mathbf{m}_k).
\end{align}
The set $\mathcal{C}_k(\mathbf{m}_k)$ is defined by linear inequalities in the optimization variables, for every $\mathbf{m}_k$. Thus, \eqref{eq:bndmax} and \eqref{eq:bndmin} are linear programs; the only information required to implement them are the values $L$, $N$, $T$ and the measurements $\mathbf{m}_k$, obtained up to $t_k$. The proposed estimate $\hat\mathfrak{f}_k^1$ yields the smallest worst-case distance to any value within $[\underline{f}_k^1(\mathbf{m}_k),\overline{f}_k^1(\mathbf{m}_k)]$.
The computational complexity of the linear programs increases with increasing $k$. A fixed number of samples $\hat{K}+1$ can be considered to limit the complexity as summarized in Algorithm \ref{algo:differentiator}, which is meant to be executed at every time instant. The next section provides a way to choose $\hat{K}$ by studying the worst-case accuracy of the differentiator and showing that a finite $K$ can be computed such that for all $\hat{K}\geq K$ the same worst-case accuracy is obtained.
\begin{algorithm}
\label{algo:differentiator}
\SetAlgoLined
\SetKwInput{Input}{input}
\SetKwInOut{Return}{return}
\Input{$L$, $N$, $T$, $\hat{K}$, $\mathbf{m}_k$}
Set $\underline k := \min\{k, \hat{K}\}$
Set $\mathbf{m}_{\underline k}^{k} := [m_{k-\underline k},\dots,m_{k-1},m_k]^T\in\mathbb{R}^{\underline k+1}$
Set $A_{\underline k}$, $M_{\underline k}$, and $\mathbf{b}_{\underline k}$ as in \eqref{eq:cset} using $L$, $N$, $T$.
Set $c_{\underline k}:=[0,\ \ldots,\ 0,\ 1]^T \in {\mathbb R}^{2\underline k+2}$
Solve $\overline{f}_k^1 := \max \left\{c_{\underline k}^T \mathbf{x} \ : |A_{\underline k} \mathbf{x} + M_{\underline k} \mathbf{m}_{\underline k}^{k}| \le \mathbf{b}_{\underline k} \right\}$
Solve $\underline{f}_k^1 := \min \left\{c_{\underline k}^T \mathbf{x} \ : |A_{\underline k} \mathbf{x} + M_{\underline k} \mathbf{m}_{\underline k}^{k}| \le \mathbf{b}_{\underline k} \right\}$
\Return{$\hat\mathfrak{f}_k^1 := \left( \overline{f}_k^1 + \underline{f}_k^1 \right)/2$}
\caption{Estimation of $\mathfrak{f}^{(1)}(kT)$, based on $\hat{K}+1$ noisy measurements, using linear programming.}
\end{algorithm}
\subsection{Differentiator convergence and worst-case accuracy}
A measure of the accuracy of the differentiator is given by the difference between the upper and lower bounds that can be ensured on the derivative
\begin{equation}
\label{eq:width}
w_k(\mathbf{m}_k) := \overline{f}_k^1(\mathbf{m}_k) - \underline{f}_k^1(\mathbf{m}_k).
\end{equation}
With the differentiator output $\hat\mathfrak{f}_k^1$ suggested above, the differentiator error is then bounded by $w_k(\mathbf{m}_k)/2 \ge 0$ if $\mathcal{C}_k(\mathbf{m}_k) \neq \emptyset$.
A related quantity is the difference of actual worst-case derivative bounds
\begin{equation}
\label{eq:truewidth}
\mathcal{W}_k(\mathbf{m}_k) := \overline{\mathcal{F}}_k^1(\mathbf{m}_k) - \underline{\mathcal{F}}_k^1(\mathbf{m}_k),
\end{equation}
which according to \eqref{eq:trueworst} correspond to the best possible accuracy obtainable from the measurements $\mathbf{m}_k$.
Let $\mathcal{M}_k(L,N,T)$ denote the set of all possible measurements $\mathbf{m}_k$ that could be obtained for functions satisfying~\eqref{eq:fddotbnd} with additive measurement noise bound $N$:
\begin{align*}
\mathcal{M}_k(L,N,T) := \big\{ \mathbf{m}_k &\in{\mathbb R}^{k+1} : \exists \mathfrak{f}(\cdot), \text{ \eqref{eq:fddotbnd} and~\eqref{eq:basemnf} hold}\big\}.
\end{align*}
Consider the obtained and the best possible accuracy over all possible measurements, i.e., their worst-case values,
\begin{align}
\label{eq:wc-diff}
\bar{w}_k(L,N,T) &:= \textstyle\sup_{\mathbf{m} \in \mathcal{M}_k(L,N,T)} w_k(\mathbf{m}), \\
\label{eq:wc-true}
\bar{\mathcal{W}}_k(L,N,T) &:= \textstyle\sup_{\mathbf{m} \in \mathcal{M}_k(L,N,T)} \mathcal{W}_k(\mathbf{m}).
\end{align}
Clearly, $\bar w_k(L,N,T) \ge \bar{\mathcal{W}}_k(L,N,T)$ according to \eqref{eq:truelpineq}.
Also, no causal differentiator can achieve a better worst-case accuracy than $\bar{\mathcal{W}}_k(L,N,T)$ due to \eqref{eq:trueworst}.
Our main result is the following.
\begin{thm}
\label{thm:zero-meas-worst}
Given positive $L$, $N$, and $T$, the accuracies $w_k(\mathbf{m})$, $\bar w_k(L,N,T)$ obtained with the differentiator~\eqref{eq:bounds} and the best possible accuracies $\mathcal{W}_k(\mathbf{m})$, $\bar \mathcal{W}_k(L,N,T)$, as defined in \eqref{eq:width}, \eqref{eq:wc-diff} and \eqref{eq:truewidth}, \eqref{eq:wc-true}, respectively, satisfy:
\begin{enumerate}[a)]
\item \label{item:finconv}$w_k(\mathbf{0}) = 2\bar h_k$, with
\begin{align}
\bar h_k &= h_o(\underline k), \ \underline k = \min\{k,K\}, \ h_o(\ell) := \frac{1}{2}LT\ell + \frac{2N}{T\ell},\notag\\
K &:=
\begin{cases}
Q &\text{if } Q^2+Q\geq \frac{4N}{LT^2},\\
Q + 1 & \text{otherwise,}
\end{cases} \quad
Q := \left\lfloor \frac{2}{T} \sqrt{\frac{N}{L}} \right\rfloor.\notag
\end{align}
\item $w_{k}(\mathbf{0}) \ge w_{k+1}(\mathbf{0})$ for all $k\in{\mathbb N}$;\label{item:noninc}
\item $w_k(\mathbf{0}) = \mathcal{W}_k(\mathbf{0})$;\label{item:0lp0fun}
\item $w_k(\mathbf{0}) = \bar{w}_k(L,N,T) = \bar{\mathcal{W}}_k(L,N,T)$.\label{item:0worst}
\end{enumerate}
\end{thm}
Items~\ref{item:finconv}) and~\ref{item:noninc}) state that the sequence $\{w_k(\mathbf{0})\}$ is nonincreasing and converges to a limit in $K$ samples, and give an expression for both, the number of samples and the limit value $\bar{h}_K$.
Item~\ref{item:0lp0fun}) states that, when all measurements equal zero, the accuracy obtained is identical to the true, best possible accuracy among causal differentiators formulated in Problem~\ref{prob:main}.
Item~\ref{item:0worst}) shows that the zero-measurement case is actually the worst over all possible measurements. This means that the proposed differentiator's worst-case accuracy is thus the best among all causal differentiators.
Note that these results are very powerful because $\mathbf{x}_k \in \mathcal{C}_k(\mathbf{m}_k)$ does not imply that $\mathbf{x}_k = \mathcal{X}_k(\mathfrak{f})$ for some $\mathfrak{f}$ satisfying \eqref{eq:fddotbnd}--\eqref{eq:basemnf}, as stated in Remark~\ref{rem:bgg}.
Since the best worst-case accuracy is achieved after a fixed number of $K$ sampling steps and then stays constant, considering more (older) measurements does not improve the worst-case performance. With this insight, Theorem~\ref{thm:zero-meas-worst} ensures that Algorithm~\ref{algo:differentiator} with $\hat{K}\geq K$ provides the best worst-case accuracy among all causal differentiators.
Particularly, if $N < L T^2/4$, then $\hat{K} = K = 1$ can be chosen; the linear programs may then be solved explicitly, yielding the differentiator $\hat\mathfrak{f}_k^1 = (m_{k} - m_{k-1})/T$ as a special case.
\section{Proof of Theorem \ref{thm:zero-meas-worst}}
\label{sec:proof}
The proof strategy for Theorem \ref{thm:zero-meas-worst} is to first study the case corresponding to the noise bound $N=1$ and the sampling period $T=1$, and then show how the general case can be obtained from this.
\subsection{The case $N=T=1$}
To begin, consider the case $(N,T,L)=(1,1,\tilde{L})$ with $\tilde{L}:=4/\varepsilon^2$. Using these parameters, the quantities in the statement of Theorem~\ref{thm:zero-meas-worst} become
\begin{equation}
\begin{aligned}
\label{eq:definitions}
K &= \begin{cases}
\lfloor\varepsilon\rfloor &\text{if } \lfloor\varepsilon\rfloor^2+\lfloor\varepsilon\rfloor \ge \varepsilon^2,\\
\lfloor\varepsilon\rfloor + 1 & \text{otherwise,}
\end{cases}\\
\bar a_k &= h(\underline k), \ \underline k = \min\{k,K\}, \ h(\ell)= \frac{2\ell}{\varepsilon^2}+\frac{2}{\ell},
\end{aligned}
\end{equation}
where we have used $\overline a_k$ and $h(\cdot)$ to denote $\bar h_k$ and $h_o(\cdot)$ corresponding to $(N,T,L)=(1,1,4/\varepsilon^2)$.
The following lemma establishes some properties of the sequence $\{\overline{a}_k\}$ that will be required next.
\begin{lem}
\label{le:sequence_a}
Consider \eqref{eq:definitions}, and let
\begin{align*}
a_k &:= \min_{\ell \in \{1,\ldots,k\}} h(\ell).
\end{align*}
Then, the following statements are true:
\begin{enumerate}[a)]
\item $h(\ell)$ is strictly decreasing for $\ell\leq {\lfloor\varepsilon\rfloor}$ and strictly increasing for $\ell\geq {\lfloor\varepsilon\rfloor}+1$.
\item If $k\leq {\lfloor\varepsilon\rfloor}$ then $a_{k}=h(k)$.
\item If $k\geq {\lfloor\varepsilon\rfloor}+1$ then $a_k = a_K$.
\item $\overline{a}_k = a_k$ for all $k\in{\mathbb N}$.
\end{enumerate}
\end{lem}
\begin{IEEEproof}
The derivative of the function $h$ is $h^{(1)}(s) = \frac{2}{\varepsilon^2} - \frac{2}{s^2}$,
so that $h^{(1)}(\varepsilon) = 0$, $h^{(1)}(s) < 0$ for $s\in(0,\varepsilon)$, and $h^{(1)}(s) > 0$ for $s\in (\varepsilon,\infty)$. Therefore, $h$ is strictly decreasing within the interval $(0,\varepsilon]$ and strictly increasing within $[\varepsilon,\infty)$. Since ${\lfloor\varepsilon\rfloor} \le \varepsilon < {\lfloor\varepsilon\rfloor} + 1$, then item a) is established. Item b) then follows straightforwardly from the definition of $a_k$.
For item c), note that for $k \ge {\lfloor\varepsilon\rfloor} + 1 > \varepsilon$, from item a) we must have $a_k=\min\{h({{\lfloor\varepsilon\rfloor}}),h({{\lfloor\varepsilon\rfloor}+1})\}$. Consider
\begin{align*}
h({\lfloor\varepsilon\rfloor}) - h({\lfloor\varepsilon\rfloor}+1) &= \frac{2}{{\lfloor\varepsilon\rfloor}} - \frac{2}{{\lfloor\varepsilon\rfloor}+1}-\frac{2}{\varepsilon^2}
\end{align*}
If this difference is nonpositive, which happens if
$
{\lfloor\varepsilon\rfloor}^2+{\lfloor\varepsilon\rfloor} \ge \varepsilon^2,
$
then $h({{\lfloor\varepsilon\rfloor}+1}) \ge h({\lfloor\varepsilon\rfloor})$ will hold. Observing \eqref{eq:definitions}, then
$a_k = \min\{h({\lfloor\varepsilon\rfloor}),h({{\lfloor\varepsilon\rfloor}+1})\} = a_K$.
Finally, d) follows by combining Lemma \ref{le:sequence_a}b) and c).
\end{IEEEproof}
Let $S_k:=\{\ell\in{\mathbb N}: 1\leq \ell\leq k-\underline{k}\}$. Consider a function $\tilde{\mathfrak{f}} : [0,k]\to{\mathbb R}$ defined as follows
\begin{align}
\label{eq:worse_f_1}
\tilde{\mathfrak{f}}(t) &:=
\frac{2(t-k)^2}{\varepsilon^2}+\overline{a}_k(t-k)+1\ \text{for } t\in[k-\underline{k},k]\ \\
\label{eq:worse_f_2}
\tilde{\mathfrak{f}}(t) &:=\tilde{\mathfrak{f}}^{(1)}(\ell)(t-\ell)^2 + \tilde{\mathfrak{f}}^{(1)}(\ell)(t-\ell) - 1
\end{align}
for $t\in[\ell-1,\ell)$ with $\ell\in S_k$ and where
\begin{equation}
\label{eq:f1rightcont}
\tilde \mathfrak{f}^{(1)}(\ell) := \lim_{t\to \ell^+} \tilde \mathfrak{f}^{(1)}(t).
\end{equation}
It is clear that $\tilde \mathfrak{f}$ satisfies $\lim_{t\to k^-} \tilde \mathfrak{f}^{(1)}(t) = \overline a_k$. The following lemma establishes that $\tilde \mathfrak{f}$ is continuously differentiable, its derivative has a global Lipschitz constant $\tilde L$, and satisfies $\mathcal{X}_k(\tilde \mathfrak{f}) \in \mathcal{C}_k(\mathbf{0})$.
\begin{lem}
\label{lem:prop_ftilde}
Let $\tilde{\mathfrak{f}}:[0,k]\to\mathbb{R}$ be defined by \eqref{eq:worse_f_1}--\eqref{eq:f1rightcont}. Then,
\begin{enumerate}[a)]
\item $\tilde{\mathfrak{f}}$ is continuous, $\tilde{\mathfrak{f}}(k)=1$, and $\tilde{\mathfrak{f}}(\ell)=-1$ for $\ell\in S_k$.\label{item:prop_f}
\item $\tilde{\mathfrak{f}}^{(1)}$ is continuous in $(0,k)$, and $\tilde{\mathfrak{f}}^{(1)}(\ell-1) = -\tilde{\mathfrak{f}}^{(1)}(\ell)$ for every $\ell\in S_k$.\label{item:prop_df}
\item $|\tilde{\mathfrak{f}}^{(1)}(k-\underline{k})| \le 2/\varepsilon^2$ for $k > \underline{k}$\label{item:prop_dfboundk}
\item $\tilde{\mathfrak{f}}(\ell)\in[-1,1]$ for every $\ell\in{\mathbb N}_0$ with $\ell \leq k$.\label{item:prop_fbound}
\item $|\tilde{\mathfrak{f}}^{(2)}(t)|\leq \tilde{L}=4/\varepsilon^2$ for almost every $t\in[0,k]$. \label{item:prop_dfbound}
\end{enumerate}
\end{lem}
\begin{IEEEproof}
\ref{item:prop_f}) The fact that $\tilde{\mathfrak{f}}(k)=1$ follows directly from \eqref{eq:worse_f_1}. Also, since $\overline{a}_k = h(\underline k)$, then
$$
\tilde{\mathfrak{f}}(k-\underline{k})=\frac{2\underline{k}^2}{\varepsilon^2} + \left(\frac{2\underline{k}}{\varepsilon^2}+\frac{2}{\underline{k}}\right)(-\underline{k})+1 = -1.
$$
Note that, by definition, $\tilde \mathfrak{f}$ is continuous in the intervals $[\ell-1,\ell)$ for all $\ell \in S_k$ and also in $[k-\underline k,k]$. From \eqref{eq:worse_f_2}, for $\ell\in S_k$ one has
$\lim_{t\to\ell^-}\tilde{\mathfrak{f}}(t) = -1 = \tilde \mathfrak{f}(\ell)$. Thus, $\tilde{\mathfrak{f}}(\ell)=-1$ for any $\ell\in S_k$ and it follows that $\tilde{\mathfrak{f}}$ is continuous in $[0,k]$.
\ref{item:prop_df}) From \eqref{eq:worse_f_2} we obtain:
\begin{equation}
\label{eq:worse_df_2}
\tilde{\mathfrak{f}}^{(1)}(t) = 2\tilde{\mathfrak{f}}^{(1)}(\ell)(t-\ell)+\tilde{\mathfrak{f}}^{(1)}(\ell), \quad t\in[\ell-1,\ell)
\end{equation}
Hence, \eqref{eq:worse_df_2} gives $\lim_{t\to\ell^-} \tilde{\mathfrak{f}}^{(1)}(t) = \tilde{\mathfrak{f}}^{(1)}(\ell)$ which according to \eqref{eq:f1rightcont} leads to continuity of $\tilde{\mathfrak{f}}^{(1)}(t)$ for every $t\in S_k$. Continuity of $\tilde{\mathfrak{f}}^{(1)}$ within $(0,k]$ then follows similarly as in the proof of item~\ref{item:prop_f}. Finally, note that evaluating at $t=\ell-1$ in \eqref{eq:worse_df_2} it follows that $\tilde{\mathfrak{f}}^{(1)}(\ell-1)=-\tilde{\mathfrak{f}}^{(1)}(\ell)$ for every $\ell\in S_k$.
\ref{item:prop_dfboundk}) From \eqref{eq:definitions}, \eqref{eq:worse_f_1} and the definition $\overline{a}_k = h(\underline k)$, it follows that for $k > \underline{k} = K$
\begin{equation}
\label{eq:critical_df}
\tilde{\mathfrak{f}}^{(1)}(k-\underline{k}) = \frac{2}{K}-\frac{2K}{\varepsilon^2}.
\end{equation}
Multiplying $\tilde \mathfrak{f}^{(1)}(k-\underline{k})$ by $K\varepsilon^2/2>0$, the inequalities
$
-K \le \varepsilon^2 - K^2 \le K
$
have to be proven.
Consider first the case $K = {\lfloor\varepsilon\rfloor}$.
Then, $K \le \varepsilon$, i.e., $\varepsilon^2 - K^2 \ge 0$, and the upper bound remains to be proven.
Since ${\lfloor\varepsilon\rfloor}^2+{\lfloor\varepsilon\rfloor} \ge \varepsilon^2$ holds in this case, one has
\begin{equation*}
\varepsilon^2 - {\lfloor\varepsilon\rfloor}^2 \le \varepsilon^2 - (\varepsilon^2 - {\lfloor\varepsilon\rfloor}) = {\lfloor\varepsilon\rfloor} = K.
\end{equation*}
Consider now the case $K = {\lfloor\varepsilon\rfloor} + 1$.
Since $K > \varepsilon$, it suffices to show the lower bound.
It is obtained from
\begin{equation*}
\varepsilon^2 - ({\lfloor\varepsilon\rfloor} +1)^2 = \varepsilon^2 - {\lfloor\varepsilon\rfloor}^2 - 2{\lfloor\varepsilon\rfloor} - 1 > -{\lfloor\varepsilon\rfloor} -1 = -K,
\end{equation*}
because ${\lfloor\varepsilon\rfloor}^2 + {\lfloor\varepsilon\rfloor} < \varepsilon^2$ holds in this case.
\ref{item:prop_fbound}) For $\ell \in S_k$, item \ref{item:prop_fbound}) follows from item~\ref{item:prop_f}).
Otherwise, for $\ell \ge k - \underline{k} + 1$, obtain from the time derivative of \eqref{eq:worse_f_1} for $t \ge k - \underline{k} + 1$
\begin{equation}
\tilde{\mathfrak{f}}^{(1)}(t)
\ge \tilde{\mathfrak{f}}^{(1)}(k - \underline{k} + 1) = \frac{4}{\varepsilon^2} + \tilde{\mathfrak{f}}^{(1)}(k - \underline{k}) \ge \frac{2}{\varepsilon^2} > 0
\end{equation}
for $k > \underline{k}$ due to item~\ref{item:prop_dfboundk}) and
\begin{align}
\tilde{\mathfrak{f}}^{(1)}(t) &\ge \tilde{\mathfrak{f}}^{(1)}(1) = -\frac{4 (k-1)}{\varepsilon^2} + \bar{a}_k = -\frac{2 k - 4}{\varepsilon^2} + \frac{2}{k} \nonumber\\
&\ge -\frac{2 \varepsilon - 2}{\varepsilon^2} + \frac{2}{\varepsilon + 1} = \frac{2}{\varepsilon^2(\varepsilon+1)^2} > 0
\end{align}
for $k = \underline{k} \le K \le \varepsilon + 1$.
Hence, $\tilde{\mathfrak{f}}$ is strictly increasing on $[k - \underline{k} + 1, k]$ and, since $\tilde{\mathfrak{f}}(k) =1$, it suffices to show $\tilde{\mathfrak{f}}(k-\underline k +1) \ge -1$.
To see this, assume the opposite
\begin{equation*}
-1 >\tilde{\mathfrak{f}}(k-\underline{k}+1) =-1+\frac{2}{\underline{k}}+\frac{2}{\varepsilon^2}-\frac{2\underline{k}}{\varepsilon^2}
\end{equation*}
or equivalently that $\varepsilon^2+\underline{k}-\underline{k}^2<0$. For $\underline{k} \le {\lfloor\varepsilon\rfloor}$ this is impossible, because then $\varepsilon \ge \underline{k}$; hence, $\underline{k}={\lfloor\varepsilon\rfloor}+1=K$. Then,
$\varepsilon^2+{\lfloor\varepsilon\rfloor}+1-({\lfloor\varepsilon\rfloor}+1)^2<0$ or equivalently
$\varepsilon^2<{\lfloor\varepsilon\rfloor}^2+{\lfloor\varepsilon\rfloor}$ which contradicts the fact that $K={\lfloor\varepsilon\rfloor} + 1$.
\ref{item:prop_dfbound}) Note that $\tilde{\mathfrak{f}}^{(2)}(t)=4/\varepsilon^2$ for $t\in (k-\underline{k},k)$. The result is thus established if $\underline{k}= k$. Next, consider $k>\underline{k}= K$. From~\eqref{eq:worse_f_2}, $|\tilde{\mathfrak{f}}^{(2)}(t)|=|2\tilde{\mathfrak{f}}^{(1)}(\ell)|$ for $t\in(\ell-1,\ell)$ with $\ell\in S_k$. From item~\ref{item:prop_df}), then $|2\tilde{\mathfrak{f}}^{(1)}(\ell)|=|2\tilde{\mathfrak{f}}^{(1)}(k-\underline{k})|$ for $\ell\in S_k$, where $|2\tilde{\mathfrak{f}}^{(1)}(k-\underline{k})|\leq 4/\varepsilon^2 = \tilde{L}$ due to item~\ref{item:prop_dfboundk}).
Thus, $|\tilde{\mathfrak{f}}^{(2)}(t)|\leq \tilde{L}$ follows for almost every $t\in[0,k]$.
\end{IEEEproof}
\subsection{The case with arbitrary positive $N,T,L$}
Let $\mathfrak{f}(t):=N\tilde{\mathfrak{f}}(t/T)$ for $t\in[0,kT]$ and $\tilde{\mathfrak{f}}(t)$ defined as in \eqref{eq:worse_f_1} and \eqref{eq:worse_f_2} with $\varepsilon=\frac{2}{T}\sqrt{\frac{N}{L}}$. First, Lemma~\ref{lem:prop_ftilde}, items~\ref{item:prop_f}) and~\ref{item:prop_df}), is used to conclude that $\mathfrak{f}$ is continuously differentiable in $(0,kT)$. Next, Lemma~\ref{lem:prop_ftilde}\ref{item:prop_fbound}) is used to conclude that $\mathfrak{f}(\ell T)\in[-N,N]$ for every integer $\ell \in [0,k]$. Moreover, Lemma~\ref{lem:prop_ftilde}\ref{item:prop_dfbound}) is used to conclude that for almost all $t\in[0,kT]$,
$$
\left| \mathfrak{f}^{(2)}(t) \right| = \frac{N}{T^2} \left| \tilde{\mathfrak{f}}^{(2)}(t/T) \right|\leq \frac{N}{T^2} \frac{4}{\varepsilon^2} = \frac{N}{T^2} \frac{L T^2}{N} =L.
$$
Furthermore, using $\varepsilon=(2/T)\sqrt{N/L}$ in \eqref{eq:definitions} recovers the definitions in the statement of Theorem~ \ref{thm:zero-meas-worst} directly.
It follows that the function $\mathfrak{f}$ satisfies \eqref{eq:fddotbnd}--\eqref{eq:basemnf} for some sequence $\{\eta_k\}$ and zero measurements, and hence $\mathcal{X}_k(\mathfrak{f}) \in \mathcal{C}_k(\mathbf{0})$ (recall Remark~\ref{rem:bgg}). In addition, $\mathfrak{f}^1_k=\mathfrak{f}^{(1)}(kT)=\bar h_k = N\overline{a}_k/T$. From~\eqref{eq:trueworst}, \eqref{eq:bounds} and~\eqref{eq:truelpineq}, then
\begin{align}
\label{eq:hklowerbound}
\overline{f}_k^1(\mathbf{0})\geq \overline\mathcal{F}_k^1(\mathbf{0}) \ge \mathfrak{f}^1_k = \bar h_k.
\end{align}
Next, $\bar{h}_k$ is shown to be also an upper bound for $\overline{f}_k^1(\mathbf{0})$.
\begin{lem}
\label{le:f_ak_bound}
Let $k,\underline k\in{\mathbb N}$ satisfy $k\ge \underline k$. Consider real numbers $f_j$, $f_j^1$ for $j=0,1,\ldots,k$ satisfying in \eqref{eq:cset} the inequalities corresponding to \eqref{eq:ff1const} and \eqref{eq:f1const} for $j=k-\underline k+1,\ldots,k$, and to \eqref{eq:fmbnd} for $j=k$ and $j=k-\underline k$. Let $\bar h_k$ be defined as in Theorem \ref{thm:zero-meas-worst}. Then, $f_k^1\leq \bar{h}_k$.
\end{lem}
\begin{IEEEproof}
From \eqref{eq:f1const} we know that $f_{j-1}^1\geq f_{j}^1-LT$. Using this relation repeatedly for $j=k,k-1,\ldots,k-\underline k+1$,
\begin{align}
\label{eq:topder1}
f_{k-i}^1 &\ge f_k^1 - iLT\quad \text{for }i=1,\ldots,\underline k.
\end{align}
Similarly, from~\eqref{eq:ff1const}, we know that $f_{j-1}\leq f_j-f_{j}^1 T+T^2L/2$. Using this relation for $j=k,k-1,\ldots,k-\underline k + 1$ yields
\begin{align}
\label{eq:topfk1}
f_{k-i} &\le f_k - \sum_{j=0}^{i-1} f_{k-j}^1 T + iL\frac{T^2}{2},\quad i=1,\ldots,\underline k.
\end{align}
Let $i=\underline k$ and use \eqref{eq:topder1} in \eqref{eq:topfk1} to obtain:
\begin{align}
f_{k-\underline k} &\le f_k - \sum_{j=0}^{\underline k-1} \left( f_k^1 - jLT \right) T + \underline kL \frac{T^2}{2}\notag\\
\label{eq:f0ineq1}
&\le f_k - \underline kT f_k^1 + LT^2 \underline k^2/2.
\end{align}
Using $-LT^2 \underline k^2/2 = 2N-\underline kT \bar h_k$ from the definition of $\bar h_k$,
\begin{align}
\label{eq:lower_fkk}
f_k - f_{k-\underline k} \ge \underline kTf_k^1 - \frac{\underline k^2LT^2}{2} = 2N + \underline k T (f_k^1 - \bar h_k).
\end{align}
However, from \eqref{eq:fmbnd} we know that, $f_k\leq N$ and $-f_{k-\underline k}\leq N$. Thus, $f_k - f_{k-\underline k}\leq 2N$, which with \eqref{eq:lower_fkk} yields $f_k^1\leq \bar h_k$.
\end{IEEEproof}
Combining \eqref{eq:hklowerbound} and Lemma~\ref{le:f_ak_bound} leads to $\overline{f}_k^1(\mathbf{0}) = \overline{\mathcal{F}}_k^1(\mathbf{0}) =\bar h_k$. From~\eqref{eq:cset}, it follows that $\mathbf{x} \in \mathcal{C}_k(\mathbf{0}) \Leftrightarrow -\mathbf{x} \in \mathcal{C}_k(\mathbf{0})$. Therefore, it must happen that $\underline f_k^1(\mathbf{0}) = \underline{\mathcal{F}}_k^1(\mathbf{0}) = -\bar h_k$. Finally, recalling \eqref{eq:width} and \eqref{eq:truewidth}, then $w_k(\mathbf{0}) = \mathcal{W}_k(\mathbf{0}) = 2\bar h_k$. This establishes Theorem \ref{thm:zero-meas-worst}\ref{item:finconv}) and~\ref{item:0lp0fun}).
To prove item~\ref{item:noninc}), note that $\bar h_k$ in Theorem~\ref{thm:zero-meas-worst} satisfies $\bar h_k = (N/T) h(\underline k)$, with the latter defined as in \eqref{eq:definitions} and $\varepsilon^2 = 4N/LT^2$. Therefore, Theorem~\ref{thm:zero-meas-worst}\ref{item:noninc}) follows from Lemma~\ref{le:sequence_a}.
\subsection{The case with $\mathbf{m}_k\neq \mathbf{0}$}
The constraint set $\mathcal{C}_k(\mathbf{m}_k)$ has the following simple property, which will be instrumental in establishing Theorem~\ref{thm:zero-meas-worst}\ref{item:0worst}).
\begin{lem}
\label{lem:Caffinv}
Let $\mathbf{m}_k\in{\mathbb R}^{k+1}$ as in \eqref{eq:defmk} and $\mathbf{x}_k\in{\mathbb R}^{2k+2}$ with components named as in \eqref{eq:defxk} be such that $\mathbf{x}_k \in \mathcal{C}_k(\mathbf{m}_k)$. Let $\tilde\mathbf{m}_k\in{\mathbb R}^{k+1}$ have components $\tilde m_0, \tilde m_1,\ldots, \tilde m_k$ satisfying
\begin{align}
\label{eq:mtildeDef}
\tilde m_j &= m_j + aj + b,\quad j=0,1,\ldots,k,
\end{align}
for some $a,b\in{\mathbb R}$ and define $\tilde\mathbf{x}_k := [ (\tilde f_{0:k})^T, (\tilde f_{0:k}^1)^T]^T$, with
\begin{align*}
\tilde f_j &:= f_j + aj + b, & \tilde f_j^1 &:= f_j^1 + a/T, \quad j=0,1,\ldots,k.
\end{align*}
Then, $\tilde\mathbf{x}_k \in \mathcal{C}_k(\tilde\mathbf{m}_k)$.
\end{lem}
\begin{IEEEproof}
Directly from the definitions, it is clear that
\begin{gather*}
\tilde f_j - \tilde m_j = f_j - m_j,\quad
\tilde f_j^1 - \tilde f_{j-1}^1 = f_j^1 - f_{j-1}^1,\\
\tilde f_{j-1} - \tilde f_{j} + \tilde f_j^1 T = f_{j-1} - f_j + f_j^1 T.
\end{gather*}
Therefore, if \eqref{eq:ff1const}--\eqref{eq:fmbnd} are satisfied for $\mathbf{x}_k$ and $\mathbf{m}_k$, they will also be satisfied for $\tilde\mathbf{x}_k$ and $\tilde\mathbf{m}_k$.
\end{IEEEproof}
Consider $\mathbf{m}_k$ with nonempty $\mathcal{C}_k(\mathbf{m}_k)$ and let $\tilde\mathbf{m}_k$ be defined as in \eqref{eq:mtildeDef}
with $a = (m_{k-\underline k} - m_k)/\underline{k}$ and $b = - m_{k} - a k$.
Then, $\tilde m_{k-\underline k} = \tilde m_k = 0$. By Lemma~\ref{lem:Caffinv}, it follows that
$\overline{f}_k^1(\tilde\mathbf{m}_k) = \overline f_k^1(\mathbf{m}_k) + a/T$ and $\underline f_k^1(\tilde\mathbf{m}_k) = \underline f_k^1(\mathbf{m}_k) + a/T$, so that $w_k(\tilde\mathbf{m}_k) = w_k(\mathbf{m}_k)$.
Next, apply Lemma~\ref{le:f_ak_bound} to $\tilde \mathbf{x}_k \in \mathcal{C}_k(\tilde \mathbf{m}_k)$. This gives $\overline f_k^1(\tilde\mathbf{m}_k) \le \bar h_k$. By the symmetry of the constraints required by Lemma~\ref{le:f_ak_bound}, also $\underline f_k^1(\tilde\mathbf{m}_k) \ge -\bar h_k$. Therefore,
\begin{align*}
w_k(\mathbf{0}) = 2\bar h_k \ge w_k(\tilde\mathbf{m}_k) = w_k(\mathbf{m}_k) \ge \mathcal{W}_k(\mathbf{m}_k)
\end{align*}
for every $k$ and $\mathbf{m}_k$. Taking the supremum over all $\mathbf{m}_k$ yields
$w_k(\mathbf{0}) \ge \bar w_k(L, N, T) \ge \bar\mathcal{W}_k(L,N,T) \ge \mathcal{W}_k(\mathbf{0})$.
Theorem~\ref{thm:zero-meas-worst}\ref{item:0worst}) is then established recalling Theorem~\ref{thm:zero-meas-worst}\ref{item:0lp0fun}).
\section{Comparisons}
\label{sec:comparisons}
\newcommand{M_{\mathrm{lp}}}{M_{\mathrm{lp}}}
\newcommand{T_{\mathrm{lp}}}{T_{\mathrm{lp}}}
\newcommand{M_{\mathrm{sm}}}{M_{\mathrm{sm}}}
\newcommand{T_{\mathrm{sm}}}{T_{\mathrm{sm}}}
\newcommand{M_{\mathrm{hg}}}{M_{\mathrm{hg}}}
\newcommand{\tau_{\mathrm{hg}}}{\tau_{\mathrm{hg}}}
\newcommand{\mathrm{d}}{\mathrm{d}}
\newcommand{\abs}[1]{\left|#1\right|}
This section compares the proposed differentiator's performance and accuracy to a linear high-gain and an exact sliding-mode differentiator.
For comparison purposes, each of those two differentiators is discretized using state-of-the-art techniques.
The proposed differentiator in Algorithm~\ref{algo:differentiator} is implemented by solving the linear programs using Yalmip~\cite{Lofberg2004YalmipMatlab} with the Matlab solver \texttt{linprog}.
Before doing the comparison, it is worthwile to note that Theorem~\ref{thm:zero-meas-worst} states the proposed differentiator's worst-case accuracy $\frac{1}{2} \bar{\mathcal{W}}_k(L, N, T)$ and the maximum time $K T$ it takes to achieve it.
For all values of $T$, $L$, and $N$, this accuracy is bounded from below by
\begin{equation}
\frac{1}{2} \bar{\mathcal{W}}_k(L, N, T) \ge 2 \sqrt{NL}.
\end{equation}
This lower limit is also obtained for certain special combinations of $T$, $L$, $N$, as well as for $T \to 0$.
Exact differentiators have a similar inherent accuracy restriction, see \cite{Levant1998RobustTechnique,Levant2017SlidingApplication}.
\subsection{Linear High-Gain Differentiator}
In continuous time, a second order linear (high-gain) differentiator with identical eigenvalues and time constant $\tau$ is given by
\begin{align}
\label{eq:highgain:diff}
\dot y_1 &= \frac{2}{\tau} (m - y_1) + y_2, &
\dot y_2 &= \frac{1}{\tau^2} (m - y_1),
\end{align}
with output $\hat{\mathfrak{f}}^1 = y_2$, input $m = \mathfrak{f} + \eta$ and $\abs{\eta} \le N$.
From \cite{Vasiljevic2008ErrorObservers}, its optimal asymptotic accuracy is obtained as \mbox{$4 e^{-\frac{1}{2}} \sqrt{NL} \approx 2.43 \sqrt{NL}$}.
The corresponding optimal time constant is $\tau = e^{-\frac{1}{2}} \sqrt{N/L}$, which is hence chosen in the following.
For simulation purposes, the linear system \eqref{eq:highgain:diff} is discretized using the implicit Euler method.
\subsection{Robust Exact Sliding-Mode Differentiator}
As a sliding-mode differentiator, the robust exact differentiator proposed in \cite{Levant1998RobustTechnique} is used.
In continuous time, it is
\begin{subequations}
\label{eq:smdiff}
\begin{align}
\dot y_1 &= k_1 \abs{m - y_1}^{\frac{1}{2}} \,\mathrm{sign}(m - y_1) + y_2, \\
\dot y_2 &= k_2 \,\mathrm{sign}(m - y_1),
\end{align}
\end{subequations}
with output $\hat{\mathfrak{f}}^1 = y_2$, input $m = \mathfrak{f} + \eta$ with $\abs{\eta} \le N$ and positive parameters $k_1, k_2$.
It is discretized using the matching method proposed in \cite{Koch2018DiscreteDifferentiators} and simulated using the toolbox~\cite{Andritsch2021RobustFeatures}.
Parameters are selected as $k_1 = 2 r$ and $k_2 = r^2$, with robustness factor $r$ as in \cite{Andritsch2021RobustFeatures} set to $r = 1.5 \sqrt{L}$.
\subsection{Comparison}
\begin{figure}
\centering
\includegraphics{simulation2_pgf.pdf}
\caption{Bounded noise $\eta$ added to the signal $\mathfrak{f}(t) = t^2/2$ sampled with \mbox{$T = 10^{-2}$}, and corresponding differentiation errors for proposed differentiator, linear high-gain differentiator, and sliding-mode differentiator from a simulation with $N = 10^{-2}$ and $L = 1$. For the proposed differentiator, the error bounds obtained along with the estimate from the linear programs in Algorithm~\ref{algo:differentiator} are also shown.}
\label{fig:simulation}
\end{figure}
For the comparison, the signal $\mathfrak{f}(t) = L t^2/2$ and noise
\begin{equation*}
\eta(t) = \begin{cases}
\max(-N, N - L (t - c \lfloor \frac{t}{c} \rfloor)^2) & t - c \lfloor \frac{t}{c} \rfloor < 2 \sqrt{\frac{N}{L}} \\
N & \text{otherwise}
\end{cases}
\end{equation*}
with constant $c = 6 \sqrt{N/L}$ are sampled with $T = 10^{-2}$.
Parameters are selected as $L = 1$, $N = 10^{-2}$.
For these particular parameters, Theorem~\ref{thm:zero-meas-worst} yields $K = 20$ and an optimal worst-case accuracy $h_o(K) = 0.2$.
Fig.~\ref{fig:simulation} depicts the noise as well as the differentiation error of all differentiators.
For the proposed differentiator, two values of $\hat K$ are considered and the error bounds, i.e., the values of $(\overline{f}_k^1 - \underline{f}_k^1)/2$, as obtained from the linear program are shown as well.
One can see that, after an initial transient of duration $K T = 0.2$, the proposed differentiator achieves the best worst-case accuracy of $h_o(K) = 0.2$, as expected from the theoretical results.
Moreover, increasing $\hat K$ improves the error bound obtained along with the estimate.
The high-gain differentiator leads to a larger but smoother error overall.
The robust exact differentiator, finally, exhibits the largest worst-case errors, because it attempts to differentiate exactly also the noise, but is the most accurate one for constant noise.
\section{Conclusion}
\label{sec:conclusion}
A differentiator for sampled signals based on linear programming was proposed. It is shown that the best worst-case accuracy is obtained with a fixed number of discrete-time measurements, which allows limiting its computational complexity.
Comparisons to a linear high-gain differentiator and a standard sliding-mode differentiator exhibited a higher accuracy. However, depending on the sampling time, the increased accuracy comes at a higher computational cost.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 1,318 |
{"url":"https:\/\/www.physicsforums.com\/threads\/prove-1-cosa-sina-1-cosa-sina-seca-tana.423847\/","text":"# Prove : (1+cosA - sinA)\/(1+cosA + sinA) = secA - tanA\n\n1. Aug 23, 2010\n\n### equilibrum\n\n1. The problem statement, all variables and given\/known data\nProve that\n(1+cosA - sinA)\/(1+cosA + sinA) = secA - tanA\n\n2. Relevant equations\nsin^2A + cos^2A = 1\ntanA = sinA\/cosA\ncotA = cosA\/sinA\n1 + cot^2A = cosec^2A\ntan^2A + 1 = sec^2A\ncosecA = 1\/sinA\nsecA = 1\/cosA\ncotA = 1\/tanA\n(Only use the above identities to prove the question)\n\n3. The attempt at a solution\nI'm stumped at this question. I have attempted various methods using the formulas that I know(stated above)and also trying to work on both sides but to no avail. I understand that by cross multiplying we can easily prove it but the correct way seems to just be by making either the LHS or RHS equal to the other,respectively. Can anyone help?\n\n2. Aug 23, 2010\n\n### hunt_mat\n\nMultiply the LHS by:\n$$\\frac{1+\\cos A-\\sin A}{1+\\cos A-\\sin A}$$\nExpand.\n\n3. Aug 23, 2010\n\n### equilibrum\n\nDon't i need to account for the RHS also? Or are we rationalizing like we do for surds?\n\n4. Aug 23, 2010\n\n### hunt_mat\n\nYou're multiplying by 1, so you only need to do this for the LHS, expand ans you'll see that things cancel and you end up with the RHS\n\n5. Aug 23, 2010\n\n### equilibrum\n\nI think i went wrong?\n\nI finalized to ,\n2+2cosA - 2sinA - 2sinAcosA\n----------------------------\n1 + 2cosA + cos^2A - sin^2A\n\nSorry if this is hard to read,i don't know how to use latex. :\/\n\n6. Aug 23, 2010\n\n### hunt_mat\n\nYou're perfectly correct, you write 1=sin^{2}A+\\cos^{2}A in the deominator, does the numorator factor (hint, it does).\n\nMat\n\n7. Aug 23, 2010\n\n### equilibrum\n\nDo you group the sin and the cos together before factoring? If so,where do we put the troublesome sinAcosA?\n\ni'm really bad at this. I only managed to factor the denominator to cosA(2+2cosA)\n\n8. Aug 23, 2010\n\n### hunt_mat\n\nYou're halfway there! Look for the factor (2-2cosA) in the numorator, and then they should cancel.\n\nMat\n\n9. Aug 23, 2010\n\n### equilibrum\n\nOkay wait i cheated a little by looking at my RHS that i have converted into a fraction and i got it. Thanks alot! the numerator factors into ( 1-sinA) ( 2+2cosA) am i right? :)\n\n10. Aug 23, 2010\n\n### hunt_mat\n\nWell done. You've done it.","date":"2017-12-14 01:06:53","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.6702569127082825, \"perplexity\": 4014.3404962921372}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2017-51\/segments\/1512948532873.43\/warc\/CC-MAIN-20171214000736-20171214020736-00733.warc.gz\"}"} | null | null |
This is a walking foot is for Slant Shank sewing machines, ideal for sewing types of material that just will not flow through your machine easily. The foot does as the name suggests, it walks the cloth under the foot therefor making sure that the material flows smoothly and does not gather, crumple, slip or stick. The Foot has built in feed dogs that grip the fabric for better control. The Walking Foot suits all types of material but is ideal for Multiple layers (quilts, Binding) vinyl cloth, thin leather, faux fur, faux leather, leatherette, PVC etc. If you are not sure if the walking foot will fit your sewing machine, please send us a message and we will try and get back to you within the hour. | {
"redpajama_set_name": "RedPajamaC4"
} | 2,973 |
COVID-19 Vaccines: Tool to Predict and Manage Global Portfolio Productivity and Risk
Vladimir Shnaydman, PhD
, Jack Scannell
Jack Scannell
Policymakers should break with drug and biotech norms and apply risk-based portfolio simulations to understand the global portfolio of COVID-19 vaccines.
While it is tempting to ask: "How quickly could the world develop a COVID-19 vaccine?" health policy may be better served by answers to questions such as:
"What are the probabilities that at least one COVID-19 vaccine is approved within 18 or 24 months?"
"Would managing the COVID-19 vaccine portfolio on a global, rather than company-level or national basis, reduce the probability of zero approvals within 24 months?"
In this paper, we show a risk-based portfolio simulation that helps answer these kinds of questions. Such decision support analysis is surprisingly rare in the pharmaceutical industry and among drug and biotechnology investors. We believe that policymakers should break with drug and biotech norms and apply such methods to understand, and perhaps manage, the global portfolio of COVID-19 vaccines.
Today, around 80 companies and academic institutions are in a race to develop and manufacture COVID-19 vaccines.1,2,3,4 The vaccine portfolio is large, dynamic, and rapidly changing. Most candidates are in pre-clinical development, with a small handful of candidates in Phase I, and one candidate in Phase I/Phase II. The programs are based on at least nine different technology platforms.1,2,3 Several of the more advanced projects are being prioritized by national governments. The current landscape is summarized in this article.5
It is reasonable to expect several types of vaccine to eventually reach the market6 but different experts have remarkably different point estimates on the timing and number of early approvals. Some experts say they are "confident" there will be a deployable vaccine in late 2020.7 Others believe that 2022 or 2023 is "optimistic."8, 9 Bill Gates10 has offered to finance up to seven manufacturing plants to produce successful vaccines but, at the same time, expects that perhaps only two of the development programs will be successful.
Much of the political and policy discussion assumes or hopes that a vaccine, or vaccines, will be ready for initial deployment in 12 to 18 months' time; a timetable which requires extremely rapid development from preclinical (PC) to Phase III; rapid FDA approval; that steps that normally run sequentially will run in parallel or overlap;11 and-perhaps-that there is a high likelihood of approval for individual vaccine candidates.
However, according to this article in The Lancet,12 the likelihood of approval for an individual vaccine in preclinical development is 10% of less. So, while the expected number of eventualapprovals is eight or more (e.g., 10% x 80) for the current portfolio, there is a very high degree of uncertainty around the number and timing of the early approvals. And when one estimates the risk formally, via portfolio simulation (see below), the 12- to 18-month timetable looks uncomfortably unlikely.
Methodology and the model
The portfolio simulator is described in this article.13 Briefly, however, it is a Monte-Carlo simulation using decision tree graphs with binary stochastic outcomes (success or failure). It was adapted to simulate the global portfolio of COVID-19 vaccines, albeit with very simple parameterization at this stage.
The simulation allows us to address, among others, the following questions:
What is the probability of zero, one, two, three, etc., vaccine approvals within 18, 24, 30, etc., months?
How does the probability of a given number of approvals in a given time period vary with portfolio size, phase duration, and probability of success (POS)? For example, is today's portfolio big enough?
With better parameterization, these questions could be answered with much higher veracity. Furthermore, it would be possible to inform a range of other important portfolio management challenges.
Model input data comprised:
The COVID-19 vaccines portfolio, with candidates by phase. We assumed 80 current programs. 75 are in preclinical development, four in phase 1, and one is in Phase I/Phase II.5Note that the COVID-19 vaccine portfolio is changing rapidly.
Phase-specific cycle times.
Phase-specific POS.
Cycles time and POS parameters were random (uniformly distributed) within a range. Given the absence of candidate-specific information, we used the same parameters (averages and standard deviations) for all candidates. We assumed that cycle times are significantly compressed versus history,11 due to the urgency of the current situation, with clinical trial stages overlapping and much work done at risk. We also assumed that the vaccine projects are statistically independent of each other which, all else being equal, will tend to under-estimate portfolio risk. In reality, POS is likely to correlate within technology classes.
We recognize that our current parameterization is crude and that it would be improved with more information from vaccine experts.
Modeling results
Baseline scenario. Risk-based estimates of approvals within 18 months, 24 months, and overall
Figure 1 plots the number of vaccine approvals against their probability (i.e., the proportion of outcomes in 1,000 portfolio simulations). Figure 2 shows cumulative risk for vaccine approvals. Based on our crude parameterization, there is a ~40% chance that no vaccine is approved within 18 months, a ~67% chance that not more than one vaccine is approved, and a ~93% chance that of no more than two vaccines are approved. If we consider the 19- to 24-month period, it becomes very likely that at least one vaccine is approved. When the timing is unconstrained, it is very likely that several vaccines come to market.
Figure 1. Risk-based vaccine approval forecasts
Figure 1 legend: The graph shows number of vaccine approvals (horizontal axis) versus their probability (vertical axis). Here, probability is defined as the proportion of times that the outcome on the horizontal axis occurred in 1000 portfolio simulations. So, for example, in the 12 to 18 month period (blue line) there is a ~40% probability of zero approvals, a ~27% probability of one approval, a ~26% probability of two approvals, and a ~7% chance of three approvals. For the 19 to 24-month period (orange line), zero approvals becomes very unlikely. Unsurprisingly, when timing is unconstrained (grey line), more approvals are more likely.
Figure 2. Cumulative risk-based vaccine forecast. Base case.
Figure 2 legend: The graph shows maximum number of vaccine approvals (horizontal axis) versus the cumulative risk (vertical axis). So, for example, in the 12 to 18-month period there is a 40% chance there are zero approvals, a ~67% chance of no more than one approval, and a ~93% chance of no more than two approvals. The risk of a low number of approvals declines over longer time periods. Other comments are as Figure 1.
Risk mitigation strategies: Raising the probability of at least one approval within 18 months
The simulation approach lets us evaluate strategies to reduce the probability of zero approvals. The current examples are simplistic and the practical implementation challenges are obvious. However, they illustrate the utility of formal analysis in choosing between realistic policy options (see Conclusions).
The strategies we explore are:
Push more projects into development. If one increases portfolio size from 80 to 120 and can keep the other parameters constant, the probability of at least one successful vaccine within 18 months increases from ~60% to ~70%, and risk decreases from ~40% to ~30%, Figure 3. By 24 months, again, the probability of at least one approved vaccine approaches 100% (Figure 4).
Compress cycle times per phase by one month while holding all other parameters constant.
The probability of at least one successful vaccine from 12 to 18 months increases from ~60% to ~67% (risk decreases from ~40% to ~33%, Figure 5).
Reduce the efficacy hurdle to increase individual project POS by 10% (i.e., from 10% to 11%) while holding all other parameters constant. Here, the probability of at least one successful candidate from 12 to 18 months increases from ~60% to ~80% and risk decreases from ~40% to ~20%, Figure 5.
Push 120 projects into development, compress cycles times, and increase POS. In the unlikely event that one could increase the number of projects, nudge POS upwards, and compress cycle times, the probability of at least one successful vaccine candidate from 12 to 18 months rises to around 95% (risk decreases ~5%, Figure 5).
Figure 3. Risk-based vaccine approval forecasts with different portfolio sizes, 12 to 18 months.
Figure 3 legend: The graph shows maximum number of vaccine approvals (horizontal axis) versus the cumulative risk (vertical axis) within the 12 to 18-month period, for a range of portfolio sizes from 70 to 120. The risk of a low number of approvals declines as portfolio size increases. However, even with a larger portfolio, the risk of zero approvals remains around 30%. Other comments are as Figure 1 and Figure 2.
Figure 4 legend: The graph shows maximum number of vaccine approvals (horizontal axis) versus the cumulative risk (vertical axis) within the 19 to 24-month period, for a range of portfolio sizes from 70 to 120. The risk of a low number of approvals appears small versus the 12 to 18-month case (Figure 3). Other comments are as Figure 1 and Figure 2.
Figure 5. COVID-19 vaccine risk mitigation strategies for the 12 to 18-month period
Figure 5 legend: The graph shows maximum number of vaccine approvals (horizontal axis) versus the cumulative risk (vertical axis) within the 12 to 18-month period, for a range of risk reduction strategies (see main text). Increasing the POS (e.g., via relaxed efficacy criteria for approval) appears to have a bigger effect on the probability of an early approval than further reductions in cycle time. Other comments are as Figure 1 and Figure 2.
Our simulations suggest an uncomfortably high chance, ~40%, that no COVID-19 vaccine will be approved within the next 18 months. Of course, one does not need a fancy simulation to feel uncertain about the near-term prospects for a COVID-19 vaccine. A modicum of common sense is enough. We do believe, however, that realistic portfolio simulation could be useful for at least two reasons. The first is to manage the vaccines portfolio itself. The second is to give an unbiased forecast on the likely arrival of vaccines, with both point estimates and error bars, for wider public health policy.
Turning first to the COVID-19 vaccine portfolio, governments and/or agencies such as CEPI or BARDA should ideally support a portfolio of projects that balances, among other things, speed to market, vaccine platform risk, vaccine-specific risk, clinical trial capacity, regulatory capacity, and manufacturing capacity. How, for example, should one allocate resource to new technologies that may be deployed quickly but which have higher technical risk, versus conventional approaches that are more likely to work but which we know are slower? And how does the optimum vaccine portfolio change as candidates succeed or fail at each step. Given ~80 candidates that we already know about, this is a task of great complexity that would likely benefit from decision support, perhaps in the form of portfolio simulation.
Turning to the wider environment, we have already seen how unproven hopes for certain drug candidates for COVID-19 (e.g., hydroxychloroquine) can capture the public imagination and the policy agenda. Public and political hopes for emerging vaccines are likely to run even higher. In such an environment, a well parameterized vaccine portfolio model, built with suitable expert input, and updated periodically, might at least help maintain an objective view around which to plan for an eventual vaccine deployment.
In what at other times would be an unusual way to end a paper, we are happy apply the portfolio simulation tools to the COVID-19 vaccine pipeline. But for it to be useful, it requires input from vaccine experts who are close to the detail of the COVID-19 projects. Only with good on-going parametrization (e.g., POS, cycle times, and correlations between or within technology classes) would such analysis be worthwhile.
Vladimir Shnaydman, PhD, is the President of ORBee Consulting. Jack Scannell, D. Phil, is the founder of JW Scannell Analytics Ltd.
The authors are very thankful to Vadim Paluy, MD, Novartis, for preliminary data validation and useful discussions.
Milken Institute. https://milkeninstitute.org/sites/default/files/2020-04/Covid19%20Tracker-4-1-WEB.pdf
Bio Century - https://www.biocentury.com/clinical-vaccines-and-therapies
BioWorld - https://www.bioworld.com/COVID19products#vac
Vaccine Centre at the London School of Hygiene & Tropical Medicine. https://vac-lshtm.shinyapps.io/ncov_vaccine_landscape/
Tung Thanh Le, Zacharias Andreadakis, Arun Kumar, Raúl Gómez Román, Stig Tollefsen, Melanie Saville & Stephen MayhewThe COVID-19 vaccine development landscape. Nature Reviews Drug Discovery, April 9, 2020. https://www.nature.com/articles/d41573-020-00073-5
Multiple COVID-19 vaccines? That's what it could take, GSK CEO Walmsley says. Fierce Pharma, April 15, 2020. https://www.fiercepharma.com/vaccines/multiple-covid-19-vaccines-s-what-it-could-take-gsk-ceo-walmsley-says.
Coronavirus vaccine: A million doses could be available by September – if trials starting this week are successful. The Independent, April 19, 2020. https://www.independent.co.uk/news/uk/home-news/coronavirus-vaccine-news-covid-19-trial-oxford-treatment-a9471966.html
Covid-19 roundup: The pandemic bear - You think a vaccine and herd immunity are just months away? Dream on, says biotech analyst. Endpoints News, April 21, 2020. https://endpts.com/covid-19-roundup-society-needs-to-pitch-in-to-shore-up-drug-vaccine-manufacturing-trump-advisor-navarro-suggests-china-is-withholding-data-to-win-vaccine-race/
Don't count on a COVID-19 vaccine for at least 5 years, says AI-based forecast. https://www.fiercepharma.com/pharma/don-t-count-a-covid-19-vaccine-for-at-least-five-years-says-ai-based-forecast
Bill Gates is able-and willing-to lose big money funding factories for COVID-19 vaccines. Fierce Pharma, April 6. https://www.fiercepharma.com/vaccines/bill-gates-plans-to-help-fund-factories-for-7-covid-19-vaccines-but-expects-only-2-will
Developing Covid-19 Vaccines at Pandemic Speed. Nicole Lurie, M.D., M.S.P.H., Melanie Saville, M.D., Richard Hatchett, M.D., and Jane Halton, A.O., P.S.M., New England Journal of Medicine, April 17, 2020
Dimitrios Gouglas, Tung Thanh Le, Klara Henderson, Aristidis Kaloudis, Trygve Danielsen, Nicholas Caspersen, Hammersland, James M Robinson, Penny M Heaton, John-Arne Røttingen. Estimating the cost of vaccine development against epidemic infectious diseases: a cost minimization study. The Lancet, 2018, vol. 6, pp1386-1396
V. Shnaydman. Industry Drug Development Portfolio Forecasting: Productivity, Risk, Innovation, Sustainability, Journal of Commercial Biotechnology, Feb. 2020, vol.25, issue 2, pp.15-25 http://commercialbiotechnology.com/index.php/jcb/issue/view/74 | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 8,336 |
Colocation is a type of web server storage service that allows you to store your private web server in a secure facility that is monitored by state-of-the-art technology and highly trained staff. A colocation facility is the perfect place for a web server, with highly controlled environments that are monitored by sophisticated climate control systems, 24-hour surveillance, and advanced fire protection technology.
By choosing to store your private web server in a colocation facility you can effectively maximize the life of your hardware and minimize the risk of hardware failure and subsequent data loss. Colocation is the perfect solution for any online business owner that has their own web server and needs a secure place to store it.
Colocation is a unique type of hosting service that gives you access to a state-of-the-art facility in which you can store your private web server. By choosing one of the colocation services listed within this directory you can ensure that you are dealing with the most reputable and reliable companies in the industry.
Colocation facilities are the perfect environment for web servers, with advanced climate control technology, air cooled server rooms, 24 hour surveillance systems, highly trained professional security staff, and included assistance from educated server technicians that are trained to optimize the life and functionality of your web server. By storing your private web server in a colocation facility using one of the services listed in this directory you can minimize the risk of hardware damage or failure, which subsequently leads to data loss and could have a substantial impact on your online business. A colocation facility is specifically designed to accommodate the needs of webmasters that have their own hardware, with server racks that are configured for maximum safety and stability.
The colocation companies listed in this directory are amongst the best in the industry and are known for providing top-notch support and competitively priced plans.
Collocation is a new entry in the world of web hosting. People who are working in online businesses might take a little time to understand how it all works as it is a new system that has been recently introduced. | {
"redpajama_set_name": "RedPajamaC4"
} | 5,332 |
# HARALD
HARDRADA
IN MEMORY OF KNAP
# HARALD
HARDRADA
# THE WARRIOR'S WAY
JOHN MARSDEN
First published in 2007
The History Press
The Mill, Brimscombe Port
Stroud, Gloucestershire, GL5 2QG
www.thehistorypress.co.uk
This ebook edition first published in 2012
All rights reserved
© John Marsden, 2007, 2012
The right of John Marsden, to be identified as the Author of this work has been asserted in accordance with the Copyrights, Designs and Patents Act 1988.
This ebook is copyright material and must not be copied, reproduced, transferred, distributed, leased, licensed or publicly performed or used in any way except as specifically permitted in writing by the publishers, as allowed under the terms and conditions under which it was purchased or as strictly permitted by applicable copyright law. Any unauthorised distribution or use of this text may be a direct infringement of the author's and publisher's rights, and those responsible may be liable in law accordingly.
EPUB ISBN 978 0 7524 7444 1
MOBI ISBN 978 0 7524 7443 4
Original typesetting by The History Press
## Contents
_Author's Note and Acknowledgements_
_Maps_
Sagas, Skalds and Soldiering
An introduction to a military biography
I Stiklestad
Norway, 1030
II Varangian
Russia, 1031–1034
Byzantine Empire, 1034–1041
Constantinople, 1041–1042
Russia, 1042–1045
III Hardrada
Scandinavia, 1045–1065
IV Stamford Bridge
England, 1066
Land-ravager
An afterword from west-over-sea
_Genealogies_
_Notes and References_
_Select Bibliography_
## _Author's Note and Acknowledgements_
A book written in English for a non-academic readership and yet drawing on source material originally set down in Old Norse, Byzantine Greek, Russian, Anglo-Saxon and Latin does require a note as to its policy in the naming of names. As there appears to be no standard form of English spelling of early Scandinavian names, I have used whichever form seems the most appropriate in the historical context and the least intimidating for an English reader. Similarly, the title of 'earl' is spelled in that English form where it occurs in England, but in its original Old Norse form as _jarl_ in a Scandinavian context. Sometimes names and terms are also given in their original spelling – set in italics and usually in parentheses – so it might be helpful to explain that the Norse character ð is pronounced 'th' (as in ra _ther_ ). I should also mention my specific use of the term _viking_ in its original sense of 'sea-raider' as distinct from the modern usage of 'Viking' as a generic term for anyone (or anything) associated with early medieval Scandinavia.
Notes have been kept to a minimum and most often used to acknowledge references to or quotations from the work of others, but there are two such authors to whom I owe a more prominent acknowledgement because Sigfús Blöndal's _The Varangians of Byzantium_ in the English edition revised and translated by Benedikt S. Benedikz was the work which played a greater part than any other in developing my interest in the man who forms the subject of this book. A more personal acknowledgement is due to my friend John Hamburg of Carrollton, Kentucky, whose unfailing enthusiasm for the same subject played its own part in encouraging this attempt at a biography of Harald Hardrada.
J.M.
## Maps
1 Harald Hardrada's World
2 Scandinavia
3 Russia
4 Byzantine Empire
5 Constantinople
6 Stiklestad
7 Stamford Bridge
MAP 1
MAP 2
MAP 3
MAP 4
MAP 5
MAP 6
MAP 7
## Sagas, Skalds and Soldiering
AN INTRODUCTION TO A MILITARY BIOGRAPHY
When he is remembered only as a Norwegian king slain in battle at Stamford Bridge in Yorkshire, where his invading army was crushed just three days before the arrival of the conquering Normans, the place of Harald Hardrada in the mainstream of English history amounts to little more than that of the 'third man' of the undeniably memorable year 1066. He spent no more than eighteen days on English soil, after all, and the subsequent events of that fateful autumn have left him overshadowed, first by the English Harold and ultimately by William the Norman, thus obscuring his reputation – acknowledged by historians ancient and modern – as the most feared warrior of his world and time.
If Stamford Bridge is set into a wider context than that of Anglo-Saxon England, however, it comes into a very different focus as the last of innumerable conflicts fought out along a warrior's way that had ranged across most of Scandinavia and eastward by way of Russia to the far-flung empire of Byzantium through the three and a half decades since a sturdy youngster stood with his half-brother, the king and future saint Olaf, in the blood-fray at Stiklestad in the west of Norway. The most comprehensive accounts of that great arc of warfaring are found in the thirteenth-century collections of sagas of the Norwegian kings, of which the most respected is the one known as _Heimskringla_ and reliably attributed to the Icelander Snorri Sturluson. His version of Harald's saga is described by the editors of its standard modern English translation as 'a biography which in Snorri's hands becomes the story of a warrior's progress. Essentially it is the life and career of a professional soldier, starting with a battle – the battle of Stiklestad where Harald, aged fifteen, is wounded and his brother the king killed – and ending in battle, thirty-six years later, at Stamford Bridge.'1
It was that observation which first suggested Harald Hardrada to me as the subject for a military biography, most especially because of its use of the term 'professional soldier'. While there are warrior kings aplenty throughout the history of the early medieval period, and not least in the northern world, Harald can be said to stand almost, if not entirely, alone among them in having spent all the years of his young manhood on active service as a professional soldier – and, quite specifically, in the modern understanding of the term.
Within a year of his escape from the field of Stiklestad, he had crossed the Baltic and found his way into Russia where he reappears among the Scandinavian mercenary fighting-men employed by the Russian princes to whom they were known as _Varjazi_ or 'Varangians'. In that capacity and apparently as a junior officer, he is known to have taken part in a major campaign against the Poles, but assuredly also came up against the subject peoples of the northern forests and the steppe warriors to the south along the Dnieper. Some three years later he arrived in Constantinople, not yet twenty years old but already a battle-hardened commander of his own warrior company, to enter imperial service with the Varangian mercenaries of Byzantium.
During nine years of service under three emperors, Harald saw action at sea in the Mediterranean against Saracen corsairs and on land against their shore bases in Asia Minor, led his troop on escort duty to the Holy Land and took part in the Byzantine invasion of Arab-held Sicily, before being despatched against rebellions in the south of Italy and in Bulgaria. His accomplishments in the Sicilian and Bulgarian campaigns earned him promotion to the emperor's personal Varangian bodyguard in Constantinople where he was almost unavoidably – although very probably not innocently – caught up in the whirlpool of Byzantine politics. Subsequently falling from imperial favour, he was briefly imprisoned before escaping in time to play his own grisly part in the downfall of an emperor amid the bloodiest day of rioting ever seen in the city. Shortly afterwards Harald's ambitions turned back towards his homeland and, despite having been refused imperial permission of leave, he launched his ships in a daring departure from Constantinople to begin the long journey north.
From the Black Sea he made his way up the Dnieper and back into Russia, assuredly bringing military intelligence to the Grand Prince in Kiev whose daughter he was to marry before moving north to assemble the great wealth he had acquired in the east and is said to have sent on to Novgorod for safe-keeping. So it was that Harald provided himself with the personal treasury which was later to assume legendary proportions in the hands of the saga-makers but still must have been more than sufficient to fund the force of ships and fighting-men that he would need to challenge his nephew Magnus' sovereignty over Norway and Denmark. By the spring of 1046 he was back in Scandinavia, forging a short-lived alliance with the claimant to Danish kingship and raiding around Denmark on a campaign of intimidation. Before the end of the year, the Danish ally had been discarded and the nephew had accepted his uncle into an uneasy joint kingship, which was to extend only until the following autumn when the sudden death of Magnus left Harald in sole possession of the Norwegian kingdom.
Thus, within less than eighteen months of his return from the east, the professional soldier had emerged in his perhaps more familiar guise of warrior king, and one whose reign was to be almost entirely taken up with conflict – seventeen years of sporadic war on the Danes, interspersed with bitter suppression of recalcitrant Norwegian factions and their Swedish allies, leading finally to the doomed invasion of England – all in seemingly voracious pursuit of dominion, vengeance and conquest.
Even that drastically abbreviated synopsis can leave scarcely any doubt of Harald Hardrada's potential as the subject of a military biography. Indeed, it might be thought to preclude the possibility of any account of his life not dominated by warfaring, and yet the approach to be taken here will still be at some degree of variance from the customary biographical format. While, of course, it will seek to offer a realistic portrait of the man himself – and of other remarkable individuals who played influential roles in his story – its first intention will be a reconstruction in some detail of the extraordinary military career by which he acquired his awesome reputation. Beyond that central concept, however, there lies a broader scope of interest, because to trace the course of Harald's warrior's way would seem to offer an exceptional, even unique, opportunity for exploration of the wide spectrum of warrior cultures – from Bulgar rebels to Norman mercenaries and Pecheneg steppe warriors to Anglo-Saxon housecarls – which he encountered across the greater extent of Scandinavian expansion at its high peak in the first half of the eleventh century.
From that perspective, Harald's mercenary soldiering in the east might be seen as an especially fitting education for a man said to have wanted to become a warlord since infancy. If the teenage years in Russia can be taken to represent a privileged apprenticeship and the wide-ranging experience in Byzantine service his time as a journeyman, taken together they assuredly informed, and in some measure shaped, his return to the northland as a warrior king. Thus the subject and structure of this book are also intended as 'the life and career of a professional soldier . . . beginning with a battle, the battle of Stiklestad . . . and ending in battle, thirty-six years later at Stamford Bridge', and so Snorri Sturluson's version of Harald's saga would seem to offer itself as my first choice of working template. Such a choice, however, raises all the scholarly doubt as to whether a saga set down in Iceland some two hundred years after the events it describes can be taken as reliable historical evidence for an eleventh-century Norwegian king. There was a time, even as recently as the earlier decades of the twentieth century, when the _konunga sögur_ (or 'kings' sagas') – and especially those forming Snorri's _Heimskringla_ cycle – were accorded all the respect due to impeccable sources of historical record, but modern scholarship has cast so much doubt on their reliability as to greatly diminish the esteem in which they were formerly held.
The historian's raw material for an understanding of the past is its surviving written record, so the first measure of any document's historical value must usually be its proximity in time and place to the events it describes, and yet in the case of Harald Hardrada the most closely contemporary documentary record cannot be considered any better than uneven. While his invasion of England is properly entered in the _Anglo-Saxon Chronicle_ for 1066, his earlier presence in Russia would seem to have entirely escaped the notice of the Kievan monks who were setting down the annals now known as the _Russian Primary Chronicle_ within a decade of his death, and yet his service with the Varangians of Byzantium is fully confirmed by a generous notice in a Byzantine document dated to the last quarter of the eleventh century.
As to the early sources originating in the Scandinavian and Baltic world, the most closely contemporary is the work of a German churchman, Adam of Bremen, whose _History of the Archbishops of Hamburg-Bremen_ was written in Latin and completed by 1075. Adam's account of Harald, while hardly much better than fragmentary, is almost unrelentingly hostile, and understandably so when its author had derived so much of his information by way of personal contact with Harald's discarded Danish ally and subsequent lifelong enemy, Svein Estridsson. Nonetheless, Adam of Bremen does offer his own acknowledgement of Harald's warlike reputation when he refers to him as the 'thunderbolt of the north' and, on occasion, can also supply interesting detail to be found in no other source.
The earliest history actually written by a Scandinavian does not appear until at least a hundred years after that of Adam of Bremen from whose work its author, known as Saxo Grammaticus, evidently borrowed material. Saxo's _Gesta Danorum_ (or 'Acts of the Danes') is another Latin history, although one more probably written by a lay clerk than a monk, because Saxo was of a Danish warrior family, a background which may well account for the unswerving loyalty he shows to Svein Estridsson; it would also account for the rather different light he might be thought to throw upon the saga record of warfare between Svein and Harald. The first historian of the Norwegian kings generally believed to have been himself a Norwegian was a contemporary of Saxo known only as 'Theodoric the Monk' whose Latin _Historia_ , written around the year 1180, is dedicated to the archbishop of Nidaros (now Trondheim). It is a work which shows extremely scant respect for Norway's royal house and is thus thought likely to have provoked the ruling Norwegian king Sverri Sigurdsson, himself the subject and patron of the first saga set down in writing, to encourage the composition of a history more sympathetic to his ancestors and one which would serve as a counter to Theodoric's _Historia_.
This was to become the work now known as _Ágrip_ or 'Summary', an abbreviation of _Ágrip af Nóregs konunga-sögum_ ('Summary of the sagas of the Norwegian kings'), a title applied only in the last few centuries, and which reflects the incomplete state of the sole surviving manuscript copy while doing less than justice to the landmark significance of the long-lost original. Probably composed as early as the 1190s, and by an Icelander living in Norway, Ágrip is the oldest surviving history of Norwegian kings written in the Old Norse vernacular and was extensively used as a source by saga-makers in the thirteenth century, although they were certainly working from a fuller and better text than that preserved in the surviving manuscript. Of no less importance here, though, is its anonymous author's use of material from the oral tradition to expand upon that found in the Latin histories, because it is just this approach which points the way, followed in subsequent decades by the authors of the more expansive saga histories – and especially those bearing on Harald Hardrada.
Variant versions of Harald's saga are found in the three oldest collections of _konunga-sögur_ – the _Morkinskinna_ , the _Fagrskinna_ and _Heimskringla_ – while another, sometimes known as the 'Separate' _Harald's saga_ , is found in a later manuscript volume known as the _Flateyjarbók_. Reference will be made to all of these saga sources throughout the following pages and so this might be a useful point at which to introduce them.
Of the four named above, only the _Flateyjarbók_ survives as an original manuscript, the largest of all Icelandic parchments, of which the core was set down by two known Icelandic scribes in the later fourteenth century. A number of further folios, including the text of the 'Separate' _Harald's saga_ , had been added by an unknown hand when it reappeared in a later ownership on the island of Flatey (hence its name, meaning 'The Book of Flatey') in the second half of the fifteenth century. The three earlier saga collections have all been dated to the first few decades of the thirteenth century, even though none survive as original manuscripts but only as copies of various dates and in no less various conditions.
The collection called _Morkinskinna_ ('mouldy vellum') was written around the year 1275 by Icelandic scribes reworking an older text – now lost, but referred to as the 'Oldest _Morkinskinna_ ' – which has been dated to at least fifty years earlier, with one scholarly estimate even placing its composition as precisely as the period 1217–22. It was this original text of _Morkinskinna_ , containing sagas of the kings reigning between 1035 and the latter half of the twelfth century, which appears to have been the source of later sections in _Fagrskinna_ and in _Heimskringla_ and so might be taken to represent the earliest of the thirteenth-century collections unless, of course, all three were drawing upon an unknown common source.
_Fagrskinna_ ('fair vellum') is a title applied through the last few hundred years to a work surviving only in copies deriving from an early thirteenth-century original which is thought to have been written earlier in Nidaros, or the surrounding Trondelag region, and probably by an Icelandic author. Apparently known in medieval times as _Nóregs konunga tal_ ('List of the Kings of Norway'), it is a collection of kings' sagas beginning in the ninth century with Halfdan the Black, father of Harald _hárfagri_ ('fair-hair'), and extending to the year 1177, which was probably also the terminal point of the original _Morkinskinna_ as it certainly was of the third _konunga sögur_ collection – and the one of first importance here – which is, of course, the _Heimskringla_ attributed to Snorri Sturluson.
I have been using the cautious term 'attributed to' in this context because there is no confirmation of the author's identity in any of the numerous medieval manuscripts of the work – most of them dating from the fourteenth century – even though the great weight of later evidence recognising him as Snorri Sturluson (and the total absence of any suggested rival claimant) puts the question almost entirely beyond doubt. Although there is no known original manuscript, there is one single leaf surviving from a copy set down before 1275 and believed to be the closest to Snorri's original on the evidence of its full text, which is preserved in at least three good transcripts. The title _Heimskringla_ ('the world's orb'), which is derived from the work's opening line ('The orb of the world on which mankind dwells . . .') and has been applied since the seventeenth century, has a cosmic resonance well befitting the scope of its cycle of sixteen sagas extending from the mythic origins and legendary ancestry of the Norwegian royal house through to the last quarter of the twelfth century.
Snorri Sturluson himself was one of the most prominent figures in the Iceland of his time, a man of wealth and power as well as literature and learning. Although born into one of the most powerful Icelandic kindreds around the year 1179, he was to acquire much of his wealth and land through marriage, while also seeking to extend his influence by marrying his daughters into other important Icelandic families. He made two extended visits to the Scandinavian mainland where he is said to have been honoured with the title of _jarl,_ as well as twice holding the presidential post of lawspeaker in the _Althing_ , the Icelanders' parliament. In his later years, however, Snorri fell victim to a poisonous blend of family feud and political intrigue when offence caused to his resentful in-laws and to the Norwegian king Hakon Hakonsson resulted in an attack on his home by an armed band led by one of his sons-in-law. They found Iceland's most eminent man of letters, sixty-two years of age and utterly defenceless, taking refuge in his cellar and there they murdered him on a September night in the year 1241. Other than that lightly sketched outline, Snorri Sturluson's remarkable life story lies beyond the scope of these pages and yet there are some aspects with such significant bearing upon his authority as Harald Hardrada's saga-maker as to demand due notice here.
When his father, Sturla Thordason of Hvamm, died Snorri was only five years old and was passed into the foster-care of Jon Loptsson, the most cultivated of Icelandic chieftains, whose home at Oddi was the foremost cultural centre in Iceland at a time when Icelanders could genuinely boast the pre-eminent literary culture of the Scandinavian world. There can be little doubt that the civilised ambience of Oddi, and especially its fine library, offered an exceptional stimulus to the literary inclinations of a youngster who might well be thought to have inherited a gift for poetry by way of his mother's descent from the warrior-poet Egil Skalla-Grimsson, who is now best known as the hero of the famous _Egil's saga_ , another work often attributed to Snorri's authorship. In fact, there can be no question of Snorri's accomplishment and learning in the art of the _skáld_ (the Old Norse term for a 'court-poet'), not only because one work of which he is firmly identified as author is the outstanding medieval treatise on skaldic verse known as the S _norra Edda_ (although more usually in the English-speaking world as the _Prose Edda_ ), but because his own youthful praise-poetry sent to the Norwegian court made so great an impression that he was invited to visit Norway. He was to take up that invitation in 1218 and spent the next two years on the Scandinavian mainland, much of that time in the service of Jarl Skuli, who held the office of regent to the young king Hakon Hakonsson.
The decade following his return from Norway in 1220 represented a period of peace in Icelandic society, a lull before the storm of internecine violence that erupted in the later 1230s. Snorri was already a man of great wealth, perhaps even the richest in Iceland, and settled on the farm at Reykjaholt to which he had moved from his wife's estate in 1206. There he would undoubtedly have built up his own library and there too he apparently had the assistance of an amanuensis, so it was at Reykjaholt that he is thought to have written most, if not all, of his surviving works – not only _Heimskringla_ , but also his _Edda_ and, quite possibly, _Egil's saga_ too – between the years 1220 and 1230. The key item of evidence supporting this unusually precise dating is a passage found in _Íslendinga saga_ ('Saga of the Icelanders', a history of his own Sturlung kindred written within living memory of Snorri's lifetime by his nephew, Sturla Thordason) which tells how another nephew, Sturla Sigvatsson, spent the winter of 1230–1 at Reykjaholt where he 'had saga-books copied from the works which Snorri had composed'.
While the writing of _Heimskringla_ can be convincingly placed at Reykjaholt in the 1220s, the gathering together of all the history and tradition upon which it draws must have represented the work of a lifetime for a man who had by then entered into his fifth decade. It was a pursuit upon which Snorri had probably first embarked in his foster-home at Oddi and continued throughout the following years, especially when his travels around Norway and Sweden during the first sojourn on the Scandinavian mainland would have allowed visits to historic sites associated with Norwegian kings and introduced him also to oral traditions which were to inform his sagas.
As to his documentary sources, Snorri's own prologue to _Heimskringla_ acknowledges a debt to an earlier historian, the esteemed Icelander Ari Thorgilsson, and to his 'lives of the kings', presumably a saga-history but a work now long since lost. He does, however, make passing reference to other written sources which have survived into modern times and of these an early version of _Orkneyinga saga_ – known to Snorri as _Jarls' saga_ – will be of special importance here by reason of its bearing on Harald Hardrada. Meticulous scholarly research into the text of _Heimskringla_ has identified further documentary sources, notably _Ágrip_ and _Morkinskinna_ , upon which he appears to have drawn but does not mention by name. There is, however, another body of historical record, quite independent of the narrative histories, and this is the wealth of skaldic verse which represented a key primary source for the saga-maker, having been used first by the author of _Ágrip_ , to a greater extent by those who composed _Morkinskinna_ and _Fagrskinna_ , but most extensively of all by Snorri in _Heimskringla_.
These court-poets known as _skálds_ , almost all of them firmly identified as Icelanders, had been in richly rewarded attendance on Norwegian kings since the time of Harald Fair-hair in the later ninth century. Usually informed at first hand and sometimes even themselves eye-witness to the events they described, their poetry can be taken to represent an immediately contemporary source of history. Before the battle of Stiklestad, Olaf insisted on his skalds sheltering within a shield-wall in order that they should see the conflict and survive to commemorate its deeds in verse for posterity. So too, Thjodolf Arnorsson, who was Harald Hardrada's favourite among his own court-poets, fought beside his king at Stamford Bridge and is thought to have been slain in the battle or to have died soon afterwards of wounds suffered there. _Heimskringla_ contains very many more examples of the first-hand authority of skaldic verse, as Snorri himself confirms in his prologue when he acknowledges having 'gathered the best of our information from what we are told in these poems which were recited before the chieftains themselves or their sons'.
The contemporaneity of such information thus lies almost entirely beyond dispute, and yet reasonable doubt might still be cast on its objectivity when, as Snorri admitted, 'it is the way of the court-poet to lavish greatest praise on those for whom the poems were composed'. Even so, he was still able to 'regard as the truth everything which is found in those poems concerning their expeditions or their battles . . . because none would dare tell the king of deeds which everyone present would know to be nonsense and untruth. To do so would have been mockery, not praise.' Clearly, then, the skald addressing his praise-poetry to the king in the company of a warrior nobility, at least some of whom could have witnessed the events he was celebrating, might be expected to aggrandise or exaggerate, but he certainly could not lie.
The art of the skald was highly sophisticated in terms of poetic form as well as being a style of writing dominated by the kenning, a compound word-form found throughout the early medieval literatures of the northern world and characterised by idiomatic imagery often alluding to pagan tradition. While such allusions are often elaborate to the point of obscurity for the modern reader, there are more straightforward illustrative examples of the kenning such as the skald Thjodolf's calling Harald Hardrada 'feeder of ravens' to signify his battle prowess and likewise referring to his warships as 'ocean dragons'. Scarcely less complex than the most elaborate kennings were the strict forms of stanza, metre and rhyme which defined the structure of skaldic verse and also served to protect it from the corruption which afflicted the folk-tale and similar material preserved in oral tradition. Such was evidently Snorri's own opinion expressed in his prologue to _Heimskringla_ , where he suggests that 'these poems are the least likely to be distorted, if properly composed and sensibly interpreted'.
Interpretation was of crucial importance when skaldic verse was used as a source of history, as is demonstrated by examples of misconstrued skaldic references leading to erroneous conclusions found elsewhere in the saga literature. Snorri's own extensive knowledge of the art of the skald is so impressively confirmed by his _Edda_ that his interpretation of skaldic verse as historical record must be accounted more reliable than that of other saga-makers, and especially so in his meticulous identification of the skalds whose work he quotes and in his subtle indications as to the authority of their evidence. It is a sphere of expertise of most especial value for _Harald's saga_ , as Snorri himself implied when he wrote of 'a great deal of information about King Harald found in the verses which Icelandic poets presented to him and to his sons. Because of his own great interest in poetry, he was one of their very best friends.' Not only was Harald the patron of poets, but he was also a skald in his own right and some number of his verses are preserved in Snorri's saga. 'No king of Norway was a better poet', in the opinion of the eminent authority Gabriel Turville-Petre, 'and none showed a deeper appreciation of the art than Harald did, nor expressed his views in more forthright terms.'2
While Snorri recognised the legacy of skaldic verse as the most reliable of his sources, he makes a point of emphasising his caution in selecting information about Harald from elsewhere in the oral tradition: 'Although we have been told various tales and heard about other deeds . . . many of his feats and triumphs have not been included here, partly because of our lack of knowledge and partly because we are reluctant to place on record stories which are not substantiated.'
As well as the evidence he had gleaned from the skalds and earlier saga-makers, Snorri Sturluson was singularly fortunate in his access to an important source bearing on Harald Hardrada within his own family, because he himself was directly descended from a daughter of Halldor Snorrason who had been one of Harald's two principal lieutenants throughout his years as a Varangian in Byzantine service. A formidable character in his own right – and one who will make further appearances in these pages – Halldor is recognised by the most authoritative modern work on the subject as 'the Icelandic Varangian who is most popular in Norse sources, being in this respect close to King Harald himself . . . [and] almost certainly the source for the bulk of the Icelandic tradition in respect of the King's Varangian career'.3 Halldor returned to Norway with Harald and apparently remained for a time at court after his accession to the kingship, but relations between the two were not often the most harmonious and eventually Halldor made his way home to Iceland where he earned great renown as a tale-spinner, principally on the strength of his adventuring in the east. His stories may even have been worked into a saga, albeit one which survived only in oral tradition and was probably never set down in writing, although Halldor himself is the subject of two tales preserved in the _Morkinskinna_ and _Flateyjarbók_ manuscript collections. It was probably inevitable that Halldor's original stories should have become corrupted during more than a century of oral transmission, even had they not been greatly elaborated already in the course of Halldor's own repeated retellings, and yet Snorri's family connection can still be said to have provided him with privileged access to material for his _Harald's saga_ which had its origin – even if no more than that – in genuinely first-hand recollections of Harald Hardrada's Varangian years.
The word _saga_ is sometimes translated into English as 'history'; however, for all the care with which Snorri Sturluson claims to have handled his sources, the _Harald's saga_ in _Heimskringla_ still cannot really be read as history in the modern sense of the term. It does offer the most comprehensive medieval account of three and a half decades of Harald's career and yet its narrative, inevitably uneven over so wide a compass, sometimes falling short on plausibility and on occasion quite inaccurate on points of detail, must be constantly checked against other records, most especially those bearing on Russian, Byzantine and Anglo-Saxon contexts. While its principal authority as an historical document must rest upon its preservation of the closely contemporary skaldic poetry – a total of more than ninety strophes (eight-line stanza form) or half-strophes from a dozen different skalds – it also deserves credit for its preservation of other evidence, ultimately deriving from oral tradition and however degraded, which might otherwise have been entirely lost to history.
In many respects, Snorri's sagas bear a resemblance to medieval hagiographies (or lives of saints), which themselves derive from oral traditions preserved in monastic communities. Indeed, his _Olaf Tryggvason's saga_ and _Olaf the Saint's saga_ in _Heimskringla_ were almost certainly informed by lives of those two fiercely evangelistic warrior kings written in the Icelandic monastery of Thingeyrar, and his _Harald's saga_ might be recognised as their secular counterpart with the similar intention of preserving a reputation held high in the folk memory of his own time. If such was his purpose, then Snorri can surely be said to have succeeded because the portrait of Harald Hardrada which emerges from the pages of his saga quite unmistakably reflects the reputation of the most feared warrior of the northern world.
In his obituary of Harald in the closing pages of the saga, Snorri writes of having 'no particular accounts of his youth until he took part in the battle of Stiklestad at the age of fifteen'. Now that is a puzzling statement indeed because there is one anecdote, however historically dubious, which is specifically concerned with Harald in early childhood and must have been known to Snorri when it was included in his _Olaf the Saint's saga_ , the longest of all sixteen in the _Heimskringla_ collection and almost certainly written before _Harald's saga_. Moreover, a fairly full account of Harald's parentage, ancestry and background can be pieced together, principally from _Olaf the Saint's saga_ but also from other sagas in the _Heimskringla_ collection, and might be usefully surveyed to conclude this introduction.
First of all, though, there is a question of nomenclature. Thus far, as also in the title, I have used the name-form 'Harald Hardrada' simply because it is probably the one most immediately recognisable to an English-speaking readership and even though no form of 'Hardrada' is found applied to Harald in any of the skaldic poetry or other closely contemporary sources and so would seem not to have been used in his own time. 'Hardrada', while often taken to mean 'the hard ruler', represents the anglicised form of the Norse term _harðraði_ , literally 'hard counsel' although perhaps better translated as 'ruthless'. As to how Harald might have been known to his contemporaries, it is hardly unexpected to find Adam of Bremen calling him _malus_ ('evil' or 'wicked'), although rather more curious is the cognomen _har fagera_ applied to him by the northern recension of the _Anglo-Saxon Chronicle._ If _har fagera_ represents an Old English corruption of _hárfagri_ , the cognomen borne by Harald's celebrated ancestor Harald Fair-hair, it is hardly likely that a late eleventh-century Anglo-Saxon chronicler would have confused the Norwegian king killed in England as recently as 1066 with a namesake who had died some hundred and twenty years earlier, but perhaps it is just possible that he took _hárfagri_ to have been a family surname.
The earliest known association of _har_ ð _ra_ ð _i_ with Harald in a Scandinavian source occurs in the verse treatise _Háttalykill_ attributed to Orkney/Icelandic authorship in the mid-twelfth century, but it is there applied to him and to other warlords simply as an adjective. Its application to Harald as a specifically personal byname does not appear until more than a century later when, as Turville-Petre explains, 'Norwegians and Icelanders of a much later age developed the suitable nickname _harðraði_ . . . [which] seems to creep into chapter-headings and regnal lists probably during the latter half of the thirteenth century'.4
What can be said with confidence is that Harald was not known to Snorri Sturluson as _harðraði_ because, while other saga titles in _Heimskringla_ – such as _Olaf the Saint's saga_ and _Magnus the Good's saga_ , to name those of Harald's half-brother and nephew as just two examples – incorporate bynames established and current in the early thirteenth century, his own saga is headed with the straightforward patronymic as _Harald Sigurdsson's saga_ , which will conveniently serve here to introduce the subject of his parentage. Harald's father was Sigurd Halfdansson, a great-grandson of Harald Fair-hair and king of Ringerike in the Uppland region north of Oslofjord. Sigurd's very practical interest in farming earned him the less than kingly nickname of _syr_ (or 'sow' because he 'nosed about rooting up the ground') from the saga-makers. While Sigurd Syr appears on occasion as the full equal of his peers and a respected voice often tempered with wise caution, other anecdotes in Snorri's _Olaf the Saint's saga_ seem to delight in portraying him as the harassed second husband of the formidable Ásta Gudbrondsdottir, the wife who bore him two daughters and three sons, of whom the youngest was Harald.
Ásta had formerly been married to Harald Gudrodsson, called _Grenske_ ('of Grenland', a district south of Westfold), another great-grandson of Harald Fair-hair and ruler of the southern part of Norway on behalf of the Danish king Harald Gormsson, called 'bluetooth'. Harald Grenske is said to have been killed in Sweden towards the end of 994 or early in the following year (although saga accounts of the circumstances are historically untrustworthy), leaving Ásta to return to her parents as a widow pregnant with his son, the future king and saint Olaf, to whom she gave birth in the summer of 995.
Thus when she remarried shortly afterwards, Ásta brought with her a stepson to be raised by Sigurd Syr until the twelve-year-old Olaf Haraldsson – already possessed of great strength, accomplished with bow and spear, brimming over with self-confidence and fired with great ambition according to his saga in _Heimskringla_ – was given by his mother into the charge of an experienced viking warrior who took him raiding around the Baltic. The saga, fully supported by skaldic verses, records his fighting in no fewer than five battles in Sweden, Finland and Holland before he eventually arrived in England as one of the huge raiding force led by Thorkell the Tall which descended on Kent in the August of 1009.
After some three years of warfaring in England, including the battle of Ringmere and the siege of Canterbury, Olaf crossed the Channel to Normandy, effectively a Scandinavian colony which had begun as a viking base on the Seine in the later ninth century and became thoroughly gallicised into a French province within seventy years, yet still offering a haven to northmen at large in Europe into the eleventh century. There he entered the service of Duke Richard II, evidently as a mercenary fighting-man according to saga accounts of his campaigning corroborated by the eleventh-century Norman historian William of Jumièges, who also records the duke's having stood as sponsor for Olaf's baptism into the Christian faith at Rouen in 1013. Even though William's account of Olaf's conversion discredits the sagas' claim for his having been baptised by Olaf Tryggvason in very early childhood, his entry into the faith can be recognised now as an event of the greatest significance for his Norwegian homeland as well as for his own place in history, because less than two years later he was back in Norway fiercely determined to complete the campaign of conversion left unfinished by Olaf Tryggvason. Yet to do so he would first need to fulfil another ambition and reclaim the sovereignty of the unified kingdom lost some fifteen years before when Olaf Tryggvason, facing defeat at the battle of Svold, had flung himself overboard from his beleaguered warship.
The kingdom which had fallen from the hand of Olaf Tryggvason thus became a fruit of victory shared between the victors: the Danish king Svein Haraldsson, called 'forkbeard', his Norwegian son-in-law Erik Hakonsson, jarl of Lade ( _Hlaðir_ , near Trondheim), and the Swedish king Olaf Eriksson who apparently owed some form of allegiance to Svein of Denmark. By the time of Olaf Haraldsson's return to his homeland – certainly by 1015, although possibly in the autumn of 1014 – there had been a shift in the political balance of the tripartite lordship imposed on Norway some fifteen years earlier. Svein Forkbeard had died in England in the first weeks of 1014, barely a month after winning the English crown, and the subsequent attention of his son Cnut became firmly fixed on winning his father's English conquest for himself. Olaf of Sweden had already passed responsibility for much of his Norwegian interest to Jarl Svein, the brother of Erik of Lade who by this time had joined Cnut in assembling an invasion fleet which would soon be on its way to England, leaving his Norwegian lordship in the care of his son Hakon.
Thus it was the young Jarl Hakon whom Olaf encountered, took by surprise and made captive, when he arrived off the west coast of Norway with two _knorr_ (oceangoing merchant craft as distinct from warships) and 120 warriors. Having secured Hakon's submission and surrender, Olaf released the young jarl unharmed and allowed his departure to join his father in the service of Cnut in England, before setting out on his own progress eastward through Norway seeking support for his cause. In fact, as just one among numerous descendants of Harald Fair-hair, Olaf cannot be said to have had any outstanding claim to the kingship of Norway, but his burly physique (he was known as 'Olaf the Stout' in his lifetime) and warfaring experience, his sheer self-assurance and persuasive oratory would have offered him as an impressive candidate for kingship. He was almost certainly also in possession of a substantial treasury, accumulated in the course of his viking career and not least from sharing in payments of _danegeld_ with which Anglo-Saxon England regularly bought off Scandinavian raiding armies in the tenth and eleventh centuries.
Nonetheless, he was to find opinion in Norway sharply divided between himself and Hakon's uncle, Jarl Svein, who had already fled inland to marshal his own support, and so Olaf turned south to Ringerike where he sought the advice and assistance of Sigurd Syr, who solemnly warned his stepson of the formidable powers whom he sought to challenge. Nonetheless, Sigurd was still ready to help his stepson and brought together an assembly of provincial kings and chieftains of the Upplands which was eventually won over by Olaf's oratory and acclaimed him king. As men of central Norway began flocking to his standard, Olaf made his way north into the Trondelag, heartland of the jarls of Lade, and even there opposition had not the strength to withstand him, at least until Jarl Svein launched a counter-attack on Nidaros which drove Olaf back to the south. There he mustered his forces and assembled a warfleet for the inevitable decisive battle which was fought off Nesjar, a headland on the western shore of Oslofjord, on Palm Sunday in the year 1016.
The victory went to Olaf and with it the kingship of all Norway; the defeated Jarl Svein fled east into Sweden, where he died of sickness the following autumn, and the jarls Erik and Hakon became otherwise engaged with Cnut who was now king in England. In the customary way of victorious warrior kings, Olaf bestowed generous gifts on his supporters, and especially upon the stepfather who had not only helped bring the Uppland kings to Olaf's cause but also, according to the saga, brought with him 'a great body of men' when he joined his stepson's forces in the decisive battle. It seems likely that Olaf's gift-giving to Sigurd Syr was to be the last meeting of the two men, because when the saga next tells of Olaf at Ringerike, some two years after the victory at Nesjar, it mentions that Sigurd had died the previous winter. In fact, that account of Olaf's visit to his mother is of particular significance here because it represents the very first appearance of Harald Hardrada in the _Heimskringla_ cycle.
In celebration of her son's homecoming, the proud Ásta prepared a great banquet for Olaf who 'alone now bore the title of king in Norway' and after the feast brought her three young sons (by Sigurd) to meet their royal half-brother. The saga account of that meeting, while hardly to be considered other than an apocryphal anecdote, does at least have the ring of plausibility when it tells how the king sought to test the character of the three young princes by pretending to become suddenly and thunderously angry. While Guthorm the eldest and Halfdan the second son drew back in fear, the reaction of Harald the youngest was simply to give a tug to his tormentor's beard. If, as the saga claims, Olaf really did respond to Harald's bold gesture by telling the three-year-old that 'You will be vengeful one day, my kinsman', history was to prove him no poor judge of character.
The following day, as Olaf walked with his mother around the farm they saw the three boys at play, Guthorm and Halfdan building farmhouses and barns which they imagined stocking with cattle and sheep, while Harald was nearby at the edge of a pool floating chips of wood into the water. When asked what they were, Harald said these were his warships and Olaf replied: 'It may well be that you will have command of warships one day, kinsman.'
Calling the three boys over to him, Olaf asked each in turn what he would most like to own. 'Cornfields' was Guthorm's choice, while Halfdan chose 'cattle' and so many as would surround the lake when they were watered, but when it came to Harald's turn he had no hesitation in demanding 'housecarls', the fighting men who formed a king's retinue. 'And how many housecarls would you wish to have?' asked the king. 'As many as would eat all my brother Halfdan's cattle at a single meal!' came the reply. Olaf was laughing when he turned to Ásta saying, 'In this one, mother, you are raising a warrior king', and, indeed, there is good reason to believe that such had been her intention from the first. The saga relates more than one anecdote bearing on Ásta's ambitions for her sons and it would seem likely that it was she rather than her husband Sigurd who had chosen the name given to their youngest boy. If so, then her choice carries its own remarkable significance because the name _Haraldr_ derives from the Old Norse term _her-valdr_ , 'ruler of warriors'.
Some dozen years had passed before there is any saga reference to Harald meeting again with Olaf, although this time it was to be in very different circumstances because much had changed since 1018. Driven from power in Norway, Olaf had found refuge in Russia and it was from there that he returned in 1030 in a doomed attempt to reclaim his kingdom by the sword. News of his coming had apparently reached Ringerike even before he had passed through Sweden and the first to meet him as he approached the border was his half-brother Harald – now fifteen years old and described by the saga as 'so manly as if he were already full-grown' – who brought some seven hundred Upplanders to join Olaf's modest army on its westward advance into the Trondelag.
Ahead of them in Værdal lay the battle which was to mark the beginning of Harald Hardrada's warrior's way when the sun turned black in the summer sky above Stiklestad . . . .
## I
## _Stiklestad_
## Norway, 1030
In the greater historical scheme of things, the presence of the young Harald Sigurdsson at Stiklestad might be thought to represent little more than a footnote to the epic drama centred upon the death in battle of the king who was soon to become Norway's national patron saint. Such might even be the inference of the saga record when the first chapter of _Harald's saga_ in Snorri Sturluson's _Heimskringla_ , which takes Stiklestad as the beginning of Harald's story, actually expends just a few paragraphs on his presence at the battle which had already taken up some thirty-eight chapters of _Olaf the Saint's saga_ in the same collection.
From the perspective being taken here, however, Stiklestad offers a range of interest which extends beyond its selection as the starting-point of Harald's warrior's way and even beyond an attempt to deduce something more about his own part in the battle than is made explicit in the saga. Not only does the conflict provide an early opportunity to survey the arms, armour, and tactics involved in an eleventh-century Scandinavian land-battle, but in so doing might also offer some insight into the warrior culture within which Harald had been raised to the threshold of his manhood.
Of no less significance for his personal destiny, however, will be a portrait of the man who stood and fell at the centre of the blood-fray of Stiklestad, because there is every reason to recognise his half-brother Olaf as casting his long shadow across the whole subsequent course of Harald's life. While it was surely a determined loyalty to a brother and boyhood hero which brought Harald to fight his first battle under Olaf's banner at Stiklestad, something still deeper might be needed to explain why, thirty-six years later, it was to Olaf's shrine at Nidaros that Harald paid his parting homage just before he embarked upon the invasion that would lead him to his last battle at Stamford Bridge. It is almost as if the ghost of his half-brother can be sensed at Harald's shoulder on very many occasions throughout those intervening years and most especially after he himself had succeeded to the kingship of Norway. As Olaf is said to have foretold at their very first meeting, Harald was indeed to become a vengeful man: so much so that it might almost be possible to recognise his entire reign as a warrior king in terms of a twenty-year pursuit of blood-feud in vengeance for the kinsman laid low on the field of Stiklestad.
None of which is intended to suggest there was anything religious in Harald's respect for his half-brother's memory, because whatever presence might be sensed at his shoulder is assuredly the ghost of the man he remembered rather than the spirit of the martyred saint whose cult had become firmly established even within Harald's lifetime. Indeed, the alacrity with which a king slain in battle by his own people was transformed into his nation's martyred patron saint is remarkable even by medieval standards. The sagas tell of wounds healed by his blood almost before his corpse was cold and such miracle stories can be traced all the way back to the eleventh century, some of them even to men who had actually known Olaf. His body had lain buried for only a few days more than the twelvemonth when it was exhumed and found to be uncorrupted, thus enabling the bishop at Nidaros to immediately proclaim him a saint.
Recognition of his sanctity evidently spread widely and with extraordinary speed. Adam of Bremen, who was at work on his _History_ scarcely forty years after Stiklestad, confirms Olaf's feast already being celebrated throughout Scandinavia, just as William of Jumièges, who was writing in Normandy at much the same time, recognised him as a martyr. One version of the _Anglo-Saxon Chronicle_ , set down some twenty years earlier still, reflects the Scandinavian seam of northern English culture when it styles Olaf _halig_ (or 'holy'). However, even when due allowance is made for the very different values of that world and time, what is known of the personality of the historical Olaf Haraldsson is not easily reconciled with any of the more familiar manifestations of Christian sanctity.
The later saga stories of his having been baptised in infancy by Olaf Tryggvason can be set aside in the light of William of Jumièges' account of the baptism at Rouen, and so it would be reasonable to assume his early life as steeped in the pagan culture of the viking warrior which, indeed, he himself was to become at the age of twelve. Having adopted the Christian faith, however, Olaf was determined to impose it upon the kingdom he was soon to claim in Norway – and, if needs be, at sword-point. Those who refused conversion, or accepted under pressure the man-god whom the northmen called the 'White Christ' and afterwards reverted to pagan practice, faced banishment, maiming, or even death at royal command.
Disloyalty to the king himself was punished with no less severity, of which the most notorious example is the saga story of five Uppland kings who first supported Olaf's bid for the kingship but shortly afterwards become so disenchanted as to conspire together for his overthrow. When word of their conspiracy was brought to Olaf, an armed force 400 strong was sent to make them captive and bring them to face his wrath. Three of the kings were despatched into exile with their families and their lands seized for the crown, a fourth had his tongue severed, while the most frightful retribution was that inflicted upon the fifth. Rorek of Hedemark had his eyes put out and, still being considered dangerously untrustworthy even thus impaired, was compelled thereafter to remain under surveillance in the king's retinue. Peremptory brutality would also appear to have characterised Olaf's foreign policy when, having seen off the jarls of Lade and knowing Cnut to be otherwise engaged in England, he still had to contend with the Swedish king Olaf Eriksson's intervention in disputed borderlands. Armed bands of Swedish officers sent to extract tribute from Norwegian bonders ( _bóndi_ , or yeoman farmers) provoked a stern response, and a verse set down by Olaf's skald Sigvat Thordsson tells of a full dozen Swedes hanged as a feast for the ravens when they ventured into Gaulardal and Orkadal south and east of the Trondelag.
The various saga accounts of Olaf's reign are so heavily burdened by legend as to be profoundly suspect as historical record, even though Snorri Sturluson clearly took greater pains to produce a rounded portrait of the man than did those others whose work merely offers a sanitised eulogy of the martyred saint. In so doing, he was able to place great reliance upon Sigvat Thordsson's court-poetry as a uniquely informed source of immediately contemporary evidence. Sigvat's _Vikingarvísur_ (or 'viking verses'), for example, provides a catalogue of Olaf's earlier warfaring around the Baltic, in England and in Normandy which was presumably informed by the king's own reminiscences, while _Nesjavísur_ ('Nesjar verses') is the poet's record of his first attendance upon his lord in battle on the occasion of the famous victory over Jarl Svein in 1016.
Indeed, and quite apart from the value of his poetry as historical record, Sigvat's relationship with his royal patron is of particular interest in that it clearly illustrates some of the paradoxes of Olaf Haraldsson's nature. Sigvat Thordsson had arrived in Norway from Iceland shortly after Olaf's return to claim the kingdom and, in the way of his trade, sought out the new king at Nidaros to offer verses composed in his honour. As a recently baptised Christian, Olaf strongly disapproved of the pagan associations of skaldic art, so his initial response to Sigvat was less than welcoming, yet the skald was able to win him over and eventually to become his most trusted friend, counsellor and emissary.
Despite that professed distaste for poetry, Olaf is known to have written verse of his own, and in the form of love-poems, a use of poetry considered beneath contempt by the high standards of the skaldic art but one which bears out his notorious susceptibility to female charms, which he himself described as his 'besetting sin' in one of the verses ascribed to him. Olaf's love-poems were addressed to the Swedish princess Ingigerd, on whom they made so favourable an impression that a betrothal was arranged through the intermediary of Rognvald Ulfsson, jarl of Gautland and himself a Swede, but closely linked to Norway by reason of his marriage to a sister of Olaf Tryggvason. In the event, however, the arrangement was to be thwarted when Ingigerd's father King Olaf of Sweden – who so despised the Norwegian Olaf that he refused even to use his name, referring to him only as 'that fat man' – insisted instead on Ingigerd's betrothal to the Russian Grand Prince Jaroslav.
Almost immediately, Olaf arranged to take another Swedish princess, Ingigerd's sister Astrid, as his bride, but only with the assistance of Sigvat who somehow circumvented her father's disapproval by travelling to Gautland and there negotiating the marriage ('among other things spoken of . . .', according to the saga) with Jarl Rognvald acting once again as intermediary and himself escorting the bride to Norway for her wedding in the first months of 1019. Rognvald thus incurred his own king's grievous displeasure and on his return Olaf of Sweden would have had him hanged for his 'treason' had it not been for Ingigerd's insistence that he escort her on her bridal journey into Russia and never again return to her father's kingdom. So it was that Rognvald Ulfsson came to settle in Russia, where he was endowed with the lordship of Staraja Ladoga on the Gulf of Finland, and it was there, some dozen years later, that his son Eilif was to be a comrade-in-arms to the Norwegian Olaf's kinsman, the young Harald Sigurdsson.
In Norway, meanwhile, marriage would appear to have placed little restraint on Olaf's 'besetting sin' when the mother of his son born around 1024 was not his queen but one Alfhild, described in the saga as 'the king's hand-maiden . . . although of good descent'. Once again Sigvat the skald was on hand, because it is he whom the saga credits with the choice of Magnus – in honour of _Karl Magnus_ , the Norse name-form of the ninth-century Holy Roman Emperor Charlemagne – as the baptismal name of the new-born prince. In so doing, though, the skald might simply have been anticipating his lord's own wishes, because Olaf so greatly revered Karl Magnus that he had his portrait carved onto the figurehead of his own warship which was thus named the 'Karl's Head'.
That passing saga reference to 'other things spoken of . . .' in the course of Sigvat's negotiations with Rognvald in Gautland has already suggested a political dimension to Olaf's quest for a Swedish queen, and the marriage does appear to have eased his formerly hostile relations with Sweden through the early 1020s. The Swedish king Olaf was becoming increasingly unpopular at home, as a result of his attempts to impose Christianity on his people according to the saga, although just as possibly because of his allegiance to a Danish overlord. Olaf Eriksson is often known as Skötkonung, a cognomen which has been variously interpreted by historians but might well indicate that he rendered some form of tribute – or skatt – to Svein Forkbeard, and some similar obligation to Cnut when he succeeded Svein. Whatever the true reason, Olaf Skötkonung was eventually forced to share the kingship with his son, whom he had christened Jacob but who was to adopt the Scandinavian name of Onund before he succeeded to full sovereignty on the death of his father in 1022. Sweden's new king evidently had no inclination to accept a Danish overlord, and neither did he share his father's hostility to Olaf of Norway with whom he was soon to find himself in an aggressive alliance against Denmark.
By the mid-1020s, and thus within a decade of his return to Norway, Olaf Haraldsson had achieved the high point of his reign. He had once again restored national sovereignty, however short-lived, to Norway and effectively accomplished its conversion to Christianity. He had also affirmed his influence in the North Atlantic colonies, most importantly in the jarldom of Orkney where he apportioned disputed territories between the brothers Thorfinn and Brusi – sons of the formidable Jarl Sigurd slain at Clontarf in 1014 – and brought Brusi's son Rognvald to take up residence at his court. Friendly relations were extended still further west-over-sea to Greenland, the Faroes and especially to Iceland, whence a number of skalds and fighting-men came to the Norwegian court. Still more impressive was Olaf's achievement as a law-maker, when he revived and revised the law code of Harald Fair-hair's time with such just and equal application to all ranks of society that the skald Sigvat could claim that he had 'established the law of the nation which stands firm among all men'. In so doing, though, he constrained the lordly liberties allowed to provincial magnates when they had been subject only to the client jarls of absent overlords in other lands and thus might already be seen to have sown the seeds of his own downfall.
The saga points specifically to Olaf's prohibition of plunder-raiding within the country and his punishment of powerful chieftains' sons who had customarily engaged in viking cruises around fjord and coastland as the principal causes of discontent with his kingship, but there were other sources of resentment too, not least his draconian response to almost every instance of apostasy or disloyalty. All of these factors were to offer ample scope for the destabilisation of Olaf's sovereignty when the ambition of the mighty Cnut was eventually drawn back from his English conquest to Scandinavia. Sometime around the year 1024, he despatched emissaries to Norway with the proposal that Olaf would be allowed to govern the kingdom as his jarl if he first came to England and there paid homage to Cnut as his lord. Whether or not Olaf was reminded of that ominously prophetic warning given him by his stepfather on his return to Norway some ten years before, his response to Cnut's emissaries, as recorded in Sigvat's verse, was emphatically rendered in the negative. Cnut had thus little option but to come north in arms, which raised the prospect of his reclaiming overlordship of Norway and then turning to Sweden as the next object of his ambition, so there was every urgent reason for Olaf and Onund to form the alliance that was agreed when they met on the border at Konungahella to plan their own pre-emptive attack upon Denmark.
Olaf's fleet of sixty ships sailed south to plunder the Danish island of Zealand while Onund brought a larger force against Skaane (in what is now southern Sweden), but Cnut was soon, if not already, sailing north from England with a large fleet which he brought into Limfjord along the northern coast of Jutland where it was reinforced by Danish warships. Under the shadow of that impressive naval muster ranged out in the Kattegat, Olaf promptly withdrew his forces from Zealand to join Onund in harrying the coastland of Skaane until Cnut's fleet came in pursuit and they withdrew to take refuge in the Holy River which flows into the sea on the eastward coast of Skaane. It was there that the chase finally came to battle in circumstances left surrounded with doubt and confusion by the historical record.
Even the date of the battle of Holy River is in dispute, although the majority of modern historians assign it to the year 1026, and yet its course still remains shrouded in mystery. The saga's claim that Olaf built and then broke a dam on the river to engulf Cnut's fleet when it had been lured into the trap has been convincingly dismissed as just one of 'many tales told of Olaf's ruses at sea and this one is no more credible than the others'.1 Although in view of the customary conduct of Scandinavian sea-fighting at the time – where vessels functioned as fighting-platforms upon which contending warriors engaged in close combat, clearing the enemy decks by the sword until victory was decided by a process of attrition – there may be an item of more convincing evidence in the next saga episode. This passage tells of Cnut's own warship beset on all sides by Norwegian and Swedish vessels, and yet built 'so high in the hull, as if it had been a fortress, with so numerous a selected crew aboard, well-armed and accomplished, that it was too difficult to assail'. Soon afterwards, Olaf and Onund 'cast their ships loose from Cnut's ship and the fleets separated'.
From this reference alone might be inferred the plausible scenario of Cnut's freshly mustered warfleet outnumbering those of Olaf and Onund, whose crews would already have been wearied by a raiding campaign, and of their suffering heavy casualties in the hail of spears and arrows which invariably opened such hostilities, leaving them with no option other than withdrawal in the face of insuperable odds. What can be said as to the outcome of the conflict is that it was not crushingly decisive, if only because none of the principals were slain, and yet the skaldic verses of Ottar the Black, a nephew of Olaf's Sigvat, have no hesitation in declaring Cnut the victor. His closely contemporary evidence must be recognised as the most convincing, especially in the light of its correspondence to the subsequent course of events.
Worthy of mention here, by way of a footnote to the conflict, is the shadowy figure of Ulf Thorgilsson, appointed by Cnut as his jarl in Denmark sometime around 1023 but who appears to have retreated to Jutland when Olaf and Onund launched their onslaught. Most of the sources ascribe a decisive role to Ulf in the battle of Holy River and yet cannot agree as to which side he was fighting for, although his murder in Roskilde church on Cnut's orders at some point after the battle must point to disloyalty, if not to outright treachery. His principal importance here, though, rests upon kinship by marriage, because both his son and his nephew will feature prominently among the enemies of Harald Hardrada. Ulf's sister Gyda became the wife of Earl Godwin in England and thus mother to the Harold Godwinson who was to triumph at Stamford Bridge, while Ulf himself was married to Cnut's sister Estrid from whom their son Svein (called 'Ulfsson' in _Heimskringla_ , but usually 'Estridsson' elsewhere) inherited his claim on the kingship of Denmark, in pursuit and possession of which he was to become briefly Harald's ally and for many years afterwards his relentless foe.
Whatever really did befall at Holy River, the outcome of the engagement clearly left Cnut in the ascendant and the Norse– Swedish alliance dissolved. Onund sailed back to Sweden with as much as remained of his fleet, while Olaf – perhaps mindful of the fate suffered in just those same waters by Olaf Tryggvason at Svold – abandoned his ships to make his way home overland. In the following year of 1027, Cnut was on pilgrimage in Rome, where he is known to have attended the coronation of the Holy Roman Emperor, and would surely not have entertained the idea of such a journey had he been in any doubt as to the security of his kingdoms. Indeed, in his letter addressed to the English people in that same year, Cnut is styled 'king of all of England and of Denmark and part of _Suavorum_ [by which is probably meant Skaane on the Swedish mainland]'.
Norway was to enjoy a short spell of peace in the aftermath of Holy River, but, on the evidence of English and Icelandic sources, it would not be long before Cnut's agents were active in the western and northern provinces such as the Trondelag and Halogaland where the rising tide of discontent with Olaf was to be most usefully encouraged by the gold, silver and promises they brought with them. Now returned to England from Rome, Cnut had apparently decided that Olaf's kingship was to be most effectively – and bloodlessly – undermined by bribery of Norwegian magnates greedy for wealth and esteem. 'Money will make men break their faith,' observed Sigvat the skald, and his verses record 'enemies about with open purses; men offering heavy metal for the priceless head of the king'.
The saga tells of Olaf's commanding the execution of one young man who had accepted Cnut's bribe in the form of a golden arm-ring and thus provoking the hostility of his kinsmen. Although just one among numerous examples of draconian retribution for disloyalty, this particular instigation of blood-feud was to prove of especially ominous significance when the victim's stepfather was the powerful Kalv Arnason and his uncle Thore Hund ('the Hound'), both of whom were ultimately to confront the king in battle at Stiklestad where Kalv himself would be accused of having delivered Olaf's death-wound.
While this episode and other similar stories in the saga show how effectively Cnut's policy of destabilisation gained ground, the situation is convincingly summarised by the modern historian Gwyn Jones. He suggests that Olaf 'had more support in parts of the country, in Uppland and the Vik for example, than Snorri allows for, and that his opponents were not so much politically allied against their sovereign as disaffected for more personal reasons, including loss of land or status, change of religion, family grievances, and private quarrels with the king'.2 The core territory of Olaf's remaining support would seem to have lain around the Vik (now Oslofjord) and, indeed, he is said by the saga to have been in that region when he heard news of Cnut's arrival in Denmark with a fleet of fifty ships from England in 1028. His immediate response was to summon a levy in defence of his kingdom and some numbers of the local people rallied to his banner, but very few came to join them from other parts of Norway and his warfleet was only such waterlogged hulks as could be salvaged from what remained of the fleet he had abandoned in Holy River two years before. Such a force hardly represented any credible resistance to the fleet of more than 1,400 ships which Cnut had assembled in Denmark and was now sailing up the west coast of Norway.
Accepting submission and taking hostages as surety wherever he touched land, Cnut sailed on until he reached the Trondelag and put in at Nidaros where a great assembly (or _thing_ ) of chieftains and bonders was summoned to acclaim him as king of all Norway. The great men of the north and west who swore allegiance were duly rewarded, some as his 'lendermen' (or _lendr maðr_ , literally 'landed-men', effectively 'barons'), and the same Hakon Eriksson of Lade who had surrendered to Olaf on his homecoming some fourteen years before was now appointed Cnut's jarl to rule on his behalf over Olaf's kingdom.
Only when Cnut's fleet had set sail back to Denmark did Olaf bring his few ships out of the Vik, but his progress up the west coast served merely to confirm his dwindling support. The saga tells of his confrontation with Erling Skjalgsson, one of the most powerful of the chiefs who had made submission to Cnut. Defeated in battle by one of Olaf's ruses, Erling stood alone with no choice but to yield and yet was struck dead by a warrior's axe moments after he had agreed to return to Olaf's service. The saga describes that axe-blow as having struck Norway 'out of Olaf's hand', and as the royal fleet of just a dozen ships sailed north the sons of Erling were already summoning the bonders of the south-west to rise in pursuit of yet another blood-feud against the king.
Even as Olaf sailed north of Stad and learned of the great warfleet assembled against him by Jarl Hakon in the Trondelag, his desperate situation had become virtually irretrievable. The warrior who had killed Erling Skjalgsson went ashore and was slain before he could return to his vessel, while the Erlingssons had twenty-five ships in close pursuit and Jarl Hakon's great force was seen in the distance by watchers sent to look north from the hilltops. When Olaf's fleet put into Aalesund, Kalv Arnason joined with others of the few remaining lendermen and shipmasters in defecting to Hakon, leaving the king with just five ships which he drew on to the shore. Clearly, all was lost to him now and his only available course was to take flight overland, first by way of Gudbrandsdal into Hedemark where he granted his warriors leave to return home if they chose so to do.
Accompanied by his young son Magnus, his queen Astrid and their daughter Ulfhild, Olaf still had with him a loyal warrior retinue, of whom the most prominent members identified by the saga included Arne, Finn and Thorberg Arnason, brothers of the Kalv who had defected to Jarl Hakon and was even now being promised great prospects under Cnut. One other of Olaf's loyal companions in adversity mentioned by the saga will be of further significance here, namely Rognvald Brusason who had been brought to the Norwegian court as a boy with his father, the Orkney jarl Brusi, some ten years before and stayed on, probably at first as a hostage for his father's good behaviour, but in time becoming a trusted friend to the king. Such, then, was the company that made its way through the Eida forest into Vermaland and over the border to take refuge in Sweden, where Olaf stayed until the following summer when he entrusted his daughter and his queen to the care of her brother Onund at the Swedish court before taking ship across the Baltic to Russia and the court of the Grand Prince Jaroslav at Novgorod. There he was assured of generous hospitality, not only by reason of Jaroslav's being his kinsman by marriage when both had taken daughters of the Swedish king Olaf as their brides, but because of the wider and more ancient relationship between the ruling houses of Scandinavia and Russia. Jaroslav and his background will be more fully considered later in the context of Harald Hardrada's east-faring, but it might still be useful at this point to indicate something of Russia's place within the orbit of medieval Scandinavian expansion.
The term _Rus_ derives from a Finnish name applied to the Swedes who were the first of the northmen to penetrate the mainland of what later became Russia, and was taken up by the Slavonic settlers to identify Scandinavian traders who had established their bases along the northern Russian waterways long before the arrival of Rurik. The traditional forebear of medieval Russia's ruling dynasty (and thus the great-great-grandfather of Jaroslav), Rurik is said to have founded his power base at Novgorod in the year 862. As in Normandy and elsewhere throughout the Scandinavian expansion, the early settlements steadily absorbed the host culture and within less than two centuries their ruling warrior aristocracy had become thoroughly Slavonic in character, yet the traffic of Scandinavian traders and warriors along the Russian rivers still sustained close relations between the Rus and their northern cousins.
Thus Russia, or _Gar_ ð _ar_ as it was called in Old Norse,3 offered a convenient realm of refuge for Scandinavian kings and princes in exile, and a remarkably generous welcome to Olaf when Jaroslav offered him lordship over the Bulgars on the Volga. In the event, that proposal proved unpopular with the warriors of Olaf's retinue, who were disinclined to settle in Russia and urged him instead to return to Norway. Olaf himself, however, is said to have been considering a pilgrimage to the Holy Land when tidings came from Norway of the unexpected death of Jarl Hakon, who had been in England with Cnut that summer and was drowned on the voyage home when his ship was lost off the coast of Caithness. The news that Norway was suddenly bereft of a ruler prompted Olaf to consider attempting to reclaim his lost kingdom. While Jaroslav warned of the might of opposition he would be facing with only slender forces of his own and offered him an even more generous lordship were he to stay in Russia, the saga tells of a vision of Olaf Tryggvason in full regalia urging his return to Norway, and this supposedly divine intervention is presented as the decisive factor prompting Olaf to set out on what was to become his death-journey into martyrdom.
'Immediately after Yule', according to the saga and so presumably in the first weeks of 1030, Olaf was making ready for departure. His son Magnus was left in Jaroslav's care and stayed behind in Russia when Olaf assembled his retinue of some two hundred and forty warriors, who had been generously armed and equipped by his Russian host, and set out on horseback along the frozen rivers of northern Russia to the shore of the Baltic. When the ice broke with the approach of spring, they took ship first to the island of Gotland and then over to the Swedish mainland where Olaf was reunited with his wife and daughter and also met King Onund who, although glad to welcome his old friend, was disinclined to renew their alliance. His spies had brought back reports of the widespread hostility they had found throughout Norway and Onund feared the worst outcome for the expedition, but he was still prepared to reinforce Olaf's small company with some four hundred of his own best warriors equipped for battle,4 granting him permission also to recruit such Swedes as were willing to join his cause on their own account.
So it was that Olaf set out for Norway with a force more than fourteen hundred strong, taking a north-westward route towards the border through Jærnberaland (the 'iron-bearing land', now the Swedish province of Dalarna) and was there joined by his half-brother Harald Sigurdsson with the seven hundred warriors whom he had raised in the Upplands on hearing the first tidings of Olaf's return. Inevitably, of course, there were others in Norway who had also had word of his movements and the saga tells of chieftains who had pledged allegiance to Cnut and his jarl Hakon having learned the news from their own spies sent into Sweden and sending out a war-summons across the land. Already in the spring, Thore Hund had crewed a warship with his housecarls and called a levy of fighting-men in his far northern province around Tromsö. So too had his neighbour, Harek of Thjotta in Halogaland, and these two most powerful chieftains of the north were now bringing their forces to join the host of Olaf's enemies gathering in the Trondelag.
Meanwhile Olaf was making his way through the woodland and moorland of the border country, offering rich rewards in lands and plunder to attract recruits from the rough folk of the forest and no small number of vagabonds besides. He had found another ally, and one of more promising military quality, in Dag Ringsson whose father is said to have been one of those Uppland kings banished for their part in the conspiracy against Olaf more than ten years before. Dag had followed his father into exile in Sweden and it was there that Olaf made contact on his own return from Russia, acknowledging him as kinsman (although, as just another of the numerous descendants of Harald Fair-hair, only a very distant one) and promising full restitution of his father's lands in Norway if he would join him with all the warriors he could muster. Dag apparently agreed with enthusiasm and is said by the saga to have brought another 'twelve hundred' men to join Olaf's forces before leading them off along his own line of march into Norway. While the Swedish contingent is said to have similarly taken its own route, the saga follows the progress of Olaf and his retinue by way of the Kjolen mountains.
When the visions and other hagiographical anecdotes encrusting these chapters of saga narrative are left aside, the plan of campaign comes quite clearly into focus as a westward advance into the Trondelag, presumably with Nidaros as the ultimate objective. The division of his forces into three contingents, each following its own route of march, can be recognised as an evasive strategy intended to outwit any watches set on the border passes, but the advance to Nidaros had evidently been anticipated by the enemy. When Olaf reached the head of Værdal a friendly bonder warned him of the great numbers of fighting-men being mustered in the Trondelag and as he moved on through the valley further intelligence confirmed that same army already on the move against him. At which point, Olaf halted his march and brought together all his forces in preparation for the conflict that would soon be upon them.
The principal concern of the saga narrative at this point appears to be the portrayal of a great Christian warrior king, even one in the mould of Charlemagne, insisting that all his warriors enter battle as Christians, chalking the symbol of a cross on their shields and advancing with the war-cry of 'Forward, forward, Christ-men, cross men, king's men!' Other evidence casts doubt on the historical accuracy of some of these claims when Sigvat the skald's verses supply a closely contemporary reference to pagans included in Olaf's forces and a very similar battle-cry is attributed to the twelfth-century Norwegian king Sverri in his own saga, a work well known to Snorri Sturluson and his contemporaries. Indeed, evidence has also been found for another war-cry of 'Press on, press on, king's warriors, hard and hard on bonder men!' used by Olaf's followers at Stiklestad.5 Probably more reliable, and certainly more relevant here, is the saga's estimate of the numbers of Olaf's forces at something over three and a half thousand fighting-men.
Although of no very great significance, the doubts surrounding the details of that particular episode do point up the difficulties involved in filtering authentic military history from the account of Stiklestad in Snorri's _Heimskringla_ version of _Olaf the Saint's saga_. Such difficulties are only to be expected when a warrior king is in the process of reinvention as a martyred saint, and are perhaps best resolved by disentangling the different sources from which the saga narrative was compiled. The more obviously hagiographical elements of Snorri's account of the battle can be traced back to the monastery of Thingeyrar where earlier _Lives_ of St Olaf had been composed with the sole purpose of fostering his cult. As to sources of a more secular character and origin, the skaldic verse which usually represents the most immediately contemporary evidence preserved in the sagas is less helpful on this occasion, even though three skalds were included among Olaf's retinue at Stiklestad. The saga describes his special arrangements for their protection, in order that they should survive to record the battle for posterity, although to no avail when two of the skalds were slain in the battle and the third died very shortly afterwards of wounds he had suffered. Olaf's favourite skald Sigvat Thordsson was not present at Stiklestad, being on pilgrimage to Rome at the time, so the references to the battle in his memorial lay _Olafsdrápa_ , while undeniably closely contemporary, still cannot be considered as first-hand evidence. In fact, the only skaldic verses brought back from the field appear to have been those composed as exhortations to the troops on the eve of the battle, some of whom were able to commit the verses to memory and survived to pass them into oral tradition.
Other recollections of so momentous a conflict would have been preserved in a similar way and thus, even though denied the rigour which underwrites the authority of skaldic verse, eventually found their way into the saga record. Such soldiers' stories, which almost always focus on particularly dramatic incidents, would have been brought home by the Icelandic warriors who are known to have served in Olaf's retinue at Stiklestad. Assuredly these would have been among the sources informing Snorri's account of the battle, much as his travels around Norway and Sweden would have given him access to local sources of oral tradition, while also acquainting him with the landscape which formed the setting for the events he was to describe. As to specifically military matters of arms and armour, strategy and tactics, the evidence supplied by Snorri's account is consistent with what is known of other Scandinavian land battles of the period, almost all of which follow much the same relatively unsophisticated course.
The large-scale land battle was an uncharacteristic feature of warfare in Scandinavia during the earlier medieval period principally, if not entirely, by reason of landscapes dominated by dense forest and mountain ridge. In Norway especially, mountainous areas covered with forest were virtually impenetrable and communication between settlements predominantly located along the coasts was most effectively conducted by sea. So too, of course, was warfare, even to the extent of the warship and its fighting crew representing the primary unit of Scandinavian military organisation long after the forests had begun to be cleared and overland routes made more accessible to troop movement.
Yet battles fought between fleets were not naval engagements in the more modern sense of the term, because the ships served initially as troop-transporters bringing the contending forces into contact and afterwards as floating platforms for the hand-to-hand fighting which was to decide the outcome of the engagement, usually when the principal commander of one side was slain. Battles on land were very similarly conducted, although close combat between sizeable forces long before the introduction of military uniforms posed the problem of differentiating between friend and foe, which would have been less likely to apply to a warrior crew of just a few dozen men who had shared shipboard accommodation. Thus it was important for a commander to arrange his more numerous troops into groups likely to be known to each other, and so the saga's account rings true when it tells of Olaf organising his forces into three divisions, each one assembled around a banner where its members were instructed to group themselves together with their neighbours and kinsmen.
The king's own retinue, or _hir_ ð, comprising his principal officers and his housecarls was to form the central division around his banner. The Upplanders were to stand with them and such local men of the Trondelag as could be rallied to the king's forces should be placed there too, along with some of the vagabonds recruited during the march through the forests. Dag Ringsson's warriors were to be deployed on the right around the second banner, while the Swedes would have a third banner and be placed on the left flank. The saga estimate of Olaf's troop numbers at 'over three thousand men' is reckoned in 'long hundreds', and so would correspond to a force well in excess of three and a half thousand, a proportion of whom – his own housecarls and those of Dag Ringsson, as well as the select Swedish troops assigned to him by Onund – can be considered 'professionals' in respect of training and equipment. Those volunteers he had been able to recruit in Sweden and along the march through the borderlands, however, were unlikely to have been of any such quality, neither in terms of arms, armour and training nor as regards battle-readiness and morale.
Having set out that deployment of troops in readiness to move on down the valley, Olaf was brought word that there would be no local recruits to his ranks. Virtually every man able to carry a weapon had joined the 'bonders' army' and those who had stayed in their homes had done so rather than join either side in the coming conflict. Finn Arnason was so angered at this news that he urged the king to plunder and burn the farms in the valley, with the intention of alarming the Trondelag men into fleeing back to their homes and thus thinning down the enemy ranks. Such would have been a tactic fully characteristic of Scandinavian warfaring, indeed one no less typical of Olaf's own domestic policy in former years, and the authenticity of Finn's proposal is reliably confirmed by the saga's quotation of lines attributed to Thormod Kolbrunarskald who was present at the time; however, the king is said to have rejected the idea as an unnecessary provocation when he yet hoped to be able to negotiate a peace with the 'bonders' army'. The only pre-emptive action he would allow was the killing of any enemy spies they might come upon, and under those orders of engagement the advance into Værdal continued, with the king taking one country road and Dag with his people another way, intending to meet in the evening for encampment overnight.
It is at this point that the saga tells of the skalds in attendance upon Olaf: the aforementioned Thormod Kolbrunarskald, Gissur Gulbraaskald and Thorfinn Mudr, all three, of course, Icelanders. When the forces were drawn up in battle array, Olaf was to have a _skjaldborg_ (or 'shield-rampart') formed around him by the strongest and bravest of his housecarls. This was a familiar tactic of northern warfaring and consisted of a body of armoured warriors formed up in close order with their shields overlapping on all sides and above, thus forming a shelter to protect the commander and his chosen companions from the onslaught of missile weapons which opened hostilities between contending forces as they closed upon each other. Calling his skalds together, Olaf commanded them to go inside the shield-rampart when action was about to begin and to stay within it so as to witness at first hand the battle which they were to commemorate in poetry. At this point the skalds composed their verses to fire up the warriors for the conflict expected on the following day, although not without sarcastic exchanges bearing on the absence of the celebrated Sigvat.
By nightfall Olaf's forces were all gathered together further down the valley – where, according to the saga, a number of local men did come to join their ranks – and settled to sleep lain under their shields in the open. That particular reference in the saga draws attention to the variety of weaponry likely to have been found among so haphazard an array of fighting-men, because the one component of arms and armour which would have been carried by each and every one of them, from the fully equipped housecarl to the roughest vagabond, would most certainly have been his shield. The least expensive and yet most essential item in the armoury of the northmen, its traditional form was of a wooden disc, approximately a metre in diameter, with a metal boss at its centre covering an iron hand-grip, and such would have been the type most commonly found throughout all the forces engaged at Stiklestad. The tapered, triangular kite-shaped shield would not have reached Scandinavia as early as 1030, but heavy shields of the longer, rectangular Slav design were widely in use among the Rus and might very well have been included in the equipment supplied to Olaf's retinue before leaving Jaroslav's court.
At first light, the slumbering army was roused by Thormod the skald's singing of _Bjarkamal_ , the ancient 'Lay of Bjarki' celebrating one of the legendary champions who fought for the sixth-century Danish king Rolf Kraki. Thought to have had its origin as the work of a Danish poet in the tenth century, this song is one of the very few survivals from a great body of poetry about Rolf widely known in medieval Scandinavia. While Saxo Grammaticus supplies a Latin verse paraphrase of its content, the text of the poem is better preserved by Snorri Sturluson who quotes two strophes at this juncture in _Heimskringla_ (and three more in his _Edda_ ), lending the authority of his own skaldic scholarship to the likelihood of a genuinely historical tradition recalling _Bjarkamal_ sounding reveille for Olaf's army before Stiklestad. When Thormod had been rewarded with a gold arm-ring as his token of royal gratitude, the army moved off to resume its advance through the valley, but once again Dag Ringsson's contingent took its own separate route, although there is no explanation why it should have done so and the reference may be no more than a storytelling device to contrive his late arrival at a point of crisis in the conflict.
At which point the saga finally brings Olaf to Stiklestad, a place name which actually identified a farm in Værdal and one apparently located near the rising ground where the king chose to range his forces, and from where he now had his first sight of the bonders' host assembling below. A spurious story of an attack on an enemy troop sent to spy on the king's army and of its leader, recognised as 'Rut of Viggia', being slain by the Icelanders of Olaf's retinue is very probably one of those occasional saga anecdotes contrived to accommodate a jest based on a personal name, especially when the king offers his Icelanders 'a ram to slaughter' and _Rut_ is the Icelandic term for a young ram. There might be just one nugget of historical value to be found in the tale, however, if it can be taken to confirm the likelihood of Icelanders included among Olaf's housecarls at Stiklestad. The passage immediately following in the saga narrative is another anecdote, but one of more particular significance here as the reference with which _Olaf the Saint's saga_ in _Heimskringla_ specifically confirms Harald Hardrada's having taken part in the battle.
The army has reached Stiklestad and been placed in battle array, although Dag Ringsson's force has yet to arrive and so the king directs the Uppland contingent to go out on to the right wing and raise their banner there, but first he advises that 'my brother Harald should not be in this battle, as he is still only a child in years'. To which Harald replies that he certainly will be in the battle 'and if I am so weak as to be unable to wield a sword, then let my hand be tied to the hilt. There is none keener than I to strike a blow against these bonders and so I shall go with my comrades.' The saga goes on to quote a verse which it attributes to Harald himself, although in a form of words which distinctly betrays Snorri's own suspicions regarding its authenticity: 'We are told that Harald made this verse on that occasion . . . .
I shall guard the wing
on which I stand – and
my mother will hold worthy
my battering reddened shields.
Not fearful of the foemen
bonders' spear-thrusts,
the young warrior will wage a manly
weapon-thing most murderous.6
'And Harald had his way and was given leave to be in the battle.'
There is, of course, no doubt that Harald actually did fight at Stiklestad and so the story certainly cannot be dismissed as implausible, but it still does lack the ring of authenticity, and not least because Snorri's use of the phrase 'we are told that . . .' is one of his customary forms of signalling his own doubts as to the reliability of his source material. It is very tempting to wonder whether Harald might have composed the verse some time after the battle, possibly even years later when he had succeeded his brother as king in Norway and the story elaborated as a frame in which to set it. Closer examination of the incident might even suggest as much because, while Olaf would have had a natural concern for his young kinsman's safety, it is hardly likely that he would have considered him too young to take part in the battle, especially when there is so much evidence attesting Harald's physical prowess and his quite exceptional height which would already have been apparent even in a fifteen-year-old. Neither would a prince already into his teens have been untrained in weapon-handling, especially one with a mother so ambitious for her sons to win battle-glory. This was precisely the form of induction into his warrior's way for which Harald would have been schooled since infancy and, indeed, encouraged to long for by his immersion in a culture entirely infused with the heroic warrior ethos. In fact, Olaf himself was said to have been just twelve years of age when he embarked on his first viking expedition and still only fourteen when he was fighting in England as a warrior in the army of Thorkell the Tall.
It is worth remembering, though, that the young Olaf was placed under the guardianship and guidance of his late father's principal lieutenant, Rani the Far-travelled, when he first went a-viking, and is similarly thought to have had no less a warrior than the famous Thorkell himself as his mentor in England. So it is perhaps more likely that Olaf would not have advised against his young kinsman taking part in the battle at Stiklestad, but against his being placed on the right wing with the Uppland contingent when the king would more probably have wanted to keep him closer to his own most trusted warriors, even within the shelter of his _skjaldborg_ where he intended to place the skalds. There is, in fact, other evidence bearing on Harald's survival at Stiklestad – which will be considered in detail later – to suggest his having been guarded on the battlefield by one of the most trusted members of the king's personal retinue.
One other aspect of the story of timely significance here is Harald's quoted remark about wielding a sword, because this might be the most convenient point at which to expand upon the subject of weaponry at Stiklestad. While the shield, as aforementioned, was the least expensive and most essential item in the armoury of the northman, the sword was not only the most expensive but also the most prestigious, and the weapon most often celebrated by skald and saga-maker. The most famous swords were given their own names, as was Olaf's weapon, called 'Neite' ( _Hneitir_ in the Norse), which served him through his many battles before its gold-worked hilt fell at last from his hand at Stiklestad. Retrieved from the field by a Swedish warrior who had lost his own sword, it was kept in the man's family for some three generations until the early twelfth century when one of his descendants became a Varangian mercenary in Byzantine service and brought it with him to the east. A closely contemporary account, which was known to Snorri Sturluson, tells how its identity was revealed to the emperor John II Comnenus and how he paid a great price in gold for the sword, which was thereafter enshrined in the Varangian chapel dedicated to Saint Olaf in Constantinople.
While unlikely to have been all so richly decorated as Neite, swords of quality would usually have blades of foreign manufacture, the best of them imported from the Rhineland, double-edged, pattern-welded and more than 70 centimetres in length. Recognised as the aristocrat of the armoury in the old northern world, the sword was the weapon of the superior class of warrior, of the housecarl, the chieftain and the king, and yet it was the axe which still represents the most characteristic weapon of the northman. It was, of course, equally useful as a working tool and would have been more widely distributed, as also would the spear, especially the lighter throwing-spear as distinct from the heavier type fitted with a broader blade which was used as a thrusting weapon in hand-to-hand combat.
Thus an army as diverse as the one which Olaf brought to Stiklestad would have gone into battle bearing a disparate range of weaponry. The professional fighting-man would have his sword and shield, possibly a war-axe, probably a spear, or even a bow and arrows when no less an authority than Saxo Grammaticus acknowledged the fame of Norse archery. Those of humbler status would have been armed with the essential shield, probably with an axe and perhaps a spear – even in so basic a form as a sharpened stake – or possibly a hunting bow, while some of the very roughest recruits of the vagabond type might have wielded nothing more sophisticated than a heavy wooden club.
Social divisions would have been still more obviously apparent in respect of helmets and protective armour or, in the great majority of cases, by their absence. The saga has a lavishly detailed account of Olaf's arms and armour comprising a gold-mounted helmet and a white shield inlaid with a golden cross, his spear (which Snorri had certainly seen beside the altar in Christ Church at Nidaros) and, of course, his keen-edged Neite. Yet the one item of his war-gear specifically confirmed by a quoted verse from Sigvat is his coat of ring-mail. This 'burnished byrnie' was probably singled out for the skald's attention by reason of its extreme rarity, because while iron was plentiful (and plate armour completely unknown) in eleventh-century Scandinavia, the laborious craftsmanship involved in the production of ring-mail made it the most prohibitively expensive item of war-gear and thus available only to the most affluent on the battlefield. It would also have been extremely hot and heavy to wear while fighting on foot, so leather may often have been preferred by those who were fortunate enough to enjoy the luxury of choice.
Helmets too, although simpler and thus less costly to produce than mail, are thought not to have been so widespread in Scandinavian warfare as is sometimes imagined. The 'winged' or 'horned' helmet of 'the Viking' has long been confidently dismissed as a fantasy, but helmets of the _spangenhelm_ type – a construction of triangular iron plates held together at the base by a circular headband sometimes mounted with a nose-guard – would have represented standard equipment for the professional fighting-men in a lordly or royal retinue. Again, however, neither helmet nor mail-coat would have been likely to be found among the rougher elements in Olaf's forces, among whom a leather cap and a heavy woollen or leathern coat would have represented the most common protective clothing behind a shield.
The saga's customary reference to the enemy host as the 'bonders' army' must not be taken to indicate a seething peasant rabble, especially when the evidence for selected soldiery gifted by the Swedish king allied with vagabonds recruited from the borderland forests suggests Olaf's forces representing rather greater extremes of warrior type. The 'bonders' army' was evidently recruited across the entire social range of the free and unfree, but was led by prominent chieftains, some of them exalted to the rank of lenderman, accompanied by their own companies of housecarls, while the bonders themselves, although lower in the social order, were still free farmers recognised by a respected modern authority on the subject as 'yeomen [who] were the staple of society'.7
Despite there being nowhere any reference to the inclusion of any foreign element, the possibility of at least some Danish involvement cannot be discounted. When Cnut left his newly acquired Norwegian dominions under the governance of his jarl Hakon, he assigned to him a 'court-bishop' in the person of a Danish priest, Sigurd, who is said by the saga to have 'been long with Cnut', of whose cause he was assuredly an ardent advocate. This Bishop Sigurd seems to have assumed the roles of principal chaplain and political commissar to the bonders' army, inciting all possible hostility to Olaf in the speech of exhortation he is said to have delivered to the forces before the battle. It would have been quite unthinkable for any Scandinavian churchman of the time, especially one given such an assignment by the all-powerful Cnut, to have been without his own escort of housecarls. Sigurd himself is described as exceptionally haughty and hot-tempered, so there would be every reason to expect his demanding a formidable warrior retinue which would undoubtedly have been present, to whatever extent it was actively engaged, at Stiklestad.
On balance, then, there is no reason to imagine this 'bonders' army' as any the worse equipped or accomplished than Olaf's forces, and yet there is nowhere any trace of doubt as to their massive superiority in numbers. Snorri Sturluson is almost certainly drawing upon a deep and ancient well of folk-memory when he describes the muster in the Trondelag as 'a host so great that there was nobody in Norway at that time who had ever seen so large a force assembled', but as to any more precise estimate of numbers, he would seem to signal his doubts as to the accuracy of the figure he mentions in his usual form of words: 'We are told that the bonders' army was not less than a hundred times a hundred on that day'. Reckoning in 'long hundreds', that figure would represent a strength of almost fourteen and a half thousand. While not entirely beyond the bounds of credibility, even at a time when the total population of eleventh-century Norway is estimated at around two million, the phrase 'a hundred times a hundred' has a suspiciously formulaic character and so might be more cautiously read as an indication of 'a very great number, almost beyond counting'. The saga also quotes lines from Sigvat, but the obscurity of their phrasing allows for no more informative evidence than a claim for Olaf's having been defeated entirely by weight of numbers, so in the last analysis neither source can offer evidence for anything more precise than confirmation of a modest army overwhelmingly outnumbered by the enemy host.
Such was clearly Olaf's own appraisal of the situation when he addressed his troops on the morning of the battle, proposing that victory was more likely to be won by shock tactics than a long and wearying confrontation of unequal forces. His stratagem was to extend his forces thinly across a long front to prevent their being outflanked by superior numbers and then to launch a ferocious onslaught at the enemy's front line, throwing it back against the ranks behind, thus extending the impact back through the host with such resulting chaos that 'their destruction will be the greater the greater numbers there are together'.
This sort of oratory is customarily set out in the sagas at great length, and in the finest prose which is more realistically recognised as creative writing than historical record, but there is still no reason to doubt the essential accuracy of its content. The same is usually also true of negotiations between principal characters in the sagas, where the dialogue cannot be anything more than speculative reconstruction and yet the outcome corresponds well enough to the subsequent course of events, as it does in the discussion which decided the command and battle order of the bonders' army.
The first choice for its leader would have been the redoubtable Einar Eindridison, called _Tambarskelve_ ('paunch-shaker'),8 who represented the most powerful figure in the Trondelag. A long-standing enemy of Olaf and married to a sister of the jarls Erik and Svein, Einar had been promised high office by Cnut. When he learned of the death of Hakon Eriksson, Einar sailed to England in full expectation of succeeding as Cnut's jarl over Norway, thus being out of the country when Olaf returned from Russia and apparently in no hurry to return and oppose him.
In Einar's absence, the most senior of the lendermen was Harek of Thjotta and it was he whom Kalv Arnason proposed for command, but the Halogalander protested that he was too old for such a duty and suggested Thore Hund in his stead as a younger man with his own blood-feud to pursue against Olaf. Although eager for vengeance, Thore doubted whether the Trondelag men who made up the greater part of the army would take orders from someone out of the far north. At this point, Kalv Arnason introduced a note of urgency, warning that Olaf's forces might be smaller but were still fiercely loyal to a fearless leader. Assuredly well aware of the potential consequences of his own disloyalty to his king, he warned of the terrifying revenge Olaf would inflict on those he defeated, urging the bonders to attack as one united army to ensure their victory, and in response they acclaimed Kalv as their commander.
Immediately setting the forces into battle order, Kalv raised his banner and drew up his housecarls with Harek and his retinue beside them. Thore Hund and his troop were placed in front of the banner and at the head of the formation with chosen bands of the best-armed bonders on both sides. The saga describes this central formation of men of the Trondelag and Halogaland as 'long and deep', which would imply that it was formed into a column, while on its right wing was 'another formation' and on the left the men of Rogaland, Hordaland, Sogn and the Fjords stood with a third banner.
At this point the saga introduces Thorstein Knaresmed,9 a sea-trader and master shipwright, sturdy, strong 'and a great man-slayer' who had been drawn to join the bonders' army by fierce enmity to Olaf on account of the great new merchant-ship he had built and which had been taken from him as _wergild_ (the fine for man-slaughter). Now he came to join Thore Hund's company so as to be in the front line of the coming battle and the first to drive a weapon at King Olaf in repayment for his theft of the 'best ship that ever went on a trading voyage'. Quite possibly inspired by the appearance of this vengeful shipbuilder, Kalv Arnason's address to his troops before the march to battle clearly sets out to fire up their lust for vengeance, urging those with injuries to avenge upon the king to place themselves under the banner which was to advance against Olaf's own standard.
Thus the bonders' army came to the field of Stiklestad where Olaf's forces had already taken up their positions, but the plan of immediate attack intended by both sides was delayed. While the king's forces were still awaiting the arrival of Dag Ringsson's contingent, detachments of the bonders' army were lagging some way behind the front ranks and so, as Kalv and Harek were coming within closer view of their enemy, Thore and his company were assigned to marshal the laggardly rearguard and ensure that all would be present and correct when battle began.
The saga has an account – assuredly more formulaic than authentically historical, but perfectly plausible for all that – of verbal exchanges between the principals on both sides when the front ranks of the opposing forces were close enough for individuals to recognise each other. Olaf upbraided Kalv for disloyalty to his king, and to his kin when he had brothers standing with the forces he was about to attack. The tone of Kalv's reply might have been thought to hint at reconciliation, but Finn warned the king of his brother's habit of speaking fairly when he meant ill and then Thorgeir of Quiststad, who had formerly been one of Olaf's lendermen, shouted to the king that he should have such peace as many had earlier suffered at his hands, 'and which you shall now pay for!' The saga endows Olaf's response with the tenor of a prophecy when he shouted a warning back to Thorgeir that fate had not decreed him a victory this day. At this point Thore Hund moved forward with his warriors shouting the battle-cry of 'Forward, forward, bonder men!' and the battle of Stiklestad began.
Olaf's forces countered with their 'Forward, forward, Christ-men! cross-men! king's men!' and the saga interpolates an anecdote, and one not entirely implausible, of confusion caused in the more distant ranks of the bonders' army where some took up their enemy's war-cry and warriors turned on each other imagining that the king's forces were among them. As Dag Ringsson's company was now coming into view, Olaf launched into his battle plan and commanded the opening assault from his position on the higher ground. The sun shone in a clear sky as the headlong charge rolled downhill and drove into the enemy lines with such impact that the bonders' array bent before it. While many in the farther ranks of the bonders were already turning to flee, the lendermen and their housecarls stood firm against an onslaught described by Sigvat as the 'steel-storm raging at Stiklar Stad'. Their stand stemmed the flight of their own reluctant rearguard, who were forced to re-form into a counter-attack which was soon pushing on from all sides, its front line slashing with swords, while those behind them thrust with spears and all the ranks in the rear shot arrows, cast throwing-spears and hand-axes, or let fly with stones and sharpened stakes.
This was the murderous hand-to-hand combat which marked the crucial phase of battle. Many were falling now on both sides and the lines in front of Olaf's shield-rampart were steadily growing thin when the king commanded his banner to be brought forward. Thord Folason the standard-bearer advanced and Olaf himself followed, emerging from the shield-rampart and leading those warriors he had chosen as the best-armed and most accomplished to stand with him in battle. Sigvat's verses tell of bonders rearing back in awe at the sight of the king's entry into the fray, although one who remained undeterred was the aforementioned Thorgeir of Quiststad, at least until Olaf's sword slashed across his face, cutting the nose-piece of his helmet and cleaving his head down below the eyes. 'Did I not speak true, Thorgeir, when I warned that you would not be the victor at our meeting?'
Thord the standard-bearer drove his banner-pole so deep into the earth that it remained standing there even when he himself had been dealt his death-wound and fell beneath it. There also fell two of Olaf's skalds, first Thorfinn Mudr and after him Gissur Gulbraaskald who was attacked by two warriors, one of whom he slew and the other wounded before he himself was slain. At around this same time Dag Ringsson arrived on the field, raising his banner and setting his troops into array, yet finding the light becoming so poor that he could hardly make out the men of Hordaland and Rogaland who were facing him on the left wing of the bonders' army.
The cause of this sudden darkening of what had been a bright summer sky only shortly before was an eclipse of the sun which is reliably recorded for the summer of 1030, but which raises its own point of difficulty as to the precise date of the battle. Snorri Sturluson firmly assigns the death of Olaf to the 'fourth kalends of August' or 29 July in modern reckoning, and so too does Theodoric the Monk in his _Historia_. The Feast of St Olaf in commemoration of the day of his martyrdom is entered in the church calendars at that same date, and yet the total eclipse – which would certainly have been visible from Stiklestad in the year 1030 – actually occurred on 31 August.
There are really only two possible explanations, of which the first is that the battle was fought in July and the eclipse merely a fictional accretion inspired by the actual phenomenon which occurred a month later. Yet the tradition of the eclipse taking place while the battle was in progress must be almost immediately contemporary when it is described in Sigvat's verses on the battle composed within very recent memory of the event. No less significant is the impressive correspondence between the timings recorded in the saga – which record the armies meeting near midday, the battle beginning in early afternoon and the king slain at three o'clock – and those calculated for the historical eclipse of August which would have begun at 1.40 p.m., become total at 2.53, and was over by four in the afternoon.
All of which might suggest the alternative explanation – which proposes 31 August as the true date of the battle and construes 29 July as a misreckoning – being the more likely; and that same likelihood is convincingly developed by the editor of a long-respected English translation of _Olaf the Saint's saga_ ,10 who suggests the discrepancy may have derived from misinterpretation of an original text which would probably have given the date in a customary medieval form as '1029 years and two hundred and nine days since Christ's birth'. Reckoning in 'long hundreds' (as 249 days) from 25 December would actually give a date of 31 August, while reckoning in 'continental' hundreds (or 209 days) from 1 January would give the date of 29 July which is found in Theodoric's _Historia_ and Snorri's _Heimskringla_. The prime significance of the eclipse in the saga, as it is also in Sigvat's verse referring to the same phenomenon, is its ominous portent, perhaps even making an implied allusion to Christ's crucifixion, because it is at just this point that Olaf is about to meet his martyrdom.
In fact, the saga narrative itself reads as if abruptly distracted from Dag's entry into the battle when it suddenly turns to identify the warriors who were at that moment closing with the king on the field. Kalv Arnason stood with two of his kinsmen, one of them also called Kalv (yet more precisely identified as Kalv Arnfinsson, and thus as Kalv Arnason's cousin), while on his other side stood Thore Hund, clad in a reindeer-skin coat he had brought back from a trading voyage to Lapland and believed to have been rendered as weapon-proof as ring-mail by the witchcraft of the Lapps. This is clearly a reference to legend, and yet to one of closely contemporary provenance when Sigvat's verses on the battle tell how 'the mighty magic of the Finns sheltered Thore from maim'.11
It was Thore with whom Olaf first engaged when he hewed at shoulders protected by reindeer skin and found that his famously sharp sword had no effect. Turning to Bjorn his marshal, Olaf commanded him to 'strike the dog whom steel will not bite', but a great blow from Bjorn's axe similarly bounced off the magic hide and allowed Thore to retaliate with a spear-thrust which killed the marshal outright, proclaiming that 'this is how we hunt the bear'. It is, of course, quite characteristic of the Norse heroic tradition to engage in such name-play at the very edge of a death-dealing combat, and just such is reflected in Snorri's narrative before it moves on to the specific detail of Olaf's martyrdom.
Having slain one of Kalv Arnason's kinsmen, Olaf next found himself facing Thorstein Knaresmed who struck with his axe to wound the king in the left thigh. Finn Arnason retaliated by slaying the shipwright, as Olaf staggered to support himself against a rock, dropping his sword as Thore Hund made another spear-thrust beneath the king's mail-coat to wound him in the stomach and Kalv inflicted a third wound, this to the left side of his neck. While Snorri's narrative confirms that 'those three wounds were King Olaf's death', he goes on to say that not all are agreed as to which of the two Kalvs delivered the wound to the neck. Theodoric the Monk's _Historia_ , set down a century and a half after the event, tells of men still disagreed as to the number of wounds suffered by Olaf as well as the identity of those who dealt them, but there is evidence found in the saga record to confirm both Olaf's son Magnus and half-brother Harald having reason to believe Kalv Arnason guilty. Perhaps most convincing of all is a story stamped with impressive authority – although preserved only in _Orkneyinga saga_ – which tells of Kalv himself having 'repented of his crime of killing King Olaf the Saint' when confronted by Rognvald Brusason in Russia five years after the battle.
Meanwhile, there is more to be told of events on the field of Stiklestad in the immediate aftermath of the king's death because, while the greater part of the force which had advanced with him fell with him also, Dag Ringsson is said to have kept up the battle with a fierce assault in which many bonders and lendermen fell and from which many others fled. This onset was apparently well remembered in tradition as 'Dag's Storm', a byname which was to have the strangest echo in another battle fought thirty-six years later. Eventually, though, Dag Ringsson's force was confronted by the greater strength of the bonders' army with Kalv Arnason, Harek of Thjotta and Thore Hund in the forefront, and was so hopelessly overwhelmed by superior numbers that he and his surviving warriors were left with no course other than flight.
It may have been at this point – or, perhaps more probably, somewhat earlier – that the young Harald Sigurdsson escaped what must by now have been a scene of fearsome carnage. Whether he had been with the Upplanders or within the king's _skjaldborg_ , he would almost certainly have been drawn into the forces gathered around Olaf's entry into the blood-fray. When Olaf's sword is said to have been retrieved by a Swede who had lost his own weapon, it would appear that all three divisions of the initial battle order had come together around the king's retinue when he emerged from his shield-rampart.
One who would assuredly have been found among the select company who formed Olaf's bodyguard was the Orkneyman Rognvald Brusason. Through the years since his first arrival as a ten-year-old boy at the Norwegian court, he had grown into a formidable warrior who had demonstrated unswerving loyalty to the king, travelling with him to Russia and back to Scandinavia on the grim progress which led to Stiklestad.
The most comprehensive account of Rognvald's life and career is preserved in the work now known as _Orkneyinga_ saga and subtitled as 'a history of the jarls of Orkney'. Completed in Iceland in 1234/5, it is effectively the updated version of an earlier text, usually referred to by the title _Jarls' saga_ , also the work of an Icelander and set down in the last years of the twelfth century. It was this _Jarls' saga_ which was known to Snorri Sturluson, providing his chief source of information on Rognvald Brusason (who was himself to become one of the most celebrated Orkney jarls after 1037), and thus representing one of the two principal sources for the opening chapter of his _Harald's saga_ in _Heimskringla_ , which begins with Rognvald's rescue of the young Harald from the carnage of Stiklestad. The other, and elder, of those sources was a strophe quoted by Snorri in the saga where it is attributed to Thjodolf Arnorsson, the skald authoritatively recognised as Harald's 'favourite poet . . . who spent many years in his company'.12
Thus when Thjodolf's verse bearing on Stiklestad opens with the line 'I have heard how the shield-storm raged near to Haug [a farm in Værdal]', the likelihood is of his having heard all of this from Harald himself and so, even though the verses were composed at least sixteen years after the event, they can be considered to represent the most reliably informed evidence. In fact, it would seem to have been from Thjodolf's reference in that same verse to 'fifteen years a youth then' that the saga (and the subsequent historical record) came to know of Harald's precise age in the year 1030.
It was not from Thjodolf, however, but from _Jarls' saga_ that Snorri appears to have learned of Harald's being 'severely wounded' in the battle and, although no source confides any such detail, he most probably suffered his injury in the maelstrom which would have undoubtedly followed the death of Olaf. As in many similar conflicts of that world and time, the death of a principal warlord was of decisive bearing on the outcome as the signal of defeat for his forces, and so it would have been at Stiklestad when such as remained of Olaf's battle array crumbled and the survivors who were able to do so took flight from the field. Among those fugitives was Rognvald Brusason and with him the wounded Harald Sigurdsson whom 'he had rescued from the battle' (and who may well not otherwise have survived the fray).
Apparently so badly injured as to be unable to travel any greater distance, Harald was led by Rognvald to the steading of a farmer who lived in a remote part of the forest. On this particular point of detail, the evidence of _Jarls' saga_ is confirmed by Thjodolf's reference to Harald as 'fifteen years a youth then . . . hiding beyond the woods'. There he could be cared for in safety until his wounds were healed and he was sufficiently recovered to cross the Kjolen mountains into Jamtaland and on into Sweden where Rognvald was awaiting him. When the time came to set out on that journey, Harald avoided more usually travelled paths and made his way along forest trails guided by the farmer's son who (according to Snorri's account and, apparently, no other) was unaware of the identity of his charge.
It was while they were riding through the wild woodland that Harald is said to have spoken the verse attributed to him by Snorri and by _Orkneyinga saga_ :
Through endless woods I crawl
on my way now, with little honour.
Who knows but that my name may
yet be far and wide renowned.
## II
## _Varangian_
## Russia, 1031–1034
The Baltic was known as _Bahr Varank_ , or the 'Varangian Sea', to the authors of the tenth-century Arab writings which preserve some of the most colourful accounts of early medieval Russia. These sources were informed by traders and travellers among the Rus on the Volga and so their use of an Arabic form of 'Varangian' (which occurs as _Væringjar_ in Old Norse and _Varjazi_ in Slavonic) supplies its own testimony for the term having emerged in Russia, yet the word itself is of Scandinavian derivation and believed to stem from the Old Norse terms _vár_ ('oath') or _várar_ ('trust'). The original meaning of 'Varangians', then, could be proposed as 'men who pledge each other loyalty', probably a group bound together by some form of oath along the lines of 'all for one, one for all'.
Used in that sense, it is a name which would certainly have befitted the Scandinavian venturers – travelling in companies on the principle of 'safety in numbers' and sworn to mutual defence and protection of their selves, their craft and their cargoes – who had been crossing the Baltic since at least as early as the eighth century to penetrate the Russian river system along which furs from northern forests were to be traded for silver from the east. Before the mid-point of the following century, the kith and kin of these warrior-traders were recognised as the _Rus_ and as men of power in the north of the land later to be named for them.
By the tenth century, and alike to their compatriots elsewhere in the Scandinavian expansion from the Hebrides to Normandy, these Rus had absorbed much of the culture and custom of neighbouring peoples whom they encountered along the east-way, and most evidently in their adoption of the Slavonic tongue. It may well be this new cultural identity which is reflected in a new application of the term 'Varangian' as a generic name for northmen (similar to the modern usage of the term 'Viking'), in which sense it probably served to distinguish themselves from their Scandinavian cousins. At the same time, however, the occurrence of the term in the documentary record is almost invariably associated with warfare, and it is this usage which points to the later – and ultimately enduring – definition of Varangian as 'mercenary warrior of Scandinavian origin'.
The history of the first centuries of the Rus, as recorded in the annals begun in the eleventh century and most usually known in English as the _Russian Primary Chronicle_ ,1 represents a catalogue of almost incessant warfare, in establishment of lordship over subject peoples, contention with predatory neighbours or internecine conflict between rival siblings of the ruling Rurikid kindred. For reasons which will bear further consideration here, Rus princes of the tenth and eleventh centuries were greatly dependent upon the services of mercenary fighting-men, of whom the most renowned were Scandinavians brought across the 'Varangian Sea'. Just such were the fugitive survivors from the Norwegian king Olaf's forces at the battle of Stiklestad who crossed the Baltic to Russia from Sweden in the summer of 1031, led by the Orkneyman Rognvald Brusason and including in their company Olaf's half-brother, Harald Sigurdsson.
Having begun _Harald's saga_ in _Heimskringla_ with Rognvald Brusason's rescue of the young warrior from the field of Stiklestad, Snorri Sturluson goes on to tell how Harald crossed over into Sweden – possibly later in 1030, but more probably in the following spring – to join Rognvald and other survivors of Olaf's defeated army on their passage across the Baltic. It must be said, though, that Snorri's scant account of Harald's warrior's way through Russia does not represent the most convincing example of saga as historical record. Indeed, its value as a source of history rests almost entirely upon its quotation of two strophes from Harald's court-poets, so it is fortunate that Snorri's evidence can be supplemented by reference to other sources in order to attempt a reconstruction of three or four years which were to prove of key significance in the military education of a future warrior king.
Snorri's account simply tells of Harald's finding his way to meet Rognvald and others of Olaf's warriors in Sweden and of their having assembled ships in the spring before sailing east to Russia in the summer. There he and Rognvald were welcomed by the Grand Prince Jaroslav who appointed Harald to share command of his 'forces for defence of the country' with Eilif, son of Rognvald Ulfsson, the former jarl of Gautland in Sweden who had been endowed with lordship of Staraja Ladoga after escorting Jaroslav's Swedish bride to Russia. The suggestion that a Rus grand prince would delegate even joint command of his military to a Norwegian princeling scarcely sixteen years of age and on such brief acquaintance is itself unconvincing, but set into the military and political context of Jaroslav's Russia in the early 1030s it lies entirely beyond the bounds of plausibility.
First of all, there was no national military force in early medieval Russia where the only semblance of a standing army was the _druzhina_ , effectively the military retinue of a prince or lordly magnate and originally intended as his military escort for protection and enforcement on tribute-gathering expeditions. Although references in the _Primary Chronicle_ most often indicate its strength at around the hundred mark, the size of a _druzhina_ varied according to the wealth and status of its lord and ranged between a quarter and twice that number. However impressively armed and equipped, such a force could not have amounted to a realistic field army for a major campaign without substantial reinforcement and it was always preferable to expend the lives of lesser troops in action than to place the _druzhina_ at unnecessary risk.
While there is one example of a Rus prince supplementing his forces with those of a foreign ally in the early eleventh century, other sources of auxiliary manpower are more frequently indicated by the historical record. Such were to be found in tribal levies, known as _voi_ , which were being superseded by militias raised in urban centres that had grown up in size and importance from the fortified trading-posts established by the earlier warrior-traders along Russian river routes. The origin of these urban militias lay in the need for defence of towns while the lord's _druzhina_ was away, sometimes for months at a time, on expeditions conducted over the vast distances which posed the major logistical problem of warfaring among the Rus. It could often also present difficulties in recruiting militias for longer range campaigning when their principal concern was always for the security of their own territory, but so too could other factors. Urban militias were able to draw upon surrounding rural areas for additional manpower and thus field a force numbering in the few thousands, but their co-operation still depended upon the loyalty owed to their lord by independent-minded townsfolk who still expected payment (even, if needs be, in the form of plunder) for their services.
Of perhaps more crucial bearing is the fact that neither urban militias nor tribal levies were possessed of the same mettle and morale as was the truly professional fighting-man. For military of that quality, the Rus warlord would invariably turn to the mercenary forces who represented his other source of reinforcement – and for Jaroslav, as for his father Vladimir before him, mercenaries invariably meant Varangians. There is little doubt that Vladimir, returning to Russia from exile in Scandinavia in the 970s, owed his initial seizure of power from his brothers to the mercenary fighting-men he had brought with him, but his greatest contribution to the history of the Varangians rests on the sturdy shoulders of the six thousand warriors he sent to the aid of the Byzantine emperor Basil II, for whom they were to form the nucleus of the famous Varangian Guard of Byzantium. The same enthusiasm was evidently shared by Vladimir's son and eventual successor Jaroslav, whose deployment of Varangians is noticed on no less than six significant occasions by the _Primary Chronicle_ and whose reign is said by a highly respected history of the period to have seen 'both a flowering and a fading, though not a complete withering of the special relationship between the Varangians and the Rus princes'.2 Nonetheless, both Vladimir and Jaroslav are more often remembered in the sagas for their tardiness, and even parsimony, when payment was due. The Varangians were of undoubted, even incomparable, value in the heat of the action and would always be the first choice of their Russian employers (as also of the Byzantines) for the most unsavoury duties, but in the last analysis the mercenary was only the hired hand of warfaring, never held in the same regard as the _druzhina_ and all too often a problem when the wineskins were opened after the fighting was done.
When the great Vladimir – revered for his conversion of the Rus to Christianity and creation of the Russian Orthodox Church – died at Kiev in the summer of 1015, Jaroslav was away in the north at Novgorod, which would seem always to have been his preferred power base. He had been endowed with the lordship of Novgorod by his father, but relations between the two had soured and Jaroslav felt himself so greatly under threat from Vladimir that he is said by the _Primary Chronicle_ to have 'sent across the sea and brought Varangians' to bolster his forces early in 1015. In the event, he would have need of those Varangians, but against a sinister sibling instead of an angry father because his ambitious half-brother Sviatopolk had moved with speed to seize Kiev as soon as Vladimir was dead. Known in Russian tradition as 'the Accursed', not least because his Byzantine mother had formerly been a nun and even his true paternity was in doubt, Sviatopolk is said to have bribed the people of Kiev to accept his succession and thereafter arranged the assassination of two of Vladimir's other sons, Boris and Gleb, who were soon to follow their father into the growing Russian calendar of saints.
Another son was killed while attempting to flee into Hungary, but the approach of autumn presented Sviatopolk with his most formidable rival in the form of Jaroslav advancing south towards the Dnieper with his Novgorod militia and a thousand Varangian mercenaries. Meanwhile, Sviatopolk had recruited his own mercenary auxiliaries from the Pechenegs, a Turkic people who represented a fearsome military presence, alternately as mercenaries for hire or as predatory raiders, in the steppe country extending into southern Russia from the north shores of the Black Sea. When Jaroslav's forces reached Liubech on the west bank of the Dnieper some 90 miles north of Kiev, Sviatopolk's host was ranged along the eastern bank. For three months the opposing armies faced each other across the river, until Jaroslav contrived to isolate Sviatopolk's _druzhina_ from their Pechenegs and trap them on a thinly frozen lake where the breaking ice ensured their destruction.
Jaroslav entered Kiev in triumph and Sviatopolk fled west into Poland to find refuge with his wife's father, the Polish king Boleslaw. He returned to Russia in 1018, bringing with him a Polish army led by his father-in-law and reinforced with German, Hungarian and Pecheneg mercenary contingents which met and defeated Jaroslav's force of Varangians and militias of Kiev and Novgorod in the contested border zone along the western Bug river. Now it was Sviatopolk who advanced on Kiev while Jaroslav took flight north to Novgorod. But the real victor was almost certainly Boleslaw who paid off his mercenary forces with the plundering of Kiev before making his own departure back to Poland, and taking possession of the Cherven border towns en route.
Meanwhile, Jaroslav was back in Novgorod and levying new taxation to pay for more Varangians to renew his offensive. Left vulnerable without his Polish allies, Sviatopolk was likewise engaged in the south and still trying to recruit fresh forces of Pecheneg mercenaries even while Jaroslav was advancing again on Kiev in the spring of 1019. The last battle between the two was fought beside the River Alta not far from Kiev where Jaroslav won a great victory and Sviatopolk again took flight, although he is said to have fallen ill and died before reaching Poland. Having regained the ascendancy, Jaroslav was still not yet secure because another of the numerous sons of Vladimir was about to mount his own challenge.
This was Mstislav whose power base lay at Tmutorokan where he had carved out his own impressive dominion in the south-east around the Sea of Azov. Perhaps tempted towards the Dnieper by Jaroslav's evident preference for Novgorod, Mstislav moved north of the steppe sometime around 1024 and based himself at Chernigov within striking distance of Kiev. Once again, according to the _Primary Chronicle_ , Jaroslav 'sent across the sea for Varangians' to face Mstislav's 'Kasogians and Khazars' recruited from his subject peoples around the Sea of Azov and supplemented with Severians (Slav auxiliaries, presumably from Chernigov). These Severians would seem to have played the greater part in defeating Jaroslav's northmen in an extraordinary battle fought at night in a thunderstorm at Listven, and Mstislav's exclamation in his hour of victory is a remark of telling military significance: 'Who does not rejoice at this? Here lies slain a Severian and here a Varangian, and yet the _druzhina_ is unharmed!'
After the defeat at Listven, Jaroslav withdrew back to the north and yet, for whatever reason, Mstislav did not pursue his flight from the battlefield, but instead conceded Kiev (whose people had earlier refused him entry) to his brother while retaining Chernigov as his own power base. Relations remained cautious and Jaroslav continued to build up his forces at Novgorod until 1026 when the two met again near Kiev and formally agreed to a division of the lands of the Rus along the line of the Dnieper, those to the east for Mstislav and those to the west for Jaroslav. 'Thus they began to live in peace and brotherhood', according to the _Primary Chronicle_. 'Conflict and tumult ceased and there was tranquillity in the land.' Under that arrangement each brother would have been responsible for defence of his own dominions, although the two did join forces in common cause on at least one occasion, until Mstislav died of sickness sometime around the year 1036 and with no surviving son, leaving Jaroslav as _samovlastets_ ('sole ruler') – and 'Grand Prince' in the full sense, although the Turkic style of _khagan_ (or 'khan') was still in use until the twelfth century – over all the lands of the Rus.
All of which is intended to provide some outline of the Russian political and military context into which Harald Sigurdsson made entry – although assuredly not as commander of defence forces – on his arrival from Scandinavia in the summer of 1031. Dispensing with the account offered at this point in Snorri's _Harald's saga_ , the greater detail found in _Orkneyinga saga_ will provide the more useful starting-point for any attempt at a realistic reconstruction of this particular passage of his warrior's way.
By way of example, one such detail of which Snorri makes no mention is the reference in _Orkneyinga saga_ to Rognvald Brusason and his fellow survivors of Stiklestad making their way to the court of King Onund (presumably at Sigtuna south of Uppsala) on arrival in Sweden and thus it would be reasonable to assume that Harald also made his way to Onund's court, probably by prior arrangement to join them there, when he followed them into Sweden. Having crossed the Baltic to Russia, probably aboard ships provided and provisioned by Onund, _Orkneyinga saga_ describes their going directly to Novgorod where 'King Jaroslav [or _Jarisleif_ in the Norse name-form used in the sagas] welcomed them kindly out of respect for the holy king Olaf'.
It is at this point that the saga introduces the 'Varangian dimension' of Jaroslav's welcome when it specifies that 'all of the Norwegians' joined Jarl Eilif to 'take over the defences of Gardariki'. The interest of _Orkneyinga saga_ in these events centres upon Rognvald Brusason, who was later to succeed his father as jarl of Orkney, and an account of his having remained in Russia while Harald went on to Byzantium. Lines from the skald Arnor Thordsson (usually called _Arnor jarlaskald_ by reason of his service as court-poet to the Orkney jarls) are quoted in support of the saga's claim for Rognvald's fighting ten battles in Russia where he was held in the highest regard by Jaroslav and in whose service he 'defended the country in the summers, but stayed in Novgorod over the winter'.
With the benefit of just those few more precise details, it already becomes possible to elaborate upon Snorri's account of Harald's entry into his career as a Varangian. There is, first of all, a useful geographical indication in the saga reference to Rognvald's company going directly to Novgorod because it points to their ships' having passed through the Gulf of Finland and continued along the waterway to Lake Ladoga where Staraja Ladoga (or _Aldeigjuborg_ in the Norse) represented the most usual port of entry for Scandinavian arrivals in Russia.
Staraja Ladoga had long been a centre of great importance on Russia's Baltic coast, and not least by reason of its proximity to the Finno-Ugrian peoples of the northern forests from whom the Rus obtained the furs they needed for trading along the east-way, initially by way of the Volga to Bulghar, and later down the Dnieper to the lucrative market of Byzantium. Archaeological evidence has identified Staraja Ladoga as the site of the earliest settled Scandinavian presence in Russia, so it must have been one of the very first fortified trading-posts known as _goroda_ (from which term, of course, is derived the Norse name of _Garðar_ ) and, assuredly also by the eleventh century, one of the wealthiest. Indeed, lordship of Ladoga had been the bride-price asked of Jaroslav by Ingigerd when she arrived in Russia for their wedding and, once granted, she immediately conferred it upon Rognvald Ulfsson who had been her escort on the journey from Sweden. Formerly jarl of Gautland, Rognvald thus became 'jarl' (according to the saga, but perhaps more properly styled _boyar_ in this Russian context) of Staraja Ladoga. Rognvald Ulfsson had died at some point during the decade before Harald reached Russia, however, and been succeeded in the lordship by his son Eilif who is already styled _jarl_ in _Orkneyinga saga_ , so when Rognvald Brusason's company sailed on from Ladoga to follow the River Volkhov down to Novgorod (called by its Norse name of _Holmgarð_ in the sagas), Eilif Rognvaldsson probably travelled with them to provide an escort for distinguished visitors to Jaroslav's court.
It is at this point that a cautious reading between the lines of _Orkneyinga saga_ would indicate Harald and Rognvald Brusason having been differently assigned in Russian service. Rognvald, first of all, would already have been known to Jaroslav as a prominent member of King Olaf's retinue in Novgorod just two years earlier and the clear inference from the saga is of his having been recruited to Jaroslav's own _druzhina_ , and not only 'out of respect for the holy king' when he himself was held in high regard on his own account and was to offer such sterling service through the ten 'teeming arrow-storms' recalled by Arnor's verses. Interestingly, Arnor's use of the term 'arrow-storm' might be read in this instance as a more specific reference than a stock skaldic kenning, because Jaroslav's pressing military concern in the mid-1030s was the defence of Kiev and the middle Dnieper against the Pechenegs of the steppe whose characteristic and most feared warrior-type was the mounted archer.
To which should be added a reminder that Rognvald was an Orkneyman, which would have neatly excepted him (but not Harald) from 'all the Norwegians' who were assigned to Eilif 'to take over the defences of Gardariki'. In fact, there is good reason to believe that Eilif would have been in need of Varangian reinforcements in the summer of 1031 because an entry in the _Primary Chronicle_ under the previous year records that 'Jaroslav attacked the Chuds and conquered them'. The Chuds, whose territory lay in what is now Estonia, were one of the numerous Finno-Ugrian tribes of importance to the Rus as the source, either by way of trade or tribute, of the greatly prized furs, so Jaroslav's 'conquest' of the Chuds would have been a campaign to impose or to enforce the rendering of just such tribute.
Presumably by reason of their strange tongue and shamanic culture, these Finno-Ugrian denizens of the northern forests and sub-Arctic tundra were believed by the northmen to be possessed of sinister occult powers, as was evidenced by the weapon-proof reindeer coats Thore Hund acquired from the Lapps to armour himself and his housecarls at Stiklestad. Similar beliefs were apparently shared by the Rus and yet, while these peoples must have first appeared as shadowy hunter-gatherers magically materialising out of the dark forests, some of their kind nonetheless represented a formidable military presence and one which reflected the influence of warrior cultures from the steppes. Indeed, some Finno-Ugrian tribes boasted their own warrior elites, not least among these the Chuds who are known to have been recruited as mercenary auxiliaries by the Rus in Vladimir's time.
There is every likelihood, then, that Jaroslav's campaign of 1030 – whether of initial conquest or in retribution for refusal of tribute already imposed – would have been hard fought against fierce resistance. If only by reason of the proximity of Staraja Ladoga, Eilif's forces would have formed a part of Jaroslav's host, but the further implication of the saga evidence is of Eilif Rognvaldsson as Jaroslav's _voevoda_ in the north, effectively commander-in-chief of all the forces of the principalities of Novgorod and Staraja Ladoga and thus most prominently involved in the campaign against the Chuds. In which case, his Varangians, who invariably bore the heat and burden of such warfaring, may have sustained heavy losses and so Eilif would have welcomed a newly arrived phalanx of battle-hardened Norwegian housecarls to replenish his mercenary forces – and all the more so when Jaroslav would already have been mustering a great army for another war of conquest.
This campaign, entered in the _Primary Chronicle_ under the year 1031, is of key importance here because it represents the one Russian military operation for which there appears to be quite specific evidence of Harald's personal involvement. This evidence is found in lines attributed to Harald's skald Thjodolf and quoted by Snorri which tell of Harald's fighting beside 'Rognvald's son' as they drove hard against the _Læsir_ 'to whom harsh terms were given'. _Læsir_ is the Norse form of _Liasi_ (or _Lyakh_ in the Slavonic) by which is meant the Poles, and so Thjodolf's reference is generally accepted as closely contemporary evidence for the involvement of Harald and Eilif in the invasion of Poland by Jaroslav and Mstislav with a large army which 'ravaged the Polish countryside', according to the _Primary Chronicle_ , and successfully recaptured the Cherven towns seized by Boleslaw in 1018.
Thjodolf's strophe also makes a more puzzling reference to 'both chieftains' (meaning Harald and Eilif) fighting against an enemy it calls the _Austr-Vinðum_ , a people unknown (at least by that name) to any other source and whose identity poses a problem for translators of the saga. The most convincing attempt at translation of _Austr-Vinðum_ is probably as 'East Wends', because the Wends (or _Winida_ in Old High German, which would reasonably correspond to the Norse _Vinðum_ ) were a Slavic people settled in north Germany and familiar to the skalds and saga-makers as an enemy of more than one Scandinavian king of the time, so it is not entirely implausible to imagine that an easterly extension of their eleventh-century settlement could have fallen victim to the ravaging Rus in 1031.
What can be said of the Russian invasion is that it was surely prompted by the anarchy (also noticed in some detail by the _Primary Chronicle_ ) which had convulsed Poland after the death of Boleslaw in the previous year and so offered Jaroslav an ideal opportunity to reclaim the towns which had been a focal point of Russo-Polish contention since their seizure by Vladimir during his westward expansion of the 980s. Indeed, Jaroslav was to take further advantage of Poland's disordered state when he relocated some numbers of Polish prisoners to his own new settlements along the Ros river which formed an extension of Russia's lines of defence against the mounting tide of Pecheneg hostilities – and there is reason to believe that it was in this more southerly theatre of operations that Harald was to spend the later period of his Russian service.
While the date of Harald's arrival in Russia can be securely placed in the summer of 1031 and the date of 1034 is generally accepted by historians for his arrival in Constantinople, the saga record supplies scarcely any indication, and still less detail, of his activities during the intervening three years. Indeed, were it not for the reference to _Læsir_ made by the skald Thjodolf history would have no evidence for his involvement in the Polish campaign of 1031. The other skaldic strophe quoted by Snorri provides even less helpful detail in its fairly formulaic paean of praise for Harald's military accomplishment in Russia and, indeed, would seem to add to the uncertainty with its couplet bearing on the duration of Harald's stay in Russia: 'You were the next, and the next after year, O warlike one, in Gardar.'
In fact, there is a question mark over authorship of this strophe when Snorri ascribes it to Bolverk Arnorsson and the same lines quoted in _Fagrskinna_ are attributed to Valgard of Voll. Less is known of Valgard than of Bolverk, who is thought to have been a brother of the more famous Thjodolf, but both are reliably included in the list of Harald's court-poets and so the historical authority of the lines in no way depends on the precise identity of their author. Their implication for the duration of Harald's stay in Russia would seem to pose a problem, though, because, as Sigfús Blöndal observed in his study of the Varangians, the reference could be taken to mean that Harald spent no more than the two years after Stiklestad in Russia, although neither Snorri nor the _Fagrskinna_ author reads it that way. Indeed, Snorri claims that Harald spent 'several years in Gardariki and made expeditions east of the Baltic', a statement convincingly interpreted by Blöndal as evidence for his being 'employed on the arduous _pólútasvarf_ '.3 By this term _pólútasvarf_ (which will occur again at a crucial point in Harald's Varangian service) is meant the winter round of tribute-gathering from subject peoples conducted by the _druzhina_ , which would have been accompanied by Varangian mercenaries. These expeditions, conducted on horseback and by sled along frozen rivers in the depth of the northern winter, would have been an arduous duty indeed and probably a dangerous one too, when the least welcome could be expected from hosts confronted with the demands of heavily armed representatives of a distant overlord.
As to the dating problem implied by 'the next, and the next after year . . . in Gardar', Blöndal's suggestion that the reference may have applied only to the period of Harald's stay with Eilif in Novgorod would seem to provide the most plausible explanation – and one with further bearing on Harald's Russian service when it makes all the more apparent the liberties taken by Snorri Sturluson with the source material he had drawn from the Orkney _Jarls' saga_. Assuming, of course, that the _Jarls' saga_ account has been accurately preserved in _Orkneyinga saga_ (and there is no reason to think otherwise), then Snorri stands accused of gross exaggeration in his claim for Harald having shared command of Russian forces with Eilif Rognvaldsson. What _Orkneyinga saga_ actually says is that all the Norwegians who had come to Novgorod with Rognvald Brusason joined Eilif's forces, and presumably in the capacity of Varangian mercenaries. Thus their taking over the 'defences of Gardariki' only makes sense if 'Gardariki' is understood to mean Jaroslav's northern dominions centred upon Novgorod, which would also correspond to Eilif's sphere of command as Jaroslav's _voevoda_ but still falls a long way short of responsibility for defence of all the lands of the Rus.
So too, the skaldic reference to Harald fighting beside Eilif – 'in phalanx tight with Rognvald's son' being the literal translation – need mean nothing more than his having been in action with Eilif's forces, even though his personal qualities and royal kinship would have very probably have afforded him a status beyond that of a rank-and-file warrior, even placing him in some capacity of command, if only over the new Norwegian Varangian recruits to whom he would already have been a familiar comrade-in–arms. While Rognvald Brusason was almost certainly admitted to Jaroslav's _druzhina_ , there cannot be said to be any real evidence for Harald's serving in Russia in any other capacity than that of a Varangian mercenary, albeit one recognised for his remarkable qualities even by the Grand Prince Jaroslav himself. A couplet attributed to the skald Thjodolf, although preserved only in _Flateyjarbók_ and not quoted by Snorri, would seem to allude to just this point in Harald's career when it tells how 'Jarisleif saw the way in which the king [Harald] was developing; the fame grew of the holy king's [Olaf's] brother'.
The relationship between Harald and Jaroslav, founded on genuine mutual respect and sustained over more than a decade, was certainly formed before Harald left for Byzantium. His military qualities might even have come to Jaroslav's notice during the Polish campaign, but the skald's reference to his growing fame would seem to suggest a later date for Jaroslav's recognition of the true potential of this unusually ambitious seventeen-year-old Varangian. At some point between his service with Eilif and his departure for Byzantium, Harald had evidently gravitated southward from Novgorod to Kiev which served as the focal point of assembly for Russian trading fleets bound down the Dnieper route to the Black Sea and the beckoning marketplaces of _Grikaland_ (literally the 'land of the Greeks'), as the empire of the Byzantines was known to the northmen.
Kiev's key location along the east-way to Byzantium was the reason for its displacement of Novgorod as the new capital centre of the Rus towards the end of the ninth century. The earlier prominence of Novgorod derived from its proximity to the northern source of furs and its access to the Volga route along which they could be traded for silver from the east. But the progress of the Rus in that direction was so constrained by the might of the Bulgars on the middle Volga and the power of the Khazars (a highly sophisticated people of Turkic origin) along its lower reaches that they were rarely able to venture further south than the great marketplace of Bulghar. So it was that their trade with the Arabs was largely conducted through powerful 'middle men' in an arrangement demanding great outlay of effort in return for suspiciously chiselled profits, whereas the Dnieper route to Constantinople promised direct dealing with the famously wealthy Greeks in a market ever eager for the most exotic and luxurious of merchandise.
The Rus were still northmen in character and culture throughout the ninth century, and so it was only to be expected that their first contact with Byzantium – launched from Novgorod in 860 – was as viking raiders, but the mighty walls of Constantinople (or _Miklagarð_ as it was called in the Norse) and the fire-breathing warships of the imperial fleet had driven off the raid of 860 as they were to do again on occasions through the following two centuries. Trading, rather than raiding, was clearly going to be the safer and more profitable approach to the Greeks, as would be confirmed by the generous trade treaties (of which the texts, terms and names of signatories still survive) made by the Byzantines with the Rus in 907 and 911.
Hence the new importance of Kiev, standing high above the point where the northern riverways flow into the broad stream of the Dnieper and already established not only as a Slav settlement but apparently also as a tribute-collection point for officials of the Khazar khans. The _Primary Chronicle_ tells of the Rus seizure of Kiev during the infancy of Rurik's son Igor – the first reliably historical prince of the Rus and great-grandfather of Jaroslav – but only in the form of folk-tales which would be of little value were it not for the apparent authenticity of its claim that the Slavs, who themselves had only been on the Dnieper since the seventh century, were happy to welcome the Rus as their overlords instead of the displaced Khazars. Indeed, the Slavs were to have a key role in the annual supply of the vessels – called _monoxyla_ and of typically Slav design as a single hollowed-out tree trunk, much like a giant dug-out canoe before it was built up and widened with planking – which formed the merchant fleets for the voyage from Kiev down the Dnieper to the Black Sea and Constantinople. It is unlikely, however, that Harald would have gone directly from Novgorod to Byzantium by way of Kiev in 1034 and much more probable that he had been earlier drawn south by the demand for mercenary forces in the region of the middle Dnieper.
There is evidence in the saga record for the custom of the Rus in Jaroslav's time having been to hire their Varangians on a contractual basis, providing their maintenance over a twelve month period and, upon its completion, rewarding their services either in coin or in kind, usually in the form of furs which had been rendered as tribute or taken as plunder. If such had been the case with Harald and the other Norwegians recruited by Eilif in the summer of 1031, a twelve months' contract would not only have covered their service on the Polish campaign and the winter round of _pólútasvarf_ , but possibly also on the expedition of 1032 from Novgorod to the 'Iron Gates', by which is meant the domain of the Ob-Ugrian tribes in the far north-eastern region of the Pechora river under the Urals. The most remote of all the Finno-Ugrian peoples, these were considered so terrifying that Russian tradition believed them to have been locked behind iron (or copper) gates until the Day of Judgement and, indeed, a similar expedition to the Ob river beyond the Urals disappeared entirely without trace in 1079.
Whether or not Harald and his Varangians were engaged on so daunting an enterprise before their contract expired, they evidently survived the experience to be rewarded with their payment due from the proceeds of tribute collected through the winter. By the later summer of 1032, then, they would have been free to enter mercenary service elsewhere and the most promising opportunity is indicated by the entry under that year in the _Primary Chronicle_ which notices that 'Jaroslav began to found towns along the Ros'. Jaroslav's intended policy of re-settlement of his Polish captives along the Ros river had already been mentioned in the chronicle entry under the previous year and this new entry confirms its implementation.
Something more needs to be said about this, however, because the foundation of townships along the Ros was just one component of a wider policy for defence of the middle Dnieper which had come under increasing pressure from incursions by Pecheneg raiders. These Pechenegs were just one of a long sequence of Turkic-speaking nomad warrior tribes, which had begun with the Huns and was to culminate in the Mongol invasion, who swept westward across the vast swathe of grassland known as the steppe which extended over some five thousand miles of Eurasia from Manchuria in the east to the Hungarian plain.
This steppe provided the natural domain of a people who were constantly on the move, settling only in tent encampments, and whose livelihood depended upon their livestock, cattle and sheep bred for meat, fleece and hide, and most importantly upon the hardy ponies which served as well for following flocks and herds across great distances as for lightning raids upon the more sedentary peoples whose lands were overrun by the nomad warriors. 'We cannot fight them,' replied the Magyars of Hungary to a Byzantine suggestion that they should rise against the Pechenegs, 'because their land is vast, their people are numerous, and they are the devil's brats!' Such, then, was the new presence faced by the Rus in the last decades of the ninth century when, having only recently broken the power of the Khazars to gain control over the trade route to Byzantium, the Pechenegs irrupted on to the steppe north of the Black Sea in their drive towards the fertile plains of Hungary.
Ferocious raiders who fought with lance and spear, sabre and hand-axe, their most characteristic weapon was the composite bow formed of a light wood (or, better still, bamboo) core strengthened with horn and bound with sinew, painstakingly bonded with glues and skilfully shaped into a curved weapon, much smaller than the northern self-bow (such as the traditional English longbow) and yet of equal power, more efficient and perfectly designed to fill every requirement of the mounted archer. Whether as friend, at least of a sort, or more often as foe, the influence of the Pecheneg steppe warrior had a dramatic impact on the character of the Rus, and not exclusively in terms of military practice, although it was probably first apparent in the urgent adoption of cavalry warfare by a people whose ancestors had always fought on foot.
While the first Scandinavian venturers into Russia, who would have crossed the Baltic after the spring thaw, found their ships perfectly suited to a system of rivers up to half a mile wide and linked by overland portages across which clinker-built craft were easily carried or rolled on logs by their crews, they would soon have discovered that the same routes, when hard-frozen through the winter, could serve equally well as thoroughfares between impenetrable forest for warriors travelling on horseback or by horse-drawn sled. Horse travel is one thing, of course, and cavalry warfare quite another, so the Rus on the Dnieper must have lost no time in adapting to the new presence of fighting-men who spent virtually their entire lives, whether at work or at war, in the saddle. The influence of the steppe warrior culture on the Rus becomes most vividly apparent in the second half of the tenth century and in the person of Jaroslav's grandfather, the warlike Sviatoslav of Kiev who inflicted a number of defeats on the Pechenegs and yet is known – most graphically from a first-hand Byzantine account – to have adopted the style and appearance of a steppe khan. Ironically enough, when he had included a Pecheneg contingent (as allies or as mercenaries) in the host he led on his last campaign to the lower Danube, Sviatoslav was making his desolate homeward retreat, following his surrender to the Byzantines, when he was slain by Pechenegs as he passed up the same Dnieper rapids where Rus convoys heavy-laden with goods for Constantinople faced the choice of paying off a Pecheneg ambush or hiring a Varangian escort to fight it off.
By contrast to the devastating sweep of later Mongol hordes, the effectiveness of the Pecheneg incursions lay in repeated raiding until the social order of the afflicted territory collapsed under the unrelenting strain. Such was the character of their campaign against the middle Dnieper where it made agricultural settlement almost impossibly difficult, and to oppose it Sviatoslav's son and eventual successor Vladimir devised a system of earthworks some 3 or 4 metres in height, their interiors reinforced by logs laid parallel to the rampart which was fronted by ditches up to three times as wide.
During the last twenty-five years of his reign, Vladimir erected some 300 miles of these defences, known as the Snake Ramparts, which were raised just too high for a steppe pony to clear at its full speed and so intended to slow down the nomad horsemen, denying them the advantage of a surprise attack and obstructing their line of retreat while Rus warriors came in pursuit. Fortified strongpoints were added to this defensive network, similarly constructed as earthwork with timber reinforcement and built at points along the line of ramparts, some of which were large enough to accommodate a cavalry squadron, which itself attests the new accomplishment of the Rus in mounted warfare. Within this defended region of the middle Dnieper, Vladimir established a number of fortified towns as well as unfortified settlements, all of them peopled with thousands of settlers brought in from subject and conquered tribes such as the Slovenes and the Chuds.
Impressively reassuring as they must have been to the Rus and their settlers, the Snake Ramparts would seem to have offered as much a provocation as a deterrent to the Pechenegs, who considered the Dnieper valley their own summer grazings, so their incursions continued and with a renewed vigour during the wars of succession which followed Vladimir's death. In consequence, and despite his preference for Novgorod and the north, Jaroslav's attention was drawn down to his southern frontier along the Dnieper where he followed his father's example in extending the Snake Ramparts and establishing new townships, such as those along the Ros where he settled prisoners from his Polish conquest. Relocation of prisoners of war, and presumably in some numbers, was a military operation requiring larger forces than the _druzhina_ , who would probably have considered it a duty beneath their dignity anyway. Neither was it a short-term operation, because the newly settled communities would probably need some measure of supervision and no less a measure of armed protection should Pechenegs make an appearance. The solution, as always for Jaroslav, would have been to recruit Varangians and so Harald and his company, not only veterans of the Polish campaign but also experienced in dealing with subject peoples, would have been the ideal choice. To which can be added just one key fragment of evidence and it is supplied by Adam of Bremen, probably Harald's most hostile historian but who can still offer occasional items of information preserved in no other source, such as his reference to Harald having 'fought many battles with the Saracens by sea [in Byzantine service] and the Scythians by land'.
The Scythians were one of the very earliest steppe warrior peoples, although of Iranian rather than Turkic origin, and first recorded north of the Black Sea in the seventh century BC, flourishing thereafter until they were displaced by the Sarmatians three hundred years later. Although there had been no Scythians around for fourteen centuries by the time Adam was writing, the name was still retained in literary currency as a generic term for 'barbarians'. Byzantine writings, for example, are known to refer to Varangians as 'Tauro-Scythians', meaning 'northern barbarians', but in its eleventh-century usage the term 'Scythian' almost invariably meant Pechenegs. Even though it is not entirely beyond possibility that Harald could have encountered Pechenegs during the earlier years of his Byzantine service, he was very much more likely to have done so in Russia on the Dnieper and there, while he would certainly have run the risk of ambush on the way to Byzantium, his greatest likelihood of meeting them in 'many battles' was while engaged on the Ros and the Snake Ramparts.
For all Jaroslav's efforts, the Pecheneg menace remained undiminished through the mid-1030s, coming to its point of crisis in 1036 when the death of Mstislav left something of a hiatus on the middle Dnieper. Jaroslav was in the north and more immediately engaged with the installation of his eldest surviving son, Vladimir, as prince of Novgorod, when a Pecheneg host seized the opportunity to besiege Kiev. In response, 'Jaroslav gathered a large army of Varangians and Slovenes' (according to the _Primary Chronicle_ ) and came south to lift the siege. In a ferocious battle fought into the evening on the fields outside the city he inflicted a crushing defeat which effectively marked the end of the Pecheneg ascendancy because within twenty years they had been driven from the Russian steppe by the next wave of Turkic warrior nomads, a people known to the Rus as Polovtsy and to the Byzantines as Cumans, although they called themselves the Kipchaks.
This triumph over the Pechenegs would have served as a fitting climax to the ten 'arrow-storms' in which Rognvald Brusason is said to have fought so valiantly for Jaroslav, had not the Orkneyman returned with the young prince Magnus who had been invited back to Norway as his father's successor the year before. Neither could the saga-makers include the victory at Kiev among Harald Sigurdsson's Russian battle-honours because by 1036 he had already been some two years in Byzantine service.
It was love for a woman which prompted Harald's departure for Constantinople, at least according to the 'Separate' version of his saga in _Flateyjarbók_ which tells how he was refused the hand in marriage of Jaroslav's daughter Elizaveta until he had won greater wealth and glory. More recent historical opinion casts doubt upon the dating of the _Flateyjarbók_ story, because Elizaveta – who is known in the sagas by her Norse name-form of _Ellisif_ and called 'the bracelet-goddess in Gardar' in Harald's own poetry – was scarcely ten years old in 1034. Nonetheless, the couple were eventually to be married, although not until Harald had returned from Constantinople a full decade later, so there may indeed have been some sort of prior arrangement because Jaroslav evidently made a habit of marrying his daughters to foreign magnates and Harald was, by that time, preparing his return to claim kingship in Norway.
Whatever promises might have been made to him in 1034, the more immediate motive behind Harald's further venture along the east-way was assuredly his great desire (a greed freely admitted in his sagas) for fame and riches which, as he would have heard from others returned from Varangian service in the east, were generously available to a warrior such as he in the land of the Greeks. The promise of such wealth would likewise have been the lure for his comrades-in-arms, because Snorri's _Harald's saga_ tells of his arrival in Constantinople 'with a large following' of fighting-men, which would have comprised his Varangian troop in Russia, probably still including those of Olaf's housecarls who had come to Russia with Rognvald and been recruited alongside Harald into Eilif's forces.
For these men, Harald Sigurdsson would surely have also offered a natural leader and not only by reason of his kinship to Olaf and descent from Harald Fair-hair, because he would by now have been a truly formidable fighting-man in his own right. Harald is well known to have been exceptionally tall (even allowing for exaggeration in the saga estimate of his height at 'five ells' or seven feet six inches). Although he was scarcely nineteen years of age when he left Russia, it is salutary to remember that Cnut had been much the same age when he fought his way to kingship of England in 1015 and, in strictly military terms, Harald was the more widely experienced of the two. He had been just fifteen when he fought at Stiklestad and there is nowhere any indication of his being discouraged by what he had seen there of the realities of warfare, although there can be little doubt that the death of Olaf – which Harald himself may well have witnessed at first-hand – assuredly cut a long, deep scar in his psyche. Both mentally and physically then, he was ideally equipped by nature for the profession of arms and, while his first experience of battle would have corresponded to the expectations instilled by the heroic culture in which he had been raised, a more expansive education – and not only in the way of the warrior – awaited him in Russia.
While the distinctly Scandinavian atmosphere in Novgorod and Ladoga – where, for example, the Norse tongue was to be heard spoken – would not have been so very unfamiliar, he would have been increasingly aware of the advance of Slavic influence on the Rus, and not least in the orbit of Jaroslav's court. Not so much farther afield, he would have encountered the Balt and Finno-Ugrian peoples, while further south – as, for example, on the Polish campaign – Harald was to become much more widely acquainted with the variety of cultures which had already exerted their influence on the Rus, and not least in the military sphere. There is, of course, no way of knowing the extent to which Harald himself was similarly influenced, in particular as regards his weaponry and war-gear, although it was usually characteristic of the mercenary employed abroad to bring his own style of arms and armour with him and afterwards to return home with those of the warriors with whom he had fought. Harald may very well have brought a sword to Russia, but probably little else unless he had been supplied with a helmet and mail-coat at the Swedish court. It is more than likely, of course, that he would have equipped himself with new war-gear among the Rus, where the more fashionable members of a _druzhina_ displayed the influence of both Byzantium and the steppe in their adoption of _lamellar_ armour (formed of upward-overlapping metal, horn or leather plates laced together with leather thongs), in the decorated metalwork of their helmets, or even in their use of the typically Turkic single-edged curved sabre.
Interestingly though, Varangian warriors would seem to have stayed loyal to the ring-mail, the double-edged straight-bladed sword and, most especially, the characteristic battle-axe they had known and used in the northland, so it can be fairly safely assumed that Harald and his troop would have been similarly armed when they left for Byzantine service. The most likely Russian influence would probably have been on their more basic clothing, where straight-legged Scandinavian trousers would long since have been replaced with the baggy Slav style adopted by the Rus, while fur cloaks which had proved their worth in sub-Arctic winters would soon realise a new value in the marketplaces of Grikaland.
As to Harald's choice of route to Byzantium, the version of his saga in _Morkinskinna_ supplies its own unfortunate illustration of the hazards awaiting a saga-maker who misunderstands the evidence he finds in skaldic poetry. Having read Thjodolf's description of Harald's march through 'the land of the _Langbards_ ' and Illugi Bryndælskald's mention of his combat with Franks, the author of the _Morkinskinna_ saga picked up other skaldic references to construct a route which took Harald from Russia, through Wendland in northern Germany, to France and on to Lombardy in the north of Italy before he reached Constantinople. Thjodolf's apparent reference to Wends has already been considered here, but his reference to _Langbardaland_ actually meant the Byzantine province of _Longobardia_ in southern Italy and not Lombardy in the north. Similarly, by _Frakkar_ , or 'Franks', Illugi was referring to the French Norman mercenaries who mutinied from Byzantine forces in Sicily to join a revolt raised against imperial lordship in the south of Italy. Thus neither skald was referring to the route of Harald's journey to Constantinople in 1034, but both were actually celebrating his service with the Varangians of Byzantium in the southern Italian campaign of 1040.
Although no saga source specifically says as much (perhaps because the voyage to Byzantium was considered insufficiently remarkable for the skalds to notice in such detail), it is virtually certain that Harald's way to Constantinople followed the same Dnieper route taken by the Rus merchant fleets which he would have seen being assembled when he looked down from the Snake Ramparts raised to protect the fortified marshalling yard at Vitichev some 28 miles downriver from Kiev. The most thorough description of this Dnieper route is that contained in _De Administrando Imperio_ , a treatise written for the education of his son by the Byzantine emperor Constantine VII in the mid-tenth century, which tells how tribute-collection began in the November of each year and how the furs and slaves thus acquired were brought down the various rivers flowing into the Dnieper around Kiev. There the tribute became the cargo loaded aboard the _monoxyla_ , similarly brought to Kiev where they were sold to the Rus by Slav boat-makers, which formed the merchant fleet setting out downriver in June and bound for the Black Sea.
The one item of closely contemporary evidence for Harald's arrival at Constantinople is found in a strophe by the skald Bolverk which would fully correspond to his having followed the Dnieper route, and yet unmistakably indicates his ships having been of Scandinavian type, possibly including _knorr_ if they were also shipping any quantity of goods for trade, but with warrior crews and rather more dignity than would have attended the barge-like _monoxyla_. Even so, their own craft would still need skill and care in the handling, especially when they reached the notorious stretch of rapids along the lower Dnieper, some of which required crews to climb overboard so as to manhandle their vessels between rocks and others where the cargo had to be unloaded and the boat carried along the bank by its crew while guards kept careful watch for a Pecheneg ambush.
Steppe raiders were still a hazard on the passage through the last of the rapids, fast flowing but also fordable and vulnerable to attack from archers on the overlooking cliffs. Beyond this point and out of danger from predators, the craft could be brought to shore and their crews rested on St Gregory's Island before continuing out into the Black Sea where the course held close to the shoreline until it reached the Danube estuary and there turned southward across open sea to the Bosporus – and it would seem to be this passage which is described by Bolverk in his strophe celebrating Harald's first sight of the Byzantine capital:
Bleak gales lashed prows
hard along the shoreline.
Iron-shielded, our ships
rode proud to harbour.
Of Miklagard, our famous prince
first saw the golden gables.
Many a sea-ship, fine arrayed,
swept toward the high-walled city.
## Byzantine Empire, 1034–1041
At that time, the empire of the Greeks was ruled by Queen Zoe the Great with Michael Katalakos.' Thus Snorri Sturluson begins his account of Harald in Byzantium, and with a sentence which supplies a key item of evidence for the date of his arrival in Constantinople while also introducing two personalities who are attributed particular significance for his subsequent career in imperial service.
The extraordinary Zoe – more properly, of course, styled Empress than 'Queen' – would seem to have figured no less prominently in Varangian tradition than in the formal history of Byzantium. As one of the three daughters of the dissolute emperor Constantine VIII, Zoe was _porphyrogenita_ ('born into the [imperial] purple') and thus empress in her own right, as well as conferring the imperial title upon no fewer than three husbands and ruling jointly, albeit briefly, with her younger sister Theodora.4 In 1002, and while still an attractive young princess, Zoe had been promised in marriage to the Holy Roman Emperor Otto III, but he died before the ceremony could be solemnised and more than a quarter of a century was to pass before the imminent demise of her ailing father made it imperative that a husband be found for her so as to ensure the succession. Consequently, she was almost fifty at the time of her first marriage, in the year 1028, to the elderly Byzantine aristocrat Romanus Argyrus who relinquished his own wife to accept the union only under extreme duress and just in time to become the new emperor Romanus III following the death of his father-in-law on the very day after the wedding. Hardly surprisingly, and despite application of all available medical alchemy, the marriage bed proved barren and was soon deserted by Romanus for that of a mistress. Already humiliated, Zoe was further enraged by being deprived access to the imperial treasury and first vented at least some of her fury on her sister Theodora, whom she despatched to a nunnery in 1031 before she herself fell prey to the sinister ambitions of John the Orphanotrophus.
A eunuch who had risen from modest origins in Paphlagonia on the southern shore of the Black Sea to the prestigious office of director of the capital's principal orphanage, John presented his youngest brother Michael to the embittered empress, who found the handsome teenager so irresistibly attractive that she took him as her lover and the city buzzed with rumours of poisoning when her estranged husband soon afterwards succumbed to an inexplicable illness. Romanus had been found dead in his bath-house only hours before the Patriarch of Constantinople was summoned to the palace at dawn on Good Friday, 12 April in the year 1034, to join the newly widowed empress in marriage to a man almost forty years her junior and to consecrate him as the Emperor Michael IV.
By virtue of that precise record of the date of consecration of a new Byzantine emperor, Snorri's statement that the empire was 'ruled by Zoe the Great and Michael Katalakos' at the time of Harald's arrival in Constantinople firmly places it after the Easter of that year. Incidentally, Snorri's use of the cognomen 'Katalakos' indicates Varangian tradition as his source of information, because Michael IV was formally known as 'the Paphlagonian' and Katalak represents the Norse form of his popular nickname Parapinakes, meaning 'clipper of the coinage' and deriving from his family's trade of silversmith while also making allusion to his own alleged practice of devaluing the currency.
A more specific timing for Harald's appearance in the Byzantine capital might be deduced from what is known of the seasonal organisation of traffic along the Dnieper route. The Rus trading fleets customarily set out from Kiev in June to allow their return from Constantinople before the rivers froze up again in the autumn and also because the water level reached the point best suited for negotiation of the rapids at that time of year. For that reason alone, Harald would quite certainly have chosen the month of June for his own departure. The duration of the voyage from Kiev to Constantinople has been estimated at some ten weeks and so – even allowing for his sea-ships having made a better time on the Black Sea crossing than the more cumbersome _monoxyla_ – Harald would have been unlikely to have reached his destination before August.
In fact, that estimate of his time of arrival would correspond perfectly well to Snorri's placing Harald's first assignment as a Varangian mercenary in Byzantine service in 'that same autumn', but perhaps less convincing is the saga-maker's claim for Harald's presenting himself to Zoe immediately upon his arrival in Constantinople. While it is scarcely likely that a _porphyrogenita_ empress would have made herself available for duty as a receptionist for mercenary recruits, it is perhaps just possible that she might have granted an audience to a warrior prince of distinguished Norse descent and held in high esteem by the Grand Prince of Kiev.
Such would seem to be the only plausible explanation of Snorri's account – and yet the other saga sources suggest a quite different situation when they tell of Harald's attempt to conceal his true identity in Constantinople on account of the Byzantine policy of discouraging high-born recruits in their mercenary forces. For that reason, he is said by _Morkinskinna_ and _Flateyjarbók_ to have entered imperial service under the pseudonym _Nordbrikt_ , which aroused the suspicions of an Icelander in command of a detachment of the Varangian Guard to the point where he tried, albeit unsuccessfully, to discover Harald's real name from Halldor Snorrason. That reference alone would point to Halldor as the original source of the story and might be thought to endorse its authenticity, were it not for a closely contemporary document – known as the _Book of Advice to an Emperor_ and dated to the 1070s – which has no hesitation in confirming Harald's true identity and distinguished kinship having been known to the Byzantines, while also confirming Michael IV as the reigning emperor who received Harald 'with a proper courtesy' upon his arrival in Constantinople.
This account of _Araltes_ (calling him, of course, by his Greek name-form) is considered the most authoritative record of his Byzantine service, and not least because its anonymous author mentions having served alongside Harald in the Bulgarian campaign of 1041, yet it appears to make no reference to his military activities prior to the invasion of Sicily which was launched in 1038. What is known of the earlier years of his Byzantine career, during which he appears to have served as a Varangian mercenary before his promotion to the Varangian Guard proper, derives from the skalds and the saga-makers, whose evidence requires some measure of corroboration by the more formal historical record.
As before in Russia, Snorri is equally impatient in Byzantium to promote Harald to the highest possible level of command, even to that of the 'acknowledged leader of all the Varangians', a statement which closer examination places under some measure of doubt. Whether or not Harald really was welcomed to Constantinople by the emperor or empress, there appears to have been nothing at all unusual about his entry into their service as a Varangian mercenary or in command of the warriors he had brought with him from Russia, who would have formed a unit typical of foreign contingents in the Byzantine armed forces.
The use of foreign fighting-men, under various forms of arrangement, had always been the practice of the Byzantine military and can be recognised as a legacy from the old Roman Empire, of which the new imperium founded upon the ancient Greek city of Byzantium by Constantine the Great in the early fourth century considered itself to be the true successor. This eastern empire, which has long been called 'Byzantine' by historians, was known to the Rus and to the northmen as that of 'the Greeks' (and reasonably so when Greek had replaced Latin as its official language in the early seventh century), yet the Byzantines themselves, almost all of whom were of Greek and Slav ethnicity, still considered themselves 'Romans' (in the Greek form of _Rhomaioi_ ) in Harald's time. Indeed, the _Advice_ tells of 'Araltes, the son of an emperor of Varangia . . . [having] determined to go and pay homage to the most blessed Emperor Michael the Paphlagonian, and to see for himself the ways of the Romans'.
Just as there had been few, if any, Italians in the 'Roman Army' of the western empire through most of its last four hundred years when the greater part of its military comprised fighting-men recruited from the free peoples east of the Rhine, foreign contingents were to make up more than half of the strength of Byzantine forces by the later eleventh century. Even before then, the 'thematic' structure of imperial military organisation, which had first appeared in Asia Minor during the seventh century, had already entered into serious decline. Since the ninth century, the eastern empire had been organised into _themata_ (or 'themes') under military governors usually known as _strategoi_ , each of whom raised his own army corps on the basis of land held in return for military service. Much like the later western European feudal system, this land-holding was passed from father to son and with it the obligation to provide a soldier, either a family member or a proxy, equipped with arms and armour, as well as his own mount when cavalry represented the principal component of Byzantine land forces.
By the eleventh century, these themes had become the increasingly independent provinces of a land-owning aristocracy, where smaller holdings were absorbed into larger estates supplying a diminishing flow of manpower to the thematic armies. In consequence, the _strategoi_ became ever more dependent upon the hire of mercenaries and thus drew in more and more foreign fighting-men to maintain the strength of the forces of the empire: Normans and Italians, Germans and Magyars, Pechenegs and Khazars, Arabs and Slavs, and – most importantly here, of course – Scandinavians who had come from the northlands by way of Russia, thus being known first to the Byzantines as _Tauro-Skuthai_ ('Northern-Scythians') and afterwards as _Rhos_ (the Greek form of Rus) before they acquired their more celebrated name of _Varangoi_ or 'Varangians'. Such mercenaries are on record as early as the reign of Michael III in the 840s and further notices of _Rhos_ serving with imperial forces punctuate the chronicles of the following century, especially after the Russo-Byzantine trade agreements of 907 and 911 which actually include provision for a military levy. A reference to two Rus ships with the imperial fleet sent to Italy in 968 represents an early, if not the earliest, item of evidence for the deployment of Varangians in Byzantine naval operations, and is of particular interest here because Snorri makes specific mention of Harald's first assignment in imperial service having been with the 'fleet in the Greek sea' in the autumn of 1034.
Before investigating that particular passage of his warrior's way in further detail, however, it should be emphasised that all these Varangians – by whatever name they might be called in the Greek sources – represented effectively auxiliary contingents within a larger imperial force and so, while each unit was probably led by one of its own kind, all would have served under the supreme command of a Byzantine general. Indeed, Snorri himself indicates as much when he tells of Harald having 'kept his men together as a separate company' before adding that 'the commander-in-chief of the fleet was a man called _Gyrgir_ '. The same _Gyrgir_ is mentioned in _Fagrskinna_ , where it is explained that this was the Norse name-form of Georgios Maniakes, the outstanding Byzantine general of his time and a figure to whom the sagas attribute a key significance in the course of Harald's Varangian career.
It should be explained that the Varangian mercenaries mentioned thus far were distinct from the 'Varangian Guard' proper, known to the Byzantines as the 'Varangians of the City' and including the emperor's personal bodyguard, which formed its own regiment of the imperial forces based at Constantinople. The longest-standing division of these forces was the _Tagmata_ , which comprised four elite regiments of horse, each under its own commander who was usually styled _domestikos_. Not unlike the Household Cavalry of the British army in more recent centuries, the Tagmata's first duty was to serve the emperor as his lifeguard, whether on campaign or in the capital itself where it also performed a range of ceremonial duties, while an associated infantry regiment known as the _Numeri_ provided a garrison for defence of the city. Naturally enough, the professional soldiery making up these regiments was largely drawn from the Byzantine Greek aristocracy, yet it was just that characteristic of the Tagmata which brought it under suspicion, and not at all unreasonably in the intrigue-ridden climate of Constantinople where its regiments were openly associated with rival political factions. Consequently, the loyalty of the Tagmata was never considered entirely reliable during times of internal political crisis, and a source of more trustworthy lifeguards was offered by the emperor's own foreign mercenary troops, whose loyalty depended upon nothing more complex than the generosity of their paymaster. Some divisions of these forces were assigned duties in the capital much like those of the Tagmata and thus formed a part of the emperor's lifeguard which became known as the _Hetairia_ , of which the best-known component was the Varangian Guard established as a regiment in its own right by Basil II, elder brother of Zoe's father, Constantine VIII.
The eleventh-century Byzantine chronicler Michael Psellus remembers Basil as having been 'well aware of the disloyalty of the Romans' and understandably so because he was just eighteen when he became emperor in 976 and the first dozen years of his reign were plagued by contention with two rival claimants to his imperial crown. That distraction encouraged the ambitious Bulgarian tsar Samuel to extend his dominions at the expense of the Empire and when Basil led an army into Thessaly against him it suffered devastating defeat in a Bulgar ambush at the pass called Trajan's Gate. While Basil would eventually take the ferocious revenge which was to earn him the soubriquet of _Bulgaroctonos_ ('Bulgar-slayer'), he was more immediately concerned with the most dangerous of his rivals, Bardas Phocas, whose forces were already converging on Constantinople in 988. With his own military still crippled by the losses inflicted at Trajan's Gate, Basil turned for assistance to Vladimir of Kiev, who supplied him with the force of 6,000 axe-wielding Scandinavian fighting-men which threw back Bardas and his army in the early weeks of 989 and went on to achieve their total destruction at Abydos on the coast of the Dardanelles some three months later.
By way of return for his generosity, Vladimir requested for himself a Byzantine bride – in the person of Basil's sister, the _porphyrogenita_ Anna – and even agreed to facilitate the union by accepting conversion of himself and his people to the Orthodox faith. Although Basil was in no hurry to arrange the marriage, which was not solemnised until the summer of 989 and only then after Vladimir had increased the pressure by occupying the Byzantine outpost of Cherson on the Black Sea, he was so greatly impressed by the performance of these _Varangoi_ that he formed them into an elite regiment of the Hetairia and the one which was also to provide his own personal bodyguard. So it was that Basil created the celebrated Varangian Guard which was to serve his successor emperors for more than two hundred years until the fall of Constantinople to the Fourth Crusade in 1204.
It is often assumed – sometimes, indeed, actually asserted – that it was this Varangian Guard of which Harald was later to take supreme command. An unsuspecting reading of Snorri's saga might give no less an impression, but it is one emphatically denied by the _Book of Advice to an Emperor_ when it supplies precise detail of the ranks which Harald held as an illustration of how it was both unnecessary and undesirable to promote foreigners, however able they might be, to positions of the highest rank. By way of reward for his service in the Sicilian and Italian campaigns, Harald was first appointed to the rank of _manglavites_ (which reliably confirms his entry into the 'Varangians of the City') and later promoted to that of _spatharokandidatos_ on his return with the emperor from the suppression of the Bulgarian revolt in 1041. While there are references in Byzantine sources to commanders of the Varangian Guard with the title of _Akoluthos_ (or 'Acolyte' in the sense of 'follower', presumably of the emperor himself), the officer in command of the _manglavites_ held the rank of _protospatharios_ , but neither of the two ranks held by Harald approached such seniority. Indeed, their comparatively modest status is unmistakably acknowledged by the author of the _Advice_ when he observes with approval that _Araltes_ 'did not grumble about the titles of _manglavites_ and _spatharokandidatos_ with which he had been honoured'.
In fact, no less an authority than Sigfús Blöndal is of the opinion that 'if he held no higher rank in imperial service, then he is unlikely to have ever held independent command of an army larger than the small force needed to reduce a small fortress or minor township'.5 Just such a 'small force' need not have been so very much larger than the 'five hundred men' said by the _Advice_ to have accompanied Harald on his arrival in Constantinople, although there is no reason to doubt Snorri's claim for new recruits having been attracted to his troop by the growing reputation of its commander, and especially by his well-documented accomplishment in garnering profit by plunder. A mercenary warrior, by definition, fought for financial gain, and there can be little doubt that it was the prospect of great wealth which had brought Harald to the land of the Greeks in the first place – a factor which must never be overlooked in any realistic reconstruction of his military career in Byzantine service.
Having described Harald's arrival in Constantinople, Snorri goes straight on to tell how in the 'same autumn he sailed with some galleys together with the fleet into the Greek sea'. This would seem to have been a customary form of introduction into Varangian service and especially in the early years of the reign of Michael IV when Arab pirates or corsairs ( _kussurum_ in the Norse of the sagas) represented a persistent menace to ship and to shore throughout the eastern orbit of the Mediterranean.
Byzantine annals for the 1030s record a great fleet from Arab-held Sicily and north Africa raiding the islands of the Aegean, the Greek mainland and the shores of Thrace, even taking the town of Myra in Asia Minor before it was overtaken by a naval force, commanded by the _strategos_ of the Cibarrote, which destroyed most of its ships and either butchered or enslaved their crews. The Cibarrote, on the southern coast of Asia Minor, was one of the maritime themes responsible for the upkeep of the 'Fleet of the Themes', which bore much of the responsibility for defence of the Aegean and its surrounding waters against Arab piracy. A similar policing duty was borne by one of the two divisions of the imperial fleet, which was also regularly assigned to naval support of military expeditions (the other division being responsible for transport of the imperial family and defence of the capital).
Foreign mercenaries were often recruited to man the ships of these fleets, many of them being Varangians chosen to begin their service to the Empire in its navy on account of the seafaring and sea-fighting expertise for which the northmen were traditionally renowned. While the capital ships of the fleet (larger vessels known as _dromoi_ ) were manned by a complement more than two hundred strong and equipped with siphons to unleash the devastating incendiary flare known as 'Greek Fire', the Varangians were more usually deployed to crew the lighter, faster and more manoeuvrable craft called _ousiai_ and considered especially effective in pursuit of the similarly speedy lateen-sailed Arab _dhows_. So when Snorri writes of Harald having 'sailed widely around the Greek islands and inflicted heavy damage there upon the corsairs', it would seem virtually certain that he and his company were serving aboard these _ousiai_ , each of which carried a crew of about 110 including 50 or more soldiers. Snorri's reference would also indicate his theatre of operations as the Aegean Sea, although there is a further possibility, which may be implied by the _Advice_ and is certainly suggested by a reference in one of Harald's own verses to sailing 'on the sea of Sicily . . . with a warrior crew'. Unless this refers to his later involvement with Maniakes' invasion in 1038, it could be taken as evidence for Harald's earlier naval service having included an assignment to the auxiliary fleet stationed off the Sicilian coast by Michael IV to safeguard the seaway between Sicily and North Africa.
For all the efforts of his skalds to portray Harald at sea as a free-spirited viking, he and his men would have been subject to the same command structure as other foreign mercenaries engaged on naval service, taking their orders from officers of the Hetairia who reported in their turn to the _strategos_ in command of the Fleet of the Themes or to the admiral directing the operations of an imperial fleet. Nonetheless, the claim made by the skald Bolverk for Harald 'having begun a fight where he wanted to have one' during these early years in Byzantine service might not be entirely without foundation if a superior officer had been sufficiently impressed by Harald's undoubted abilities and rapidly acquired experience to encourage his initiative by allowing him more than usual licence in pursuit of the enemy.
There is also every reason to expect that Harald would have had his own keen financial interest in seeking out and overhauling a well-laden Arab pirate craft, because his saga in _Flateyjarbók_ has a precise note of the profit thereby accrued. Just 100 marks was due to the emperor's coffers for every corsair taken, and once that had been rendered any surplus plunder was kept by Harald and his men. Varangians in naval service were paid less generously than those in the Hetairia, so the entitlement to a share of captured booty must have represented a lucrative source of performance-related pay and one of which Harald would certainly have taken full advantage. Although Snorri has nothing to say about this remunerative aspect of Harald's sea-service, he soon has occasion to tell of the 'hoard of money and gold and treasure of every kind' acquired on the subsequent land campaign in 'the parts of _Affrika_ which the Varangians call _Serkland_ '.
Snorri's source for these references would appear to have been surviving verses by the skald Thjodolf, one of which is actually quoted in the saga, but doubt is cast upon his interpretation of that source material by the absence of any record of a Byzantine expedition to Africa during the reign of Michael IV. When the poetry of the skald represents the most closely contemporary evidence, the disparity between saga account and historical record must be attributed, once again, to a misinterpretation on the part of the saga-maker, which can only derive from the use of the Norse word _Serkir_ (often translated as 'Saracen') as a generic term for Arabs and Arabic-speaking peoples, and likewise to the use of _Serkland_ for any region of the Islamic conquest wherein they might have been encountered.
Snorri had already mentioned the Byzantine general Georgios Maniakes, even implying his involvement with Harald in the action against Arab corsairs in the Greek islands, and yet, while Maniakes was effectively commander-in-chief of Byzantine forces at that time, he was unlikely to have been in immediate command of naval operations. So when Snorri places an anecdote (which will be considered in more detail later) concerning Harald and Maniakes immediately before the chapter bearing on Serkland, it would suggest that Harald and his troop had been brought ashore when the campaign against the corsairs was extended inland to strike at their support bases in Asia Minor, where there was conflict with the Arabs during the early years of Michael's reign and where Georgios Maniakes and the emperor's brother Constantine, _strategos_ of Antioch, were in command of the Byzantine forces.
Having driven the Saracens out of Asia Minor by the end of 1035, the Byzantine campaign pressed on through Armenia and Syria towards the Euphrates and it may well have been that theatre of operations to which Thjodolf referred in his strophe telling of Harald's capture of 'twice-forty towns in Serkland' before he 'bore his war-making to smooth Sicily'. Although the total of 'twice-forty towns' is realistically read only as an approximation – the figure 'eighty' being thought to represent a traditional indication of 'very many' – there is no reason to doubt the placing of these conquests prior to Harald's known involvement in the Sicilian invasion some two years later. Other lines from Thjodolf, preserved in _Flateyjarbók_ and probably known to Snorri, although not quoted in the saga, refer to the 'king of Africa' finding it difficult to guard his people against Harald and these may also allude to the campaign in Serkland or, perhaps more probably, to the Caliph of Tunis whose son commanded the Arab forces encountered in the invasion of Sicily. Another half-strophe of skaldic verse, also preserved in _Flateyjarbók_ and in _Morkinskinna_ , clearly does recall the fighting in Serkland and is worthy of quotation here because it is attributed to Harald himself, although composed in Norway many years after his return from Byzantium.
One other time there was, when I
reddened blades from my homeland;
the sword singing in the Arab town
– and yet that was long ago.
It has thus far been possible to follow the chronology of Snorri Sturluson's _Harald's saga_ in _Heimskringla_ quite closely – as, indeed, was my original intention – but his sequence of events through the next five or six years of Harald's Byzantine career diverges so far from that suggested by more reliable historical record as to require some rearrangement here. Snorri may well have already entangled anecdotes refering to the Sicilian invasion of 1038 with others, similarly derived from Varangian tradition, relating to Harald's earlier activities located by the skalds in the regions they know only as 'Serkland'.
At this point in the saga, however, its narrative enters upon a further series of anecdotal accounts concerning four sieges (only one of which is specifically placed in Sicily) preceded by two episodes refering to Harald's contentious relationship with Georgios Maniakes, which might be assigned either to the Sicilian invasion or the earlier campaigning in Asia Minor. The historicity of almost all these stories is dubious at best, especially when none has the support of any skaldic verses, while some of them can be safely dismissed as apocryphal. There is another chapter, however, which quite clearly derives from court-poetry – two strophes quoted in the saga and both attributed to the sightless skald Stúf Kattason – describing Harald in the Holy Land and thus representing reliable evidence for a genuinely historical Varangian assignment, even though its true character is largely disguised by the aggrandising enthusiasm of the skald and the saga-maker.
The initial difficulty with the saga account is Snorri's placing of Harald's journey to the Holy Land after his return from the Sicilian campaign (which had taken him on into southern Italy in its later phase) and thus in the year 1041, when the more reliable evidence of the _Advice_ places him in Bulgaria with a contingent of the Varangian Guard accompanying the emperor in suppression of the rebellion. The historical record of the turbulent events crammed into these few months would allow only just enough time for Harald's withdrawal from the Sicilio-Italian theatre, his promotion to the rank of _manglavites_ , and his participation in the Bulgarian campaign (all reliably recorded by the author of the _Advice_ ) and would thus entirely exclude the many weeks required for an expedition as far as Jerusalem.
The first of the strophes accredited to Stúf tells of the 'weapon-bold warrior' having journeyed from Grikaland 'Jerusalem-wards' and of Palestine being rendered 'unburned in submission to his hand', while the second tells of his enforcing justice on both sides of the Jordan, having 'made an end of men's treacheries, inflicting sure trouble for proven crime'. Although evidently derived from these verses, Snorri's account is clearly intended to portray Harald in the guise of a pilgrim making generous offerings at the holy places and enshrined relics, its underlying motive probably being to ensure that its hero was not to be outdone by other northern magnates such as Cnut of Denmark and Jarl Thorfinn of Orkney, both of whom made pilgrimages to Jerusalem in the eleventh century. While the skaldic verses can be taken as authoritative evidence for Harald's journey to the Holy Land, it is their reference to his punishment of criminal elements which might be said to supply the vital clue to what really brought him there.
There is, first of all, no question of his having 'conquered' Palestine for the empire, when relations between Constantinople and the Caliphs of Egypt had been remarkably harmonious since 1027, in which year it had been agreed that the emperor Constantine VIII should be allowed to rebuild the church of the Holy Sepulchre. There had been no further progress in that direction through the last year of the ailing Constantine's reign, nor through that of his immediate successor, Romanus Argyrus, until the succession of Moustansir-Billah to the Caliphate in 1035. Perhaps because he was the son of a Byzantine mother, this new caliph was generously tolerant of other faiths and strongly opposed to religious persecution, having already freed many thousands of Christian captives before he signed a thirty-year peace treaty with Michael IV in the following year. Included in this treaty was a renewal of the agreement to permit restoration of the Holy Sepulchre and so architects, masons and other Byzantine craftsmen were immediately despatched to Jerusalem, escorted on their journey by a troop of Varangians entrusted with their protection from attack by desert bandits. While there is every reason for confidence in the ability of formidable Varangian fighting-men to deal with such predators, their deployment on this escort duty is of particular significance because the choice of such elite soldiery would indicate the working party having been accompanied by very high-ranking pilgrims, probably even members of the imperial family, taking advantage of a rare opportunity to visit the holy places.
The most likely imperial personages to undertake such a pilgrimage were the empress Zoe's sisters Eudocia and Theodora, both of whom were nuns at that time, and their eminence alone would have ensured that all the travellers would have been welcomed with open gates at every point along the journey, a reception naturally interpreted by the skald as the willing 'submission' to Harald as he progressed along the same route. All of which corresponds so well to much of the detail encoded in Stúf's verses as to propose the Varangian escort having been none other than Harald and his troop, a possibility – even if no more than that – which would provide the most plausible basis for Snorri's saga account, and might also have some further bearing on Harald's involvement in events in Constantinople some eight years later.
Allowing for Snorri having misplaced the date of Harald's expedition to Jerusalem, his account may still be correct in its claim for Harald having afterwards returned to the capital, particularly if he had made the journey in the capacity of military escort for _porphyrogenita_ pilgrims. All of which might even point to the likelihood of Harald and his troop having already been admitted to the Varangian Guard proper by 1036, quite possibly as a result of their qualities demonstrated on active service in Asia Minor having attracted the attention of the emperor's brother Constantine. In which case, Harald would surely have established himself as a formidable presence in the Varangian ranks by the following year when he and his men were assigned to Georgios Maniakes' forces for the invasion of Sicily – and it is that campaign which offers the most likely setting for the saga accounts of personal contention between two of the most extraordinary soldiers of their time.
Crete had been lost to the Empire two centuries before, following the appearance in the Mediterranean of a fleet carrying 10,000 Muslim warriors who had been first expelled from Andalusia and some years later from Alexandria which they had captured in 818. Once more on the loose in the Middle Sea, they seized Crete, compelling the conversion of its inhabitants to Islam before enslaving them and turning their island into a pirate base for the corsairs who became the terror of the eastern Mediterranean. Within just a couple of years, Saracens had claimed Sicily too, although in this case at the invitation of a Byzantine renegade, a former admiral who rose in revolt after being dismissed from imperial service and sought the support of a North African emir. Thus in 827 a hundred Arab ships were brought to Sicily, the ex-admiral was slain and the island transformed into another, still more vexatious, stronghold of corsairs and forward base for Saracen incursions across the Strait of Messina even to the Dalmatian coast.
The Empire had eventually managed to reclaim Crete in 961, but Sicily remained in Saracen hands. Basil II had been planning its recapture and may well have achieved it had he not died in the year before his fleet was due to sail, so the island remained a threat to the security of Byzantine southern Italy, a plague upon ship-borne trade so important to the imperial economy, and an affront to an empire which still considered itself 'Roman'. Through the decade after Basil's death, however, Saracen Sicily became the battleground for a struggle between its two Arab chieftains, one of whom sought imperial assistance against his brother and rival. In response, the _catepan_ (the local equivalent to the title of _strategos_ elsewhere in the empire) of Italy was sent to Sicily in 1037, but meanwhile the other brother had appealed for help from the Caliph of Tunis who similarly despatched forces under the able command of his son Abdallah-ibn-Muizz, who attracted increasing support and so well outfought the _catepan_ as to force his withdrawal (although in apparently good order) to the Italian mainland. The emperor Michael resolved to try again, and this time with his finest available forces – including 300 Norman mercenaries from Salerno as well as an elite company of Varangians from Constantinople – under the command of his finest general, who was, of course, the afore-mentioned Maniakes.
Said to have been Turkish-born and evidently of lowly origins, Georgios Maniakes was possessed of the physique of a giant and naturally endowed with 'all the attributes of a man born to command . . . a voice of thunder, hands strong enough to shake gates of brass and the scowl upon his face terrible to behold', as recalled by the chronicler Michael Psellus, who knew him personally. For all these qualities, Georgios had climbed only slowly to the peak of command, having started out on his military career as a menial servant – 'among the baggage-men', according to Psellus – but steadily rising through the ranks until he 'attained the highest position open to a soldier'. First emerging as a commander – in the post of _strategos_ of the lesser theme of the Euphrates Cities – during the reign of Romanus Argyrus, he rose to real prominence with his capture of the great city of Edessa on the mid-Euphrates in 1032, and so when the emperor Michael appointed him _strategos_ of Longobardia he would have had every reason to believe Maniakes capable of achieving no less a triumph in Sicily.
This, then, was the _Gyrgir_ who is said by Snorri to have come up against Harald while both were marching overland (although neither the campaign nor its location is specified). The Varangians were the first troops to arrive in the place where it was planned to set up camp for the night and so Harald was able to choose the higher ground, rather than the lower lying marshy land, on which to have his men pitch their tents. When Gyrgir arrived, he immediately ordered their tents taken down so as to make his own camp on the better ground, but Harald refused to comply, insisting on the Varangians' independence of any command other than that of the emperor and empress to whom they had sworn allegiance (a privilege, incidentally, of which there is no known record). An argument between the two was approaching the point of drawn weapons when it was agreed to resolve the matter by the drawing of lots, in which Harald outwitted his superior officer by sleight of hand. Anecdotes based around the same 'triumph by trickery' formula are found so often in Snorri's storytelling – and, indeed, throughout the whole saga literature – that this tale would be considered of dubious authenticity, even if a strikingly similar battle of wills were not to occur in a later passage of this same saga where Harald scores over his nephew Magnus in a dispute over precedence in ship-berthing.
All that is known of the mighty Maniakes, and especially of his merciless mode of military discipline, would put the story itself almost entirely beyond the bounds of credibility, and yet it might still have some genuine basis if it reflects the inevitability of contention between two men possessed of such powerful personalities formed by such dramatically contrasting backgrounds. In the event of such a confrontation, and when Maniakes is said by Psellus to have been so tall that 'men who saw him had to look up as if at the summit of a mountain', it is scarcely likely that any concession would have been made to a young prince, however physically impressive, still in his early twenties and recently arrived out of the north. Indeed, there is much to be said for the trenchant analysis made by Benedikt Benedikz when he suggests that Harald 'as a somewhat undisciplined junior, was rather frequently carpeted by the Chief, and that the smart repartee and spectacular action contained in [the "Separate"] _Harald's saga_ and _Heimskringla_ alike are much-expanded self-justifications, originally told by Harald and blown up by his flatterers'.6
Curiously enough, and especially in view of the prominence accorded him in Snorri's saga, there is no mention of Georgios Maniakes in any surviving skaldic verse, yet the skalds do supply their own further confirmation of Harald's involvement in the invasion of Sicily. Indeed, Valgard of Voll would seem to have been in Harald's company during the later years of his Byzantine service and makes specific reference to the Sicilian campaign when he writes of Harald taking 'a great force south of the broad lands . . . eventually Sicily was depopulated'. So too does Bolverk who would seem to be describing Harald's courageous part in seizing a beach-head for the landing of Maniakes' forces when he tells how 'ships ran to shore and the lord [Harald] fought nobly, winning sand beneath him for a great army in the south of Sicily'.
Just such would have been a fully plausible deployment of Varangians, in view of the renowned Scandinavian accomplishment in seaborne warfare. It is also probable that a troop such as that under Harald's command might have been deployed in the capture of smaller towns or coastal forts (of the type called _riba-t_ , many of which were raised in Arab-held Sicily), although the northmen are not known to have used siege engines on their own account and the earlier record of viking sieges invariably attributes their success to guile. Snorri does not put a name to any of the fortified towns which he claims to have fallen to Harald's Varangians, and neither does he indicate even the approximate whereabouts of three of them, specifically locating only one of the sieges in Sicily, and that the most glaring example of what has been called an 'itinerant folk-tale' (meaning a story long current in various different traditions before its attachment to whichever current hero).
In fact, three of his four siege stories might be recognised as tales of that kind, the first of them telling of a Sicilian town which falls to Harald's forces by means of a firestorm contrived by capturing birds who have flown out of the town's buildings, fixing kindling, wax and sulphur to their tails and setting it alight, so as to return the poor creatures to their roosts as flying firebombs. Not only utterly implausible, the story is also notoriously unoriginal when it was also told of Harald's contemporary, the Norman Robert Guiscard in Sicily, of the Russian princess Olga taking revenge upon a Slav town a hundred years earlier, and of the Danish viking Guthrum at the siege of Cirencester in the century before that.
Indeed, similar stories have been attached to Alexander the Great and Genghis Khan, but Snorri's version probably originated in Armenia where the legend was associated with an emir of Baghdad before finding its way into the currency of Varangian tradition, which has been described by the modern authority Omeljan Pritsak as 'a kind of "hatchery" for old Icelandic storytelling'. Pritsak's essay goes on to explain how 'Constantinople was the meeting place for peoples of different cultures, and the higher milieu of the imperial capital stimulated the soldiers to tell stories in which truth and fantasy could be easily combined'.7
A great many tales from those same wellsprings were brought back to Iceland by returning Varangians and thus passed down to the saga-makers, by which time some number of them had become attached to the heroic legendry accumulating around Harald. Such was assuredly the source of Snorri's tale of the incendiary birds, as it must likewise have been for the story of Harald's faking his own illness and death so as to enable his Varangians to gain entry into another besieged town with his 'funeral' cortege before casting aside the charade and seizing the victory. It is thought likely that Snorri's version of this tale originated in southern Italy, where it was associated with Robert Guiscard's capture of a monastery, before being picked up by Varangian tradition, yet a similar episode is attached to a more ancient hero by Saxo Grammaticus and other examples are found elsewhere in medieval sources, although usually those informed by Norman tradition.
Snorri's third variation on this same theme tells of Harald having a tunnel dug beneath the town under siege, while maintaining an attack on its walls so as to distract the attention of the defending garrison. This ruse is perhaps more plausible than the first two, but the story is scarcely original when it had been widely current since classical times – and if Harald had been engaged in such a tactic, it would surely have involved Byzantine military engineers and been under the direction of a superior officer. Even so, it is perhaps worth noticing that Snorri once again mentions the 'vast hoard of booty' won by Harald's troops after they had burst out of the tunnel to seize the town.
The fourth anecdote making up this quartet of siege stories in the saga is the one taken most seriously by historians and by reason of its involving Harald's companion-in-arms, Halldor Snorrason, who was one of Snorri's own ancestors and thus quite certainly the original source for a tale included in _Heimskringla_ but in no other version of Harald's saga. The story itself is simple enough, telling how Harald's Varangian troop laid siege to the 'largest and strongest, wealthiest and most populous' of the towns they captured and one well defended against assault by a moat surrounding its walls. Harald's ruse in this instance was to send some of his men, apparently unarmed and unconcerned, to engage in games within view of the town walls but beyond the range of the defenders' weapons. This activity continued for some days while the townsfolk mocked them with taunts, eventually becoming so confident as to leave their gates open and thus providing the opportunity for Harald's men to draw the weapons hidden in their cloaks and make a charge into the town. Harald let them lead the assault and yet he himself took longer than expected to follow up with the rest of his force, thus exposing the vanguard – including Halldor and his fellow-Icelander, Ulf Ospaksson, both described by Snorri as 'outstanding warriors and very dear to Harald's heart' – to bear the brunt of fierce fighting. Some Varangians had been killed and many wounded before Harald reached the gates and even as he did so his own standard-bearer was slain. At which point he called upon Halldor to take up the standard, a command which the Icelander refused, accusing Harald of timidity in holding back from the fray. While Snorri offers swift assurance that 'these words were spoken in anger rather than truth', other evidence preserved in the Icelandic sources indicates Halldor's loyalty to his future king having been tempered with a critical cutting-edge and, indeed, other versions of Harald's saga include the same acrimonious exchange with Halldor, but which they otherwise append to the tale of the 'fake funeral' ruse. 'Let the trolls carry the standard for you, you coward' is perhaps the most convincingly idiomatic of these alternative renderings, all of which might be taken to suggest Halldor's response to Harald having been a favourite feature of the storytelling for which he became renowned in Iceland in the years after his return home from the Norwegian court.
Snorri's version of the story tells how Halldor himself was wounded in the fighting, suffering a deep gash to his face which left him marked with 'an ugly scar for the rest of his life' and it seems very likely that his scar might have prompted a variety of tales explaining how it came to be inflicted, each one including his sharp retort to the king as its punch-line. None of which lends especial credibility to Snorri's story of the 'Varangian games', which may even have been contrived for inclusion in the saga as a convenient opportunity to introduce the genuinely historical characters of Halldor and Ulf, both of them reliably identified as sons of prominent Icelandic families, into the narrative of his _Harald's saga_.
There is nowhere any indication of when these two remarkable men first joined Harald's retinue, although it is not impossible that they might have been among those Icelanders who fought in Olaf's army at Stiklestad and afterwards followed Harald to Russia and Byzantium. It is just as likely, though, that they were already employed in Byzantine mercenary service (possibly in company with their fellow-Icelander, Bolli Bollason, whose Varangian career is well-known from _Laxdæla saga_ ) when they joined Harald's troop, perhaps attracted by its reputation for profitable plundering or accepting personal invitations which might well have been offered to fighting-men of the outstanding quality described by Snorri. However and whenever they were first recruited into Harald's company, Halldor and Ulf evidently rose swiftly to become his principal lieutenants by the time of the Sicilian campaign, afterwards accompanying the rise and fall of his career in the Varangians of the City before returning with him to Scandinavia.
While Ulf spent the rest of his life in Norway where he was made a lenderman, and in Harald's service where he held the premier military post of king's marshal (or _stallari_ ), Halldor would seem to have settled uneasily into life at court and chose to go home to Iceland sometime around 1051, bearing with him all the tales of Varangian adventure which were to establish his reputation as a storyteller of outstanding authority. As the favourite son of a famous chieftain of Helgafell, Halldor makes appearances in a number of Icelandic sources, but the most impressive testimonial to his renown as a teller of tales is found in _Morkinskinna_ , where the _Tale of the Story-wise Icelander_ tells of a young man who came to King Harald in Norway where his storytelling kept the court enthralled through all twelve days of Yule. Harald himself was particularly impressed by the performance and so asked the young Icelander where he had learned the story he told. 'It was my custom in Iceland to journey each summer to the _Althing_ and it was there that I learned the story, piece by piece each year, from the telling of Halldor Snorrason.' 'In that case,' said Harald, 'it is little wonder that your knowledge is so excellent, and good fortune will attend you now.'
It should be said, of course, that Halldor's reminiscences are unlikely to have been preserved intact and uncorrupted through almost two hundred years of oral transmission, and even then that they represented only a small proportion of the Varangian lore – assuredly including many even taller tales – which found its way into Icelandic tradition and thus provided Snorri with his reservoir of source material. Consequently, Halldor is not necessarily to be blamed for those occasions when the saga's chronology becomes unhelpfully confused or when its aggrandising enthusiasm bursts the bounds of historical credibility. Nonetheless, such passages from the saga are still of interest when they might reflect something of the feelings of Varangians about their commanders, as appears to be the case in Snorri's chapter which contrasts Harald with Georgios Maniakes in the context of a campaign only loosely identified and yet bearing unmistakable resemblance to aspects of the Sicilian invasion.
Snorri claims that Harald tried always to keep his own men out of the heat of battle when the forces were in action together and yet drove them fiercely against the enemy whenever they were engaged as a separate unit. Thus victories were won when Harald was in sole command and the troops acclaimed him as a better commander than Maniakes, who countered that the Varangians were not giving him their full support and responded to the criticism by ordering Harald to take his men off on their own while he himself remained in command of the rest of the army. When Harald did so, Snorri tells of his taking not only his Varangians, but also a contingent of 'Latin-men', by which must be meant Norman mercenaries, and this reference alone would associate the story with the Sicilian campaign where Byzantine forces did include a Norman contingent, although Snorri's narrative places it earlier, presumably in Asia Minor, and probably conflates tales told of more than one theatre of operations.
Of key significance in Snorri's account is the passage telling of ambitious young soldiers leaving the main army to join Harald's troop when they learned of the greater booty being shared by the men under his command, because the most usual source of contention between Maniakes and his mercenaries in Sicily is known to have been the sharing of plunder. When disputes of this sort are set beside Maniakes' code of iron discipline, it is not difficult to imagine the sort of problems which would have been presented by a contingent of northmen under their own young officer, brimming over with self-confidence and mercenary avarice.
So too, the Normans – who had proudly aristocratic commanders of their own – are known to have clashed with the heavy-handed Georgios over battle-booty in the Sicilian campaign, but one thing of which Maniakes cannot be accused is failure in pursuit of victory. Within two years of campaigning in Sicily, he had reclaimed virtually all the island from a Saracen enemy possessed of superior numbers. The Byzantine army certainly included first-class fighting-men in its Norman and Varangian mercenaries – and likewise in the force of sturdy Armenians led by Katalokon Cecaumenus (who has been suggested as one possible candidate for authorship of the account of Harald in the _Advice_ ) – but others, such as the reluctant Longobard recruits from Apulia, were of lesser quality and so the elite units must have borne the heat and burden of the day in the fiercely fought battles which led to the defeat of the Saracen commander Abdallah at Traina in 1040.
The immediate aftermath of Traina heralded Maniakes' dramatic fall from imperial favour – and entirely as a consequence of his own fearsome temper. He was never going to be well-disposed towards the naval commander assigned to the Sicilian invasion, because the admiral Stephen had been a caulker in the shipyards of Constantinople until his brother-in-law the emperor Michael appointed him to the rank of _patricius_ and to command of the fleet which brought Maniakes' army to the shores of Sicily. Having accomplished that duty, presumably to the best of his modest abilities, Stephen was later held personally responsible for allowing Abdallah to escape by ship to Tunis in the wake of the defeat at Traina. So explosive was Maniakes' rage at this oversight that he actually took a whip to the unfortunate admiral, provoking Stephen's bitter complaint to the emperor accompanied by allegations of treason on the part of the general, charges sufficiently serious to prompt the recall of Maniakes to the capital where he was to spend most of the next two years in prison.
Before his loss of command, Maniakes was to assert his arrogance of power over his subordinates with disastrous consequences, first causing affront by seizing a fine warhorse which had been chosen as his own prize by Arduin, commander of the Longobard contingent, and then by denying the Normans the full share of booty which they believed to be their due. As a result, the Norman mercenaries defected to join the latest rebellion brewing up among imperial subjects in the south of Italy, thus depriving the Byzantine forces of their best mercenary cavalry just as Maniakes was replaced in command by the scarcely comparable admiral Stephen. In the event, Stephen was dead within the year and replaced in his turn by an obscure eunuch known only as Basil who soon managed to lose almost all that had been won in Sicily, leaving Messina as the one remaining imperial possession on the island.
It does seem very likely that the defection of Norman mercenaries who felt themselves to have been short-changed by the overbearing Maniakes might have formed the subject of a story brought back to Iceland – quite possibly by Halldor – and thus found its way into Snorri's saga in the form of his reference to 'Latin-men'. While there is good reason to believe the Varangians having similarly resented Maniakes, there is no question of Harald and his troop having followed the Normans, either in their defection or in their alliance with the Italian rebellion, because it is perfectly clear from the evidence of the skalds alone that when Harald and his troop were despatched to Italy they were fighting against the same Normans who had earlier been their comrades-in-arms in Sicily.
There had been trouble already in Byzantine Italy, where rebels had seized the town of Bari in 1038, and there was still greater trouble ahead through the three decades which it took the Normans to break the last imperial hold on the Italian mainland in 1071. In 1040, however, the empire was still prepared to put down any insurgency in its Italian provinces. Indeed, Bari was retaken in that same year just before a new rebellion broke out in Mottola where it claimed the lives of the catepan and other imperial officials before the rebel leader made his peace and submitted to the emperor. A newly appointed catepan arrived towards the end of the year with the support of a force of Varangians, some of whom must have been assigned to him from the army in Sicily because they included the troop commanded by Harald, who 'led the march in the land of the Longobards' – according to the skald Thjodolf – when a separatist revolt in Apulia had Norman cavalry as its cutting-edge.
Norman mercenaries had first emerged in Italy in 1015, when a band of young pilgrims had been recruited to fight for the Longobards against imperial forces. When word of this new source of demand for fighting-men got back to Normandy, other young warriors looking for action and profit made their way south until a steady tide of Normans was flowing down into Italy. Eventually Norman mercenaries were also to be found in Byzantine forces – being available, as was ever the way of the professional, to fight for whichever paymaster might be recruiting – engaged against the Saracens in Sicily and Pechenegs in the Balkans.
Already in the later 1030s, the sons of Tancred de Hauteville, who himself had been just another knight in the service of the dukes of Normandy, can be recognised as the first representatives of a formidable Italo-Norman dynasty. William (called 'Iron-arm') and his brother Drogo led the Norman contingent with Maniakes in Sicily in 1038, while their more famous brother – the afore-mentioned Robert called _Guiscard_ , or 'the crafty' – was to be appointed by the Pope to new dukedoms of Apulia and Calabria in 1059, as also of Sicily which he first invaded with his younger brother Roger in 1061 and which was finally wrested from the Saracens in 1072.
Only recently mercenaries in imperial service, these Normans now presented the most serious opposition facing Byzantine forces in Italy. It has been suggested that it was their highly effective development of the close-formation cavalry charge which gave the Normans the edge over the Byzantines, 'who hated the solid lines of horsemen with levelled lances',8 and this may well have brought them the victory over superior numbers of imperial troops in the two major battles fought in southern Italy in the spring of 1041. Varangians served with the Byzantine forces in both of these conflicts and are said by the Greek annalists to have suffered heavy losses first at Olivento in April and again in the second battle fought early in the following month at Montemaggiore, where a great part of the catepan's army was drowned in the full flood of the Ofanto river.
The skald Illugi tells of Harald's going early 'to disturb the peace of the Frakkar', by whom can only be meant the Normans, and so it would seem likely that he and his troop would have been engaged in the fighting on at least one of these occasions. Nothing more is known of Harald's part in this Italian campaign, other than that he clearly came out of it alive and with full honour on the evidence of his subsequent promotion to the rank of _manglavites_. His was not the only contingent of Varangians serving in Italy, because others are mentioned by the annals when Harald is known to have been already on campaign with the emperor against the Bulgars, so it is not impossible that he and his troop may have been withdrawn to the capital before the more serious of the defeats inflicted on Byzantine forces in that spring.
Snorri himself has nothing to say of Harald in Bulgaria, because the solitary reference to that campaign found in his saga is a single phrase in a strophe from the skald Thjodolf quoted at the foot of its opening paragraph. Thjodolf's verse is principally concerned with the battle of Stiklestad, although set down many years after the event, and yet refers to Harald as _Bolgara brennir_ or 'burner of the Bulgars', thus supplying the only fragment of skaldic testimony to corroborate the eminently authoritative evidence of the _Advice_ for his part in the emperor Michael's final suppression of the Bulgar rebellion in 1041.
An outline of the background might be helpful at this point, because there has been little reference to Bulgaro–Byzantine relations here since the Bulgarian tsar Samuel destroyed the emperor Basil's army at Trajan's Gate in the year before the foundation of the Varangian Guard. Basil had sworn to take his revenge on the Bulgars for that devastating defeat and, although it took him a full twenty-five years to do so, that vengeance was terrible indeed. Having rebuilt the Byzantine military into a war-machine capable of outfighting the Bulgars in their own rough Balkan terrain, Basil had already reclaimed most of the eastern extent of the peninsula for the empire by 1004. Ten years later, he defeated a Bulgar host in the narrow pass of Cimbalongus north of Serrae and earned himself enduring infamy after the battle when he put out the eyes of 15,000 prisoners, leaving one out of every hundred with the sight of a single eye so as to be able to lead their comrades home. When the tsar Samuel, already a sick man by that time, beheld the return of so many grievously mutilated warriors, he is said to have suffered an apoplexy and died a few days later, yet his people fought on for four more years until finally surrendering to Basil the Bulgar-slayer in 1018.
The name 'Bulgar' derives from the Old Turkic _bulgha_ , meaning 'to mix', and the earliest ancestors of the people who were known by that name in the tenth and eleventh centuries would have been a Turkic steppe tribe akin to the Huns and Pechenegs – as also, indeed, to the later Mongols. That original stock of nomadic warrior-herdsmen had long since been diffused by its passage through the various gene pools of the Balkans, and most influentially those of the Slav pastoralists, by the time of the creation of the 'First Bulgarian Empire' under its tsar Samuel, who was himself of largely Armenian descent. There were, of course, other branches of the same original stock – principally the Volga Bulgars, who adopted the Islamic faith from their Arab trading contacts – but the Bulgar subjects of the Byzantine empire were those settled around Macedonia.
As frighteningly vindictive as he had been after his victory over the Bulgars in battle, Basil was to show a remarkable generosity towards them once they had become imperial subjects, and most particularly in allowing them to pay their taxes in kind rather than in cash, but the same generosity was soon to be discontinued during the reign of Michael IV, especially when the emperor's health had entered into its terminal decline and responsibility for imperial finances had passed to John the Orphanotrophus. Now the great power at the Byzantine court, he was soon to demand taxation rendered in hard currency, thus provoking a tide of hostility among the Bulgars, which only awaited the emergence of some sort of leader before it erupted into full-scale revolt.
Just such a figurehead appeared in 1040 when one Peter Deljan declared himself tsar in Belgrade. This 'Tsar Peter' is sometimes identified as an escaped slave and sometimes as a grandson of the great Samuel, yet he could well have been both because he was possibly a son of Samuel's son and short-lived successor, Gabriel Radomir. His claim would seem to have had some measure of legitimacy, because he was joined in early autumn by an ally in the person of Alusian – presumably Peter's cousin, because he was not only a grandson of Samuel but also a son and younger brother of the last two Bulgarian tsars – who had escaped from house arrest in Constantinople (where he had been held by order of the Orphanotrophus but on an unknown charge) to take his place beside Peter Deljan at the head of the rebellion.
With its joint lords of revolt in place, the Bulgar rising was unleashed against an imperial authority already under pressure from Saracens in Sicily and Normans in southern Italy, so the rebels would seem to have had a head-start for their surge through Macedonia and into northern Greece, where they inflicted a heavy defeat on the garrison at Thebes. The emperor Michael was in his palace at Thessalonika when the rebellion broke out and lost no time in hurrying back to Constantinople to organise his military response – which may well have included the recall of Harald and his troop from Italy and, if so, then in all likelihood on the recommendation of Michael's brother, the general Constantine.
Constantine remained in Thessalonika and held the city when the Bulgars arrived to lay it siege. He was supported by forces apparently drawn from a regiment of the Tagmata, but identified only as the 'Tagma of the Great-hearted', who made a magnificent sortie in the last week of October to win an impressive victory in throwing back the besieging Bulgars, who suffered casualties in the thousands and the rest of their forces put to flight. Nonetheless, the rebels were evidently able to recover and to fight on, because they had driven westward to storm Dyrrachium on the Adriatic coast before the end of the year. In the spring of 1041, however, their prospects were beginning to darken when an impressive imperial army – assuredly now including Harald and his Varangians – was in Thessalonika with the emperor who declared his intention of leading his forces in person.
This was, indeed, an extraordinary announcement because, although still only in his twenties, Michael the Paphlagonian was a chronic invalid obviously nearing the end of his life. He had long suffered from epilepsy, but what Psellus calls his 'internal trouble' had caused him to become bloated to the point of semi-paralysis, his legs hideously swollen and afflicted by gangrene so that every movement must have been a torment. Yet Michael was determined to lead his army on a carefully planned operation, which would have been confident of victory even if the rebel leaders had not fallen out with each other and thus ensured its absolute certainty.
When he was accused of treachery by Deljan, Alusian had struck back with a cook's knife (at least according to Psellus, who describes the whole grisly exchange enacted at a banquet) to put out both of his cousin's eyes and then to slice off his nose. Now in full command of the rebels, Alusian led them against the Byzantine army but with so little success that he had to flee into hiding when their onset was thrown back. Presumably recognising the inevitability of total defeat, Alusian entered into his own secret negotiations with the emperor, offering surrender in exchange for restoration of such honours as were due to him and to his family. When these conditions were accepted, Alusian proceeded with a pre-agreed charade of advancing his horsemen once more towards the enemy before suddenly abandoning them in a theatrical rush to throw himself upon the emperor's mercy. While he was granted a full pardon and returned to Constantinople, the Bulgar host persisted in its dogged resistance, now with the mutilated Deljan at its head and refusing to surrender until it was finally crushed by the emperor's army at the battle of Prilep.
When the skald Thjodolf makes mention of Harald having fought 'eighteen fierce battles' before his return to Norway, it is reasonable to assume that these would have been the major engagements in which he saw action as a Varangian mercenary in the service of Michael IV. So too, when Thjodolf's description of his king as 'burner of the Bulgars' is set beside the reference made by the author of the _Advice_ to 'the revolt of Delianos in Bulgaria [where] Araltes went on campaign with the emperor, with his own troops, and demonstrated deeds against the foe worthy of his birth and nobility', Harald was quite certainly involved in this later phase of the Bulgarian war and (if Thjodolf's words might be taken literally) possibly deployed on a firebrand-wielding intimidation of the rebel heartland.
What can also be said with certainty is that this campaign was to be his last in imperial service – leading on to the probability of the battle at Prilep having been the last that he fought as a Varangian mercenary. Once again though, Harald clearly served the emperor with sufficient distinction to merit promotion, and this time to the rank of _spatharokandidatos_ when he accompanied Michael's triumphal return to the capital.
## _Constantinople, 1041–1042_
Probably the most extraordinary aspect of the Varangian Guard is the fact of the personal protection of the _Basileus_ (as the Byzantine emperor was formally styled in Greek), who was 'held to be the sole legitimate sovereign of the Christian world' and represented as 'the earthly counterpart and vice-regent of the Christ Pantokrator',9 having been entrusted to fighting-men out of the remote northland whose two best-known characteristics were their mighty battle-axes and notorious appetite for alcohol. Customarily referred to in the Greek annals as 'the axe-bearing Guard' – and on one occasion by a contemporary observer as the 'Emperor's wine-bags' – at least there is some reflection of ceremonial dignity encoded in the Greek titles bestowed on the various ranks of the Varangians of the City.
The title of _manglavites_ , for example, had its origin in _manglavion_ , the name given to a short whip borne by officers of the Hetairia preceding the emperor in procession and used by them to clear the way for the progress of the imperial party. Although thought to be largely honorary in Harald's time, the rank of _manglavites_ still carried with it the privilege of wearing a gold-hilted sword, such as that described in _Laxdæla saga_ when Bolli Bollason returns home from his service in the palace guard with his sword 'now inlaid with gold at the top and shank and with gold bands wound around the hilt'. This reference is of particular interest because it confirms an officer of the Varangian Guard having used gold decoration on his own sword (in some cases a valued heirloom and given its own name, as in the case of Bolli's 'Leg-Biter'), while Michael Psellus describes a quite different weapon, 'a single-edged sword of heavy iron' known as the _rhomphaia_ , which was 'slung from the right shoulder' of every palace guardsman. This must have been a dress sword and thus quite distinct from the double-edged blade of the traditional northern type which accompanied the spear (of a heavier type than that found in the Byzantine armoury) and, of course, the famous two-handed axe to make up the more typical complement of Varangian battle-weaponry.
Nonetheless, a ceremonial association with sword-bearing is clearly indicated by the _spatharo_ \- prefix found in the titles applied to ranks such as that of _spatharokandidatos_ , to which Harald was promoted on his return from Bulgaria, and likewise that of the superior _protospatharios_ , both of these having their origin in an earlier Hetairia lifeguard called the _basilikoi anthropoi_ (literally the 'emperor's men') which pre-dated the formation of the Varangian Guard. The _Laxdæla saga_ account of Bolli Bollason's return from Constantinople also supplies some evidence for the dress uniform of the palace guard when it describes the eleven men of his retinue 'dressed in clothes of scarlet' and Bolli himself wearing 'a cloak of red scarlet given him by the emperor of Byzantium'. This has been taken to indicate 'red scarlet' as the uniform colour of the _manglavites_ , while that worn by officers of the Hetairia holding the honorary rank of _spatharokandidatos_ had traditionally been white (with the distinguishing badge of a golden torque) and may still have been so in the eleventh century. Again, it must be stressed that these were items of ceremonial garb as distinct from war-gear, which would have been essentially a helmet, shield and coat of ring-mail for a Varangian on campaign or even garrison duty in the capital.
The conical helmet might well have been of 'spangenhelm' construction, although some would have reflected Slavic or Turkic influence and, in the case of the more affluent warrior, may even have been decorated with precious metals. The longer a man remained in mercenary service, of course, the more likely he was to adopt items of foreign arms and armour, but Scandinavian military taste was invariably conservative in character and the mail-coat would seem to have been at least as characteristic of Varangian war-gear as was the axe. So it was in Harald's case, although his mail-coat is said by Snorri to have been unusually long and so would have been similar in style to those worn by the mailed Norman knights with whom he served in Sicily. The shield most often used by Varangians of Harald's time would have been of the traditional Scandinavian circular design, and thus much larger than the disc-shaped shields carried by Byzantine cavalry, although the long, tapered 'kite' shields favoured by the Normans were finding their way into Russian and Byzantine armouries through the eleventh and twelfth centuries when fragments of saga evidence also suggest shields of that type brought back to Iceland, presumably by returning Varangians.
One further item of military equipment particularly associated with Harald is his banner, known as _Landeyðuna_ ('Land-ravager') and noticed on more than one occasion in Snorri's saga where it is said to have been his most highly prized possession. The name alone bears testimony to the banner's long active service before it was raised on his last campaign of 1066 and if this was the same banner which featured in Halldor's anecdote connected with the siege story then it must have come into Harald's possession while he was in Byzantine service, and perhaps in emulation of those carried by the standard-bearers of the Tagmata regiments. These regimental standards were highly honoured, in much the same way as the eagles carried by the old Roman legions, and yet smaller units within a regiment (companies or cavalry squadrons known as _banda_ ) also had their own banners, known as _bandophorai_ , one of which might have found its way into Harald's hands – but the story of Land-ravager is a long one indeed, and worthy of its own appointed place later in these pages.
What can be said of Land-ravager at this point – and especially if Thjodolf's phrase 'burner of the Bulgars' can be taken at face value – is that it would have fluttered proudly over Harald's troop on the march into Constantinople with the imperial forces returning victorious from the Bulgarian campaign in 1041. Michael Psellus – reporting, as usual, at first-hand – describes the entry of the emperor's army into the city as 'a brilliant occasion', with the whole populace thronging to greet their emperor as he 'returned in glory to his palace, bringing with him a host of captives, among whom were the most notable men of the Bulgars, including their leader, the pretender [Peter Deljan] himself, minus his nose and deprived of his eyes'.
The whole performance was a typically Byzantine blend of splendour and savagery, reaching its climax when the Bulgar prisoners were force-marched through the stadium of the Hippodrome in which the high and low usually gathered to watch horse-races, and yet for Psellus the really tragic figure was that of the emperor Michael himself: 'I saw him on this occasion . . . swaying in the saddle of his horse. The fingers gripping his bridle were as if those of a giant, each of them as thick and as large as a man's arm, the result of his internal trouble, while his features preserved not a trace of their former likeness.' This was to be the last public appearance of an unlikely and yet remarkable _Basileus_ whose personal tragedy has been justly recognised by one of the outstanding modern English historians of Byzantium: 'Few emperors had risen from more lowly origins, or by more questionable methods; none suffered a more agonising end. He possessed wisdom, vision and courage . . . and in the reigns that followed, there would be many who regretted his loss'.10
One who certainly would have had his own reason to do so was the newly promoted _spatharokandidatos_ of the Varangian Guard, because the passing of Michael the Paphlagonian – who had himself carried to a monastery of his own foundation on 10 December 1041 and there took the monk's habit and tonsure before he died on the same evening – was to mark the decisive point of downturn in Harald's fortunes in imperial service.
The fast-failing health of the emperor had been apparent in court circles for more than a year – and not least to his brother, John the Orphanotrophus, who was thus in need of a successor who could secure the avaricious interest of himself and his kin. His one remaining brother with manhood left intact was Constantine, but he was now as widely disliked as John himself. Stephen, the lowly shipyard worker promoted to admiral of the imperial fleet by reason of his marriage to Michael's sister Maria, had been dead for over a year but had left a son – also named Michael – and it was he who offered the family its last potential candidate for the succession if he were to be accepted as an adopted son by the ailing emperor and an empress now in her sixties.
All of which had been neatly accomplished by the scheming Orphanotrophus before the emperor went away to war and so his favoured successor was already on hand when the death of Michael IV was announced. All that was needed was his endorsement by the _porphyrogenita_ Zoe, now utterly alone and as gullible as ever, who could hardly refuse the proclamation of her adopted son as the emperor Michael V – although he was to be more popularly known as Michael _Calaphates_ ('the Caulker') in satirical reference to his father's erstwhile employment with the tar-brush. In the event, John's manipulation proved disastrous for his family and, indeed, most immediately for himself because the uncle preferred by the new emperor was Constantine whom he raised to the eminence of _nobilissimus_ and appointed to command of the forces as 'Grand _Domestikos_ ', while the Orphanotrophus was shortly to find himself aboard a galley carrying him into the exile from which he was never to return.
Not the least astonishing move in this reshuffling of imperial favourites was the restoration of the man only recently disgraced for taking a whip to the emperor's late father, because Georgios Maniakes was released from imprisonment and offered the ships and men he needed to reclaim Italy from the new Norman ascendancy (where just four towns remained in imperial control) and to make yet another attempt to win back Sicily from Saracen control. The return of the formidable Maniakes was never going to bode well for Harald, especially when the young emperor apparently shared a similar ill-disposition towards Varangians, replacing them as his bodyguard with 'young Scythians' (almost certainly Pechenegs) said by Psellus to have been eunuchs 'who knew his [Michael's] temper and were well suited to the services he required of them'. The Varangian regiment itself was not disbanded and those of its members who had formerly served as the imperial lifeguard were simply reassigned to garrison duty in the capital. While these ominous developments cannot be placed into precise sequence, they must have been implemented within the first few months of 1042 and so might seem to form a prelude to the more dramatic events which were to bring the short reign of Michael V to its gruesome conclusion in the third week of April.
One of the first of these is of particular importance here by reason of its involving the imprisonment of three officers of the Varangian Guard – namely, Harald Sigurdsson, Halldor Snorrason and Ulf Ospaksson. It should be said, first of all, that there is no reference to Harald's arrest and confinement in the most closely contemporary evidence of skaldic verse or Byzantine records, so all that is known of this episode derives from later northern sources and principally from accounts included in the different versions of Harald's saga, of which that set down by Snorri Sturluson must have its own claim to be the best informed. The original sources informing all these saga accounts can only have been stories brought back to the northlands by returning Varangians, as Snorri himself effectively admits in the saga, and so his family connection with Halldor Snorrason must lend at least some measure of first-hand authority to his version of events.
Nonetheless, Snorri's account is grossly distorted by misinterpretation and confusion, and most unhelpfully in his sequence of events, as in his opening passage which links Harald's imprisonment (from which he had evidently escaped by 21 April) with his decision to leave Constantinople, being eager to return to his homeland again 'having heard' that his nephew Magnus had become king of both Norway and Denmark (which indeed he did, but not until after the death of Hardacnut early in June of the same year). Snorri goes on to tell how Harald's intention to depart so enraged the empress Zoe that she accused him of defrauding the imperial treasury of plunder won on expeditions under his command – even though the true reason for her anger was of a more personal nature.
Harald is said to have asked for the hand in marriage of 'Maria, the beautiful maiden daughter of Queen Zoe's brother' and to have been refused, although 'some Varangians who had served in _Miklagarð_ and returned to Iceland' claimed the empress herself wanted to marry Harald and that this had been the true objection to his request to depart the capital, 'although a quite different story was given to the public'. Having thus confirmed Varangian tradition as his source of information for this passage of his narrative, Snorri immediately demonstrates how such source material can so easily and often fall short as reliable historical record. The only Maria known in the court circle of the time was the emperor's sister and the admiral Stephen's widow who would scarcely correspond to Snorri's description, so if this 'Maria' existed at all she could not possibly have been a niece of the empress when Zoe had no brother and neither of her two sisters had ever married.
It is, of course, not at all unlikely that a young officer might have enjoyed some sort of liaison with a Byzantine noblewoman and yet no Varangian, however well born, would have been considered a proper choice of husband for such a lady when Greek society took so dim a view of the regiment's character. Neither would an empress in her sixties have considered – or been allowed to consider – a marriage so far beneath her imperial dignity, even though another anecdote, which is found in _Morkinskinna_ where it tells of Harald's utterly ungracious response to Zoe's request for a lock of his hair, would suggest that the two names were linked by salacious gossip (unfounded or otherwise) apparently current in mercenary barracks at the time and assuredly providing the source of both saga references.
The allegation of Harald's defrauding the emperor (also attributed to Zoe in _Fagrskinna_ ) is quite another matter, however, and especially in view of so much evidence preserved elsewhere in the sagas, not least in that set down by Snorri himself which makes frequent mention of the wealth accumulated by Harald in Byzantine service. When first on campaign in Serkland, Harald was already gathering a 'hoard of money and gold and treasure of every kind' which he sent 'in the care of trusted men to _Holmgarð_ ' for Jaroslav's safe-keeping, while two of Snorri's four siege stories conclude with similar notes of the 'immense booty' collected when the towns had fallen to Harald's guile. Presumably most of this plunder also found its way to Novgorod because, when Harald eventually reached Russia on his return from Constantinople, he is said to have spent the winter gathering together 'all the gold he had taken from _Miklagarð_ , together with other valuable treasure of all kinds' into a hoard 'greater than had ever been seen in the north in one man's possession'.
At which point, Snorri comes up with the dubious explanation that much of this wealth had been acquired by means of Harald's having thrice taken part in _pólútasvarf_ , a term which he interprets as 'palace plunder' and a Byzantine custom whereby Varangians were allowed to ransack all the imperial palaces on the death of an emperor and to take as much of his treasure as they could carry away. There has been evidence found for a similar custom of 'palace plunder' known in Rome after the passing of a pope or his bishops (until abolished in 904) and likewise in Baghdad on the death of the caliph, but no such practice was known in Constantinople and Blöndal dismisses any such idea as 'inconceivable' in a Byzantine context (although he admits it is not impossible that guards on duty at the time of an emperor's passing might have been allowed to take certain precious objects as personal mementoes).
Having said that, Blöndal does subject the whole question to a meticulous examination leading to his suggestion that the key may well lie in Snorri's use of the term _pólútasvarf_. Russian in origin, of course, it was applied there to a tax-collecting expedition accompanied by a military escort, not infrequently comprised of Varangian mercenaries who were remunerated with a share of the tribute collected. Mention has already been made here of the probability that the young Harald would have been engaged on just such duties with Eilif Rognvaldsson in Novgorod, but he spent no more than two winters in the north of Russia and so would have had no time to amass any very great wealth before he left for Byzantium. Neither, indeed, would Snorri's explanation suggest as much, because he specifically applies _pólútasvarf_ to Harald's Byzantine service, and thus leads Blöndal to his proposal of the term 'having become Varangian slang for tax-gathering expeditions in Imperial service'.11 If so, then the inference must be of Harald's extortion of unlawful revenue for himself and his men while engaged on tax-collection in imperial service, although the substance of the allegations brought against him in Constantinople bears only upon his holding back more than the legitimate share of battle-booty.
While the saga leaves no doubt of Harald's Varangian career having been 'mercenary' in every sense of the term, it is still impossible to know whether or not he was justly accused, especially when there is the further possibility that Georgios Maniakes might have had some part to play in putting Harald and his lieutenants in prison. Released from his own imprisonment and restored to imperial favour, he was in a position to take revenge on those who had been his enemies just two years before, including Harald and his troop who may even have taken Stephen's side in the acrimony which was to deprive Maniakes of command. If the general did have any knowledge, or even suspicion, of wrong-doing on Harald's part, he would have been well placed to set retribution in process, a possibility further supported by stories in the _Morkinskinna_ and _Flateyjarbók_ versions of the saga which tell of at least one earlier occasion when _Gyrgir_ had complained to the Emperor of Harald wanting to keep all the booty that he took for himself.
On this occasion, however, Snorri himself makes no attempt to implicate Maniakes (who, by this time, would already have left for Italy and Sicily) and lays the blame for Harald's arraignment squarely upon the empress Zoe while thrusting the responsibility for his arrest and imprisonment upon Constantine Monomachus, 'who at that time ruled as king of the Greeks'. At this point it is clear that Snorri's chronology has gone completely awry and so much so as to make a nonsense of the conclusion to the next passage of his narrative, which tells of Harald having seen a vision of St Olaf promising to come to his aid, just before he, Halldor and Ulf were thrust through a door on the street and into their cell inside a tall, roofless tower. As fully expected, the saint was as good as his promise and made yet another appearance in Constantinople, this time to 'a lady of high birth' he had once healed of some ill whose aid he now sought in the rescue of his brother. Following Olaf's supernatural guidance, the noblewoman came to the prison on the following night, bringing with her two servants who set ladders against the wall and scaled the tower so as to lower down a rope and haul the three prisoners up out of their cell to freedom.
The more expansive variation on the same theme in Morkinskinna also has a vision of Olaf appearing to Harald as he approaches his prison, but in this version to advise him as to the whereabouts of a hidden knife. With this weapon and the assistance of his two loyal lieutenants, Harald is able to slay the fearsome serpent lurking in the dark cell before the three make their escape. Curiously, it is this story which is taken up by Saxo Grammaticus in his history, having learned it from the Danish king Valdemar who claimed to have the very same knife in his own possession. Snorri must have known of this story which would seem to have formed part of Halldor's repertoire – one of the tales told of Halldor refers to a mocking rhyme claiming he had only sat upon the _wurm_ and left the knife-work to Harald and Ulf – yet he would seem to have given it so little credence that it was omitted from his own saga. In fact, it might be thought rather more credible than any supernatural intervention by Olaf, because a snake or similar reptile would have been a very likely resident in a Byzantine dungeon and one easily re-cast by a saga-maker into some more alarming form of monster, especially in view of a number of similar 'prisoner in snake-tower' tales of south-east European origin current during the twelfth century.
They were evidently of no interest whatsoever to Snorri, however, because his account of the rescue by way of the roofless tower moves swiftly on with Harald's urgent quest for revenge. Having been brought to freedom, he went directly to his Varangians who took up their weapons and followed him to find the emperor asleep in his bedchamber, from which he was seized to suffer the putting out of his eyes. At this point in the narrative, Snorri summons up the support of his most authoritative source of evidence in the form of two passages of skaldic verse by Harald's court-poets, the first attributed to Thorarin Skeggjason, the second to the oft-quoted Thjodolf, and both informed by Harald himself for their description of his blinding of a Byzantine emperor – although one whom neither skald identifies by name.
The timely introduction of this impressively contemporary evidence from the skalds at last enables the alignment of Snorri's narrative with the more reliable historical record of events in Constantinople in the spring of 1042 when an emperor was blinded and deposed on 21 April after one of the bloodiest days in the capital's history. That emperor could not have been the Constantine Monomachus named by Snorri, however, and neither could it have been he who committed Harald to prison because some seven more weeks were to pass before he made his formal entry into Byzantine history as the emperor Constantine IX when he became Zoe's third husband in the second week of June. The emperor who suffered the mutilation described by the skalds can only have been Michael V Calaphates.
Having disposed of his uncle the Orphanotrophus and cowed the courtier aristocracy – even emasculating dissenting members of his own family – Michael now believed himself sufficiently beloved of the people to proceed with the removal of his co-empress Zoe. Probably inspired to action by the sight of the cheering crowds lining his processional route to the great church of the Hagia Sophia on the first Sunday after Easter (18 April in 1042), Michael had Zoe arrested, arraigned in front of witnesses he had prepared earlier, and forcibly transported through the night – garbed in a nun's habit and shorn of her hair – to a convent on the island of Prinkipo in the Sea of Marmara. It is, perhaps, tempting to wonder whether rumours associating Zoe with a Varangian _spatharokandidatos_ might have prompted Harald's arrest around this time, possibly to neutralise any potential military challenge before Michael addressed the Senate on the following morning to announce Zoe's punishment for allegedly attempting to poison her co-emperor. While the senators had no realistic alternative to approval of the emperor's action, a very different response greeted the proclamation made to the crowd on the street outside, where voices were immediately heard denouncing the caulker's son as a blasphemer and demanding the return of the _porphyrogenita_.
Those isolated calls soon swelled to the point where the _sebastokrator_ (or 'city prefect') who had made the proclamation only just escaped with his life from an angry mob grown so huge that it seemed as if the whole city had risen in open revolt, especially when the Patriarch of Constantinople ordered all the bells to be rung calling the people to arms. A number of Varangians had apparently responded to the summoning bells, because Psellus makes mention of many axes wielded among the crowds surging to besiege the imperial palace and attack the mansions of the emperor's family, with particular attention directed towards the palace of the _nobilissimus_ Constantine. Some of those Varangians must have been those formerly in service with the imperial lifeguard – on the evidence of Psellus' reference to discontented _Tauro-Skuthai_ who departed the palace – but others of their kind, who had probably been long in Constantine's service, remained loyal to the Grand Domestic as he fought his way through a mile and a half of crowded city streets before coming to the aid of his nephew under siege in the imperial palace.
A man of genuine military experience and evident personal courage, Constantine first deployed his bowmen and _ballistae_ on the high towers to drive the mob back from the gates with a hail of arrows and bolts, before despatching a boat across the Marmara to bring Zoe back from the island of Prinkipo with all possible speed. In the desperate hope that a personal appearance by his co-empress might just save Michael and his faction from their encircling doom, the old lady was brought ashore and hastily robed in the imperial purple before being taken through the palace to stand with her adopted son in the imperial box of the Hippodrome. It was now afternoon and the mob had been too angry for too long to be persuaded by any such charade. They saw Zoe still held in thrall by the son of a shipyard caulker and renewed their demand, now not only for the removal of Michael but for his replacement with the only other surviving _porphyrogenita_. Thus emissaries were sent forth to bring a reluctant Theodora out of the convent where she had spent the last fifteen years and bear her by force to the Hagia Sophia where she too was garbed in the purple before accepting the imperial crown.
It must have been very late in the evening before a proclamation in the name of the two sister empresses declared the emperor deposed and the congregation moved out of the cathedral to join the crowd still besieging the palace where Michael and his uncle had now received reinforcements – probably including more Varangian mercenaries – brought back from a recent victory in Sicily. Crack front-line troops fresh from active service would have been gratefully welcomed by the beleaguered Grand Domestic and were to be desperately needed early in the following morning when the palace was attacked from three sides. One of the routes chosen for this three-pronged onslaught was by way of the great bronze gate known as the _Chalke_ – and it may well have been some of the insurgents following this line of approach who paused to break Harald and his companions out of their dungeon.
There has been more than one suggestion as to the prison in which Harald was held. The version of his saga in the _Flateyjarbók_ places it on the same street as the 'church of the Varangians', of which the oldest is thought to have been that dedicated to St Mary near the Hagia Sophia, but the other and, perhaps, greater likeli-hood is of his being imprisoned in the _Numera_ (its cells having been used at one time by the _Numeri_ garrison) which lay in close proximity to the Varangian barracks and would have been most easily reached from the Chalke. The Patriarch had already directed the mob to break open the city's prisons and release their inmates on the Monday, but the Numera would have been under military control and so was more likely to have been breached during the dark hours of Tuesday morning. Indeed, Snorri's saga account indicates the rescue having been accomplished in the night-time and, unlikely as his story of the noblewoman may seem, Psellus remarks on the numbers of women and girls included in the mob so it is fully possible that one of these may have taken some part in releasing the three Varangians from their cell. It is still more likely that some prisoners of particular importance would have been located for urgent rescue by those directing the insurgency and Harald would surely have been one of these, and not only because his release would have encouraged the support of most of the Varangians. There were now those in high places who may already have known of him and, perhaps, even foreseen a particular role for his services.
Whichever was the prison that held him, Harald would have been free of its confines in time for him and his men to take some part in the fighting which engulfed Constantinople throughout that Tuesday – because 20 April in the year 1042 was to go down in the annals with singular notoriety as the bloodiest day in the long history of the Byzantine capital. More than three thousand are said to have been slain before the palace finally fell in the early hours of the following morning when the forces around the emperor either surrendered or escaped, allowing the mob to overrun the whole vast complex, pillaging its treasures and paying especial attention to the imperial treasury, where the archives of the tax-collectors were destroyed. At least one Varangian might have had reason to see some treasury documents in shreds or aflame and he would not have been alone in so doing, although the more pressing concern of the mob was to find and kill the ex-emperor.
For the moment, though, it was to be frustrated because Michael and his uncle Constantine had gone from the palace before the first light of dawn when they took a boat along the coast to seek sanctuary in the monastery of St John of the Studion. There they had taken the tonsure and been admitted as monks while Zoe, left alone in the palace, was raised up on the shoulders of the insurgents who bore her aloft and placed her on the imperial throne. If her delight and relief were soon to be tempered when she learned of the return and coronation of the sister she had hated for so long, the sound of cheering crowds around the Hagia Sophia left Zoe no other option than to acknowledge the decision of the people and accept Theodora as her co-empress. Meanwhile, the whereabouts of Michael and Constantine had been discovered and the mob was gathering outside the church of the Studion monastery, still bent upon their destruction but not yet prepared to violate the sanctuary.
Evening was approaching by the time one of the newly appointed officials arrived from the city with orders from Theodora to bring the ex-emperor and his uncle out of the church, but talk of public execution was already to be heard and the two fugitives clung ever more desperately to the altar. Despite assurances of their safe-conduct back to the city, the pair still refused to relinquish their sanctuary and so the official abandoned persuasion for violence, commanding some of the mob to drag them from the church and compel their progress back to the palace. All of this is described in detail by Michael Psellus, who had already reached the Studion before the arrival of the official party and was thus enabled to provide a first-hand account of the fearful course of subsequent events.
Outside the monastery now, Michael and Constantine had been brought only a short distance along their route before they were confronted by a detachment of guards, apparently recognised by Psellus who describes them as 'brave men who shrank from nothing'. These new arrivals bore with them further orders, officially authorised by the new _sebastokrator_ of Constantinople and yet thought to have originally issued from the empress Theodora herself: the deposed emperor and his uncle the _nobilissimus_ were to be blinded forthwith. Psellus tells how the captives were taken on to the Sigma, an open space outside the Studion, but pauses to pay genuine tribute to Constantine's extraordinary bravery in offering himself as the first to suffer mutilation and lying down, unrestrained, as it was administered. His nephew was possessed of no such courage, howling with terror at the fate awaiting him and having to be held down by the guards before their orders could be carried out. Thereafter Michael was taken to a monastery to live out the rest of his days, as also was his uncle – although the _nobilissimus_ Constantine was later brought out of his cell for interrogation as to the whereabouts of funds misappropriated during his nephew's reign.
When Psellus' account is set beside the similarly contemporary evidence preserved by the skalds, there can be no doubt that the detachment of guards charged with the grim duty carried out on Wednesday 21 April 1042, was Harald and his troop of Varangians. Thjodolf's lines bear their own clear testimony: 'On both eyes blinded was then . . . Grikaland's great lord by the destroyer of the wolf's grief [meaning a renowned warrior, presumably Harald himself].' Likewise, 'Norway's ruler [certainly meaning Harald] placed the grim mark on the brave man [apparently meaning Constantine]'. It is important to point out that neither skald suggests this as an act of personal revenge on Harald's part, and indeed Thorarin provides the clearest description of a mercenary warrior paid for services rendered: 'Our valiant chieftain gained still more of the glow-red gold; Grikaland's king was made stone-blind as his chief suffering'.
It is clear now that Snorri's saga bears scarcely any correspondence to the most likely historical context of Harald's escape from imprisonment and his mutilation of the emperor. There is no reason to believe that Harald acted other than as a mercenary officer under orders, although the source of those orders and the choice of Harald and his troop to carry them out prompt further consideration here. Psellus' account of the background to what befell at the Studion and on the Sigma points directly to the newly consecrated empress who was well aware of Zoe's hostility and feared she might yet prefer to restore Michael than share the imperium with her sister. Thus determined to extinguish any possibility of political recovery on the part or in the name of the deposed emperor and yet unwilling to have him slain, Theodora and her advisers apparently decided to command the traditional form of mutilation as the most effective means to that end. Duties of that type were customarily and conveniently assigned to Varangians, who were still known to the Greeks as 'Tauro-Scythians' and recognised as barbarians from the remote northlands for whom naked brutality was stock-in-trade.
It is true, of course, that Harald and his troop were just one of many such mercenary units available in the ferment consuming Constantinople in those April days of 1042 and so it is fully possible that their selection for this task was either purely arbitrary or entirely accidental. Yet the empress Theodora – who had been a nun just days before she had been dragged out by the mob to share the imperial throne with the hostile sister who had once already incarcerated her in a convent – had urgent need of someone whom she knew to be not only utterly trustworthy but fully capable of the task assigned him. In such anxiety and so precarious a situation, she might very well have had some recollection of the name of the officer commanding the escort which brought her in safety through the dangerous deserts of the Holy Land on the pilgrimage to Jerusalem just six years before.
None of which is more than speculation, of course, but Harald's assignment to the gruesome duty outside the Studion must have greatly enhanced his prominence and authority in the Varangian Guard of the new regime. So much so that he might very well have been appointed judge and executioner in a purge of those who had found themselves on the losing side in the fighting which brought about the palace revolution. Varangians in Byzantine service had evidently long held the privilege of dealing with those within their own ranks accused of a crime or misdemeanour. That custom was very probably rooted in the rough justice meted out to those who had infringed the oaths sworn by members of the original Varangian companies. Some very similar discipline would have prevailed among Russo-Scandinavian mercenaries in imperial service prior to the establishment of the Varangian regiment by Basil II and continued thereafter as a special regimental privilege with particular application within the Varangian Guard. There would be good reason, then, to see this practice reflected in the half-strophe preserved in _Fagrskinna_ and attributed to Valgard of Voll which tells of Harald having 'commanded the half of them to hang then and there; so you have done and there are fewer _Væringjar_ remaining'. Although this fragment has been variously interpreted, Valgard himself is thought to have served with Harald during this later period of his imperial service and there is no doubt that Varangians fighting for Michael and Constantine could have been justly accused of treason when they had broken a solemn oath to defend the legitimate _porphyrogenita_ empresses. Judged guilty by their commander – in the person of Harald – they would quite certainly have been condemned to death by hanging.
While the _Advice_ denies Harald's promotion above the rank of _spatharokandidatos_ , it fully confirms the high personal esteem in which he was held by the new imperial regime – in which the sister empresses were shortly to be joined by a co-emperor when Zoe took Constantine Monomachus as her new husband. This must have been a quite unexpected development and not only because both sisters were now in their sixties. The tall, thin Theodora was unlikely to abandon the chaste habit of a lifetime and while the same could never be said of her shorter, chubbier elder sister, Zoe had already had two husbands and third marriages were viewed with the sternest disapproval by the Orthodox Church. Nonetheless, the reputedly lascivious Zoe is said by Psellus to have wanted another husband if only to help guard against any reversal of her restored fortunes and her choice fell upon the charming and aristocratic Constantine Monomachus. Even while her second husband was still alive, Zoe had developed a close friendship with this Constantine, thus arousing the suspicion of the ever-watchful Orphanotrophus who ordered him into exile on the island of Lesbos and it was from there that he was summoned back to Constantinople in the early summer of 1042.
The Patriarch apparently found a way around his Church's disapproval so as to conduct their wedding on 11 June and afterwards to consecrate the empress's new husband as her co-emperor Constantine IX who was to reign for thirteen years until his death in 1055. In fact, the term 'co-emperor' was soon to become no more than a formality, because within three months Zoe and Theodora had retired from public life leaving Constantine as the sole effective imperial figure and it must have been around this time that the emperor known in the saga as 'Konstantinus Monomakus' made his genuinely historical entry into Harald's story.
Snorri Sturluson's confused account indicating Constantine Monomachus as the emperor mutilated by Harald has led at least one historian to discount the whole episode, and yet quite unjustly so in view of the impressively convincing and closely contemporary evidence provided by the two skalds. The emperor in question can only have been Michael Calaphates and so Snorri's unfortunate error is perhaps best explained as a confusion of two Constantines having led him to the assumption that the _nobilissimus_ Constantine who suffered blinding on the same occasion as his nephew was the same Constantine who refused Harald permission to leave Constantinople. At least there can be no doubt as to the accuracy of Snorri's identification of the Constantine in that latter instance because it is fully confirmed by the reliable evidence of the Advice when it states that 'Araltes wished in the reign of the emperor Monomachus to be given permission to return to his own land, but it was not forthcoming. Indeed, his way was obstructed and yet he slipped away by stealth . . .'
Unfortunately, the _Advice_ supplies no further detail of just how Harald 'slipped away by stealth' from Constantinople and so the saga preserves the only full account of the adventure which forms a characteristically bold finale to his career as a Varangian mercenary in Byzantine service. Yet the saga fails to offer any very convincing explanation as to the reason for his sudden and urgent departure. The simple desire to see his homeland once again cannot really be accepted as sufficient explanation and so there must have been a more pressing reason – and indeed there was, but it is one which will become more clearly apparent from the viewpoint of Kiev than from that of Constantinople. The tidings which did prompt Harald's request for leave to resign from imperial service assuredly reached him from Russia – possibly even under diplomatic cover if they came from the Grand Prince Jaroslav himself – and at some time in August when the annual trading fleet from Kiev came to harbour after its passage across the Black Sea.
That particular estimate of timing is fortuitous here, because it would also have been in August when imperial authority passed to the new emperor Constantine Monomachus and so it would have been to him that Harald brought his request for leave of departure. In the event, of course, it was refused – and for good reason in the light of subsequent developments – but Harald's own reason for departure was of the greatest urgency. Even in August, there was little enough time left to prepare for the crossing of the Black Sea and long journey up the Dnieper back to Kiev, which was indeed Harald's intended destination.
Snorri tells how Harald and a select company of his comrades took two of the Varangian galleys and rowed them out until they came to the iron chains slung across the entrance to the harbour. On approaching this obstacle, the oarsmen were commanded to pull with all strength while others of the crew, heavy-laden with their gear, were ordered to the stern of the ships as they ran up to the chains. At which point, as the craft lost momentum to hang over the chain barrier, the crewmen were ordered back to the bows, their weight tilting Harald's galley forward into a slide down from the chain and into open water. The same tactic was followed by those aboard the other galley, but without the same success because their keel stuck fast on the chain and the ship broke its back, allowing only some of its crew to be pulled to safety aboard Harald's galley while others were lost beneath the waves.
Thus Snorri tells of Harald's escape from Constantinople with no lesser authorities than Blöndal and Benedikz pronouncing the story 'in all probability . . . correct in its essentials'. That credibility is only fractionally defrayed by the inclusion of 'a silly, romantic fable' dragging the aforementioned 'Maria' into the story when she is forcibly abducted, taken aboard one of the galleys and rowed out into the Black Sea before being set ashore with a retinue who were to escort her back to Zoe as proof of Harald's ability to do just as he chose.12 When that unlikely element is set aside, the technical detail is certainly unusually convincing when compared with that found in many of the anecdotes included in Snorri's saga, as also is the specific reference to Harald's galley sailing 'north to _Ellipalt_ ' (identified as a lagoon in the mouth of the Dnieper) and on from there 'through the eastern realm' (meaning Russia). There certainly was a great iron chain supported on rafts across the Golden Horn (and another across the Bosporus, but that is not known to have been in use until a century after Harald's departure) floated out through the hours of darkness to provide a defence for the Harbour of Neorion where the imperial fleet was berthed beside its arsenal and store-houses, while the Varangian galleys were moored by the Tower of St Eugenius which also secured the southern end of the chain across the Golden Horn.
It should be said that at least one authority has suggested this episode as a 'borrowed tale' akin to the siege stories (a similar escape from the harbour at Syracuse being known from Roman times), but the authenticity of the saga account is too well supported for such doubt. Not only does the _Advice_ confirm Harald's departure from Constantinople by stealth, but Snorri illustrates that stealth with detail so convincing as to indicate his original source having been the first-hand recollection of Halldor Snorrason who was certainly aboard the galley which brought Harald to Kiev on this first passage of his long journey home to the northlands.
## Russia, 1042–1045
It was while on voyage up the Dnieper that Harald is believed to have composed sixteen strophes of verse recalling his Varangian exploits, each one ending with the same refrain: 'Yet the bracelet-goddess in Gardar still refuses me'.13 Although most of these _Gamanvísur_ have long since been lost, Snorri Sturluson does preserve one complete strophe which is quoted in his _Harald's saga_ by way of conclusion to his account of the escape from Constantinople – and with a note identifying ' _Ellisif_ , the daughter of King _Jarisleif_ in _Holmgarð_ ' as the 'goddess in Gardar' to whom all this poetry was addressed.
Whether or not these verses really were composed aboard ship – as they may well have been when they were evidently intended for presentation to the princess he was to marry shortly after his arrival at the Russian court – the lines preserved in the saga represent a fragment of immediately contemporary evidence containing more than one point of interest. First of all, they effectively discredit the earlier saga claim for his marital ambitions regarding the (presumably fictional) 'Maria', and also carry a curious echo of his revered half-brother Olaf, whose one recorded attempt at the skaldic art comprised similarly intended verses written for Ingigerd, the Swedish princess who was later to become the bride of Jaroslav of Kiev and the mother of his daughter, the Elizaveta known in the sagas, and presumably also to Harald, by her Norse name-form of _Ellisif_.
Elizaveta had been little more than a child, of course, when Harald set out for Byzantium eight years earlier and the marriage of any daughter of a Russian Grand Prince to a mere Varangian mercenary would have been virtually unthinkable anyway, but now an eighteen-year-old Kievan princess would represent an eminently suitable prospective wife for a wealthy Scandinavian prince whose ambition was turning towards kingship in the northlands. Just such a possibility may have been long in Jaroslav's mind, because he was in the habit of arranging politically strategic marriages for his offspring. His younger son Vsevolod was to be wed to a daughter of the Byzantine Monomachus family, while Elizaveta's two sisters made still more impressive marriages when they became the queens of Hungary and France. If Jaroslav had already recognised Harald's potential as a warrior king and suspected – or actually known – something of his ultimate ambition while he was still in Constantinople, it is not at all unlikely that the prospect of so prestigious a bride might have been offered to lure him back to Russia. All of which might be perfectly plausible and yet still does not explain why Harald was so anxious to leave imperial service or why he should have been refused permission to do so.
The homesickness implied in Snorri's claim that Harald was eager to see Norway again hardly corresponds to the apparent urgency of the situation and the further claim for Harald 'having heard' of his nephew Magnus adding the sovereignty over Denmark to his kingship in Norway clearly defies credibility. Magnus had remained in Russia while his father set out on the journey back to Norway which was to bring him to his death in battle at Stiklestad. Thereafter, the young prince stayed at Jaroslav's court until brought back to Norway as his father's successor in response to popular demand shortly before the death of Cnut in 1035. On the death of Cnut's son Hardacnut some seven years later, 'Magnus the Good' extended his sovereignty to Denmark, once again by apparent popular acclaim, and yet Hardacnut died in England – where he was buried at Winchester on 8 June 1042 – so it is scarcely possible that news of Magnus' succession as king of Denmark could have reached Constantinople until very much later in that year, by which time Harald had already made his escape to Kiev. The factor of most ominous significance in the sphere of Russo-Byzantine affairs at just that time is nowhere mentioned in the sagas and yet could only have had its own crucial bearing on Harald's situation because, by the spring of 1042, Jaroslav was already advanced in building the warfleet with which he was planning to launch an expedition against Constantinople in the following year.
According to Michael Psellus, Byzantine military intelligence would seem to have known something of these suspicious developments in Kiev even while Michael IV was still alive, although the brief but disruptive reign of his successor and the cataclysm surrounding his deposition must have proved a serious distraction from the forward planning of imperial defence policy. Even so, there is every likelihood that anxious fears of impending Russian hostilities lay behind his successor emperor Constantine's refusal of permission for Harald to leave Constantinople, and especially so when he would surely make his way directly to Kiev. To allow a widely experienced officer of the Varangian Guard to share his inside knowledge of the deployment and weaknesses of Byzantine forces with a likely aggressor would have been incautious to the point of irresponsibility, so the emperor's response to Harald's request for leave cannot be considered either unreasonable or unjust. In fact, it was particularly astute because Harald must have maintained contact with Jaroslav throughout almost all his years in imperial service if – as the saga claims – he had been sending his plunder 'in the care of trusted men to _Holmgarð_ ' and into the Grand Prince's safe-keeping. Such 'trusted men' would have been accomplished in evading the scrutiny of Byzantine officialdom – not least when the export of gold and currency from Byzantium was forbidden – and thus equally qualified for service as trustworthy message-bearers.
So too, it would surely have been similarly 'trusted men' arriving in Constantinople with the annual trading fleet in the summer of 1042 who brought Harald the tidings which called him back to Russia, and the most likely reason for that urgent summons would have been Jaroslav's requirement for detailed military intelligence to guide his planning of the intended assault on _Tsargrad_ (as _Miklagarð_ was called by the Rus). All historical opinion is agreed that Harald was gone from Constantinople by the time the Russian expeditionary force appeared in the Bosporus (presumably the later spring or early summer of 1043), so his date of departure is usually placed between the second half of 1042 and the earlier months of the following year – and yet, when other salient factors are brought into consideration, the date of his return to Russia might be fixed more precisely still. Not least among those factors is another threat which was about to be presented to the new emperor, and this one posed in the formidable form of Georgios Maniakes.
While in exile on Lesbos Constantine Monomachus had enjoyed the company of his long-standing mistress, a granddaughter of Bardas Sclerus who had been the second pretender (alongside Bardas Phocas) challenging Basil II at the time of his formation of the Varangian Guard in the later 980s. This lady was soon to follow her lover to the capital where Zoe would seem to have had no serious objection to sharing her new husband and so it was that the 'Sclerena' (as she is said to have been universally known) became a fixture in court circles. Outside the palace confines, however, the Sclerena became widely unpopular, although not so much in her own right as on account of her avaricious relatives who took every possible advantage of her new semi-imperial standing. Of these kinsfolk, it was her brother Romanus whose activities were to prove most disastrous for the course of Byzantine history, initially because his estates adjoined those of Georgios Maniakes in Anatolia where the two men had become bitterly hostile neighbours.
Since his restoration by the former emperor and subsequent return to Italy in April 1042, Maniakes had suppressed a revolt in Apulia with a devastating, but nonetheless effective, campaign of appalling savagery before he once again fell prey to typically Byzantine political intrigue when the Sclerena's brother contrived to have the general recalled and replaced – or would have done so had Georgios not refused to submit to a second dismissal from imperial favour. The officer sent to Italy as his replacement was seized upon arrival, disgustingly tortured and summarily executed. Having firmly asserted himself in command, Maniakes led his troops across the Adriatic in the early spring of 1043 and began his advance upon the capital until confronted by the greatly superior numbers of an imperial army near Ostrovo in Macedonia. Maniakes had his army acclaim him emperor before the battle began and Psellus describes his defiance in the front line of the first onslaught against the enemy lines: 'Thundering out commands as he rode up and down the ranks, he struck terror into the hearts of all who saw him, while his proud bearing overwhelmed our vast numbers from the very outset. Circling around our legions and spreading confusion all about, he had but to attack before the ranks gave way and the wall of troops pulled back.' At which point the battle-god who had favoured him on so many fields would seem to have turned away at just the same moment a thrown lance found its mark and delivered his death-wound to the mighty Maniakes. Decapitated on the battlefield, the head of the greatest Byzantine soldier of his time was brought back to the emperor in Constantinople, where it was paraded around the Hippodrome by the returning army and impaled high on a spike in full view of the populace.
While the annals assign no precise date, the death of Georgios Maniakes is usually and reliably placed in February/March of 1043, but what can be said with greater certainty of his last battle is that the imperial forces sent against him did not include Harald with his Varangians. Had it been otherwise, the saga-makers would have made every imaginable claim for Harald's achieving ultimate victory over the greatest personal enemy of his career in imperial service; and if he was not with the emperor's army in that battle then he had most certainly made his escape from Constantinople before February 1043. The long voyage across the Black Sea and up the Dnieper was hazardous enough in any season, but in the winter months it would have been a venture of utter folly, so Harald's journey from Constantinople to Kiev can be placed with all possible confidence in the autumn of 1042.
Particular attention must be paid to the date of events through this passage of Harald's warrior's way as a precaution against the misleading chronology of the saga narrative. Snorri's casual assignment of events to 'that winter' or 'the following spring' gives the impression of Harald having spent barely a year in Russia and yet some three full years must have passed between his arrival at Kiev in the autumn of 1042 and his departure for Scandinavia which could not have been made before the later autumn of 1045. While there is no absolute certainty that Snorri is to be trusted when he tells of Jaroslav having given Harald his daughter in marriage in the winter following his return from Constantinople, there is no real reason to doubt him in this instance. So the wedding to the princess Elizaveta was probably consecrated around the time of the winter festival which is more closely related with the feast of Epiphany in the Orthodox calendar and might be dated – although still with due caution – to the earliest weeks of the year 1043. Snorri's saga goes on to quote a half-strophe from the skald Stúf which speaks of Harald's marriage having brought him 'gold aplenty as reward [presumably a generous dowry] and a princess too' – and one whose distinguished parentage (of the Rurikid line and the Swedish royal family) would have conferred its own measure of new prestige upon a man with his own ambitions on kingship.
For Jaroslav, on the other hand, his immediate return on investment of that dowry would have been the detailed military intelligence Harald had brought with him along the east-way, because his predominant concerns in the new year of 1043 must have centred on plans for the great expedition he intended for the coming summer. Even though events in Byzantium had been moving on apace in Harald's absence, he would surely have had a useful working knowledge of the numbers and deployment of Byzantine land forces around the capital and elsewhere across the empire, although it would have been some months yet before he learned of the fate of his old enemy _Gyrgir_. The item of most immediate concern to Russian tactical planning and the one on which Harald may very well have been able to offer valuable information was the disposition of the imperial fleet, because its great warships armed with the empire's celebrated secret weapon of 'Greek Fire' represented Constantinople's first line of defence.14 If, for example, Harald could report the empire's naval forces being 'below strength [with] the fireships dispersed at various naval stations', then he would have supplied the most reliable intelligence because those details are quoted from Psellus' account of shortcomings in marine defences available to the emperor when the Russian fleet did appear in the Bosporus. Sadly for Jaroslav, however, no military intelligence reports could have warned him of the sudden Black Sea storm which would seem to have been the decisive factor in the crushing defeat of his great enterprise.
Despite the inevitable discrepancies between accounts of the same event preserved in the Russian _Primary Chronicle_ and the contemporary Byzantine record – as set down by Psellus and the annalist Cedrenus – all those sources agree on the outcome having been a disaster for the Rus. The strength of their fleet, led by Jaroslav's son Vladimir of Novgorod and an experienced _voevodo_ by the name of Vyshata, is estimated at some four hundred ships (of a type resembling the Scandinavian longship, but reflecting Slavic influence in its broader beam and more heavily timbered hull), most of which were destroyed by a combination of storm at sea and enemy incendiary assault.
Psellus writes proudly of the emperor's assembly of an impromptu warfleet – three 'triremes' (or _dromoi_ ) with incendiary siphons aboard, some transport vessels and old hulks made as seaworthy as possible – to present 'the barbarians' with the semblance of a defensive naval cordon. He tells of the Byzantine warships engaging with the enemy fleet and throwing it into disarray with Greek Fire just before the onset of a hurricane force easterly completed the work of destruction. Yet his story is so suspiciously reminiscent of the defeat of a Russian attack of a hundred years before, when an earlier emperor achieved unexpected triumph with a similar scratch naval force, that the _Primary Chronicle_ might be thought more trustworthy when it describes a storm playing havoc with the Russian fleet on the sea-crossing from the Danube to the Bosporus before fourteen Byzantine warships emerged to drive off such vessels as were still capable of flight.
Nonetheless, the Greeks did not have everything go their way. When Prince Vladimir's own ship was crippled, he and some of his _druzhina_ managed to escape to the Bulgarian shore aboard another, presumably one of those which had survived the initial maelstrom well enough to be capable of destroying four enemy vessels off the Thracian coast. Vyshata, however, was less fortunate, because it was he who took command of those warriors who had managed to get ashore and led their retreat overland until it was cut off by Byzantine troops. Those not slain were taken prisoner, many of them said to have been mutilated in captivity, and three years were to pass before negotiations secured the return of Vyshata and his fellow survivors to Russia. While Cedrenus' claim for fifteen thousand Russian corpses washed up on the Bosporus shore is clearly a gross exaggeration, grievously heavy casualties must have been suffered when the _Primary Chronicle_ admits barely six thousand survivors from a force which had set out with more than ten thousand fighting-men, of whom some number are said both by Russian and Byzantine sources to have been Varangian mercenaries. If so, then this was to be the last occasion on which Jaroslav is known to have employed the Varangians who had for so long been his principal source of mercenary recruitment, as they had for his father before him.
This year of 1043 can be seen as a landmark in the military history of the Rus – and on two counts. Not only does it effectively represent the end of the long-standing tradition of Varjazi mercenaries serving as the sword-arm of Russian princes, but it also marks the end of an era in Russo-Byzantine relations because Jaroslav's venture into the Bosporus was the last of a long history of Russian assaults on Tsargrad, of which the first is said to have been launched by Oleg, a kinsman of the founding dynast Rurik, in 860. Yet the question remains as to why Jaroslav made the attempt in the first place. His motive is said by the Byzantine sources to have been the death of a Rus merchant – 'a barbarian nobleman' according to Psellus – in a market brawl in Constantinople, which would seem to have been a mere pretext for an invasion which had been at least two years in the planning, even though Cedrenus tells of a demand for compensation in the sum of 3lb weight in gold for every man in the Russian fleet. Psellus, on the other hand, notices at least one Russian ship laden with a 'rampart', presumably meaning some structure intended for assault on city walls and yet those surrounding Constantinople had withstood such attempts by Persians, Avars and Arabs – as well as Rus – for more than half a millennium and it is almost inconceivable that Jaroslav actually intended the seizure of the city.
No less puzzling is the fact of the expedition being launched at the same time as Jaroslav's magnificent Hagia Sophia – the largest surviving Byzantine-style church of the eleventh century, even decorated with inscriptions in Greek rather than Church Slavonic, and unrivalled as the most visibly imposing feature of a far wider Russian cultural flowering – was under construction in Kiev. Interestingly, the authors of a highly respected recent history of early Russia have found no 'necessary contradiction between the demonstratively Constantinopolitan style of Jaroslav's public patronage and his campaign against Constantinople in 1043', going on to suggest his entire cultural programme having been directed _against_ Constantinople as an assertion of Kievan equality and a reaction against Byzantine 'imperial pretensions'.15 In fact, there is much in Psellus' account to support that explanation, especially when he refers to the expedition as the 'rebellion' inspired by the furious rage harboured by a 'barbarian race for the hegemony of the Romans'.
A closely similar view underlies the suggestion made by another historian, and one of pre-eminent authority, that 'it is quite possible that Psellus was alluding to the traditional Byzantine claim to political sovereignty over Russia'.16 Thus Jaroslav's enterprise of 1043 must be seen as an extravagant gesture in defiance of imperial influence north of the steppe, and its apparent contradictions as a reflection of the paradox attendant upon the man himself. The 'Jaroslav the Wise' surrounding himself with 'the sweetness of books' while ushering in the 'Golden Age of Kiev' was the same Jaroslav Vladimirovich who had succeeded his father, 'Vladimir the Saint', as supreme ruler of the Rus only after two decades of bitter internecine warfare which had left all but one of his brothers dead – usually in violent circumstances – and the one survivor consigned to incarceration. His first importance in these pages, though, lies in his far-reaching influence on a future king of Norway, because there will be a number of occasions throughout the course of Harald's reign when the man called _Jarisleif_ by the saga-makers can be recognised as his principal exemplar in the art and practice of kingship.
It is unfortunate, then, that the saga record preserves so little detail of the three years Harald spent in Russia before making his return to Scandinavia. Snorri Sturluson records the marriage to the princess Elizaveta, of course, but he would seem to know nothing else of his activities through this period other than his gathering together all the gold and treasure he had sent ahead from Byzantium into the celebrated hoard 'greater than had ever been seen in the north in one man's possession'. Snorri makes so many references to Harald's treasury that his claims cannot have been without a substantial core of truth – especially when they have been supported by archaeological evidence of coin finds in Scandinavia – and yet it is still curious that the _Morkinskinna_ or _Fagrskinna_ versions of the saga have nothing to say on the subject.
While considering the saga accounts of Harald in Russia, it should be noted that they all identify Jaroslav's capital as _Holmgarð_ – by which, of course, is meant Novgorod and it is true that Novgorod had formerly been his preferred power base, even after the agreement with his brother Mstislav had granted him Kiev. On (or even shortly before) Mstislav's death and most evidently after his own decisive defeat of the Pecheneg siege in 1036, Jaroslav moved to establish Kiev as his new capital. Thus it would have been to Kiev rather than Novgorod that Harald had sent his profits from the east into Jaroslav's safe-keeping and in the orbit of the Kievan court that he would have spent the greater part of his stay in Russia after his return from Constantinople.
Nonetheless, he eventually would have had to make his way to _Holmgarð_ because Novgorod lay on the route to Staraja Ladoga from where he was to take a ship across the Baltic. In fact, Harald must have spent some time in the north of Russia because it was there that he would have assembled the ships and fighting-men to accompany his return to Scandinavia.
There can be no doubt that news of his return from Byzantium would have been carried northwards long before he left Kiev, while stories of his exploits in the east had assuredly reached Russia long before he did and had already begun to build a reputation which was to attract some numbers of professional warriors seeking to share in such profitable battle-glory. Despite the doubtful authenticity of some of the saga stories, the fact of their being so numerous and so enthusiastically endorsed by the skalds can only confirm the genuine substance of a remarkable military record. So, too, their emphasis on Harald's guile and resourcefulness would have had a particular appeal to the Scandinavian military mind-set, while a Russian warrior would have been most impressed by what he heard of Harald's prominence in the imperial guard, his brushes with Maniakes and his part in the downfall of an emperor. There is every likelihood, then, of Slavic Rus, and perhaps even Finno-Ugrian, warriors having been included with Scandinavians in the force he was to raise in Novgorod where talk of his coming would have been abroad before the arrival of the man himself. Rumours of his looking to recruit mercenary forces and of the abundant treasury with which he would be ready to pay for them would have offered a welcome prospect in Varangian circles – and especially since Jaroslav's relocation of his power base to the middle Dnieper had so diminished his formerly voracious appetite for northern mercenaries.
However elaborated those rumours of Harald had become in the course of repeated and ever more enthusiastic retelling, the eventual arrival of the man himself can only have fulfilled their promise. If any in Novgorod still remembered the fifteen-year-old princeling of some fifteen years before, they would scarcely have recognised in him the full-grown man returned from the east with his own _druzhina_ of battle-hardened veterans from the Varangian Guard at his back and a heavy purse of Byzantine gold at his belt. Now into his thirtieth year, Harald would have appeared very much as Snorri describes him in the saga: 'Handsome and of distinguished bearing, with a fair beard and long moustaches [as was the Slav-influenced fashion among east-farers]. One eyebrow was slightly higher than the other. His hands and feet were large and well proportioned.' Even though it is hardly possible that Harald was as tall as the five ells claimed by Snorri (a figure probably construed from the 'seven feet of earth or as much more as he is taller than other men' said to have been promised him by the English Harold before battle was joined at Stamford Bridge), he evidently was a man of towering physique, whose appearance would have been enhanced by the splendid Byzantine apparel and richly decorated weaponry and war-gear he had brought back from Grikaland.
In Novgorod and Ladoga, he would also have been ideally placed to hear the latest word from around the Baltic and with especial interest when it bore on his nephew's warfaring. Thus he would have already learned of Magnus' devastating defeat of the Wends and of his having made Svein Estridsson his Danish jarl ('just as Cnut the Great had set Jarl Ulf, his [Svein's] father as chieftain over Denmark while he himself was in England', according to Magnus' saga in _Heimskringla_ ) – at least until Svein rose up in arms to assert his own claim to the kingship of Denmark.
In the autumn of 1045 Magnus inflicted a decisive defeat on his Danish rival in battle off Helganess on the eastern coast of Jutland, Svein took flight to Sigtuna where he found refuge at the Swedish court and Harald evidently decided it was time to make his move. Snorri's saga quotes a strophe from the skald Valgard of Voll who had been with Harald since Miklagard and now sailed with him across the Varangian Sea . . .
Laden with the richest cargo, you
launched your swift ship, Harald,
carrying gold from Gardar –
hard-won with honour – westward.
Through storm and gale you steered,
sturdy chieftain. Ships wallowed
deep until at last, through thinning
spindrift, you sighted Sigtuna.
## III
## _Hardrada_
## _Scandinavia, 1045–1065_
Harald's voyage from Russia to the Scandinavian mainland in the later autumn of 1045 was a sea-crossing of some 400 miles and little more than a week's duration – even when allowance is made for the 'storm and gale' recalled in Valgard's verse, yet it represents a passage of such significance in his warrior's way as to be considered a 'sea-change' in the fullest sense of that term. Throughout the previous ten years 'we can be sure he spent most of the time with harness on his back' (to borrow Gwyn Jones' evocative turn of phrase), '. . . [as] a professional who fought in any theatre of war to which his employer sent him'.1 Now he was a warlord in his own right, with a reputation and a treasury which were already assuming legendary proportions, and driven by the ruthless ambition for which history would remember him as Harald Hardrada.
It can only have been that ambition – as yet, of course, cloaked with his characteristic guile – which had brought Harald to the court of the Swedish king Onund Olafsson at Sigtuna and to his first encounter with the man whom the saga calls by his patronymic name-form of Svein Ulfsson. 'Harald and Svein were greatly pleased to meet as they were related by marriage' – as, indeed, they were when Harald's Russian wife was a daughter of Onund's sister Ingigerd and Svein's mother Estrid was half-sister to Onund's father, Olaf.
From this point onwards in the saga narrative great attention is paid to kinship by marriage, and necessarily so because it formed a complex network of relationships crucial to the course of political history in early medieval Scandinavia. Indeed, Svein's own claim on the Danish kingship derived from his mother who was a full sister to the mighty Cnut (as well as half-sister to Olaf of Sweden), and his father, Ulf Thorgilsson, had been the jarl entrusted with his realm of Denmark while Cnut himself was most concerned with his new kingdom in England. By way of surety for his jarl's good behaviour, Cnut kept Ulf's two sons with him as hostage and so Svein passed his younger years at the English court. While his brother Beorn stayed on as an earl in England, Svein was drawn back to Scandinavia and, at some point after his father's assassination at Roskilde around the year 1028, he returned north to spend some twelve years in the service of his cousin Onund in Sweden.
Throughout most of those years, Svein must have been watching and waiting while kingship in Denmark passed first to Hardacnut (Cnut's son by his Norman queen Emma) and then, after Hardacnut's death, to the Norwegian Magnus Olafsson. Whether or not there really had been an agreement between Magnus and Hardacnut to the effect that whichever of them survived the other should succeed to his kingdom and Svein honoured that agreement when he submitted to Magnus and became his jarl in Denmark (as the sagas claim), the Danes were apparently content to accept the son of Olaf the Saint as their overlord. Yet Svein himself was not long to share such contentment and soon enough found sufficient support to challenge Magnus in arms. Saxo Grammaticus claims Magnus defeated Svein on land and at sea in Jutland, while Snorri tells of Svein's defeat in three battles, the last of them fought off Helganess and resulting in Svein's flight back to the court at Sigtuna shortly before the arrival there of Magnus' uncle Harald, who was likewise in search of a kingdom.
So it was that the two would have found themselves with rather more in common than kinship by marriage and their discussions through long winter nights at the Swedish court would seem to have been passed in formulating the plan of action they were to launch in the coming spring. Snorri tells of all the Swedes having been Svein's friends by reason of his kinship to their royal house and of their becoming Harald's friends too, although more probably attracted by the reputation of a wealthy and battle-glorious warlord, as is implied by the skald Thjodolf's strophe quoted in the saga and telling of Harald's 'gold-laden ship from the east . . . oaken keel parting the billows; since that time, Olaf's kinsman, all the Swedes did aid thee'. Thus the 'large force' with which Svein and Harald launched their raiding cruise around Denmark in the spring of 1046 would have mostly comprised Swedish ships crewed by Swedes of viking inclination when it sailed down the east coast of Sweden to bear west around the coast of Skaane and strike at the islands of Zealand and Fyn – as recorded, presumably again at first-hand, by the skald Valgard in his three strophes quoted in the saga.
Valgard exults in wolves battening on the battle-slain in Zealand, bright fire burning houses and barns south of Roskilde, helmets tested and ornate shields shattered on Fyn island, and 'chains chafing the flesh of chattel maidens' as they are dragged to the ships. All of this was the stock-in-trade of the skald as war-poet, of course, and yet for Harald this ravaging of Denmark must have been his practical introduction to the viking raiding for which his countrymen had long been notorious at home as well as abroad. Unlike his sainted half-brother, who had been taken aboard his first viking cruise at the age of twelve, and for all his own wide-ranging education in the way of the warrior, Harald's only comparable earlier experience would have been the attacks on corsair shore bases in which he had engaged as a newly recruited Varangian mercenary with the Byzantine fleet in the Mediterranean some twelve years before.
For all the detail of plunder and slave-taking preserved in Valgard's verse, the principal purpose of this campaign against the Danish islands in the spring of 1046 was intimidation, firstly of the islanders themselves, intending to cow them into submission to Svein's claim to kingship, and secondly of Magnus, when it threw down a newly reinforced challenge to his sovereignty over Denmark. While that was clearly Svein's motive, Harald's interest in the expedition is less apparent because he had no claim on Danish kingship in his own right or he would have been recognised by Svein as a rival rather than an ally. Harald's sole claim to kingship at this time lay in Norway and so his purpose in terrorising Magnus' Danish subjects can only have been a demonstration to his nephew of his return to the northlands as a force to be reckoned with.
By 1046 Magnus Olafsson – said by Saxo Grammaticus to have been called 'Magnus the Good' by the grateful Danes, while Snorri credits the cognomen to the skald Sigvat – had been king of Norway for more than a decade. As a five-year-old child, he had been left in the care of Jaroslav in Novgorod when his father returned to Norway on the death-journey to Stiklestad in 1030, and was 'not yet eleven' (on the evidence of Arnor Jarlaskald) when he was brought back to Norway in 1035.
Having earlier promised lordship of his new Norwegian kingdom to both Kalv Arnason and Einar Tambarskelve, Cnut had decided to place his own young son Svein in the kingship even before Olaf came back from Russia – and indeed, had told Einar as much in England, prompting Einar to delay his own return home until after the blood-fray at Stiklestad. Thus it was in the respective capacities of boy-king and regent that Svein Cnutsson and his mother Ælfgifu (Cnut's English wife, called _Alfifa_ in the Norse) came to Norway from Denmark in the later summer of 1030 at the beginning of a five-year reign remembered almost exclusively, at least in the saga histories, for the oppressive rule and penal taxation which were to become so intolerable that their Norse subjects eventually drove them out.
There is widespread doubt among historians as to the reliability of the saga-makers' claims, not least because such policies would have been ultimately self-defeating when they could only alienate a subject people who had recently shown themselves capable of disposing of their own legitimate king. The true situation was more probably one of powerful native lords increasingly resentful of the imposition of an Anglo-Danish child monarch (especially one accompanied by his English regent mother) when one of their own kind might be so easily called back from his Russian exile. Then there was also the sense of national and personal guilt surrounding the martyrdom of Olaf, whose cult had gained ground at an almost unprecedented pace, and so the recall of a son to reclaim the kingship torn from his sainted father might even be seen as an act of reparation – especially when Kalv Arnason accompanied Einar Tambarskelve to summon the young Magnus home from Novgorod.
The most interestingly detailed account of their mission is that preserved in _Orkneyinga saga_ when it tells of Einar and Kalv confronted on arrival at Staraja Ladoga by Rognvald Brusason, who was only dissuaded from taking summary vengeance when he was assured of Kalv's repentance for 'his crime of killing King Olaf the Saint'. Learning of the reason for their coming to Russia, Rognvald accompanied the pair to Novgorod and their meeting with Jaroslav, who recalled what had befallen Olaf on his return to Norway and was thus unwilling to place the son at risk of any similar fate. Only when the Norse contingent swore solemn oaths of their good faith was Magnus given leave to return to his homeland – and with the added assurance of the trustworthy Rognvald as his escort.
Once Magnus was back in Norway and acclaimed as king of the whole country, _Orkneyinga saga_ turns its attention to Rognvald who returned to Orkney around the year 1037 after he had had news of the death of his father, Jarl Brusi. For some eight years, Rognvald shared the jarldom with his uncle, the famously mighty Thorfinn, the two even going together on viking raids west-over-sea until they came into violent contention over Thorfinn's demands to add a greater share of the islands to his mainland possessions in Caithness. The saga tells of Thorfinn's victory at sea in the Pentland Firth followed by Rognvald's flight to Norway to seek assistance from Magnus and his return to Orkney with a force of Norwegian housecarls. Even that formidable reinforcement was unable to protect him when conflict with Thorfinn was renewed in a sequence of reciprocal house-burnings before Rognvald was slain on the isle of Papa Stronsay in the Yuletide season of 1046.
Throughout that same period, of course, Magnus reigned as king of Norway and, after 1042, of Denmark also. Curiously, some of the most closely contemporary evidence for his reign is to be found in another Orkney-related source, namely the praise-poetry composed by Arnor Jarlaskald on a visit to the Norwegian court, probably made in the spring of 1047. Snorri's _Magnus the Good's saga_ quotes Arnor's verses on more than one occasion and they evidently represent a principal source for his account of Magnus' war on the Wends. Arnor acclaims Magnus as the 'scion of heroes, [who] harried the Wendish homeland', and yet would seem to make no specific reference to his attack on 'Jomsburg' (the fortress base of the doubtfully historical 'Jomsvikings', whose celebrity rests almost entirely on the fictional _Jomsvikinga saga_ ) claimed by the sagas. Adam of Bremen, on the other hand, records Magnus' laying siege to _Jomne_ , 'the richest city of the Slavs' and this apparent confusion among the sources is most convincingly disentangled by Gwyn Jones when he identifies the 'Jomsburg/Jomne' stormed and burnt by Magnus in 1043 as Wollin at the mouth of the Oder, 'whose inhabitants, by now predominantly Wendish, but no doubt still retaining a Danish element more sympathetic to Svein [Estridsson] than to any Norwegian, had thrown off their allegiance [to Magnus]'.2
Magnus' most celebrated triumph over the Wends, however, was the battle fought on Lyrskov Heath (called _Hlyrskogs Hede_ in the saga and located northwest of what is now Schleswig) where he was operating in alliance against a common enemy with his sister's Saxon husband Ordulf when the Wends invaded southern Jutland. He brought his fleet to Hedeby where his forces disembarked to join up with Ordulf's Saxons for an attack on the rear of the Wendish host and Snorri tells of Magnus inspired by a vision of his father the saint to throw aside his mail and lead the attack 'wielding the battle-axe _Hel_ which had been Olaf's own' (a claim supported by Arnor's lines: 'With broad axe burnished and byrnie cast off, for battle eager, with both hands the haft of Hel he grasped'). With or without such supernatural assistance, Magnus' forces and their allies won a famous victory over superior numbers. Snorri's saga tells how 'it was said that there had never been so great a carnage in the northlands in Christian times as that of the Wends on Hlyrskogs Hede' and Adam of Bremen, who was writing within living memory of the battle, records fifteen thousand Wendish dead.
There is no reason, then, to doubt Magnus' record of genuine military achievement – not only against the Wends but also against Svein's challenge to his sovereignty over Denmark – and yet the enthusiasm for his personal battle-glory expressed across the full range of sympathetic sources might still be read as an attempt to compensate for a shortfall in his warrior reputation, and most especially by comparison with that of his east-faring uncle. Magnus had acquired his kingship of Norway and of Denmark by invitation not conquest, while he had been a mere child sheltering in Russia when his uncle was shedding blood beside Olaf on the battlefield at Stiklestad.
All of which needs to be borne in mind when Snorri's _Harald's saga_ tells of Magnus having returned to Norway after his victory off Helganess and there learning of his uncle's arrival in Sweden to forge an alliance with the man he thought to have so recently and so decisively defeated. In the following spring Magnus is said by the saga to have raised a levy of troops in Norway and to have mustered a great army even before he had news of his Danish subjects submitting to Harald and Svein's onslaught on Zealand and Fyn. Snorri once again takes the opportunity to report Harald's reputation – 'so much taller and stronger than most men, and so shrewd that he won the victory wherever he fought, and so rich in gold that no-one had ever seen the like of it' – which was doubtless already well known to Magnus and his court. While a quoted strophe from the skald Thjodolf exults in the prospect of 'death-dealing Magnus from the northward mustering his roller-horses [warships], whilst from the southward Sigurd's son makes ready his sea-steeds [ditto]', wiser counsel in Norway feared grievous consequences throughout the northlands if Olaf's son and brother were to make war upon each other and proposed instead that emissaries be sent with speed and in utmost secrecy to Denmark where trustworthy friends could be found to open negotiations.
The proposed terms of reconciliation – a half-share in the kingship of Norway and an equal apportionment of their combined treasury – were probably what Harald was hoping for and certainly the best he could reasonably expect, so word of his inclination to acceptance was brought back, under the same cloak of secrecy, to Norway. Evidently Harald now had what he wanted and so could dispense with Svein, yet it would be hardly seemly for a saga-maker to impute such casual treachery to his hero and so Snorri contrives an anecdote fully typical of northern tradition as his device of justification. While in conversation together one evening with drinking-horns in hand, Svein inquires of Harald which of all his treasures he most greatly values. Harald declares it to be his banner, the famous Land-ravager said to bring victory to the man before whom it is borne in battle and which has been of that same service to him ever since he came by it. Svein professes scepticism and refuses to believe any such tale before Harald has carried the banner to victory in no less than three battles against his nephew. To which Harald counters that he knows full well of his kinship with Magnus and, indeed, of no reason why they might not yet enjoy a more congenial meeting than the current state of contention.
Not unexpectedly, this exchange engenders mutual suspicion, and on Harald's part to the extent of leaving a log in his usual bed aboard ship while choosing another sleeping-place for himself. In the dark of night, an unknown man finds his way on to the ship to strike at Harald's bed with a great axe which is discovered fixed deep in the log before dawn on the following morning. It is clearly time to flee such a treacherous ally and Harald immediately summons his own men to put to sea under cover of darkness and row north along the coast until reaching the place (presumably around the Vik) where Magnus is encamped with his forces. Another strophe quoted from Thjodolf tells of a joyful reunion between the two and confirms Magnus' offer to share his kingdom with his uncle.
The saga narrative continues now with two anecdotes seemingly intended to illustrate the agreed division of Magnus' kingship and Harald's wealth. In the first of these, Magnus comes to his uncle's camp and distributes gifts of garments, gold and weaponry to the attendant warriors before inviting Harald to choose between two proffered reed-straws. When the choice is made, Magnus gives it into his uncle's hand and with it 'half of Norway, together with the dues and duties of all estates within it', yet retaining the royal precedence in protocol for himself whenever the two are together.
All of which being gracefully accepted, the new joint-kingship is announced to a public assembly on the following day and celebrated with a banquet which provides the setting for the second of Snorri's anecdotes. To this lavish feast Harald brings his vast wealth, carried in great chests which are emptied out on to a vast ox-hide on the floor and from this he takes up a piece of gold as large as a man's head, inviting Magnus to produce gold of his own to compare with it. The best he can offer is the golden ring about his own arm, which Harald considers a meagre token of the wealth of a man who holds two kingdoms and adds the provocative suggestion that there are those who would even question his claim to that small item. When Magnus insists on his undeniable right to an arm-ring given him by his father, Harald counters that Olaf had originally taken the ring from his own father, Sigurd Syr. A strophe from the skald Bolverk celebrating the 'close accord reached peacefully' between those kinsmen and predicting strife for 'the usurper Svein' is placed as the conclusion to Snorri's anecdote, yet it cannot disguise the first trace of rancour introduced into the relationship between the two kings of Norway.
According to Snorri, the two spent the winter on tribute-collecting circuits (an activity long since familiar to Harald) throughout the Upplands and northward to Nidaros and the Trondelag. Some of these were conducted together, others separately and Snorri tells how each also kept his own separate court. Yet they were together in the same hall when they received a visit – recorded in _Morkinskinna_ – from the skald Arnor who had come from Orkney bringing two praise-poems he had composed in their honour. Arnor first recited his _Magnusdrápa_ , obviously one he had prepared earlier since it appears to have been largely concerned with Arnor's own experiences with the Orkney jarls before celebrating Magnus in its concluding strophes. Even then, when Arnor declares that no king will be so great as he before the sky is rent asunder, his lines seem to be merely recycling closely similar terms of acclaim previously addressed to Jarl Thorfinn – but such must very often have been the way of the working skald on tour. Magnus was sufficiently impressed to express his appreciation with the gift of a gold arm-ring, while Harald, possessed of his own special expertise in the skaldic art, judged the verses addressed to Magnus quite superior to Arnor's _Blágaladrápa_ ('Lay of the Black Goose' and perhaps a kenning for the raven on the battlefield) composed in his own honour. Nonetheless, he similarly rewarded the skald with a gold-inlaid spear on receipt of which Arnor promised to compose a memorial lay if he should outlive him – and, indeed, so he was to do some twenty years hence.
'It was not to be long, though,' according to Snorri, before the two kings were at odds, as is demonstrated in his saga by an anecdote telling of their two fleets assembled to collect tribute from Denmark and both at sea heading for the same unspecified destination. As it happened, Harald put his ships into harbour before Magnus' arrival and chose to moor them in the royal berth customarily reserved for his nephew's vessels. So affronted was the younger king by this disregard for protocol that he ordered his warriors to arms. Feigning alarm – 'Nephew Magnus is angered!' – Harald commanded his own ships to be cut loose from their moorings and only afterwards came with a warrior retinue aboard Magnus' ship where the two engaged in another exchange of taunts. The resemblance to that earlier dispute over choice of camp-site on campaign with Georgios Maniakes is so striking as to suggest the story (interestingly omitted from versions of the saga found in _Morkinskinna_ and _Flateyjarbók_ ) as another example of a formulaic device serving to illustrate a relationship between co-rulers which really had begun to founder.
Indeed, Snorri virtually confirms as much when he suggests this being just one example of many similar disagreements between the two whose difficult relationship was being further aggravated by rival court factions. None of which seems to have greatly hampered the royal progress to Denmark, where Svein Estridsson, who had been collecting tribute from the Danes while the two kings were otherwise engaged through the winter in Norway, made a swift departure to Skaane on learning of the Norwegian fleet's approach. His absence enabled an apparently uncontended circuit of Denmark for Harald and Magnus who spent the greater part of the summer taking the submission of their Danish subjects before they came to Jutland in the autumn and it was there – 'at a place called Suderup' in the last week of October – that Magnus fell sick and died.
While the vision of his sainted father which attended Magnus' passing is recorded in full detail with dialogue by the saga, greater historical importance can be attached to the account of the death-bed bequest of his Danish kingdom to Svein and prompt despatch of a kinsman to inform Svein of these last wishes. To Harald, of course, Magnus bequeathed his share of the kingship of Norway, thus tempting suspicion as to the true cause of death and the possibility of his uncle having had some part in it, yet nowhere in the sagas, nor in the more formal histories, is there even the faintest hint of such guilt on Harald's part. Had there been any such rumour, however doubtfully founded, Adam of Bremen and other sources unrelenting in their hostility to Harald would most certainly have seized upon it and so his succession as sole king of Norway was evidently accomplished in all innocence, even though it would soon bring him into contention with the formidable Einar Tambarskelve.
Now some sixty-five years of age, Einar 'Paunch-shaker' had been prominently engaged on all sides of the struggle for power in Norway through almost half a century. Renowned as the strongest man and finest archer in the northlands, he had fought beside Olaf Tryggvason when the kingdom fell from his hand at the battle of Svold in 1000, and yet was still held in such high regard by the victorious Jarl Erik Hakonsson of Lade as to be given the jarl's sister Bergljot in marriage. High-born and wealthy in his own right, Einar was endowed by the jarls of Lade with such great landholdings in Orkadal that he was to become the most powerful man in the Trondelag.
When Jarl Erik followed his brother-in-law Cnut to England in 1012, he appointed Einar as guardian (and effectively regent) for his teenage son Hakon who was to govern western Norway in his stead, while his brother Svein remained jarl of the eastern provinces. Young Hakon was driven out to join his father in England as soon as Olaf Haraldsson returned to make his bid for kingship of Norway in 1015, so it was Einar who stood beside Jarl Svein in resistance to this new King Olaf, and it was Einar's grappling-hook which pulled Jarl Svein's ship to safety when Olaf triumphed at the battle of Nesjar in the following year. The two subsequently made their escape to Sweden where Svein died in that same autumn and Einar stayed on for some six years until making his peace with Olaf and returning to the Trondelag where he was restored to his own lands and to those of his wife's dowry. In about 1023, however, Erik died in Northumbria (where he had been Cnut's earl since 1016) and news of his death may very well have prompted Einar's journey to England where he was made welcome not only by his nephew Hakon but also, and with especial generosity, by the great Cnut himself who was probably already planning to move against Olaf in Norway.
In the event, of course, Olaf played directly into Cnut's hand when he allied with Onund of Sweden to launch an expedition against Denmark. Probably apprised of Cnut's intentions and feeling himself under no obligation to his Norwegian king, Einar absented himself from Olaf's enterprise and stayed at home to await developments. There he was well placed to welcome the arrival of Cnut's agents who came with gifts and promises to grease the slope of Olaf's descending fortunes in the aftermath of the battle of Holy River, and so he was to be again in the following year of 1028 when Cnut himself arrived to lay all Norway in his power. The flight of Olaf into exile in Russia and the return of Hakon as Cnut's jarl in Norway placed Einar firmly in the ascendant with the assurance that he and his son Eindridi were to be the most powerful men in the kingdom excepting only Jarl Hakon.
Thus when Hakon was drowned at sea, Einar had every expectation of succeeding him as jarl over Norway, even travelling to England in high hopes which were to be dashed, of course, when Cnut announced his intention to replace Hakon with his own son by his English wife. Evidently feeling no great urgency to make his own return to Norway, Einar was still out of the country when Olaf returned from Russia to meet his death at Stiklestad and when he did come home he found himself recognised as a great power in the land, a position he was able to further secure by his encouragement of the already burgeoning cult of Olaf the Martyr. Having placed himself in the forefront of the resentment building up against young Svein and his mother Alfifa, Einar was the natural choice of leader for the diplomatic mission which brought Magnus Olafsson back from Russia and, true to the oath he had sworn before Jaroslav in Novgorod, Einar gave his unswerving support to the new king throughout all twelve years of his reign – and, indeed, even after his death.
Harald's own response to the sudden demise of his nephew clearly sprang from ambition rather than sentiment. The saga tells how he considered Denmark also to be part of his legacy due from Magnus and so summoned all the warriors together, announcing his intention of going in force to the Vibjorg _thing_ , and of having that great assembly acclaim his kingship of the Danes before proceeding to subjugate the whole country. With the full support of his forces, he intended to ensure Norwegian sovereignty over Denmark for all time, but that support was to be denied him on the instigation of Einar Tambarskelve who makes his first appearance in _Harald's saga_ with the declaration that his own first duty was to bear King Magnus' body to its final resting-place before fighting wars in pursuit of another king's domain. It was better, he believed, to honour Magnus in death than any other king alive and he proceeded to array the body in fine robes and lay it out in clear view from Harald's ship.
All the men of the Trondelag followed Einar and most of the other Norwegians followed them to make ready the fleet for the solemn journey home. Finding himself now with no army at his command, Harald had no option but to return with them to Norway, yet no sooner had he put into the Vik than he set out westward on a royal progress, summoning assemblies in every province to acclaim his kingship over all the land, while Einar led the Trondelag contingent home to bury Magnus in St Clement's church where his father Olaf already lay enshrined. At which point in the saga narrative, Snorri pauses to enter his own obituary expressing full agreement with those of all the earlier sources in commemorating the nobility, courage and generosity of 'the most popular of kings, praised by friend and foe alike'. Presumably those former foes included Svein Estridsson who had been about to abandon his claim to kingship of Denmark when he was brought news of Magnus' dying wish that he should inherit the kingdom and also of the entire Norwegian host having now left the country. Vowing that so long as he should live he would never again flee the kingdom, Svein raised a force in Skaane to accompany his own royal progress accepting submission of his people.
By the following spring, then, there were two claimants convinced of their right to kingship of Denmark, and one of them already assembling the forces with which to assert his claim because Harald is said by the saga to have called a levy throughout Norway, mustering half those ships and men to sail south and spend the summer plundering and burning Jutland. Snorri quotes a half-strophe of Harald's own composition, telling of his ships lying in _Gothnafjord_ (now Randersfjord) while night-linened ladies lulled their husbands with song, and completes it with a half-strophe by Thjodolf promising to cast anchor further southward the following year. A further quotation, this one from the skald Bolverk describing 'the sea-steed, plunder-laden . . . on the darkling deep', apparently celebrates the same expedition, and lines ascribed to a lesser-known Icelandic skald called Grani exult in vengeance taken on the daughters of one Thorkel Geysa. These women, who had earlier mocked Harald's threat to Denmark, were carried off from their father's burning farmstead to the ships and returned only on Thorkel's payment of a huge ransom.
Thjodolf's lines foretelling repeat performances 'further southward next summer' are borne out by the saga when it goes on to record Harald's leading another such expedition against Denmark in the following raiding season and in every subsequent summer for almost a decade and a half. 'Each year the Danes trembled' according to the skald Stúf, and yet Svein had sworn that he would never relinquish his rightful claim and neither were his people ever to accept Harald as their king. After the raid of 1048, Svein threatened to launch his own fleet against Norway and there wreak the same havoc Harald had been inflicting on Denmark, unless he would agree either to a peace treaty or to a battle which would finally decide the dispute.
The challenge was to meet in battle on the Gaut Elf river (which marked the borderline between Norway and Danish territory on the Scandinavian mainland) in the following summer and both kings spent the winter preparing their ships and men for the contest. In the event, Harald brought his forces to the appointed place only to find Svein's fleet lying away to the south off Zealand. Perhaps suspecting that Svein had lured all the Norwegian forces into the Kattegat so as to leave Norway itself defenceless against his own fleet, Harald sent the greater part of his bonder levy home, while leading a select force made up of his own hird, his lendermen and the bonders with homes nearest to the Danish border on a raiding foray south of the Skagen headland to Thy province and across Jutland to plunder the great trading township of Hedeby. All of this is confirmed by the saga's quotation of verses attributed to the skald Stúf and Thorleik the Fair, an Icelandic skald visiting Svein Estridsson's court, but perhaps most vividly and certainly most immediately by lines attributed to an anonymous Norse warrior who tells of standing on the northern extremity of the town's rampart before dawn and watching 'high flames up out of houses whirling'.
Gwyn Jones suggests that destruction of Denmark's principal marketplace 'may appear a self-strangling exercise for a man ambitious for the Danish throne', before adding that 'burning towns came naturally to Harald . . . and if we can trust to Snorri the expedition of 1049 had terror and loot as its primary objectives'.3 Having plundered Hedeby and left it aflame, Harald's fleet of sixty ships was sailing northwards laden with booty when Svein appeared on the coast of Thy with a large force and a challenge to do battle onshore. Realising his own crews were hopelessly outnumbered, Harald replied with a counter-challenge to a sea-fight (this exchange confirmed by a strophe from Thorleik quoted in the saga). By now it would seem to have been getting late in the day and a change in the wind left Harald's ships lying off the island of Læso where thick sea-fog came down as night fell.
As the sun rose on the following morning, however, its light picked out the approaching dragon prows of a huge Danish fleet and Harald ordered his men to take to the oars and put out to sea, but their ships were waterlogged and heavy with the plunder from Hedeby while the enemy fleet was already threatening to overtake the best efforts of their oarsmen. So a new order was given to throw some plunder overboard to hinder the enemy's progress by tempting them to retrieve abandoned booty from the water. Determined not to be cheated of his advantage by such a ruse, Svein urged his ships on in pursuit and Harald ordered heavier items of cargo thrown overboard to lighten the load and increase the speed of flight, but the enemy fleet was still gaining on them and it was then that Harald came up with his master-stroke of throwing Danish captives overboard. When he saw his own people floundering in the waves, Svein could do no other than break off the chase to let his crews rescue as many as possible of their countrymen from the water – and allow most of the Norwegian fleet to make their escape. Thus deprived of what might have been a decisive victory, Svein saved at least some face when he came upon just seven enemy vessels, manned by levied bonders and lagging behind the main fleet off Læso. Snorri's story concludes with a quoted strophe from the skald Thorleik (in Svein's service, of course) mocking the bonders as they begged for quarter and offered ransom, presumably to be paid out of plunder taken on the raiding, in exchange for their lives.
While there is no doubt as to the historicity of Harald's onslaught against Hedeby in 1049 – and especially when archaeological evidence confirms the burning of the town – the account of his fleet's escape as preserved in the sagas depends largely on two strophes of Thorleik's verse. It is curious, then, that Saxo Grammaticus records a suspiciously similar encounter, also dated to 1049 but located on the Djurså river, where Svein had managed to muster an army against the raiders, but one scarcely adequate either in numbers or experience to face a battle-hardened enemy. So terrified were they of the approaching Norwegians that the Danes jumped into the river rather than face the oncoming foe and, indeed, many of them were drowned. Saxo was the son of a distinguished Danish military family, so there is reason to respect his authority in this instance and yet it is possible that his account refers to a quite different incident, even though it seems unlikely that such an extraordinary encounter would have passed unnoticed by Harald's skalds and thus escaped the attention of the saga-makers.
This regular raiding of Denmark apparently continued, presumably on an annual basis, for another thirteen years and yet it takes up very little further space in the saga record. In terms of strictly military history, the 1050s might even be considered the least interesting decade of Harald's warrior's way if his transition from Varangian mercenary to Scandinavian warlord resulted in little more than a reversion to the piratical custom of his viking forebears.
In which case, his years of experience in Russia and throughout the Byzantine Empire would seem to have made the least impression on his early performance as a warrior king and yet their influence is rather more evident in other spheres of his governance. His fiscal policy – assuredly inspired by the Byzantine example – is credited with developing a true coin economy in Norway and archaeological evidence from coin-hoards attests the numerous mints established during his reign. The famous wealth he had brought back from the east was quite certainly the source of the Byzantine coins struck for emperors from Basil II through to Constantine IX and imitated on Danish currency of the eleventh century. Of which the outstanding example is a Danish silver penny of Svein Estridsson dated to _c_. 1047 and carefully copied from a rare gold _histamenon_ of Michael IV, part of a limited issue and thought to have reached Scandinavia in Harald's treasury where it was probably a part of his reward for services rendered on the Bulgarian campaign of 1041.4
Similarly also, his network of contacts in Russia must have facilitated the expansion of Norway's trade along the east way in his reign and the example of the Russian traders he had known in Novgorod and Kiev may well have inspired the expansion of Norwegian trading around the North Atlantic. Into that context must be placed a curious remark made by Adam of Bremen in his _Description of the Islands of the North_. Describing the frozen sea 'beyond Thule [Iceland]', he writes of 'Harald, the well-informed prince of the Norwegians, [having] lately attempted this sea. After he had explored the expanse of the Northern Ocean in his ships, at length there lay before his eyes the darksome bounds of the world's edge and by retracing his course he barely escaped the vast pit of the abyss in safety.'
The skaldic verses which represent immediately contemporary evidence for Norsemen reaching the North American continent have been dated to the early eleventh century and Harald's contact with Iceland would assuredly have kept him informed of exploration to Greenland and beyond, so it is not impossible that he might have been tempted to follow in the wake of the Vinland voyagers. Had he actually done so, of course, his skalds would have surely celebrated the adventure and yet no such verses have survived even long enough to reach the attention of the saga-makers. Thus Adam of Bremen's claim for Harald's North Atlantic venturing rests entirely upon his own authority and yet his writings demonstrate a well-informed interest in the subject and so cannot be dismissed entirely out of hand.
It is in the ecclesiastical orbit, however, that the eastern influence is best recorded and here the saga account of Harald's church-building at Nidaros is not only rich in detail but reliably supported by more recent archaeological investigation. Snorri tells of Harald having completed construction of the church dedicated to Olaf by Magnus but left unfinished at the time of his death, and building two churches of his own, one dedicated to St Gregory beside his royal residence on the banks of the River Nid and a St Mary's church (interestingly bearing the same dedication as the earliest Varangian chapel in Constantinople) on the site where Olaf's remains had lain through the winter following his martyrdom.
There is every reason, of course, to assume Harald's genuine interest in memorials to his kinsman Olaf, who was already effectively established as Norway's patron saint and whose cult was ever more widely revered throughout the Scandinavian world within a few decades of his martyrdom. Yet it would be fully characteristic of Harald to have had a more political motive when every opportunity of association with the saint would more securely establish himself as a worthy successor in the kingship. In so doing, he would surely have been inspired by the example of Jaroslav and particularly by his magnificent Hagia Sophia which Harald had seen under construction in Kiev and in which he would have recognised a reflection of the prestige of the Grand Prince no less clearly than a monumental dedication to the Holy Wisdom.
While the reverence of Olaf as saint and martyr had finally established Christianity in Norway by the mid-eleventh century, the Christian tradition with which Harald himself would have been most familiar after spending so much of his adult life in Russia and Byzantium would have been the eastern Orthodox faith, so it is unsurprising that he invited eastern churchmen to his Norwegian court and arranged for them to visit Iceland also. Their presence in Scandinavia evidently incurred disapproval not only from the archbishop of Hamburg (which met with a typically defiant response), but evidently also on the part of the papacy itself when a papal legation was sent in protest to Harald's court and promptly thrown out. All of which would very well correspond to the closing line of the account of _Araltes_ in the _Book of Advice to an Emperor_ in which he is complimented on having 'maintained faith and friendship towards the _Rhomaioi_ [the Byzantines] when he was ruling in his own land'.
Curiously, Snorri makes no reference to eastern churchmen in Iceland, but he does pay full tribute to Harald as 'a great friend to all Icelanders', telling of his sending four ships with cargoes of flour to a famine-stricken Iceland (thus dating the voyage to 1056) and of his gift of a bell for the church at Thingvellir. It has been suggested that Harald's generosity to the Icelanders was still more generously repaid by the accounts of him in Icelandic sources, and it may well have been so, especially in view of his patronage of so many court-poets from that country. This was very probably what Snorri meant by 'his great many acts of generosity to the people who stayed with him', and yet the only Icelanders mentioned by name in this passage are Harald's long-standing lieutenants, Halldor Snorrason and Ulf Ospaksson.
Both had served with Harald throughout most of his time in Byzantine service and both returned with him to Norway. Ulf came of an old Icelandic family (ultimately descended from Ketil Bjornsson, called 'Flatnose', a Norse king in the Hebrides in the mid-ninth century whose offspring were among the earliest settlers in Iceland) and was a nephew of Gudrun Osvifsdottir, heroine of _Laxdæla saga_. His remarkable loyalty to Harald through some three decades in his service was justly rewarded in Norway where he was appointed the king's marshal, made a lenderman in the Trondelag and given Jorunn, daughter of Thorberg Arnason, as his wife. Snorri makes particular mention of Ulf's shrewd judgement, which is most evident in military matters and even to the extent that had he not died so early in the year 1066 Harald's warrior's way might not have come to an end in the manner that it did.
Ulf's comrade-in-arms, Halldor Snorrason, was a man of very different personality. Snorri tells of his huge build and powerful strength, yet frankly admits his personality to have been 'blunt, outspoken, sullen and obstinate'. Clearly Halldor was never going to be the most diplomatic of courtiers and so it is hardly surprising that some five years at the Norwegian court were to prove quite long enough and sometime around 1051 he returned to Iceland where he lived to a great age on his farm at Hjardarholt enjoying celebrity as a famous storyteller. Even while in retirement in Iceland, Halldor would still seem to have been in contact with Harald, even though his departure from the Norwegian court is said to have involved a dispute with the king over payment due (according to the _Tale of Halldor Snorrason_ in _Morkinskinna_ ), a tradition not unconnected with Harald's increasingly imperious conduct reported in the saga. Even his favourite skald told how the king would brook no opposition to his demands and Snorri quotes a full strophe from Thjodolf telling how 'neither could the king's own men go against his wishes'.
If it was this aspect of his regal personality which prompted Adam of Bremen to call Harald a 'tyrant' and allowed later historians to endow him with the cognomen _harðraði_ – whether translated as 'hard counsel' or as 'ruthless' – the same autocratic mind-set was to prove his first line of defence against the hostile native elements who had challenged Norwegian kings throughout the first decades of the eleventh century and brought down his half-brother Olaf as they had Olaf Tryggvason before him. The focal point of that hostility still lay around the Trondelag, long the heartland of the jarls of Lade and where now Einar Tambarskelve, himself son-in-law to the mighty Jarl Hakon, represented their effective successor in all but title. Although most often hostile and only nominally conciliatory to Olaf, Einar had reclaimed the kingship of Norway for Olaf's son in 1035 and remained staunchly loyal to 'Magnus the Good' thereafter, yet he clearly had no similar regard for his successor (even though Einar's son Eindridi was married to a daughter of Harald's sister, Gunnhild).
Skilled in law-dealing, Einar took any and every opportunity to speak for the Trondelag bonders against the royal officers at assemblies, even in the presence of the king himself. That attitude of defiance soon developed into a policy of deliberate provocation as the saga tells of his building 'a great following of men on his estates and bringing a still greater force with him when he came to Nidaros'. On one occasion, he is said to have brought eight or nine longships with a force five hundred strong which he boldly disembarked and marched through the town in full view of the king's residence. This scarcely veiled challenge prompted Harald to compose some lines of verse proclaiming his response to 'the mighty chieftain who means to fill the throne-seat':
Einar with his flailing blade
will drive me from my kingdom
unless he is forced to kiss
the axe's thin-lipped edge.
Here, then, was a king who intended to take no prisoners and awaited only the opportunity to arrange the axe-kissing he had promised in his poetry.
While there is no doubt as to Harald having arranged the killing of Einar, and of his son Eindridi with him, the saga record supplies two quite different accounts of how it happened. The version found similarly in _Morkinskinna_ and _Flateyjarbók_ tells of Einar being invited to a feast at Nidaros where he falls into a drunken sleep while a skald is celebrating the king's adventures. Harald has a kinsman suddenly wake him with a straw applied to his nostrils and in a state of embarrassment so acute that Einar takes revenge by killing the offender the next morning, providing the king with just reason to put both him and his son to death.
The alternative version of the story is found in Snorri's _Heimskringla_ and independently in _Fagrskinna_ , suggesting its likely origin in Norwegian (as distinct from Icelandic) tradition. The tale itself is of some more convincing character too, telling of a man in Einar's service, and standing high in his favour, caught thieving in Nidaros. When the accused was brought to face justice, Einar accompanied him with a heavily armed retinue to take the fellow away from the court by force. Confrontation with the king was becoming unavoidable now and mutual friends sought to arrange a conciliatory meeting between the two. Trusting in his son's kinship by marriage to the king's family as his own safe conduct, Einar arrived at the royal residence, but left Eindridi outside in the courtyard with others of his company while he entered alone, only to find himself trapped in a darkened chamber where Harald's warriors fell upon him and hacked him to death. Hearing the sound of weaponry, Eindridi rushed in to his father's aid, but was likewise struck down and fell dead beside Einar's body. Harald's housecarls formed up outside the entrance to forestall any attack by Einar's retinue, but there was no such attempt now that the Trondelag men were without a leader, so the king marched with his retinue to a ship moored on the river and was rowed away down the fjord.
When the news was brought to Einar's wife, Bergljot, she cried out for vengeance: 'Were Hakon here, those who killed my son would not now be pulling in safety downriver.' Hakon was the son of Ivar the White, a lenderman in the Upplands whose mother was also a daughter of the great Jarl Hakon and thus sister to Bergljot. If there was a man most able, and even obliged, to avenge Bergljot's husband and son it was this Hakon, a direct descendant of the jarls of Lade and said by the saga to have surpassed all others in Norway at that time in his courage, strength and accomplishment. Even while Einar and Eindridi were buried near to the tomb of Magnus in St Olaf's church in Nidaros, so great a hostility to Harald was abroad among the men of the Trondelag that there was already talk of armed revolt.
The king's form of response on this occasion was to be diplomacy, so he was in need of an emissary well placed to deal on his behalf and the man he chose was Finn Arnason. Second son of the powerful lenderman Arne Armodsson, Finn had remained staunchly loyal to King Olaf, following him to Russia and returning to stand in the front rank of his forces at Stiklestad. Whether or not he had fled back to Russia after the battle and afterwards returned to Norway with Magnus is left unclear by the saga record, but now, almost thirty years after Stiklestad, he was established as a lenderman in Austratt (north-west of Trondheimfjord) and as a figure of great standing in Harald's kingdom. Snorri tells of the king's great affection for Finn and his brothers and (with just one significant exception) there is no reason to doubt him, not least by reason of the bonds of marital kinship. Not only was Finn's wife the daughter of Harald's brother, Halfdan, but Harald had himself recently formed a close relationship with Finn's niece.
According to Snorri, Harald had been 'married again' in the winter of 1047/8, this time to Thora, a daughter of Finn's younger brother, Thorberg Arnason. There is no question of the historicity nor, indeed, the intimacy of Harald's association with Thora because she was to become the mother of his two sons – and ultimate successors – Magnus and Olaf, but its legitimacy as a 'marriage' is utterly suspect when there is nowhere any indication that Harald's marriage to his Russian queen had been dissolved and when Ellisif was not only still alive but was to outlive her husband. The true situation, then, can only have been that Thora had become Harald's concubine within months of his full accession as king of Norway. Again it might be possible to detect a Byzantine exemplar because Harald would surely have known of the tripartite arrangement between Constantine Monomachus, the empress Zoe and the Sclerena, and yet the one highly probable reason for his taking a second 'wife' may well have been the hope of securing a male successor.
The precise dates of birth of his offspring are nowhere recorded, but his two children fathered upon Ellisif were both daughters – Maria and Ingigerd – and it is fully possible that both had been born before his 'second marriage' to Thora, by which time Harald had been married to Ellisif for some five years and the urgency of producing a male successor must have been a matter of increasing concern to him, because longevity was not commonly characteristic of warrior kings. His half-brother Olaf had been just thirty-five when he was killed in battle, Olaf Tryggvason only about thirty when he fell to his death at Svold and even Cnut had not yet reached the age of forty at the time of his death. Harald was now already a year or two into his thirties and evidently lost no time in fathering male offspring upon Thora when his first-born son, Magnus, was old enough to go to war with his father in the year 1062. Neither was formal legitimacy of birth any essential qualification for succession in Norway in those times, if only on the evidence of his predecessor, Magnus, having been born to Olaf not by his queen, but by his 'hand-maid'.
Thus all the Arnason brothers were bonded to the king by ties of marital kinship, but Finn was by far the best placed to negotiate on his behalf with current dissident elements, firstly by reason of his own and his family's standing in the Trondelag, but also because of his old acquaintance with Hakon Ivarsson who had sailed with him on viking ventures west-over-sea several summers past. When Harald came to Austratt, the saga tells of Finn having welcomed him in good humour, although with the least formality when he chided the king as a 'great scoundrel'. If Finn were to go into the Trondelag and the Upplands as Harald's ambassador and there pacify men who hated the king so bitterly, he would want a reward for his service. Harald was prepared to grant any favour he chose and Finn asked that his brother Kalv be restored to his lands in Norway and given a safe conduct and the king's peace when he returned to live there again.
With whatever ultimate motive already in his own mind, Harald granted the favour requested and Finn went forth to accomplish his embassy with quite remarkable success. Accompanied by a retinue nearly eighty strong, he came to the Trondelag men and reminded them of the evil consequences which had befallen the land the last time they had risen in arms against their king. Warning against letting their hatred of Harald push them into the same mistake again, his oratory – and the king's promise to pay compensation for the killing of Einar and Eindridi – persuaded them to take no further action, at least until they heard of Hakon Ivarsson's response to the appeal made to him by Einar's widow, Bergljot.
Finn travelled on over the Dovre mountains into the Upplands where he first sought the advice of his own son-in-law, the jarl Orm Eilifsson, who was himself the son of a daughter of the mighty Jarl Hakon of Lade. Jarl Orm accompanied Finn to his meeting with Hakon Ivarsson and together they negotiated an agreement: Hakon would be reconciled with the king in exchange for being given King Magnus' daughter, Ragnhild, in marriage and with a dowry befitting a princess. Finn agreed to the proposal on Harald's behalf and returned to the Trondelag where the former unrest and rebellion had by now apparently subsided.
All of which would have amounted to precisely the outcome intended, had it not been for the proud Ragnhild's response to Hakon's suit and her insistence that a king's daughter could not accept a husband of lesser rank than that of jarl. Hakon could only bring his case to Harald who refused the request, because there had never been more than one jarl in the land at any one time since Olaf's reign and there would be no new jarl appointed while Orm still lived. Accusing the king of breaking his agreement, the furious Hakon stormed out of the court and took ship to Denmark where he was welcomed as a kinsman by Svein Estridsson (Svein's wife and Hakon's father both being Jarl Hakon's grandchildren) and placed in command of Danish coastal defences. Although generously endowed with estates, Hakon nonetheless chose to live aboard his warships the whole year round keeping guard against Baltic pirates. Meanwhile, Finn Arnason is said himself to have been angered because Harald had broken his own agreement made in good faith with Hakon, but it was to be a far greater grievance against the king which would very shortly drive Finn also into exile in Denmark.
It might be helpful at this point to attempt a cautious alignment of the saga narrative with more reliable historical chronology, because Snorri provides very few indications of the date of events and tends, as on earlier occasions, towards misleading compression of the time-scale. In this instance, _Orkneyinga saga_ supplies the most useful framework of reference, because it is from the orbit of Jarl Thorfinn that the infamous Kalv Arnason returns to make his first entry into Harald's saga. Kalv was last mentioned here when he travelled with Einar Tambarskelve to bring Magnus home from Russia in 1035. According to _Orkneyinga saga_ , he had confessed his guilty part in the martyrdom of Olaf to Rognvald Brusason at that time and yet Snorri Sturluson's _Magnus' saga_ appears to suggest that the young Magnus was not apprised of that confession and held both Kalv and Einar in high regard after his return to Norway. Indeed, the earlier years of Magnus' reign represented a new ascendancy for Kalv, who even assumed the role of foster-father to the young king, until a man from Værdal had occasion to inform him of Kalv's part in the battle of Stiklestad. When Magnus next met with Kalv it was at a feast held at the farm of Haug close by the battlefield and he took the opportunity to invite his foster-father to ride with him to the place of martyrdom and 'see the marks of what befell there'. Kalv was apparently expecting the worst, because he had already ordered his servant to load his ship in readiness for a swift departure, and he flushed deep red at Magnus' suggestion, but the king would accept no prevarication, even issuing a command. Having ridden to the place of martyrdom, the two dismounted and Magnus asked Kalv to point to the exact spot where Olaf had been slain. So he did with his spear-point and Magnus next asked where exactly he himself had stood at that moment. When he admitted to having stood then where he stood now, Magnus saw how the dying Olaf would have been within range of Kalv's axe. Challenged face to face at the very spot, Kalv still denied his guilt before leaping to his horse and riding away. By nightfall, he was aboard ship and sailing out of the fjord under cover of darkness on voyage to find refuge in Orkney with his kinsman Jarl Thorfinn (whose wife, Ingibjorg, was a daughter of Finn Arnason).
It is at this point that the _Orkneyinga saga_ narrative can supply its evidence as to dating, because it claims that the cost to the jarl's household of accommodating Kalv and his retinue was the reason why Thorfinn demanded a greater share of the jarldom. Expecting imminent armed conflict with his uncle who was already assembling forces from Caithness and the Hebrides, Rognvald sailed for Norway to seek assistance from King Magnus. On his return to Orkney he brought with him a substantial and well-equipped army provided by Magnus and also a message for Kalv Arnason, promising him the king's pardon if he would support Rognvald against Thorfinn. When the dispute came to battle at sea in the Pentland Firth, Kalv's six large warships stood off from the action, but only until Rognvald began to get the upper hand and Thorfinn called out for assistance. Presumably, Kalv could hardly refuse his kinsman in such extremis and brought his ships against the smaller craft in Rognvald's fleet, swiftly clearing their decks. At which point the Norwegian crews cut their vessels loose from the lashings and took flight, thus depriving Rognvald of the greater part of his forces and ensuring certain victory for Thorfinn.
'That same night', according to the saga, Rognvald again sailed east to Norway and there told Magnus of the outcome of the battle. He is said by the saga to have stayed only a short while in Norway before sailing back west-over-sea with a retinue of Norwegian housecarls. On landfall in Shetland he learned that Thorfinn was in Orkney in company with only a small force and so Rognvald seized the opportunity for a surprise attack. Although caught quite unawares and finding his house aflame, Thorfinn broke his way through a wooden wall, carrying his wife Ingibjorg out of the burning building in one of the saga's most famously celebrated escapes. His chance for revenge came early in the Yuletide season when Rognvald, believing Thorfinn to have been killed in the fire, was on the small isle of Papa Stronsay collecting malt for the winter feasting. Thorfinn's reciprocal surprise attack put yet another house to the torch and slew Rognvald's Norsemen and yet Rognvald himself managed to get away, but only to be caught and killed while hiding among the rocks by the shore.
When Thorfinn sailed to Norway in the following spring in an (ultimately unsuccessful) attempt at reconciliation with Magnus, he found the king ruling jointly with Harald, so his visit can be securely dated to the earlier months of 1047. Thus Rognvald's death, his own two voyages to Norway and the intervening sea-battle in the Pentland Firth must all be similarly assigned to the year 1046, which would place Kalv Arnason's confrontation with Magnus and his flight from Norway to Orkney fairly safely in the year 1045, or just possibly in the previous autumn, when Magnus would have been at the peak of his ascendancy and well placed to confront the man who had slain his father.
The demise of Rognvald Brusason left Thorfinn with supreme power over the jarldom and _Orkneyinga saga_ tells how 'Kalv Arnason never left his side'. Indeed, Kalv had already been placed in lordship over the Hebrides by Thorfinn 'to ensure his authority there' and there is every reason to believe he was so assigned because these _Suðreyjar_ (as the Western Isles are called in the saga) were most often governed by the Orkney jarls throughout the first half of the eleventh century. Yet it would seem that his former land-holdings in Norway represented the more attractive prospect for Kalv, because Snorri tells how 'he made ready to leave at once and sailed east' as soon as he had news of the favour granted to his brother Finn by Harald. On his return and as promised, Kalv was restored to all the estates and revenues he had enjoyed under Magnus and bound himself 'to perform all services required of him by King Harald for the good of the kingdom'.
Just such a service was to fall due in the following spring when the king raised a levy for his annual raiding expedition around Denmark and assigned Kalv to command of the ship's crew which was to make the first landing on Fyn island. With the assurance that Harald would swiftly bring his main force up in support, Kalv led his men ashore into the attack, but encountered such fierce resistance that they were swiftly overwhelmed and he was just one of the many Norwegians cut down by pursuing Danes as they fled back to their ships. Presumably having seen Kalv slain on the sand, Harald's purpose was accomplished and he brought the main force ashore to advance inland for the serious business of plundering with fire and sword.
While a half-strophe by the skald Arnor and quoted by Snorri must be accepted as closely contemporary evidence for Harald having 'dyed crimson his flashing blade on _Funen_ [Fyn]', the incident is nonetheless strikingly reminiscent of that siege where the Varangian officer held back while Halldor's company suffered the heat of the fray (and Halldor himself that famous wound to his face), only coming up in support when the plundering was at hand. This would seem to have been a tactic long favoured by Harald and here deployed again to take his ultimate revenge on the man he may actually have seen deliver Olaf's death-wound at Stiklestad more than twenty years before. Kalv's brother Finn certainly believed it so and is said by the saga to have been filled with hatred for the king, convinced that Harald had 'not only contrived Kalv's death, but also deliberately deceived Finn into tempting his brother back to Norway so as to bring him within the king's power'.
Harald let people say whatever they would, while refusing to confirm or deny any allegations – and yet 'the king was very pleased with the outcome of events', according to the saga and fully confirmed by the strophe which he composed at the time:
Now I have done to death,
– driven to it was I – and
laid low two of my liegemen,
eleven and two I remember.
Men must guard against
the guileful toil of traitors;
great oaks are said to grow
up out of acorns small.
So bitterly angry was Finn Arnason that he took his leave of the kingdom and sailed south to Denmark where he was welcomed by Svein Estridsson who eventually appointed him jarl of Halland and charged him with the defence of that border country against Norwegian attack.
The two subsequent chapters in Snorri's saga have less bearing on Harald himself, being concerned with the viking adventures of his nephew Guthorm whose sphere of activity lay around the Irish Sea with its base in the city of Dublin, but they nonetheless supply a valuable point of chronological reference. Of key importance in that respect is Guthorm's expedition with _Margad_ which led to a falling-out over shares of plunder and culminated in the killing of his fellow raider, because the 'Margad' of the saga has been identified as Eachmargach, the Hiberno-Norse king of Dublin known to have been killed in 1052. Thus when Snorri places the death of 'Margad' in the summer following Kalv's death, the attack on Fyn island can be safely assigned to the year 1051 and Kalv's return to Norway to the previous year, 1050. The saga tells of Kalv's returning as soon as he learned of the favour his brother had secured from Harald, so Finn's embassy to the Trondelag and to Hakon Ivarsson in the Upplands can be similarly dated to 1050 and the killings of Einar Tambarskelve and Eindridi placed earlier in that same year or, just possibly, in the latter months of 1049. Within that same time-frame, Hakon Ivarsson's angry departure to Denmark and entry into Svein Estridsson's service must also be placed in 1050.
While the true date of Hakon's return to Norway is left uncertain in the saga narrative, the circumstances which brought it about provide the subject of a colourful anecdote. Although endowed with fine estates by Svein, Hakon still chose to live 'both winter and summer' aboard his warships as, indeed, befitted the man charged with defence against Baltic piracy. In the event, however, it was upon this policing duty that his career in Denmark was to founder when Svein's delinquent foster-son and his warband launched a campaign of viking brigandage which created havoc around the country. Protests brought to the king by victims of these predations were referred on to Hakon who hunted the fellow down, cleared his ships in a fierce sea-fight and delivered his head to the king at dinner as evidence of his own efficiency. Shortly afterwards, Hakon received a message assuring him that while Svein wished him no harm, the same could not be said of his victim's kinsfolk and he would be best advised to leave the country at once. So it was that Hakon Ivarsson came home to Norway – and with fortuitous timing because Jarl Orm had recently died, thus leaving a vacancy for a new jarl in the Upplands to which Hakon was duly appointed, Harald proving as good as his word on this occasion at least and the princess Ragnhild likewise when she consented to become Jarl Hakon's wife at last.
The compressed chronology of Snorri's saga narrative places the full story of Hakon's Danish exile and homecoming before the account of Kalv Arnason's return and demise, thus distorting a more realistic sequence of events. If Hakon truly had stayed aboard his warships 'winter and summer', it is hardly possible that he could have left Norway in umbrage before Kalv's arrival in the later months of 1050, become established in Svein's service and then overreached himself in time to return to Norway before Kalv was killed on Fyn some time in the summer of 1051. It would be more reasonable, then, to sacrifice the convenience of the saga-maker's storytelling and propose Hakon's homecoming, appointment as jarl of the Upplands and marriage to Ragnhild somewhat later in the 1050s – although quite certainly before the year 1062 when he makes his next and most significant appearance in the saga as the hero of the great battle on the River Nissa.
Although Snorri claims that Harald continued his raiding of Denmark 'every summer' after his succession to the kingship, the saga describes no further raids through a full decade after the attack on Fyn island in 1051. Exactly ten years, in fact, because the next account of such an expedition is quite firmly placed in the summer of 1061 and after Harald's 'founding' of the town of Oslo on the northernmost shore of the Vik estuary (now Oslofjord). The key importance of Oslo – at least, as suggested by the saga – would seem to have been as a forward base for the assembly and provisioning of the fleets about to sail for Denmark or held in ready proximity against Danish attack. The fleet of 1061, however, was made up of lighter craft manned by very much smaller forces than the full battle-fleet levied in 1049. The reason for this more modest operation would appear to have been the expectation of little, if any, resistance – even though fairly effective opposition had evidently been ready to resist the landing on Fyn island in 1051. It is, of course, possible that the raid on Fyn was planned in full knowledge of the hostile reception it was to encounter and with the deliberate purpose of committing Kalv Arnason to a suicide mission, and yet the expedition of 1061 would seem to have been caught unawares on Jutland where 'the inhabitants mustered forces and defended their homeland'.
Unprepared for so serious a confrontation, Harald sailed on into Limfjord to begin raiding settlements along its banks, but wherever his forces landed they came up against determined opposition – and then his spies brought news that Svein had arrived at the mouth of the fjord with a large warfleet. Fortunately for the Norwegians, the enemy pursuit was delayed by the narrow channel into Limfjord which allowed entry for only one ship at a time, so Harald sailed up to a wider point where just a narrow strip of land lay between the fjord and the North Sea. Waiting until nightfall, the Norwegian craft were brought on to land, unloaded of their plunder and carried across to the seashore where they were loaded up again and ready to put to sea by dawn.
Having escaped Svein's fleet, Harald's ships sailed homeward past Jutland while he swore that he would bring a bigger fleet and greater forces the next time he came to Denmark. Indeed, the story may well have been included in the saga purely by way of prelude to the events of the following year culminating in the epic sea-battle on the Nissa. All through the following winter of 1061/2 while Harald was at Nidaros, his new warship was being built at Eyrar and this was a vessel to rank with the very greatest launched in the northlands, even with Olaf Tryggvason's famous 'Long Serpent' described in his saga as the 'best-fitted and most costly ever to be built in Norway'. In fact, Harald's ship would have been marginally larger than Olaf's, built with thirty-five pair of benches when the 'Long Serpent' had thirty-four. Thus driven by seventy oars, it is described by the saga as much broader in the beam than the usual warship and so is thought to have been of a type called the _búz_ , its design based on that of a large sea-going merchant vessel but adapted for the purpose of warfare. As flamboyant as it was formidable, its bows were inlaid with gold, its prow surmounted by a dragon's head and its stern-post by the monster's tail – these latter features inspiring the skald Thjodolf to an abundance of dragon imagery when he celebrated the ship in verse.
That same winter Harald issued a challenge to Svein to meet him in battle on the Gaut Elf river in the coming spring and thus resolve which of them was to be king of both countries. Preparation of his forces was already under way and a full levy of all Norway brought together a great army, but the final flourish was the launching on to the Nid of Harald's new capital ship, described – at first hand – by Thjodolf as 'floating, with flaming mane and its sides all gilded, the dragon'. It would appear that Thjodolf accompanied his king when the fleet sailed, if only on the evidence of no less than six of his strophes quoted in the saga and describing the voyage south from Nidaros to the Vik where a storm blew up, scattering the ships to find shelter in the lee of islands and the safety of Oslofjord.
As soon as the weather improved, the fleet formed up and sailed on to the Gaut Elf, only to discover that Svein's ships and men were lying off to the south of Fyn and the Smalands. Once again, Harald is said to have assumed his old enemy was avoiding battle and so sent his 'bonders' levy' home, thus reducing his fleet to 150 ships which he took 'raiding far and wide' along the coast of Halland. Coming into Laholms fjord, however, he sighted Svein's fleet numbering some three hundred vessels and thus representing twice the strength of his own. It must be said that Snorri's repetition of this same formula does little to support the credibility of his saga as historical record, and yet his source of information in this instance is impressively reliable when the figures are derived from poetry ( _Nisavísur_ , or 'Nissa river verses', of which as many as seven strophes survive) composed by the skald Stein Herdisason who was an eye-witness to the battle aboard Ulf Ospaksson's ship.5
The size of the enemy fleet so alarmed some of the Norwegian warriors that they urged Harald to pull back, but the king remained quite determined and his address to the troops is preserved in another strophe from Stein Herdisason: 'Rather than flee shall each of us, unfaltering, fall dead heaped upon the other.' At which his fleet drew up into battle array with Harald's great dragon-ship at the centre and Ulf's vessel alongside, while the Trondelag contingent lay on one side and Jarl Hakon Ivarsson's flotilla on the other. Svein brought up the Danish fleet, including no less than six jarls among its commanders, and he set his own ship to face Harald's with Finn Arnason beside him. Now all the ships in the central battle lines of both sides were roped together, but Svein's fleet was so great in number that many vessels could not be lashed into his main formation and so were left free to engage with the enemy as their skippers felt inclined. Similarly on the Norwegian side, where Hakon Ivarsson's flotilla was left untied and also free to engage with individual enemy craft, as indeed they did and with great success in clearing every ship that they were able to grapple.
The manoeuvring and manhandling of so many oar-driven warships cannot have been easily or swiftly accomplished, and so it was late in the afternoon of 9 August 1062 by the time the fleets engaged around the mouth of the Nissa. Much of the saga account of the fighting relies on descriptive skaldic verse – two strophes by Stein Herdisason, two and a half strophes by Thjodolf, who was apparently also in attendance, and a single strophe by Arnor Jarlaskald who was almost certainly far away in Orkney while the battle was fought. As might be expected, they all tell of fierce fighting by heroic warriors on both sides and yet also securely confirm all the points of detail in Snorri's narrative (for which, of course, they provided the principal source).
The opposing formations, each of them apparently roped into a huge fighting-platform, seem not to have reached the stage of hand-to-hand action for some time, probably because they were made up of the largest high-hulled vessels, and so the lengthy opening phase of the conflict was conducted with projectile weaponry, with Harald himself wielding his bow for hours on end on the evidence of Thjodolf's lines: 'All night long, Norway's lord let arrows fly from yew-bow to shining shields.' The free-ranging craft on both sides were better able to engage, of course, and it was in this sector of the fighting that Hakon Ivarsson is said to have most excelled himself. Danish ships tried to keep out of his path, but Hakon kept up the pursuit, clearing the decks of ship after ship until a skiff found its way through the mêlée to summon him over to a flank of Harald's formation which was giving way under pressure and taking heavy casualties. Rowing to that sector of the action, Hakon attacked with such ferocity that the Danes fell back, and so he continued to fight all through the night, somehow always managing to be wherever there was the greatest need of his assistance.
Before the night was over the principal Danish formation finally broke up into flight and Harald was able to lead his men aboard Svein's capital ship, clearing its deck so thoroughly that the only members of its crew left alive were those who had jumped over the side and been lucky enough to be hauled aboard other ships as they fled the carnage. Svein's banner was down now and no fewer than seventy of his vessels cleared, while all the rest of his ships and men were in flight, with the notable exception of Finn Arnason, Svein's jarl of Halland but now an old man with failing eyesight, who had stayed till the very last – 'in mid-column fighting, too proud to flee' according to Thjodolf – and was finally made captive. Yet there was nowhere any sign of the king himself.
While Harald and his ships rowed off in pursuit of the escaping enemy, Jarl Hakon stayed with his ship which was so densely surrounded by damaged and deserted craft that he could scarcely force his way out through the tangle of ship-timber, and it was then that a small boat rowed up alongside and a tall stranger wearing a heavy cowl called out, asking for the jarl by name. Hakon was helping tend the wounds of one of his warriors and turned to ask who it was that called him. 'This is _Vandrað_ (a cognomen used elsewhere in the sagas for one in difficulties) who wants to speak with you,' adding in a whisper, 'I would accept my life from you if you would grant it me.' Hakon called men to take the fellow aboard a skiff and serve as his safe conduct past Norwegian vessels, then to take him ashore to a named farmer who was to give him a horse and his son to go as his escort. They did just as they were bid and delivered the stranger to the farmer who likewise followed Hakon's instruction, although the farmer's wife was less welcoming. On learning the outcome of the battle, she expressed little surprise because she knew the Danish king Svein to be a coward as well as lame. Hakon's men took their boat and returned to the ships, while 'Vandrad' went on his own way, but there is a further point of particular interest in Snorri's anecdote, because the skeleton of Svein Estridsson – exhumed and scientifically examined in more recent times – has shown that, if not actually lame, he certainly would have walked with a limp.
Meanwhile, Harald had abandoned pursuit of the enemy and was back aboard Svein's ship sharing out the spoils, quite certain now that the Danish king must be dead elsewhere or drowned overboard when his body was nowhere to be found on deck – and it was only afterwards that he learned of Svein's reappearance on Zealand where he was gathering together his surviving troops. More immediately though, Harald had a prisoner of war to deal with because Finn Arnason had been brought before him. With the mocking complaint that the Norwegians would now have the nuisance of dragging an old blind man around with them, he asked Finn if he was ready to ask for his life to be spared.
'Not by a dog like you!' 'Then perhaps by your kinsman Magnus?' Harald's son (by Thora and thus Finn's great-nephew) was in command of one of the Norwegian warships, but Finn would not ask it of a puppy. 'Will you accept it from your niece, Thora, for she is here also?' 'Ah! Then it is no wonder you fought so lustily if the mare was with you!'
Harald spared Finn's life, of course, and kept the old man with him for a while until his surly temper became so very wearying that he was given leave to return to his king Svein and put ashore on Halland. Harald then sailed north to Oslo and it was there he passed the winter.
What had befallen in the battle was the talk of his court throughout that winter of 1062/3. Surely the skalds celebrated the king's victory, but when the warriors spoke of what they had seen it was generally agreed that Hakon Ivarsson had been the bravest, the shrewdest and the luckiest of the heroes, even to the point where it was said that it was he who had really won the battle.
Hakon himself, meanwhile, had returned to his jarldom of the Upplands before winter, but his exploits on the Nissa were still the most popular topic of conversation in Oslo in the following spring when someone recalled speaking with the men who had ferried 'Vandrad' ashore and declared Hakon's luckiest escapade to have been his rescue of Svein Estridsson. Just one remark among many passed over the drinking horns, of course, but the saga quotes a proverb in the northlands to the effect that 'Many are the king's ears' and, indeed, the story was very soon brought to Harald, who assembled a troop of some two hundred housecarls to ride out to the Upplands that very same night. Even then, it would seem that Hakon's luck still held, because a friendlier soul bribed a farmer to hasten ahead of the king and warn the jarl of his coming, so when Harald reached Hakon's house he found it empty. The warning had been brought to Hakon late in the night, yet there was just enough time to see all his valuables hidden safely away in the woods before he and his retinue took horse over the border into Sweden. There he was welcomed by King Steinkel (who had succeeded Onund-Jacob in 1056) and stayed with him at court into the summer.
Harald having returned north to pass the summer in Nidaros, Hakon was able to return to the Upplands in his absence and when the king returned south in the autumn Hakon crossed back again into the Swedish province of Vermaland where Steinkel had endowed him with the lordship. So it was that when Harald's officers were despatched to the Upplands that winter for the customary collection of revenues, the Upplanders refused payment, saying they would gladly pay their taxes but only to their own jarl Hakon.
As it happened, the king had greater affairs of state on hand in the winter of 1063/4, because emissaries were already in negotiation with Denmark. After some fifteen years of battle and raiding, both peoples now wanted peace and pressure was growing upon their kings to come to some form of settlement. Thus in the spring of 1064 Harald and Svein arrived, each with his own force of ships and men, at a pre-arranged meeting on the Gaut Elf river where, after lengthy and tortuous argument, a treaty was eventually agreed. Each king was to hold his own kingdom within its own ancient borders, no compensation was to be paid for injuries and depredations suffered through the long years of conflict, prisoners were to be exchanged and the kings were to remain at peace as long as they both should live.
Curiously though, Snorri is alone among the saga-makers in setting out so much detail of the peace-making and the six strophes of verse which he quotes in support of his account are suspiciously attributed to an anonymous skald. Still more curiously, Saxo Grammaticus' history supplies no account whatsoever of any treaty, recording only that Svein rebuilt his forces for the defence of Denmark after the defeat of 1062, while Harald's ambitions were already being drawn in other directions. There is no doubt that a settlement of some kind was reached and almost certainly in 1064, when Snorri later dates the treaty between Harald and Svein to the second year after the battle on the Nissa which had been fought 'fifteen years after the death of King Magnus [in 1047]'.
In fact, a peace settlement had become the only realistic option on both sides, because the wasteful warfare which had drained the resources of two nations for a decade and half had achieved nothing. Even though Svein had lost every battle he fought and despite all the intimidation of Harald's relentless raiding, the Danes had remained loyal to their king for more than twenty years and left not a trace of doubt as to the man whom they preferred as their ruler. As to Harald's own intentions, it has been suggested that Saxo is correct and that he may already have been thinking of further-flung conquest, but the immediate course of events would indicate his concern more urgently focused on the rumbling dissension within his own kingdom and the threat still posed by the last representative of the line of an ancient enemy. The same Hakon Ivarsson who had become the effective figurehead of dissension in the Upplands was the great-grandson – and, indeed, the very namesake – of the mighty jarl of Lade who had ruled Norway for fully twenty years before the advent of Olaf Tryggvason.
Harald returned to Oslo after the peace-making and passed the summer there while his officers went again into the Upplands and were again refused their dues, payment still being held back for the return of Jarl Hakon who was said to have already assembled a great force of Gautlanders. That news apparently prompted Harald to action and by the end of the summer he had sailed to Konungahella where he assembled a fleet of light craft to carry his troops up the Gaut Elf river. Snorri tells of these vessels being hauled ashore and carried overland around the waterfalls (now called the Trollhätten Falls) as the expedition made its way upriver – a passage which would have been reminiscent for Harald of the Dnieper rapids on his voyage to Miklagard some thirty years before – and thus they eventually came to the wide expanse of Lake Vanern. Rowing eastward across the lake, Harald came ashore on the far side and there learned of Hakon's whereabouts, but the jarl had already had word of the Norwegian advance and was bringing a sizeable force of Gautlanders to meet it, apparently expecting to repel a plunder raid.
Harald left his ships at the mouth of a river and a company of warriors there to guard them, before leading the greater strength of his troops overland. The saga tells of the king and some of his officers on horseback, but most of his warriors going on foot, as they made their way through woodland and marsh overgrown with brushwood until reaching a ridge of higher ground from which they could see Hakon's forces on the far side of more marshy ground. Now within sight of each other, both armies formed up into battle array, but Harald ordered his men to stay on the higher ground and wait to see if the enemy meant to attack. 'Hakon is a very impetuous man.'
Although Snorri writes of Harald having set out on this expedition in late summer, it would seem to have turned into later autumn by the time the armies met, because the saga account has the battle fought in frosty weather with light flurries of driving snow. Up on their higher ground, the Norwegians sheltered behind their shields, while Hakon's 'lightly clad' Gautlanders, likewise ordered to hold back and await Harald's move, were feeling the chill of the day. All of which would seem to have been included in Harald's tactical plan, when his warriors suddenly leaped to their feet, raising a war-whoop and beating their shields. The headman of the Gautlanders (whom Snorri styles their 'Lawman') had tethered his horse to a stake which was torn from the ground and hit him on the head when the animal bolted at the sound of the shouting and shield-beating.
At this the Lawman galloped away while Hakon had his banner brought forward, signalling the Gautlanders to advance across the marshy ground towards the Norwegian position atop the ridge, but as soon as they reached the foot of the hill Harald's men came down on them in a headlong charge. While some of Hakon's men fell under the impact and were slain, the rest of them took flight, but there was little point in pursuit because it was now evening and Harald had taken possession of Hakon's banner, which is said to have formerly belonged to King Magnus. The battle of Vanern was over and Harald had the victory, but as it was to be his last battle fought in Scandinavia, it might be worth a little more attention than it is generally offered by historians and particularly in terms of military detail.
By the mid-eleventh century, European influence had become more evident on Scandinavian battlefields and the better equipped Swedish warrior, although armed with the traditional sword and shield, may have worn a helmet of the conical Norman design with a nasal guard (although possibly of German manufacture) and been armoured in ring-mail, while the humbler 'lightly clad' fighting-men who apparently made up the majority of Hakon's force would have been without mail armour and dressed in woollen hats, tunics and straight trousers. Their fairly basic armament would have certainly been a 'flat', all-wooden slightly curved bow of the characteristic northern type, with a simple spear for hand-to-hand combat and a leather-faced round wooden shield hanging from a sling around the upper body. The majority of Harald's warriors would have been more heavily armed housecarls, wearing helmets of spangenhelm construction similarly fitted with a nasal guard and worn with a mail byrnie. Some of their swords and shields may have reflected eastern design, so wooden shields of longer Slavic rectangular style could have been found alongside the traditional heavy wooden disc type and some swords with single-edged blades showing the influence of the steppe warrior and the Byzantine armoury. Thus equipped, the impact of a downhill charge by battle-hardened warriors thrown against the lighter-armed and effectively unarmoured Gautlanders would been have very much as it is described in the strophe from Thjodolf quoted in the saga: 'Fallen the flocks of Steinkel's followers; sent straight to _Hel_.'
Snorri does supply a telling tailpiece to the battle of Vanern in his description of the Norwegian march back to their ships, when a man suddenly jumps out of the woodland to spear the warrior carrying Hakon's banner and seize it from his hand. To which Harald responds with the shout 'The jarl still lives! Bring me my coat of mail!', but the man has long disappeared into the brush, so the march continues on its way back to the boats – and Hakon Ivarsson has just made his last appearance along Harald's warrior's way.
It remained only to deal out retribution to the recalcitrant Upplanders and so, in the winter following his defeat of Hakon (1064/5), Harald embarked on a circuit of tribute-collection with menaces, which must have been long familiar to him ever since his first winter in northern Russia. He chose to move first against the bonders of Romerike, charging them not only with refusing payment of lawful taxes but also with support of the king's enemies. Some were ordered to be maimed, others to be killed and the rest to have their property seized. Through the next twelvemonth the king moved on to Hedemark, inflicting similar destruction to that dealt out in Romerike, afterwards with fire and sword to Hadaland and finally to Ringerike, all of this confirmed by three strophes from Thjodolf telling of Uppland farmsteads left derelict and empty. Yet there is a note of irony which cannot pass without notice, because Ringerike had been the small kingdom of Harald's own father, Sigurd Syr, and so it would almost seem as if his time in the northlands had come full circle by the ending of the year 1065.
## IV
## _Stamford Bridge_
## _England, 1066_
Within eighteen months of the peace settlement with Svein of Denmark – according to Snorri's saga and a quoted strophe from the skald Thjodolf – Harald's campaign of intimidation against the Upplanders had brought about their full submission and when Hakon Ivarsson disappeared into the Swedish woodland after the battle of Vanern the long-standing challenge from the dynasty of Lade melted away with him. The rumbling dissension in the formerly troublesome Trondelag had been stilled for most of fifteen years and, so too, the death of Olaf had been avenged when Kalv Arnason was sent to his death on Fyn island, bringing to an end a blood-feud unsatisfied for two decades and, at the same time, fulfilling Olaf's prediction as to the future character of his half-brother: 'You will be vengeful one day, my kinsman'.
By the end of the year 1065, and for the first time in twenty years, there would seem to have been no reason why the fifty-year-old Harald should not have passed the Yuletide season undisturbed by the preparation of a campaign planned for the coming spring – and yet, by March of the following year, he was mustering his armies and assembling his fleet for an invasion of England. Just how long he might have had ambitions in that direction has been a subject of speculation among historians even since the time of Saxo Grammaticus – and, of course, will bear further consideration here – yet the sagas make no reference to the prospect of such a conquest until the arrival of a visitor to his court in the early months of 1066. Nonetheless, the short passage of chronological summary placed after the conclusion of the Uppland campaign is followed by a discernible pause in the narrative before Snorri launches into his own version of events in England during the early 1060s.
He tells how 'Edward Æthelredsson' was accepted as king by the English on the death of his half-brother Hardacnut and of Edward's marriage to 'Edith, the daughter of Earl Godwin Wulfnothsson'. Although English by descent and the son of a South Saxon thane, Godwin had stood high in Cnut's favour and already begun his rise to prominence by 1018, when he is thought to have returned with the king to Denmark and there been married to Gyda (or Gyða), the sister of Jarl Ulf Thorgilsson who was himself the husband of Cnut's sister Estrid and, of course, the father of her son Svein. Already made an earl by that time ('earl', or _eorl_ , being the English form of the Old Norse _jarl_ , and a title introduced into England during Cnut's reign), Godwin's lordship was extended to the earldom of all Wessex by 1020 and he had become one of the most powerful men in the land by the time of Cnut's death in 1035, thereafter playing an important and often contentious role through the reigns of the three successor kings until his own death in 1053.
The sole significance of this Earl Godwin in the saga, of course, is as the father of the two men destined to be of such ominous significance along the final passage of Harald's warrior's way, and it is to the brothers Harold and Tostig Godwinson that Snorri next turns his attention. As the eldest surviving son, Harold succeeded to the earldom of Wessex on his father's death and was to establish himself and his family as a still greater power in the land, while his younger brother Tostig was to become earl of Northumbria when Siward, a Danish warlord thought to have first come to England in Cnut's following, died in 1055 leaving a young son Waltheof who was not yet of an age to succeed to his father's earldom. Thus by the later 1050s, virtually all the land of Edward the Confessor's kingdom – excepting only the earldom of Mercia – lay within the grasp of the Godwinsons and remained so until the autumn of 1065 when the Northumbrians, weary of the heavy taxation demanded by Tostig (largely for his personal benefit) and the equally heavy-handed manner of its collection, rose in revolt. Tostig himself, always an especial favourite of the king, was with Edward and his court at Oxford on 3 October while the Northumbrians were declaring him an outlaw, slaying every last one of his housecarls, and seizing all the contents of both his armoury and his treasury at York.
The man they invited to take over his earldom was Morcar, the younger brother of Edwin who had quite recently succeeded their father Ælfgar as earl of Mercia, and so it was with the new earl Morcar at its head that a great host of insurgent northerners marched south to Northampton where Earl Edwin was to bring a Mercian contingent to join their advance. In the event, they were met at Northampton by Harold of Wessex ready to negotiate on behalf of King Edward. Recognising the risk of disastrous civil war, he acceded to their preferred choice of earl and persuaded the king to ratify his decision, which Edward was to do on 1 November before bidding farewell to Tostig and lading him with wealth before his departure into exile at the court of his wife's kinsman, Count Baldwin of Flanders. In fact, this parting from Tostig was to be the last public act of Edward's reign, because the Confessor soon afterwards fell ill and passed from this life on 5 January. On the following day, Harold Godwinson was consecrated king of England.
If Tostig expected the new king's first priority to be the restoration of his brother to his earldom or, at the very least, his recall from exile, he was to be disappointed because Harold's first public act following his succession would seem to have been his wedding ceremony. Having already fathered a number of children on his mistress, the woman whom Harold now chose to marry was not only the widow of the Welsh king Gruffydd ap Llywelyn (on whom the Godwinson brothers had jointly inflicted a decisive defeat just three years before), but also the sister of Earl Edwin of Mercia and Earl Morcar of Northumbria. Presumably the king's choice of bride was driven by the imperative of national unity, when this marriage served to link the noble houses of Wessex and Mercia, but to Tostig it can only have added a high varnish of insult to painfully recent injury. Thus deprived of any prospect of restoration in England, Tostig's fury evidently drove him to seek an ally in support of his cause, but it is at this point that the various sources of historical record prove less than helpful. He is said by Orderic Vitalis – an English-born chronicler living in Normandy and writing in the second quarter of the twelfth century – to have first approached Duke William of Normandy, but this claim is unsupported by any other source and given little, if any, credence by later historians.
A quite different first line of approach on Tostig's part is suggested by all the Scandinavian sources, Snorri Sturluson's _Heimskringla_ foremost among them. In fact, there is good reason to accept at least the substance of Snorri's account of events in his _Harald's saga_ because, although clearly inaccurate on some points of detail, its proposal of Tostig's journey from Flanders to Denmark, by way of Frisia, in order to seek the support of his cousin Svein Estridsson has the full measure of plausibility. The close kinship between the two is beyond question – Tostig's mother Gyda and Svein's father Ulf having been brother and sister – and the practicality of the journey itself is hardly in doubt, even in the earlier months of the year when it could have been made overland on horseback over flat coastal country. Snorri's detailed presentation of their conversation at the Danish court can only have been of his own reconstruction and yet corresponds perfectly well to the wider scheme of things while being fully in character on both parts: Tostig pleading his case and Svein responding with the generous offer of a home and a jarldom in Denmark, although unwilling to provide the military support requested. He had enjoyed just two years of peace after enduring some fifteen years of hostility from his warlike neighbour in Norway, and was too well aware of his own limitations 'to vie with the prowess of my kinsman, King Cnut' by attempting a campaign of conquest in England. Bitterly disappointed by his cousin's refusal, Tostig announced his intention to 'find a friend in a less likely quarter' and Snorri records that 'the two parted on less than cordial terms'.
Following his departure from the Danish court, Tostig is said by the saga to have travelled on to Norway by way of the modest sea-crossing through the Kattegat and into the Vik, whereabouts Harald Hardrada was still in residence at his winter court. While there is no evidence for any earlier contact between the two, Harald's reputation must have been no less famed in Anglo-Danish Northumbria than elsewhere in the Scandinavian world and so Tostig would have been well acquainted with the warfaring prowess of Norway's king, if only from what he had learned in York. Indeed, just such is the indication of Snorri's form of words when he has Tostig tell Harald that 'all men know that no greater warrior than you has come out of the northlands'. As before at the Danish court, the saga's detailed, but still more expansive, account of the exchanges between these two can only be of Snorri's own reconstruction and yet, for all that, it is no less convincing both in character and in substance.
Tostig (whom Snorri erroneously describes as the eldest of the Godwinsons) is said to have told Harald of his banishment from England and his unsuccessful quest for an ally in Denmark which had led him to approach the 'greater warrior' in search of support for his claim on the English throne. The saga indicates Harald's initial reluctance on the grounds that Norwegians would be disinclined to make war on England under an English commander when 'people say that the English are not entirely trustworthy'. Tostig counters with a reminder of Harald's nephew Magnus having informed King Edward of his own claim to the kingships of both Denmark and of England under the terms of his agreement with Hardacnut. When Harald is sceptical, Tostig next asks why he does not hold kingship of Denmark as his predecessor Magnus had done, only to be assured that the Norwegians had 'left their mark on those [Danish] kinsmen of yours'. To which Tostig responds with the undeniably truthful statement that Magnus had won the support of the Danish chieftains (whereas Harald had all the Danes against him), but did not attempt conquest of England because its people all wanted Edward as their king. At which point, he offers his most tempting lure in the form of an assurance that most of the chieftains in England would be his friends and support him should he wish to attempt its conquest – paying off with the pointed comment that 'it does seem very strange that you should have spent fifteen years failing to conquer Denmark and yet now show such little interest when England is yours for the taking'.
Harald is said to have considered all this carefully, to have recognised 'the truth in Tostig's words' which led him to acknowledge his own 'great desire to win this kingdom'. Thereafter, the two spoke again at length and in detail before reaching their decision to invade England in the coming summer of the year 1066.
Having followed the template of Snorri's _Harald's saga_ thus far in this chapter, it would be unjust to overlook the objections raised by very many scholarly historians to his account of Harald and Tostig, objections which amount to serious doubt that there was any such meeting between the two in Norway, or anywhere else in Scandinavia, in the early months of 1066. The first basis for these objections is the fact that the meeting is noticed almost exclusively in Scandinavian sources, the awkward exception being Orderic Vitalis, whose account bears striking similarities to those found in the _Ágrip_ , in Theodoric's _Historia_ and, most curiously, to the speeches recorded in the kings' sagas, among which, of course, Snorri's _Heimskringla_ stands foremost here.
The historian Kelly DeVries offers an astute comment on the interpretation of these various sources by modern historians when he suggests that 'it is much easier to believe that the Norwegian invasion of England was Harald's scheme alone and that his alliance with Tostig Godwinson was an afterthought made only when the two met for the first time, probably in Scotland or Northumbria. . . . Simply declaring the saga accounts of this meeting to be fiction places a lot of belief in the accuracy of the other sources, most of which are silent about any of Tostig's movements not taking place in England.'1 The obvious answer might be as straightforward as the quite different sources of information available to the various earlier authorities working in widely different locations or, put most simply, to ask how they might have known what they say they know.
For example, Adam of Bremen and Saxo Grammaticus, whose works represent the more formal historical record set down within the Scandinavian orbit, both seem to know of prior contact between Harald and Tostig, if not of its date or location, and yet there is no obvious reason why English or Anglo-Norman chroniclers should have had information about such a meeting, and especially so if the sagas are correct in locating it in Norway. Interestingly, though, one of the earliest versions of the _Anglo-Saxon Chronicle_ (the 'C' manuscript of the Abingdon text) tells of Harald's fleet arriving at the mouth of the Tyne in September 1066 where it is joined by Tostig's ships 'as they had previously arranged', which would clearly indicate knowledge of an earlier contact between the two.
Some modern historians accept that such contact had been made, but by an emissary acting for Tostig rather than the man himself, even though there is no mention of such a go-between anywhere in the sources and it would have been quite uncharacteristic of the always deeply suspicious Harald to have planned such a momentous venture with an ally of whom he can have known very little, if anything at all, and had yet to meet in person. One factor possibly underlying the 'emissary theory' is that of the time required for Tostig to travel from Flanders to Denmark and Norway, then back to Flanders before launching his own (reliably recorded) raid on the Isle of Wight before the end of May or, at the very latest, in early June. Yet the four-month period available to him need not exclude any of those destinations when considered in the light of the saga evidence for seafaring, and especially when all the sea-travel involved would have been undertaken during the better weather of advancing spring.
All of which would have been familiar territory to a saga-maker and, not least among them, Snorri Sturluson. In fact and despite the late date of its composition, there is good reason to credit the substance of his account, even in preference to that of earlier sources. First of all, he offers none of the usual signals of his own doubt as to the accuracy of his information and, indeed, it would be utterly remarkable were he to describe an entirely fictional episode in such thoroughly convincing detail. The greater likelihood, then, might be that his saga account of the initial negotiations between Harald and Tostig had been informed by his own privileged access to Norwegian diplomatic circles when he was an honoured guest at King Hakon Hakonsson's court in 1218.
To dismiss all this Scandinavian evidence as total fiction would mean that the invasion of 1066 was entirely of Harald's own devising, and yet – despite widespread assertion to the contrary – there is nowhere any indisputable evidence of such intention on his part prior to the early months of 1066 in which the saga places his meeting with Tostig. Indeed, an entry in the Worcester manuscript of the _Anglo-Saxon Chronicle_ for 1048 (being the year after the death of Magnus had enabled his succession as sole king of Norway) records Harald's despatching assurances to King Edward of his peaceful intentions as regards England. It is true, of course, that his nephew had inherited a claim on the English kingship following the death of Hardacnut, but as Gwyn Jones points out, 'there is little evidence that Magnus seriously considered the conquest of England'.2 Indeed, Edward had been unwilling to supply ships and men in response to a request from Svein Estridsson while he was in contention with Magnus, and it is most unlikely that Harald would have entertained any serious thought of conquest of England while Edward still lived.
The fragments of evidence picked out by all the historians taking a contrary view are associated with an attempt made by Ælfgar, father of the aforementioned Edwin and Morcar, to win back his earldom of Mercia from which he had been deposed earlier in the same year of 1058. Entries in the Worcester manuscript of the _Anglo-Saxon Chronicle_ , the Irish _Annals of Tigernach_ and a thirteenth-century recension of the Welsh _Annales Cambriae_ have led to the widespread conclusion that Ælfgar and his ally Gruffydd ap Llywelyn secured the assistance (perhaps on a mercenary basis) of a Norwegian fleet at large in the Irish Sea at the time and under the command of Harald's eldest son, Magnus. This same conclusion has led to the proposal that such an expedition would have been sent under Harald's own authority and with the probable intention of testing the defences of the English coast, yet a closer examination of the evidence of those three sources would indicate nothing of the kind.
The 'pirate host from Norway' noticed in the _Anglo-Saxon Chronicle_ is more meticulously described by the Irish annalist as 'a fleet [led] by the son of the king of the _Lochland_ [Scandinavians], along with the _gallaib_ [literally 'foreigners', but meaning Norsemen] of the Orkney isles, of the Hebrides and of Dublin', which would actually indicate an assembly of the same viking elements regularly found summer-raiding along the western seaboard. These same free-booters are recorded in employment as mercenary naval forces on a number of occasions through the eleventh and twelfth centuries and so their services would have been available to Gruffydd, who was well connected in the Irish Sea zone, as also to Ælfgar, who had similarly hired a dozen viking ships to force his return the last time he had been driven from his earldom. As to the commander of such a viking coalition, the person identified by Tigernach as 'the son of the king of the _Lochland_ ' could well have been the son of a Norse chieftain in the Western Isles (customarily styled _rig_ or 'king' in the Irish sources). If his name really was 'Magnus, Harald's son' as is claimed by the Welsh annalist (but by no other source), it would be quite implausible to identify him with Harald Hardrada's son of that name by his Norwegian 'wife' Thora, because that Magnus could not possibly have been born earlier than 1047 (1049 being the more likely date indicated by the saga) and the claim for a boy no older than eleven placed in command of a viking fleet such as that described by Tigernach lies entirely beyond the bounds of credibility.
Thus it can be said that there is no indisputable evidence for Harald's planning a conquest of England prior to the spring of 1066 and everything to support Kelly DeVries' proposal of Tostig as 'the prime instigator' of the expedition which was to lead him to his death at Stamford Bridge in the September of that same year.3 The question remains, however, as to how Tostig managed to persuade him – or how he persuaded himself – to undertake the English enterprise and, indeed, what it was that he hoped to gain from it.
This last question is perhaps the most easily answered, if only on the strength of the claim made in the _Ágrip_ and by Theodoric's history (and also, indeed, by Orderic Vitalis) that Tostig offered Harald half of England, intending to rule the other half as his vassal (the submission of fealty being attested by Adam and Saxo, as also by two of the English sources). No such offer is specified by Snorri's account and yet it might be implied in Tostig's claim that the majority of English chieftains would be his friends and supporters, an assurance which Harald had little reason to doubt, at least in respect of the English north country, because he would always have known of York, which stood as the capital centre of Tostig's former earldom, as _Jorvik_ and of its stature as a principal stronghold of the northmen west-over-sea through two centuries. Indeed, the old kingdom of Northumbria would still have been recognisable to him, if only in terms of cultural fusion, as an Anglo-Scandinavian province and the greater extent of the English territory formally recognised as the Danelaw since the second half of the tenth century. This, of course, had also been the earldom of which Tostig had been deprived scarcely six months before, so the very least achievement expected of their projected invasion was to reclaim Northumbria for its former earl who would thenceforth rule as the liege client of a Norwegian overlord. When his liegeman was also a scion of the current English royal house, the conquest of all England surely lay within reach – and it was that prospect which offered the irresistible lure to the 'vengeful' Harald.
Snorri tells of his thinking carefully over Tostig's proposal, recognising the 'truth in his words and realising at the same time his own great desire to win this kingdom'. When the mighty Cnut had won that same kingdom scarcely half a century before, England had represented his crowning achievement and yet it was one which his sons could not sustain. Assured that England was now his 'for the taking', Harald was presented with the opportunity to take his vengeance at last upon the man long since buried at Winchester but still bearing the ultimate responsibility for the death of Olaf in the battle he had contrived at Stiklestad. Harald's very last act before leaving Nidaros to join the great invasion fleet awaiting him in the Solund Isles was to open the saint's shrine and to trim his half-brother's hair and nails. While the saga does not record whatever words he might have spoken while standing alone in that silent place, it is hard to believe they did not include some form of promise made by an avenging kinsman.
Whether or not Tostig realised that he might have awoken Harald's thirst for vengeance, he surely intended the most flattering appeal to his warrior pride. So too, he would have been ideally placed to inform a realistic assessment of the opponent Harald could expect to meet in England, because Tostig had taken his own prominent part in his brother Harold's principal military triumph some three years earlier. Indeed, the Norwegian Harald may already have known something of the campaign launched against Gruffydd ap Llywelyn in 1063, when Tostig had brought a force out of Northumbria down to the Dee and there linked up with the fleet Harold had brought north round the Welsh coast from Bristol to drive Gruffydd into flight over the Irish Sea. Together the Godwinsons had inflicted such widespread devastation across Gruffydd's kingdom of Gwynedd and such grievous suffering upon its people that they rejected and put to death their own king when he attempted to return to his ruined domain later the same year.
News of this decisive destruction of a Welsh king long notorious for his raiding over the border may well have been brought to Norway by means of the regular traffic plying the sea-road linking Dublin with Scandinavia by way of the Hebrides and Orkney. No less likely is that Harald would have heard tales of the English Harold's later warrior service to Duke William in Normandy (reliably dated to 1064), because his Norman sojourn and his swearing of fealty to William was so well known to Snorri as to be recorded in remarkable detail in his _Harald's saga_. Harald assuredly knew at least something of William the Norman too, but it is unlikely that he would have been daunted by either of these men. Both were his juniors, Harold (born _c_. 1022) by at least six years and William (born 1028) by more than a dozen, and neither could boast a military reputation bearing any comparison to the one he had earned throughout three and a half decades of warfaring across the greater extent of the known world. For all Harald's undoubted appreciation of his own warrior fame, he was not spared a word of hard-headed caution from his old comrade-in-arms Ulf Ospaksson, who is said by the saga to have warned him to expect no easy conquest, by reason of 'the army called in England the king's housecarls and formed of men so valiant that one of them was worth more than two of Harald's best men'. Snorri emphasises the significance of this caveat with a strophe of verse which he attributes to the marshal himself (although perhaps more likely the work of Stein Herdisason, the skald closely associated with Ulf in life and the author of his memorial lay).
In fact, Ulf's advice would well correspond to the opinion of at least one modern historian who believes it 'likely that there was no force in Europe equal to the Anglo-Saxon _huscarls_ . . . so well-trained that they were able [if only on the evidence of the Bayeux Tapestry] to use both the two-handled battle axe and the sword with equal dexterity'.4 Ironically and as the name 'housecarls' suggests, this body of professional fighting-men had been introduced into the English military by Cnut when he became king of England in 1016, but fifty years later the ranks of the 'royal housecarls', and their counterparts in the service of the earls, were more often filled by warriors of native stock eager for the status associated with a warrior elite and, of course, the pay that went with it. Unlike the Scandinavian housecarl who was usually rewarded with land grants, his English equivalent had always been paid in cash, initially funded by a general tax specially levied for the purpose by Cnut, but later from the treasuries of the king and his earls after the tax had been abolished by Edward the Confessor.
While there was little difference between the essential weaponry of the English and Scandinavian housecarl – sword and shield, axe and spear making the complement in each case – there would have been finer points of variation reflecting different foreign influences. Just as the arms and armour of some Norwegian warriors might be expected to reflect the Russo-Slavic, or even Byzantine, characteristics brought home by the east-farers, and Germanic styles were more likely to be found among their counterparts in Denmark and Sweden, so the Anglo-Saxon (or, perhaps more accurately, 'Anglo-Danish') housecarl of the mid-eleventh century would reflect the Norman influence which had long since found its way into the English court and its military. His mail-coat extending to the knee (thus longer than the Scandinavian custom) and his helmet of a one-piece forging fitted with a nasal guard are two such examples, while his long kite-shaped shield, similar in design to those associated with the Norman knight, would be another. There was, however, something particularly significant about this fighting-man because – like the Varangian in Byzantium and the _galloglach_ in medieval Ireland – he was similarly representative of the elite mercenary axe-bearing warrior type found right across the Scandinavian expansion in the early Middle Ages.
While Ulf's pessimistic comparison of English and Norwegian housecarls might be thought less than fair, it does serve to illustrate the international reputation of the foemen whom Harald was to face in England. So too, it reflects the wise caution characteristic of this old soldier who was sadly and deeply mourned by his king when he died in that same spring. 'There lies the man who was most faithful and loyal of all to me' are the words said to have been spoken by Harald as he walked from Ulf's graveside – and I can think of no other occasion where the saga record touches so convincingly on the core of human warmth beneath the mail-coat of the warrior king.
'In the spring' – according to the saga and apparently shortly after Ulf Ospaksson's passing – Tostig left Norway and sailed westward to Flanders, there to rejoin the men who had come with him into exile and the other troops who had since gathered to his cause out of England and from Flanders too. Having already agreed with Harald to mount their joint invasion later that summer, Tostig appears to have made the first move on his own account, crossing from the Flemish coast – 'with as many housecarls as he could muster', according to two manuscripts of the _Anglo-Saxon Chronicle_ – to attack the Isle of Wight where he plundered provisions for his troops and funds for his war-chest. The early sources offer no indication as to why Tostig should have chosen to strike at the south coast of England, but it has been persuasively suggested that he specifically chose the Isle of Wight as his first target in emulation of his father, Earl Godwin, who had himself been briefly exiled to Flanders during Edward's reign and made his own successful return with a landing on the same island. It is no less likely, however, that the more general direction of his attack might have been chosen by Harald in Norway with the strategic intention of concentrating the greater strength of English forces in the south.
Just such was indeed the result of Tostig's sudden appearance on the Isle of Wight, because the English Harold was in London when he learned of the landing and – perhaps imagining that this was the first phase of the anticipated Norman invasion – urgently commanded a full-scale mobilisation said by the _Chronicle_ to have 'assembled greater naval and land hosts than any king in this country had ever mustered before'. By this time, Tostig's fleet already had moved on to harry the Sussex coast and reached Sandwich, where he had occupied the town and was seizing ships and recruiting men (willingly or otherwise) to reinforce his Flemish forces, when news of the advancing royal army prompted him to put back to sea. Sailing up the east coast, he paused to raid Norfolk before entering the Humber estuary with a fleet numbered at 'sixty ships' by the Anglo-Saxon chroniclers. It would seem that this strength now included seventeen ships said by the twelfth-century verse chronicle of Geoffroi Gaimar to have been brought from Orkney by Copsi (or Copsig), one of the supporters who had earlier accompanied Tostig into exile, which had joined up with his fleet as it rounded the coast of Thanet.
It was with these quite impressive forces that Tostig came ashore on the south bank of the Humber to plunder and burn around Lindsey (modern Lincolnshire) until confronted by the Mercian and Northumbrian levies mustered against them by the brother earls Edwin and Morcar. Although the _Anglo-Saxon Chronicles_ supply no detail of the engagement or its precise whereabouts, they leave no doubt as to Tostig having been convincingly defeated. Gaimar would appear to credit this victory to Edwin and his Mercians, while Morcar's Northumbrian forces remained on the north bank of the Humber to prevent the invaders crossing over into (what is now) east Yorkshire. Thus Tostig was driven back out to sea, where his forces were further reduced by the flight home of the Flemish contingent laden with their plunder. So it was with only a dozen ships that he made his way up the Northumbrian coast and into the Firth of Forth where he found refuge at the Scottish court in Dunfermline and there awaited the arrival of the very much greater fleet being assembled by Harald in Norway.
By way of a footnote to Tostig's unpromising overture to the greater enterprise, it is perhaps worth mentioning the reference made by the English chroniclers to 'a portent in the heavens such as men had never seen before', which remained visible every night for a week after its first appearance on 24 April. This phenomenon, called by some 'the long-haired star' and illustrated on the Bayeux Tapestry, was Halley's Comet and its practical importance here bears on the dating of Tostig's incursion which is placed by the _Chronicle_ 'soon after' the passage of the comet and thus dated to May (or, perhaps just possibly, early June) of 1066. The greater significance of this comet for the chroniclers, of course, appears to have been as an omen and one impressively borne out by the subsequent course of events.
While there is no mention of the comet in the saga (and neither is there any account of Tostig's activities), other omens are described in such sinister detail as to cast the darkest shadow over Harald's fleet being brought together in the shelter of the Solund Isles. Snorri mentions very many 'dreams and portents' reported at this time, but selects just three for inclusion in his saga. The first of these was a nightmare which came to one Gyrth, probably one of Harald's own housecarls, who was sleeping aboard the king's ship when he dreamed that he saw a huge troll-woman (one of the monstrously ugly and invariably hostile giant race of northern mythology) out on one of the islands, with a knife in one hand and a trough in the other. As his dreamscape widened, Gyrth could see eagles or ravens perched atop every prow in the fleet as the gruesome giantess sang (in skaldic verse, of course) of the king being enticed west-over-sea to fill graveyards and of birds of carrion following in his wake to feast on slain seamen.
A troll-woman also appeared in a dream to another man as he slept aboard a vessel lying alongside Harald's ship, this one riding on a wolf with a dead warrior in its blood-streaming jaws and the English battle-array behind her against the skyline. As soon as the wolf had consumed the corpse, its grisly rider dropped another into its jaws while chanting a strophe foretelling reddened shields, fallen fighting-men and the doom awaiting Harald himself. Apparitions very much like these are found elsewhere in the saga literature – perhaps most vividly in its record of ominous supernatural experiences surrounding the battle of Clontarf where the Orkney jarl Sigurd was slain in Ireland in 1014 – and represent a legacy from the darker side of pagan antiquity still preserved in the literary Christian culture of thirteenth-century Iceland. The association of such traditions with Harald may not be entirely accidental, however, and especially in the light of Adam of Bremen's claim that he 'gave himself up to the magic arts'. In fact, Adam's remark most probably refers to nothing more sinister than Harald's accomplishment in the art of the skald which demanded of its practitioners an extensive knowledge of the ancient beliefs of the northlands to inform the imagery of their kennings. There is good reason – and, perhaps, on more than one count – to believe Harald well acquainted with Odin, the lord of battle among the old gods of the north. The last of the three apparitions described in Snorri's saga (and also included in the other collections) has no such pagan associations, however, because it concerns a dream – or, perhaps more properly, a vision – said to have occurred to Harald himself and in which 'his brother Saint Olaf' brought him a warning: 'Now I fear, great Harald, your death at last awaits you. . . .'
No 'dreams and portents', however disturbingly prophetic, could turn back the great enterprise now because the invasion fleet was ready and word had long since been sent through all the kingdom to summon up a 'half-levy of the whole army'. These terms 'levy' and 'half-levy' occur throughout the kings' sagas and yet there is still no full consensus in scholarly circles as to whether any such system of muster – of which there is no formal historical record until the twelfth century – was actually practised in the Scandinavian warfaring of Harald's time. While the forces raised by Svein Forkbeard and his son Cnut for their invasions of England certainly appear to have been of the order of national armies as distinct from viking warbands, one school of thought has still recognised them as an effective coalition of the king's own force (or _lið_ ) made up of his warrior retinue of housecarls (or _hirð_ ) with the semi-professional manpower of free farmers called bonders and those of his allied chieftains and client rulers, possibly drawn from a wider extent of the Scandinavian world.
The alternative view proposes a systematic levy (or _leiðang_ ) of ships and men, together with their weaponry and provisioning, called up by the king and supplied by his subjects on a proportional basis – such as that estimated for the early eleventh century in terms of three farmsteads required to supply one man with his war-gear and provisions. The terms of such a system, known only from later sources, provide for the mustering of a full levy for national defence, while only the half-levy was to be called up for a campaign of aggression such as Harald intended in 1066 and so Snorri's statement of his summoning 'a half-levy of the full army' would correspond to what is known of the _leiðang_ in the twelfth century. Indeed, one Norwegian historian has even proposed this same _leiðang_ as Harald's own innovation – to which Kelly DeVries adds an observation of particular relevance here when he suggests that 'it seems ludicrous to believe that someone like Harald Hardrada, who had served in what was probably the most organised army in the world at the time, the Byzantine army, would abandon such a logical notion once he had returned to Scandinavia'.5
None of which, unfortunately, is of very great assistance in attempting to estimate either the size of fleet or the numbers of fighting-men which Harald brought to England in the autumn of 1066. As to ship numbers, Snorri records it being 'said that the king had over two hundred warships as well as supply ships and smaller craft' assembled in the Solund Isles and his estimate is comparable (especially if reckoned in 'long hundreds') to the round figure of three hundred vessels in the _Anglo-Saxon Chronicles_ , a total which must also include the reinforcements acquired on route, principally those known to have joined the expedition by the time it set sail from Orkney. Other estimates supplied in the English sources tend to range upwards from that figure and even so far as the total of 'five hundred great ships' claimed by the historian John (formerly known as 'Florent' or 'Florence') of Worcester writing in the early twelfth century, but the figure most widely accepted by modern historians would be around the three hundred recorded in the _Chronicles_ and plausibly supported by the saga.
In the absence of any numerical estimate of manpower in the earlier sources, it has been upon a base-line of ship numbers that historians have attempted to calculate the strength of Harald's army of 1066 – and with an extraordinarily wide range of results. Such calculations are subject to many variables, of course, and not least that of the average number of warriors aboard each ship. Harald's capital ship at the battle on the Nissa was said to have been fitted with thirty-five benches which would have accommodated a crew of at least seventy oarsmen, in addition to a shipmaster or steersman and, presumably also, the king accompanied by his attendants. Snorri's claim for its quite exceptional proportions must be taken to mean that there would have been no other vessel of such size in the fleet which sailed from Norway in 1066 (if, indeed, the 'great dragon' was still in service at that time, because the sagas make no further reference to it after 1062).
In view of such variables, it is perhaps unsurprising that the estimated sizes of Harald's forces vary so very widely from as few as seven and a half thousand to the most ambitious estimate (at least, of which I am aware) placing it at eighteen thousand fighting men. While a figure in the region of nine thousand seems to be most often found in the general currency of modern accounts, a more detailed analysis has suggested a figure somewhere between eleven and twelve thousand, presumably including an essentially non-combatant component such as serving-men and boys.
As to the course followed by the fleet between its departure from the Solund Isles and its arrival off the Northumbrian coast, history depends almost entirely upon the evidence of the saga record, which is preserved in greatest detail by Snorri's _Harald's saga_ and _Orkneyinga saga_. The first landfall was in Shetland – as was customary for Norse voyagers bound west-over-sea – whence the fleet sailed south, through the turbulent Sumburgh Roosts towards the Fair Isle and on to Orkney where it assuredly found moorings in the famous broad haven of Scapa Flow.
The jarls Paul and Erlend, sons of the mighty Thorfinn, had recently succeeded their father, who had died only a year or two earlier. They are said by _Orkneyinga saga_ to have been good-natured and well regarded by their people, ruling as joint jarls rather than dividing up the islands and mainland territories between them. Having come awry with King Magnus by reason of a blood-feud arising out of the killing of Rognvald Brusason, Thorfinn is said by the saga to have returned again to Norway after Magnus' death and there made his peace with Harald, effectively acknowledging him as his overlord. So, when Harald's fleet put into Orkney on voyage to England in 1066, Thorfinn's sons and successor jarls would have been obliged to join their ships to his expedition – as, indeed, they appear to have done quite willingly. Neither would their Orkney contingent have been the only reinforcement waiting in Scapa Flow, because a Hebridean Norse adventurer by the name of Godred Haraldsson – but more usually remembered as Godred _Crovan_ ('of the white hand') – is known to have fought at Stamford Bridge and would almost certainly have joined the Norwegian forces in Orkney, presumably in company with some number of other ships and warriors from the Isles and from Man.
When the fleet sailed out of the Flow to cross the Pentland Firth on voyage for England, Harald's queen Ellisif remained in Orkney, probably at Kirkwall, with her daughters and there awaited a husband and father whom they were never again to see alive. Presumably Harald had brought his queen and their daughters thus far west-over-sea so as to be nearer at hand to join him when he had won his new kingdom, and yet he had left his elder son Magnus with his mother, Thora, in Norway where he was to act as regent while his father was otherwise engaged upon the conquest of England.
Across the Pentland Firth now and rounding Duncansby Head, the fleet sailed down the east coast of the Scottish mainland until it reached the Forth. Two versions of the _Anglo-Saxon Chronicle_ have been taken to indicate the Scottish court of Malcolm Canmore at Dunfermline as the place of Harald's first meeting with Tostig, who there 'gave him allegiance and became his man', but the evidence of the Abingdon 'C' _Chronicle_ is probably to be preferred when it places their meeting at 'the mouth of the Tyne as they had previously arranged'. If so, then there is no reason to assume that Harald might have put into the Forth on an impromptu state visit to Scotland. In fact, the saga does state quite plainly that 'he sailed down the coast of Scotland and down the English coast' and there is a very practical reason why he should have done so, because the wind had thus far been with him, giving his fleet a good speed southwards from Orkney. That same wind was keeping William the Norman's invasion fleet bottled up at the mouth of the Somme and winds can change or simply drop away altogether, so there was everything to be gained by pressing on to the target zone in northern England.
If the same thought had also been in Tostig's mind, then he would have had reason to expect the timely arrival of the Norwegian fleet from Orkney and brought his own few ships out of the Forth to meet the Norwegian fleet at Tynemouth 'as they had previously arranged'. Harald cannot have been greatly impressed by the first sight of his ally's contribution to the enterprise, although the saga makes no mention of any such opinion and, indeed, makes no mention of Tostig at all until the expedition had sailed up the Humber and won its first battle. Only at that point is there entered a hasty reassurance – framed as if it were a mere detail which had slipped Snorri's mind – of Tostig having travelled north from Flanders 'to join King Harald as soon as he arrived in England'.
Snorri does have a full account, and one more detailed than in any other version of the saga, of the Norwegian progress down the Northumbrian coast to make its first English landfall in the district of Cleveland – probably disembarking at the mouth of the Tees – where a landing party is said to have ravaged the countryside without resistance. While this might be recognised as a 'run ashore' to replenish supplies after days at sea and in the way of the old viking _strandhögg_ , the saga reference to Harald having 'subjugated the whole district' might equally be read to indicate it as an exercise in intimidation akin to his regular summer-raiding of the Danes. Unless the same raiding band stayed on shore to advance southwards overland, the fleet's next landfall would seem to have been made at Scarborough – a place-name originating as 'Skarthi's burg' and said to commemorate one Thorgil called _Skarthi_ ('the hare-lipped') who had established his viking fortress there a full century before Harald's arrival – and this one is still more reminiscent of that earlier campaigning in Denmark. Meeting with determined resistance on the part of the townsfolk, Harald's weapon of choice on this occasion, as so often in the past, was fire and a great pyre was lit on the higher ground above the town, from which flaming logs were pitchforked down on to the roofs. Houses went afire one after another until Skarthi's old burg was so greatly damaged – even 'destroyed' according to the saga – that the raiders were able to descend upon it for the usual plunder and slaughter. Curiously, nothing of this is recorded in the early English sources and yet it is said still to survive as a horror story in local tradition.
'In this manner,' says the saga, 'King Harald subdued the country wherever he went.' So he was to do further down the coast in the district of Holderness, a place-name indicating the district as the domain of a _hold_ , a title reserved for an important local magnate and evidently one with forces ready to meet the invader in arms when Snorri tells of Harald's men having defeated them in battle. The landing parties would have been back aboard their ships before the fleet rounded Ravenspur (now Spurn Head) to sail up the Humber estuary until it entered the River Ouse and there put into land at a place identified – but only by John of Worcester and his very early twelfth-century contemporary, Simeon of Durham – as _Richale_ (now Riccall).
Harald was now within reach of his principal objective, because the Ouse flows through York, a city of some fifteen thousand households defended by such fortified walls as befitted the capital fortress of the vast Northumbrian earldom and yet still very much a trading centre of similar Scandinavian character to that of Dublin beyond the Irish Sea. Capture of York must have been the first major objective of the expedition, and certainly on the part of Tostig who would have known the city, its people and its surrounding shires very well since it had been his official power base for a full decade, thus raising the question as to why the invasion fleet should have come to rest at Riccall rather than pressing on up the Ouse, even to York itself. The most likely explanation would seem to be the presence of an element of the English fleet, or possibly the naval component of the Northumbrian earl's forces, which would appear – from a reference in the _Anglo-Saxon Chronicle_ – to have been up the River Wharfe, where it might well have taken refuge on learning of the appearance of so great a Norwegian force approaching the Humber. It would seem, then, that Harald probably placed his own fleet at Riccall to trap these English ships in the Wharfe, while still enabling disembarkation of his troops at a point just some seven miles' march from the city.
It is possible, had he been so optimistic, that Tostig might have hoped to gain immediate entry to his former capital and the submission of its townsfolk on his arrival with an impressive Norwegian army. It is certainly no less likely that he would have given Harald just such an impression, and yet his own arrival off the Tyne with a mere dozen ships would not have inspired confidence in such assurances, especially when Morcar and Edwin had their combined forces within the city walls, presumably inspired with confidence after their success against Tostig in Lincolnshire. While the alarming news of this quite unexpected invasion had been despatched to Harold Godwinson as soon as the Norwegian Harald landed at Riccall, the great forces he had mustered against Tostig's earlier attacks on the south coast are known to have been disbanded on 8 September (and thus, according to John of Worcester and Simeon of Durham, only shortly before the Norwegian fleet reached Tynemouth).
Probably thinking that York was unable to hold out against the expected onslaught or siege long enough for a royal relief force to be assembled and to accomplish the long march north, Edwin and Morcar appear to have decided to march their forces out of the city and confront the enemy in open battle, possibly even in the belief that just such a strategy had more often favoured English than Scandinavian forces in the past. The saga seems to indicate Harald's forces disembarking from their ships at Riccall and almost immediately advancing along the road to York, but it is more likely that the landing of so many troops with their equipment and supplies from some three hundred craft would have taken rather longer, and that the advance along the Ouse would not have begun until at least a day or two after the disembarkation. Edwin and Morcar, meanwhile, had assuredly stationed a watch along the obvious route of approach while holding their forces in readiness for warning of the approaching enemy.
While so much of this preliminary detail is left obscure in all the sources, the account of the conflict itself as set out by Snorri in his _Harald's saga_ is possessed of an unusual clarity. He is even able to agree with the English sources on the precise date of the battle when he assigns it to the 'Wednesday before Saint Matthew's Day' or Wednesday 20 September in the modern calendar. It is to just one English authority however – namely, the locally well-informed Simeon of Durham – that history is indebted for the specific location of the site of battle 'at Fulford near York on the northern bank of the Ouse'. The name Fulford apparently does mean 'foul ford' and is said by a local historian to refer to 'the foul or muddy beck which feeds into the river here',6 yet in older times there were two Fulfords along this bank of the river, one of them called Water Fulford and the other Fulford Gate (or sometimes 'Gate Fulford') which has given its name to the battle fought along the stretch of riverbank known as Fulford Ings.
Simeon's use of the term 'northern bank' is somewhat misleading because it can only apply to the city of York rather than to the battlefield, which was clearly on the southern bank of the river as it flowed along the left of Harald's advance from Riccall. By the time his army reached the vicinity of the Fulford and had thus come within a couple of miles of the city, the Northumbrian and Mercian armies were formed up behind their shield-wall to block the invaders' path. Snorri tells how Harald drew up his troops across a broad front, with its left flank reaching down to the river and the other towards a dike (or ditch) which appears to have extended into a deep, wide swamp. Harald's standard was raised on the riverside flank 'where his forces stood thickest' while the thinner ranks of his less reliable troops (presumably those with Tostig) stood over by the dike.
The earls' forces took the initiative with a charge – made along the line of the dike and led by Morcar's standard – which drove into the right flank of the Norwegian line and apparently caused it to break up on impact. Whether this reflected the weakness of Tostig's contingent or represented a tactical feint typical of Harald's guile is uncertain, but it was that point in the battle which the king chose to order his left wing into an attack against the facing ranks of Edwin's forces. With his Land-ravager standard to the fore, the swerve of the Norwegian charge crumbled the enemy into disorder and a great many were slain even before they took flight, some along the riverbanks but most of them into the dike 'where their dead soon lay so thickly that the northmen could cross the waterlogged swamp dry-shod'.
Whether success came quite as swiftly as the saga suggests or only after the 'long contest' described in the English sources, it was still a truly historic triumph – not only the last of so many credited to Harald himself, but also the very last Scandinavian victory on English soil. It would seem, nonetheless, to have been won at no small cost when John of Worcester tells of Morcar's men having 'fought so bravely at the onset of the battle that many of the enemy were laid low', so it is very likely that Tostig's right wing would have suffered heavy casualties in Morcar's initial onslaught. Yet all the saga-makers are in error when they claim Earl Morcar to have been slain in the fighting, because he certainly survived the battle, probably by taking flight and perhaps to his own country of East Anglia where he was to reappear in 1071 and with his brother Edwin among the leaders of a revolt against the Norman conquest. The authority for this premature obituary of Morcar appears to be an oddly formed strophe quoted in the _Heimskringla_ version of the saga where it is attributed to the skald Stein Herdisason, and so perhaps even the learned Snorri was misled in this instance by the acrobatic complexities of skaldic syntax. So too, it seems that misinterpretation of another line of verse might have led him to identify Morcar's brother earl Edwin as Waltheof, presumably meaning the son of the late Earl Siward of Northumbria. This strophe, quoted from an otherwise unknown and unattributed _Haraldsstikki_ , tells of 'Waltheof's warriors by weapons slain, lying fallen thickly in the fenland', but does not indicate this _Wæltheow_ either as Morcar's brother or as an earl (even though he had been given an earldom in the Midlands). Yet Siward's son was certainly of an age to fight at Fulford and may well have done so – possibly among Edwin's Mercian contingent – because he is known to have fought with the English forces just a few weeks later at Hastings.
Neither of these two skaldic authorities quoted in the saga can be said with any certainty to have been present at the battle of Fulford, but there was one skald who is known to have accompanied the expedition to England in 1066 and he was, of course, Harald's favourite court-poet Thjodolf Arnorsson who composed his last known verses on the field of his king's last battle and is said by a credible Icelandic source to have been killed at Stamford Bridge.7
Not until the passage immediately following the account of the blood-fray at Fulford, however, does the saga find occasion to notice that Tostig had earlier joined the expedition and to add an almost apologetic note of the earl having taken part 'in all these battles'. It is also at this point in the narrative that Snorri makes his first reference to the place-name of Stamford Bridge (or _Stafnfurðubryggja_ ) when he tells of Harald's assembling his forces there while preparing to advance on York (apparently imagining Stamford Bridge on the Derwent some seven miles east of the city to have been very much closer to the fleet at Riccall).
The saga next tells of English friends and supporters of Tostig flocking to join the victorious army – 'just as Jarl Tostig had previously promised' – and of all the inhabitants of the countryside around the city offering submission to Harald after learning of the defeat of their 'powerful chieftains'. In fact, these few sentences must represent a summary of the invaders' activity during the three days following the battle, events which culminated in Harald's receipt of a message sent out by the inhabitants of York to offer – in the words of his saga in _Fagrskinna_ – 'themselves and their town into his power'.
Agreement on the terms of submission was to be made at a meeting just outside the city walls on the following Sunday (24 September), to which Harald arrived accompanied by his whole army. Having demonstrated the potential of his military might, the king is said by the saga to have been given the allegiance of the townsfolk and 'the sons of their leading men' (a choice apparently guided by Tostig's local knowledge) as the customary hostages. In fact, these terms would appear to have been even more reasonable than indicated by the saga, because John of Worcester and Simeon of Durham tell of an exchange of hostages, a hundred and fifty being given over by each side. Such generosity would have been sensibly diplomatic on Harald's part, if his greater need was recruitment of local warriors to replenish the manpower thinned down at Fulford before moving south against the English Harold, and would also have been in Tostig's best interests if York was to be the capital of his earldom once again.
Of still greater value in explaining the subsequent course of this hostage exchange is the evidence of the Abingdon 'C' version of the _Anglo-Saxon Chronicle_ because its indication of the Yorkshire hostages being delivered to Harald on the following day would imply their being gathered from the surrounding districts, the Wolds and the vales of Pickering and of York, as well as from the city itself. The best-appointed place of delivery from these different directions would have been the crossing over the Derwent where the old Roman roadways linking York to outer-lying centres of population at Bridlington, Malton and Thornton-le-Street all converged on Stamford Bridge.
Having returned with his army to the ships on the Sunday night, Harald rose on the next morning to breakfast in bright sunshine before dispersing his forces for the day ahead. One warrior out of every three was to stay with the ships and under the command of his son Olaf, his new marshal Eystein Thorbergsson, called _Orri_ ('the heathcock'), and the two Orkney jarls, while the other two thirds of his army were to accompany him for collection of the promised hostages at Stamford Bridge. Taking up their shields, helmets, swords and spears, there seemed no need to burden themselves with the great weight of mail-coats on such a day and so their armour was left behind. The saga even describes the troops as 'very carefree' when they set out from Riccall that morning, because they were as yet entirely unaware that Harold Godwinson and his army, numbered by the chroniclers in the 'many thousands', was just seven miles away.
There is no precise indication of when news of the invasion reached the English king, whose greater concern as regards impending invasion from Normandy had kept him in the south while his northerly earls saw off the nuisance of his brother Tostig's raiding around the east coast, but he evidently moved with the greatest urgency as soon as he knew of the Norwegian landing at Riccall, summoning his housecarls and 'marching northward, by day and night' – according to the Abingdon 'C' _Anglo-Saxon Chronicle_ – 'as quickly as he could muster his _fyrd_ '.
This _fyrd_ was the English equivalent of the Scandinavian _leiðang_ , although much more reliably recorded and in detail before the mid-eleventh century. Put most simply, then, the _fyrd_ was a levy raised on the basis of one man from every five hides (a 'hide' being the land necessary to support a household, varying between different parts of the country and so ranging between 60 and 120 acres). Although unarmoured and equipped only with such weaponry as the bow and the axe which otherwise served them as the customary tools of the countryman, the select _fyrd_ – meaning those most usually called out and kept in some measure of military training – nonetheless represented a semi-professional fighting force forming the rank and file of an Anglo-Saxon army, while the mail-coated, sword-bearing housecarls were the real professionals who formed its true cutting-edge.
In all probability, the royal housecarls would have accompanied the king on horseback so as to make all possible speed on the long road to York. Some members of the _fyrd_ may also have had horses to ride, but the greater majority would have been on foot and mustered to join the march as it passed through their shires. By whatever means the army travelled, it clearly managed a remarkable pace for almost 200 miles, because the king was already on his way when he had news of the earls' defeat at Fulford and yet had reached the Wharfe in time to spend the night of Sunday 24 September at Tadcaster. On the following morning, his troops made directly for York, where they would have been informed of the place of the planned hostage-collection and so marched straight through the city to advance on Stamford Bridge.
For whatever reason – possibly the belief that Harold was too far distant to present any immediate threat or perhaps sheer over-confidence in the wake of a decisive victory – the usually deeply suspicious Harald of Norway had neglected to post any watch on the main approaches to the city itself, because the sources are unanimous as to his being caught entirely unawares when a swelling dust cloud was seen in the distance from the ridge of higher ground where he stood with his men on the east bank of the Derwent. The saga tells of the sunlight picking out the gleam of shields and glint of mail through the rolling cloud, prompting Harald to ask of Tostig who this host might be. Admitting that it did indeed appear hostile, Tostig still hoped that it might be the approach of more of his friends seeking protection from the all-conquering invader, and yet the king chose to wait until more was known about this army. 'So they did' – according to the saga – 'and the nearer came the host, the greater it appeared and its glitter of its weapons sparkled like a field of broken ice.'
By this time Harald can have been in no doubt that this was the enemy host and surely led by the English king himself. Tostig's first thought was 'to turn and hasten back to the ships for the rest of the men and the weapons, and to put up a defence among them with the ships to prevent their horsemen riding over us', but Harald had another plan: 'We shall send three good warriors on the fastest horses, to ride with all speed to bring our men to come to our assistance at once. The English will have a hard fight of it before we are all brought down.' These two statements – probably true in substance, but otherwise of the saga-maker's own reconstruction – introduce a question which stands at the centre of the historians' debate about Stamford Bridge when it concerns the role of horses in the battle, not least as regards the sagas' claim for Anglo-Saxons fighting as cavalry.
It is usually assumed that northmen coming ashore from their ships to plunder inland would have simply seized any available horses to speed their progress and this was assuredly the case in the earlier 'viking' period, but King Harald was not embarked upon any such free-booting enterprise in 1066. This was a full-scale invasion akin to that in which he had served as a Varangian officer in the front line of Maniakes' landings in Sicily almost thirty years before. There he quite certainly saw the warhorses of the Tagmata being brought ashore from the imperial fleet, so Harald may have been seeking to emulate the Greeks if he shipped horses of a quality befitting a conquering king and his retinue aboard the fleet he brought out of the Solunds that autumn.
The supposed English cavalry of such concern to Tostig are another question entirely, and one which will bear further consideration shortly, but attention must first be paid to a feature of the opening phase of the battle which seems to have entirely escaped the notice of the saga-makers. Saxo Grammaticus agrees with all the other Scandinavian sources when he tells of the Norwegians having 'left off their armour' when leaving their camp, but stands alone in his assertion that their intention was to plunder the surrounding land, yet he would seem to have some support from Geoffroi Gaimar's reference to 'thieving cattle'. Kelly DeVries has linked these two references to the story found in some English chronicles and telling of a Norwegian contingent caught on the other side of the bridge when the enemy host appeared. His very convincing theory proposes some of the northmen having earlier crossed the river from Harald's position to replenish their provisions by slaughtering cattle grazing in the meadow on the west bank.8 There is every reason, in that case, to believe that they would have been attacked by the first English arrivals, some attempting to take flight back across the river while others made a stand at the bridge, if only to buy more time for the main force to arrange its defensive formation. The heroism of one of these warriors – a burly axe-man who apparently had chosen to wear his byrnie that day – is celebrated by the twelfth-century historians Henry of Huntingdon and William of Malmesbury as also by an interpolation of the same date into the Abingdon 'C' _Anglo-Saxon Chronicle_ , all describing how he held the bridge against the enemy, his mail-coat deflecting their arrows until a spear thrust from below finally dealt him his death wound and allowed the English free passage across the river.
Surprisingly, there is no account of this magnificent stand in any version of the saga, possibly because it simply went unnoticed by his comrades on the east bank who were more urgently concerned with preparation for battle, but if there is any truth in the story then Harald and his men owed no small debt to the time he bought for their formation into the shield-wall which was to long hold off the English onslaught. The sagas all describe the use of this characteristic defensive tactic, with Snorri supplying the most detail of a 'long and rather slender line, its wings bent back until they met to form a wide circle of even depth all round, with shields overlapping both before and above'. Harald was inside the circle with his standard and his warrior retinue, as was Tostig with his company and his own banner, but Snorri goes on to explain that the archers (who cannot have been numerous) were to remain inside the circle while the men in the front rank fixed their spear-shafts into the ground with the points levelled directly against oncoming cavalry, both the men and their mounts.
By this time Harold Godwinson had arrayed a 'vast army, of both cavalry and infantry', and the saga records the sequence of verbal exchanges which usually form a prelude to battle. The first of these occurs when Harald falls from his 'black horse with a blaze [on its nose]' while riding around the shield-wall and clambering swiftly back to his feet as he declares: 'That fall was the farewell to fortune.'9 All of which is said to have been seen from a distance by the English Harold who asks of some Norse-speakers who were with him if they recognised the 'big man who fell from his horse, the man in the blue tunic and beautiful helmet' and is told that it was the king himself. 'What a large and formidable man he is! Let us hope now that his luck has run out.'
Now the saga tells of twenty horsemen riding out from the English host and up to (or at least within earshot of) the Norwegian lines. One of them asks whether Tostig is with the army and the man himself replies in the affirmative. The foremost of the riders presents him his brother Harold's greetings along with an offer of peace and all of Northumbria as well. Indeed, and rather than have his brother refuse to join him, he would even concede a full third of his kingdom. Tostig recalls his brother's very different attitude of the previous winter before asking what might be offered to King Harald Sigurdsson for all his endeavours, only to be told of the precise extent of England which was to be allowed the Norwegian Harald: 'Seven feet of earth or as much more as he is taller than other men.'
This reply is set down in slightly variant forms across the versions of Harald's sagas (excepting only that in _Morkinskinna_ which records nothing of these preliminary exchanges) and with such close similarity as to indicate their having drawn it from a common source. If this, presumably Scandinavian and probably Norwegian, original represented an entirely fictional construction, it is one quite remarkable for its splendidly English resonance, and all the more so when it appears nowhere in the earlier English historical record. As so often on these occasions, if no such statement really was spoken at the time then there is every reason to feel that it ought to have been – even though no such eloquence was to sway Tostig, who compared the earlier 'treachery' of Harold his brother with the loyalty shown by Harald his ally, and declared their shared intention to win the realm of England by a victory or to die with honour in the attempt.
As the rider and his company rode back to the English lines, the Norwegian Harald asked Tostig if he knew 'the man who had spoken so well'. When told that it had been Harold Godwinson himself, the king said he wished he had known that earlier so as to ensure that 'this Harold should not live to tell of the deaths of so many of our men'. Tostig admitted to having expected as much and so to have revealed the identity of his brother would have effectively amounted to becoming his murderer. 'Rather that he should kill me than I him.' 'What a small man,' was Harald's comment on the English king as he turned towards his own warriors, 'but how well he stood in his stirrups.'
At which point in the darkening narrative, Snorri quotes a strophe said to have been composed by Harald at the time which tells of going 'forward into battle against blue blades, [while] my byrnie and all our armour lies with the ships'. Snorri takes this opportunity to describe the king's mail-coat as being so long that it reached below the knee (thus closer to the Norman style than that of the thigh-length northern byrnie) and nicknamed 'Emma' (perhaps as a satirical reference to Cnut's Norman queen and the mother of Hardacnut). Unhappy with his first 'poor verse', Harald attempts a more inspiring version which speaks of the 'Hild of combat [a kenning for one of Odin's valkyrie daughters, but perhaps alluding also to his own mother] who bade me hold my head high in bloody battle, when blades and skulls are clashing'. To which the skald Thjodolf adds his own strophe promising to guard the 'eaglet' princes who are destined to avenge 'hard-fighting, high-hearted Harald' should their father fall in the blood-fray now about to begin.
The course of the battle of Stamford Bridge as described in the sagas corresponds in most essentials to the traditional sequence of assaults on the shield-wall repulsed by arrow and spear until at last the defending formation breaks out in a charge and the day is decided by hand-to-hand combat. None of which would surprise the military historian were it not for the sagas' clear statement of the English attacking as cavalry, because while the Anglo-Saxon warrior is known to have ridden to battle on horseback he is always believed to have dismounted on reaching the field where he invariably fought on foot. Numerous contributors to a long-running scholarly debate have suggested various other battles as the model followed by the saga-makers, but it is the one fought at Hastings where Harold Godwinson was defeated and slain just nineteen days after his own defeat of Harald Hardrada at Stamford Bridge which is usually suggested as the likely exemplar.
The most unhelpful factor in this debate is the absence from other accounts of Stamford Bridge of any detail which might confirm or deny the saga-makers' version of events, and this has enabled the suggestion from at least one quarter that the saga version might, at least to some extent, be historically accurate. Nor can such a proposal be dismissed out of hand, because it is certainly not impossible that Harold Godwinson might have taken advantage of so many of his housecarls having been mounted for the northward march to order them into battle on horseback against a shield-wall such as he himself may not have encountered before. He might even have been inspired to do so by the Norman cavalry he would have seen while in service with Duke William some two years earlier – and yet cavalry warfare of the quality perfected by the Normans is a rather more sophisticated technique than simply fighting on horseback and it is inconceivable that Anglo-Saxon warriors armed to fight on foot as heavy infantry could have gone into battle on horseback with anything akin to the expertise of Norman cavalry highly trained to charge with couched lance in squadron formation.
Whatever might have been the source of the saga accounts, the suggestion of waves of mounted spearmen flung against a shield-wall flies in the face of everything that is known about Anglo-Saxon warfaring and so the most that might be allowed – if the saga-makers are to be given some benefit of doubt in the absence of any decisive evidence to the contrary – is the possibility of just some housecarls having led the English attack on horseback, even if not strictly as 'cavalry'. Nonetheless, the Norwegian defensive formation held firm and drove off each wave of assailants, although Snorri indicates mounted warriors riding in circles around a loose defensive formation and seeking for any openings into the ranks. After some duration of this onslaught – and probably very much later in the afternoon, because it is unlikely that the armies had reached the field before midday – there came the crucial moment when the shield-wall broke open to allow the headlong charge in pursuit of a retreating enemy.
Yet here the saga-makers are at variance, because Snorri indicates this as an unwise Norwegian response to a deliberately feigned retreat by the English intended to draw them out from behind a solid wall formed of iron, oak and muscle before turning around to unleash a maelstrom of spears and arrows against a headlong disordered pursuit. This proposal bears such a distinct similarity to the later course of battle at Hastings as to arouse suspicion and so the rather different interpretation offered by the other versions of the saga in _Morkinskinna, Fagrskinna_ and _Flateyjarbók_ – all of them indicating the sudden charge as a counter-attack against a particularly fierce mounted offensive around the defensive circle – is probably to be preferred. Understandably provoked by the sheer aggravation of relentless attack suffered in close and cramped formation, the northmen at last broke out of their shield-wall to launch a ferocious charge against an enemy thrown into sudden retreat 'and there was a great slaughter among both armies'. When the Norwegian king saw what was happening, he led his own retinue into the greatest heat of the fighting, much as Olaf had done at this stage in his own last battle. Quite unlike his half-brother, however, Harald was consumed by an uncontrolled warrior-fury – seemingly akin to that of the berserkers of viking legend – when he rushed ahead of his companion warriors, slashing with both hands so that neither helmet nor mail-coat could withstand his onslaught and all in his path fell back before him.
In the death-song he had promised to compose for Harald some twenty years before, Arnor Jarlaskald tells how 'Norway's king had nothing to shield his breast in the battling, and yet his war-hardened heart never wavered, while Norway's warriors were watching the bloodied sword of their bravest leader slicing down their foemen'. So perhaps it was just as he had always known it would be – with his battle-rage at white heat and no mail-coat to stem his stride nor shield-grip to hamper his wielding a weapon in each hand – that Harald Hardrada came at last to the end of his warrior's way, because the saga tells how it seemed that the enemy were about to be routed when the king was struck by an arrow in the throat.
'And this was his death-wound.'
There is no reason to doubt the wound-site, because the exposed throat and face offered the obvious target area for an archer aiming to kill a fully mailed warrior. The saga-maker may even have been right in believing the victory to have been within grasp when the king fell because a berserker charge must have been one of the most fearsome experiences of early medieval warfare. Even so, the odds were still stacked against a Norwegian victory when the northmen without armour or heavier war-gear had been caught entirely unawares by an enemy host of apparently superior numbers.
Beyond such straightforward pragmatic considerations, there is another factor of bearing and it lies in the claims made by the skalds and saga-makers for Harald's 'great victory-luck'. Indeed, the English Harold would seem also to have known of it, if he truly did suspect that it might be about to run out when he saw his enemy fall from a horse on that Monday afternoon – as did Harald himself, and at much the same time, when he spoke of a 'farewell to fortune'. Yet a skald steeped in the ancient legends of the northland might have read those same runes differently, because he would have known Odin as the least trustworthy of battle-gods who would sustain and shield one of his chosen through years of warfaring before suddenly failing him, and for no other reason than to summon another hero home to Valhalla.
On the field of Stamford Bridge meanwhile, the king was dead and his fall is said to have been followed by a lengthy pause in the fighting. Tostig still stood beside the royal standard in the place where the main force had earlier held their formation and there began to re-form the shield-wall while the skald Thjodolf – possibly already wounded and not long to outlive his lord – composed the grim lines of what was to be his last strophe:
Upon evil days has
the host now fallen;
needless and for nothing out
of northland Harald brought us;
badly bested we are now
and ended in the life of he
who boldly bade us battle
here in England.
It was then that the English Harold found his way towards earshot of his brother and again offered quarter both to him and to those survivors who stood with him. But the northmen shouted back that they would sooner die than yield and roared out their war-cry to begin the slaughter once again. It must have been during this phase of the battle – which cannot have lasted long with so few left alive to fill up gaps in the shield-wall – that Tostig was slain, although Snorri makes no further mention of him and the saga record of his fighting bravely until finally struck down is preserved only in _Morkinskinna, Fagrskinna_ and _Flateyjarbók_.
Yet the blood-fray was still not done, because at this point Harald's marshal Eystein Orri arrived and with him a force of warriors who had remained at the ships that morning. These men had not left their armour behind, of course, and so were exhausted after running so many miles from Riccall in full war-gear, yet when Eystein found Land-ravager and raised it up again, they summoned up the energy to renew the onset with such greater ferocity that it was long remembered – according to the saga – as 'Orri's Battle'. As the heat of battle rose to match the heat of the day, many of Eystein's men are said to have thrown off the weight of their mail-coats, thus offering softer targets to the English blades that cut them down. 'Almost all the leading Norwegians were killed there.'
Those who survived apparently attempted to flee back to Riccall, because the Worcester _Anglo-Saxon Chronicle_ tells of many killed by drowning or burning and indicates the English pursuit having extended even to an attack on at least some of the ships, which would well correspond to Snorri's statement that 'it had grown dark before the carnage was ended'. Nonetheless, there were some of 'the leading Norwegians' who had not fallen with Eystein, because other saga sources record that the young prince Olaf (who is known to have fought at Fulford) had stayed with the two Orkney jarls to guard the ships while Eystein answered the call to battle. Thus these three represented the surviving principals of the Norwegian army when, according to the same _Chronicle_ , Harold Godwinson of England gave 'quarter to Olaf, the son of the king of the Norwegians . . . to the jarl[s] of Orkney and to all those who were left aboard the ships'. Harold Godwinson must have had more than enough of killing when, despite his best efforts at peacemaking, he had found his own brother's remains among the thousands lying on the battlefield at Stamford Bridge and afterwards arranged for Tostig's burial at York, but not so very long before he himself was to fall in battle at Hastings against the Norman duke to whom he was said to have sworn fealty two years earlier.
By which time, Olaf, Paul and Erlend had taken ship – or, more precisely, just two dozen ships, which are said by the _Chronicle_ to have been all that were needed to carry home the survivors of the Norwegian army – from Ravenspur back to Orkney. There Olaf was reunited with his father's queen Ellisif and his half-sister Ingigerd, but alas not with her sister Maria, who is said by the sagas to have died on the day – and, indeed, at the very hour – when her father had fallen in battle.
The three of them passed the winter in Orkney and in the following summer returned to Norway where Olaf shared the kingship with his brother Magnus. On Magnus' death, just two years later in 1069, he succeeded as sole king of Norway and is remembered as _Olaf kyrra_ , or 'Olaf the Quiet'. For whatever reason (unexplained in any of the sources), his father's remains were not brought back to Norway until later in the year following the battle, when Harald Sigurdsson was buried, according to his saga, 'at Nidaros in Saint Mary's church which he himself had founded'.
## _Land-ravager_
## AN AFTERWORD FROM WEST-OVER-SEA
Nothing further is told of Harald's famous standard in the saga after Eystein Orri had retrieved the banner from wherever it had been abandoned when Tostig was slain and raised it up again to lead his warriors in the last desperate stand remembered as 'Orri's Battle'. At which point _Landeyðuna_ disappears entirely from the saga record and might be thought to have been lost for ever amid the blood-stained debris left lying along the bank of the Derwent water. Yet it need not be so, because there is reason to believe that the celebrated Land-ravager was not only rescued from the field of Stamford Bridge but eventually found its way to a westward region of the Scandinavian expansion where Harald himself had no occasion to travel but where his grandson, Magnus Olafsson – called 'Bareleg' on account of his adoption of the garb of the Gael – is well remembered as the warrior king who finally and formally claimed the Hebrides (or _Suðreyjar_ ) for Norway in 1098.
In the room thought to have been the original Great Hall of Dunvegan Castle on the Isle of Skye is displayed a broad fragment of textile known in the Gaelic as _Am Bratach Sidhe_ (or 'The Fairy Flag') and long regarded as the most treasured possession of the Clan Macleod, whose principal stronghold this fortress is said to have been since the fourteenth century when the name Macleod made its first entry into the historical record. At least half a dozen stories are told of how this 'Fairy Flag' came into the possession of the Macleods of Dunvegan – some claiming it to have been a gift of the fairy folk (and, indeed, the bridge where that gift was made is clearly signalled to any modern visitor who might pass that way), while others say it was brought from the Holy Land by a clansman returning from a crusade. There are problems with both of these traditions, firstly by reason of the unreliable historicity of fairies and secondly because there appears to be no record of any Macleod known to have been on any of the crusades.
Another feature of the traditions surrounding this _Bratach Sidhe_ is the belief in its power to save the clan in times of danger and Macleod chieftains are said to have twice unfurled the flag when hard-pressed in battle and thus to have won the victory. It is this claim – and the possibility of its association with the Fairy Flag long before it came into the hands of the Macleods – which points toward the genuinely historical proposal that _Am Bratach Sidhe_ is, in fact, Harald Hardrada's _Landeyðuna_.
Clan Macleod has always been proud of its Gaelic-Norse origins and justly so because their line has been convincingly traced all the way back to Olaf Cuaran, Norse king of York and of Dublin, who died the 'straw death' in monastic retirement on Iona in 981. The Leod for whom the clan is named, however, was directly descended from the line of the Norse kings of Man and the Isles through one Helga 'of the beautiful hair' who was the sister of the same Godred Crovan who fought with the Norwegian army at Stamford Bridge and survived the battle to become the founding dynast of the royal house of Man.
The entry under the year 1066 in the thirteenth-century _Chronicle of Man_ refers to the 'very great slaughter of the Norwegians' at Stamford Bridge and tells of 'Godred, called _Crovan_ , son of Harald the Black from _Island_ [thought to mean the Isle of Islay], fleeing from the rout' and making his escape (probably overland by way of North Wales or the Solway) to the Isle of Man. The saga account of the phases of the conflict would almost certainly indicate the 'rout' referred to by the _Chronicle_ as 'Orri's Battle', in the course of which Land-ravager disappears from the historical record. If Godred had brought a banner, probably made of silk and assuredly of Byzantine origin, back from Stamford Bridge, he could very well have made a gift of it to his sister and assuredly also spoken of the legendary powers associated with its service as Harald's battle-flag.
All of which might be thought to correspond quite impressively to the proposal of Land-ravager having been handed down the generations of Helga's descendants even to the present Macleod of Macleod in whose castle at Dunvegan it is revered as _Am Bratach Sidhe_. Still more impressive, though, are the results of a modern forensic examination of the fabric of the Fairy Flag identifying it as a silk at least as old as the seventh century and of eastern origin, probably from Rhodes or possibly from Syria, both of which were sources supplying this greatly prized textile to the Byzantines.
If the Fairy Flag of the Macleods really is the same Land-ravager banner which Harald is said to have valued above all other treasures in his possession, then its location on Skye offers a quite remarkable coincidence, because to the south-east of Dunvegan stands the magnificent mountain range known as the Cuillin.
Once again, the claims of 'Celtic' tradition might stand accused of clouding the issue and not least through the efforts of Sir Walter Scott who played a great part in associating 'Cuillin' with the legendary Irish hero Cuchullain. In fact, the true origin of the name, alike to that of the other Cuillin on the neighbouring island of Rum, derives from the Old Norse – _kjolr_ ('the keel') or _kiolen_ ('high rocks') – and so the Cuillin of Skye can be said to share its name with the Kjolen range over which the young Harald Sigurdsson, having recovered from wounds suffered at Stiklestad, crossed from Norway into Sweden along that early passage of his warrior's way.
## Genealogies
There is just one abbreviation: HH = Harald Hardrada
DESCENT OF HARALD HARDRADA AND HIS SUCCESORS FROM HARALD FAIR-HAIR
THE ARNASONS AND THEIR NETWORK OF MARITAL KINSHIP
THE JARLS OF LADE AND THEIR DESCENDANTS
## _Notes and References_
##### Introduction
1. Magnusson & Pálsson (ed.), _King Harald's Saga_ , p. 31.
2. Turville-Petre, _Haraldr the Hard-ruler and his Poets_ , p. 5.
3. Blöndal & Benedikz, _The Varangians of Byzantium_ , p. 210.
4. Turville-Petre, _Haraldr the Hard-ruler and his Poets_ , pp. 3–4.
##### Stiklestad
1. Turville-Petre, _The Heroic Age of Scandinavia_ , p. 156.
2. Jones, _A History of the Vikings_ , p. 382.
3. In the twelfth-century saga texts, however, Russia is identified by the later Icelandic name-form of _Garðaríki_.
4. While the saga actually specifies 'four hundred chosen men', such references are calculated in 'long hundreds', or 120 in modern reckoning, and so the reinforcement would have amounted to 480 of Onund's warriors. That same formula is applied here to all troop and ship numbers found in the saga texts, although such figures should usually be considered only as approximations.
5. Foote & Wilson, _The Viking Achievement_ , p. 284.
6. 'Weapon thing' is one of many skaldic kennings for 'battle'.
7. Foote & Wilson, _The Viking Achievement_ , p. 80.
8. Although usually translated as 'paunch-shaker', the original meaning may have been 'he who twangs the bow-string' and a reference to his part in the battle of Svold where the young Einar fought as an archer aboard Olaf Tryggvason's ship.
9. Thorstein's surname translates as 'knorr-maker', from the trading ship type known as a _knorr_.
10. Jacqueline Simpson (ed.), _The Olaf Sagas_ , p. 381.
11. By 'the Finns' is meant the Lapps, who are also a Finno–Ugrian people.
12. Turville-Petre, _Haraldr the Hard-ruler and his Poets_ , p. 10.
##### Varangian
1. Known in Russian as _Povest' Vremennykh Let_ , a title literally translated as 'Tale of the Years of Time'.
2. Franklin & Shepard, _The Emergence of Rus_ , p. 201.
3. Blöndal & Benedikz, _The Varangians of Byzantium_ , pp. 54–5.
4. Her eldest sister, Eudocia, had long since become a nun, thus effectively renouncing her claim on succession.
5. Blöndal & Benedikz, _The Varangians of Byzantium_ , p. 75.
6. _Ibid_., p. 66.
7. Pritsak, 'Varangians', in Pulsiano (ed.), _Medieval Scandinavia: An Encyclopedi_ a, p. 689.
8. Gravett, _Norman Knight_ : 950–1204 AD, p. 60.
9. Obolensky, _The Byzantine Commonwealth_ , pp. 84, 160.
10. Norwich, _A Short History of Byzantium_ , p. 222.
11. Blöndal & Benedikz, _The Varangians of Byzantium_ , pp. 80–6.
12. _Ibid_., pp. 97–8.
13. Harald's actual phrase is 'gold-[arm]ring _Gerðr_ '; _Gerðr_ being the name of the wife of the god Frey and used as a skaldic kenning to mean 'goddess' in the complimentary sense of the term when applied to a mortal woman.
14. 'Greek Fire' is thought to have been distilled petroleum thickened with sulphurous resin, which burst into flame on contact with enemy vessels and continued to burn on the water.
15. Franklin & Shepard, _The Emergence of Rus 750–1200_ , p. 216.
16. Obolensky, _The Byzantine Commonwealth_ , p. 225.
##### Hardrada
1. Jones, _A History of the Vikings_ , p. 404.
2. _Ibid_., p. 401.
3. _Ibid_., p. 407.
4. Davidson, _The Viking Road to Byzantium_ , pp. 221, 228.
5. If Stein's figures are given in 'long hundreds', as they probably are, then 150 Norwegian and 300 Danish ships would represent 180 and 360 respectively in modern reckoning, although such precision is of little bearing here.
##### Stamford Bridge
1. DeVries, _The Norwegian Invasion of England in 1066_ , p. 238.
2. Jones, _A History of the Vikings_ , p. 403.
3. DeVries, _The Norwegian Invasion of England in 1066_ , p. 230.
4. _Ibid_., p. 211.
5. _Ibid_., p. 204.
6. Broadhead, _Yorkshire Battlefields_ , p. 41.
7. Turville-Petre, _Haraldr the Hard-ruler and his Poets_ , p. 17.
8. DeVries, _The Norwegian Invasion of England in 1066_ , pp. 278–9.
9. There are different forms of translation of these words, but this (from DeVries, p. 284) is the most accurate.
## _Select Bibliography_
Adam of Bremen, _History of the Archbishops of Hamburg-Bremen_ (trans. F.T. Tschan), New York, 1959
Anderson, A.O. (trans.), _Early Sources of Scottish History AD 500–1286_, 1922, repr. Stanford, 1991
_Anglo-Saxon Chronicle, The_ (trans. G.N. Garmonsway), London, 1972
Blöndal, S. and Benedikz, B.S. (trans. and rev.), _The Varangians of Byzantium_ , Cambridge, 1978
Broadhead, I.E., _Yorkshire Battlefields_ , London, 1989
Davidson, H.R.E., _The Viking Road to Byzantium_ , London, 1976
DeVries, K., _The Norwegian Invasion of England in 1066,_ Woodbridge, 1999
Foote, P.G. and Wilson, D.M., _The Viking Achievement_ , London, 1980
Franklin, S. and Shepard, J., _The Emergence of Rus 750–1200_ , London, 1996
Graham-Campbell, J. (ed.), _The Viking World_ , London, 1980
Gravett, C., _Norman Knight 950–1204 AD_, London, 1993
Griffith, P., _The Viking Art of War_ , London, 1995
Harrison, M., _Anglo-Saxon Thegn 449–1066_ , London, 1993
——, _Viking Hersir 793–1066_ , London, 1993
Heath, I., Byzantine Armies AD 886–1118, Oxford, 1979
——, _The Vikings_ , London, 1985
Henry of Huntingdon, _The Chronicle of Henry of Huntingdon_ (trans. T. Forester), 1853, repr. Lampeter, 1991
John ['Florence'] of Worcester, _Florence of Worcester: The History of the Kings of England_ (trans. J. Stevenson), 1853, repr. Lampeter, 1988
Jones, G., _A History of the Vikings,_ Oxford, 1984
Karasulas, A., _Mounted Archers of the Steppe 600 BC –AD 1300_, Oxford, 2004
Lang, D.M., _The Bulgarians from ancient times to the Ottoman Conquest_ , London, 1976
_Laxdæla Saga_ (trans. M. Magnusson and H. Pálsson), Harmondsworth, 1969
Lindholm, D. and Nicolle, D., _Medieval Scandinavian Armies 1100–1300_ , Oxford, 2003
Nicolle, D., _Medieval Warfare Source Book: Christian Europe and its Neighbours_ , London, 1998
——, _Armies of the Caliphates 862–1098_ , Oxford, 1998
——, _Armies of Medieval Russia 750–1250_ , Oxford, 1999
Norwich, J.J., _A Short History of Byzantium_ , London, 1997
Obolensky, D., _The Byzantine Commonwealth: Eastern Europe 500–145_ 3, London, 1971
_Orkneyinga Saga_ (trans. H. Pálsson and P. Edwards), London, 1978
Page, R.I., _Chronicles of the Vikings: Records, Memorials and Myths_ , London, 1995
Psellus, Michael, _Fourteen Byzantine Rulers_ (trans. E.R.A. Sewter), London, 1966
Pulsiano, P. (ed.), _Medieval Scandinavia: An Encyclopedia_ , London and New York, 1993
Rumble, A.A. (ed.), _The Reign of Cnut, King of England, Denmark and Norway_ , London, 1994
_Russian Primary Chronicle, The_ (trans. S.H. Cross), Cambridge, Massachusetts, 1930
Simeon of Durham, _Simeon of Durham's History of the Kings of England_ (trans. J. Stevenson), 1858, repr. Lampeter, 1987
Stenton, F.M., _Anglo-Saxon England_ , Oxford, 1947
Sturluson, Snorri, Edda (trans. A. Faulkes), London, 1987
——, _Heimskringla_ (trans. L.M. Hollander), Austin, Texas, 1964
——, _King Harald's Saga_ [from _Heimskringla_ ] (trans. M. Magnusson and H. Pálsson), Harmondsworth, 1966
——, _Olaf Sagas_ [from _Heimskringla_ ] (ed. J. Simpson and trans. S. Laing), London, 1964
——, _Sagas of the Norse Kings_ [from _Heimskringla_ ], (ed. P. Foote and trans. S. Laing), London, 1961
_Tale of Halldor Snorrason, The_ (trans. T. Gunnell) in _The Sagas of Icelanders_ (ed. O. Thorsson), New York, 2000
_Tale of the Story-wise Icelander, The_ (trans. A. Maxwell) in _The Sagas of Icelanders_ (ed. O. Thorsson), New York, 2000
Treadgold, W., _Byzantium and its Armies, 284–1081_ , Stanford, California, 1995
Turnbull, S., _The Walls of Constantinople AD 324–1453_, Oxford, 2004
Turville-Petre, G., _The Heroic Age of Scandinavia_ , London, 1951
——, _Haraldr the Hard-ruler and his Poets_ , London, 1968
William of Malmesbury, _History of the Kings before the Norman Conquest_ (trans. J. Stevenson), 1854, repr. Lampeter, 1989
Wilson, D.M. (ed.), _The Northern World_ , London, 1980
Robert 'Guiscard' de Hauteville 102–3, 109
| {
"redpajama_set_name": "RedPajamaBook"
} | 2,760 |
If you have a friend that you would like to recommend this website to, or if you just want to send yourself a reminder, here is the easy way to do it!
Simply fill in the e-mail address of the person(s) you wish to tell.
Optionally you can specify your friend's name, your first name and your e-mail address (so they do not think it is spam or reply to us with gracious thanks). If you want to, you can enter a message that will be included on the e-mail. | {
"redpajama_set_name": "RedPajamaC4"
} | 8,098 |
Robert Hanssen
Spy (born 18-Apr-1944)
Victor Cherkashin; with Gregory Feifer. Spy Handler, Memoir of a KGB Officer: The True Story of the Soviet Agent who Recruited Robert Hanssen and Aldrich Ames. Perseus Books Group. 2005. 338pp.
Adrian Havill. The Spy Who Stayed Out in the Cold: The Secret Life of FBI Double Agent Robert Hanssen. New York: St. Martin's Press. 2001. 262pp.
Norman Mailer; Lawrence Schiller. Into the Mirror: The Life of Master Spy Robert P. Hanssen. New York: HarperCollins. 2001. 317pp.
Elaine Shannon; Ann Blackman. Spy Next Door: The Extraordinary Secret Life of Robert Philip Hanssen, the Most Damaging FBI Agent in U. S. History. Little, Brown & Co. 2002. 247pp.
David A. Vise. The Bureau and the Mole: The Unmasking of Robert Philip Hanssen, the Most Dangerous Double Agent in FBI History. Atlantic Monthly Press. 2002. 272pp.
David Wise. Spy: The Inside Story of How The FBI's Robert Hanssen Betrayed America. Random House. 2002. 309pp.
Public Information Research Namebase [link]
Library of Congress Name Authority [link] | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 8,564 |
{"url":"https:\/\/www.physicsforums.com\/threads\/help-stokes-theorem-integral-problem.129577\/","text":"# Help! stokes theorem - integral problem\n\n1. Aug 24, 2006\n\n### sarahisme\n\nHello all,\n\nhttp:\/\/img244.imageshack.us\/img244\/218\/picture8ce5.png [Broken]\n\nI am completely new to this stokes theorem bussiness..what i have got so far is the nabla x F part, but i am unsure of how to find N (the unit normal field i think its called).\n\nany suggestions people?\n\ni get that nabla x F or curl(F) = i + j + k\n\ncheers\n\n-sarah :)\n\nLast edited by a moderator: May 2, 2017\n2. Aug 24, 2006\n\n### benorin\n\nWell, a way to find N is to first find any normal to the surface and then normalize it. Some lead-in work: Put the surface S into vector form,\n\n$$S:\\, \\, \\, \\vec{r}(u,v)=\\left< u\\cos v,u\\sin v, v\\right> \\, \\, 0\\leq u\\leq 1,\\, 0\\leq v\\leq\\frac{\\pi}{2}$$\u200b\n\nAlso, recall that the vectors $$\\frac{d\\vec{r}}{du}\\mbox{ and }\\frac{d\\vec{r}}{dv}$$ are tangent to S, and that the cross product of two vectors is normal to both vectors, so a normal vector to S is\n\n$$\\frac{d\\vec{r}}{du}\\times\\frac{d\\vec{r}}{dv}$$\u200b\n\nbut we want a unit normal to S, so we normalize the above vector (divide it by its magnitude) to get\n\n$$\\vec{N}(u,v)= \\frac{\\frac{d\\vec{r}}{du}\\times\\frac{d\\vec{r}}{dv}}{\\left| \\frac{d\\vec{r}}{du}\\times\\frac{d\\vec{r}}{dv}\\right|}$$\u200b\n\nPS: I gave the same reply on www.mathlinks.ro\n\n3. Aug 24, 2006\n\n### sarahisme\n\nhow do i work out what dS is?, i think that is my main problem....\n\nhow does this look for the integral we need to evaluate?\n\nhttp:\/\/img151.imageshack.us\/img151\/5053\/picture9fn3.png [Broken]\n\nthat is, do we have to use the normal or the unit normal when doing this stuff?\n\nLast edited by a moderator: May 2, 2017\n4. Aug 25, 2006\n\n### HallsofIvy\n\nStaff Emeritus\nSome text books refer to the \"fundamental vector product\": If a surface is given by the parametric equations x= f(u,v), y= g(u,v), z= h(u,v), then the fundamental vector product is\n[tex]\\left<\\frac{\\partial f}{\\partial u}, \\frac{\\partial g}{\\partial u},\\frac{\\partial h}{\\partial u}\\right> \\times \\left<\\frac{\\partial f}{\\partial v}, \\frac{\\partial g}{\\partial v},\\frac{\\partial h}{\\partial v}\\right>[\/itex]\n\nThe \"fundamental vector prodct\" for that surface is normal to the surface and the \"differential of area\" is equal to the fundamental vector product time du dv. the \"scalar differential of area\", for the surface is the length of the fundamental vector product times du dv. You certainly would not use the unit normal since it is the length of the normal vector that gives the information about the area.\n\nIn your case, since you are integrating the vector $\\nabla \\times F$, you need to use the vector differential of area.\n\nLast edited: Aug 26, 2006\n5. Aug 26, 2006\n\n### sarahisme\n\nhmmm i can't quite decide whether to go with my answer of pi\/4 or try to redo the question and get -pi\/4 as the answer (which is what a friend got...)\n\n6. Aug 26, 2006\n\n### HallsofIvy\n\nStaff Emeritus\nNow I am confused! What do you mean \"go with my answer of pi\/4\"? How did you get that answer to begin with? Why would you redo the question if you know you will get the same answer?\n\n7. Aug 27, 2006\n\n### sarahisme\n\nits ok, i think its to do with which direction you choose the normal to be pointing...\n\n8. Aug 27, 2006\n\n### HallsofIvy\n\nStaff Emeritus\nAh, I missed the \"-\". It was on the previous line from $\\frac{\\pi}{4}$ and I though it was a hyphen! Yes, swapping the direction of the normal will multiply the answer by -1. Notice that you will still have Stokes' theorem true since, by convention, you traverse the boundary in such a way that if you were walking along the boundary with your head in the direction of the normal vector, you would have your left arm inside the region.\n\n$d\\vec r$ here, however, because of the way the parameters u and v are given, should be the outer normal so that, since $\\vec F$ is also pointing away from the origin, the answer is positive. You might want to ask your teacher for more detail on how to select the direction of the normal in a problem like this.\n\n9. Aug 28, 2006\n\n### sarahisme\n\nah, yep i see now i think , that makes a bit more sense. :) thanks for all the help everyone! :D","date":"2017-10-20 15:01:26","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.888572096824646, \"perplexity\": 777.6880504736458}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.3, \"absolute_threshold\": 20, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2017-43\/segments\/1508187824225.41\/warc\/CC-MAIN-20171020135519-20171020155519-00497.warc.gz\"}"} | null | null |
\section*{Plain Language Summary}
Previous laboratory and field measurements have shown the emergence of a strong wave-driven mean current in submerged canopies of aquatic vegetation. By controlling the rate of water renewal in coastal canopies, this mean current could play a vital role in mediating the valuable ecosystem services provided by vegetated systems such as seagrass beds (e.g., nutrient and carbon uptake). However, two different driving mechanisms have been identified in previous studies for this wave-induced mean current, which has led to two distinct predictive formulations for its magnitude. This brief contribution describes a modified model that aims to reconcile these formulations and, thereby, clarify the hydrodynamic mechanism driving the mean current.
\section{Background}
Many of the ecosystem services provided by aquatic vegetation (e.g., nutrient and carbon uptake, oxygen production) are limited by the rate of water exchange between the canopy and the surrounding environment. The wave-driven mean current discussed in \citeA{abdolahpour2017wave} could be an important mechanism for such water renewal in submerged coastal canopies. The goal of this comment is to elaborate on---and reconcile---the different models proposed by \citeA{luhar2010wave} and \citeA{abdolahpour2017wave} to describe this wave-driven mean flow.
It is well established that, in the absence of canopies, progressive surface waves can give rise to mean currents through two different mechanisms: Stokes drift and boundary-layer streaming. Stokes drift is the net flow that results from incomplete particle orbits near the water surface in the presence of waves \cite{van2017stokes}. Boundary layer streaming is driven by a wave stress arising from nonzero temporal correlation between the horizontal and vertical components of the oscillatory flow \cite{longuet1953mass,scandura2007steady}. In addition to the different driving mechanisms, there is another important distinction between these phenomena. While boundary layer streaming can be measured using fixed-point instruments, Stokes drift is a Lagrangian phenomenon that is difficult to capture in such Eulerian measurements \cite{umeyama2012eulerian}. Indeed, Stokes drift is often defined more generally as the difference between the average Lagrangian velocity of a fluid parcel and the mean Eulerian velocity of the fluid.
\citeA{luhar2010wave} suggest that the wave-driven mean current observed in submerged canopies is analogous to boundary layer streaming, i.e., driven by a wave stress. However, \citeA{abdolahpour2017wave} suggest that it is analogous to Stokes drift, i.e., arising from incomplete particle orbits near the canopy interface. These differing interpretations have led to two distinct formulations that predict the magnitude of the mean current. These two formulations are summarized and discussed briefly below. A modified model that aims to reconcile both formulations is presented in the next section.
\citeA{luhar2010wave} used the following energy and momentum balance arguments to predict the magnitude of the wave-driven mean flow. The time-averaged wave stress driving the mean current was estimated based on two key assumptions. First, that the wave energy dissipated by vegetation drag inside the canopy is balanced by the net work done by pressure at the canopy interface, $-\overline{p_w w_w}$. Second, that the relationship between the pressure and horizontal velocity above the canopy is described adequately by linear wave theory, $p_w = \rho(\omega/k)u_w$. Here, $p_w$, $u_w$, and $w_w$ are the wave-induced pressure, horizontal velocity, and vertical velocity fields; $\rho$ is the fluid density; $\omega$ is the wave frequency; and $k$ is the wavenumber. An overbar denotes a time average. With these assumptions, the wave stress was estimated to be:
\begin{equation}\label{eq:wavestress}
\tau_w = -\rho\overline{u_w w_w} \approx \frac{k}{\omega} \frac{2}{3\pi} \rho \int_{0}^{h_v} C_{Dw} a U_c^3 dz,
\end{equation}
in which $h_v$ is the height of the region occupied by the plants, $C_{Dw}$ is a wave drag coefficient for the vegetation, $a$ is the vegetation frontal area per unit volume, $U_c$ is the amplitude of the horizontal oscillatory velocity inside the canopy, and $z$ is the coordinate normal to the bed. Next, the momentum transferred into the canopy by this wave stress was assumed to be balanced by the mean vegetation drag induced by the wave-driven current,
\begin{equation}\label{eq:dragbalance}
\tau_w \approx \frac{1}{2} \rho \int_{0}^{h_v} C_{Dc} a \overline{u}_c^2 dz,
\end{equation}
where $C_{Dc}$ is a current drag coefficient and $\overline{u}_c$ is the time-averaged mean flow inside the canopy. Finally, assuming that the quantities $h_v$, $C_{Dc}$, $C_{Dw}$, $a$, $U_c$, and $\overline{u}_c$ are approximately constant over the height of the canopy, equations~(\ref{eq:wavestress}) and (\ref{eq:dragbalance}) were combined and simplified to yield the following expression for the magnitude of the mean current:
\begin{equation}\label{eq:luhar_uc}
\overline{u}_c = \sqrt{\frac{4}{3\pi}\frac{C_{Dw}}{C_{Dc}}\frac{k}{\omega}U_c^3}.
\end{equation}
Clearly, this expression involves a number of assumptions and simplifications. For an extended discussion of these issues, the reader is referred to \citeA{luhar2010wave}.
Equation~(\ref{eq:luhar_uc}), with $C_{Dw}/C_{Dc}$ set to 1 for simplicity, was shown to generate reasonable predictions for the wave-driven currents observed by \citeA{luhar2010wave} in laboratory experiments over model seagrass canopies. However, it fails to yield accurate predictions for the mean currents that have been measured in subsequent field studies over seagrass beds \cite{luhar2013field} and laboratory studies involving rigid and flexible model vegetation \cite{abdolahpour2017wave}. In particular, the formulation developed by \citeA{luhar2010wave} is inconsistent with the laboratory measurements made by \citeA{abdolahpour2017wave} in two important ways. First, it predicts that the magnitude of the mean current does not depend on canopy density. Second, the model assumes that the mean current is distributed over the entire canopy height. Measurements made by \citeA{abdolahpour2017wave} show that for rigid model vegetation the mean current is confined to the canopy interface, with a vertical extent that is comparable to the vertical orbital excursion, $\xi_T$. For flexible model vegetation, the mean current is most pronounced at an elevation corresponding roughly to the height of the canopy in its most pronated state over a wave-cycle. Moreover, for both rigid and flexible canopies, the magnitude of the mean current increases as the canopy frontal area parameter, $a$, increases (or equivalently, as the canopy drag length scale $L_D \approx a^{-1}$ decreases; see equation (5) in \citeA{abdolahpour2017wave}).
Motivated by the observation that the wave-induced mean flow is most pronounced at the canopy interface, \citeA{abdolahpour2017wave} proposed an alternate interpretation for its origin: that it is driven by the vertical heterogeneity in orbital motion created by canopy drag. Since drag reduces orbital velocities within the canopy, \citeA{abdolahpour2017wave} argued that a fluid particle near the interface would experience higher shoreward velocity under the wave crest and reduced offshore velocities under the wave trough (see figure 3 in \citeA{abdolahpour2017wave}). This would result in open particle orbits and a Lagrangian mean current in the direction of wave propagation, similar to Stokes drift \cite{jacobsen2016wave}. This interpretation was further supported by the observation that maximum mean velocities measured by \citeA{abdolahpour2017wave} scaled with the difference in orbital velocities above and below the interface. By combining this physical insight with dimensional reasoning and fits to laboratory measurements, \citeA{abdolahpour2017wave} developed the following expression to predict the maximum mean current:
\begin{equation}\label{eq:abdolahpour_umax}
\overline{u}_{max} = 0.5 U_\infty^{rms} \left(\frac{\xi_T}{L_D}\right)^{0.3}.
\end{equation}
Here, $U_\infty^{rms}$ is the root-mean-square value of the horizontal orbital velocity at the canopy interface. Note that equation~(3) makes use of the \textit{in-canopy} horizontal orbital velocity, $U_c$, while equation~(4) depends on the velocity at the canopy interface, $U_\infty$. \citeA{abdolahpour2017wave} show that equation~(\ref{eq:abdolahpour_umax}) yields much more accurate predictions for the mean currents measured in prior laboratory and field experiments compared to the expression shown in equation~(\ref{eq:luhar_uc}). Further, equation~(\ref{eq:abdolahpour_umax}) explicitly accounts for canopy density through the drag length scale $L_D$.
Equation~(\ref{eq:abdolahpour_umax}) is a clear step forward in terms of predictive capability. However, the Lagrangian interpretation proposed by \citeA{abdolahpour2017wave} remains problematic. This is because all prior measurements for the wave-driven mean current have come from fixed-point Acoustic Doppler Velocimeters. In other words, the mean current is clearly observed in Eulerian measurements. It is generally accepted that any mean currents resulting from a Stokes drift-like phenomenon appear as the difference between the mean Lagrangian and Eulerian velocities. So, if the mean current was analogous to Stokes drift in origin (i.e., driven by spatial heterogeneity in orbital motion), measuring it using fixed-point instruments would be challenging. As demonstrated in \citeA{umeyama2012eulerian}, this would require Particle Tracking Velocimetry techniques, or spatial interpolation and Lagrangian integration of velocity fields from Particle Image Velocimetry.
Thus, the streaming flow interpretation proposed by \citeA{luhar2010wave} is supported by the fact that all prior measurements of the wave-driven current in submerged canopies have come from fixed-point instruments. However, the expression shown in equation~(\ref{eq:abdolahpour_umax}), developed by \citeA{abdolahpour2017wave} using Lagrangian arguments, generates significantly better predictions. A modified model and scaling arguments that can potentially reconcile this discrepancy are presented next.
\section{Modified Model}
As noted earlier, the expression shown in equation (\ref{eq:luhar_uc}), developed by \citeA{luhar2010wave} using energy and momentum balance arguments, has two important deficiencies. First, it predicts that the magnitude of the mean current is not dependent on canopy density. Second, it assumes that the streaming flow is distributed across the entire height of the canopy. Since the experimental observations of \citeA{abdolahpour2017wave} indicate that the wave-driven mean current is most pronounced at the canopy interface, the distributed drag formulation shown on the right-hand side of equation~(\ref{eq:dragbalance}) can arguably be replaced with an interfacial friction formulation dependent on the maximum mean current, i.e.,
\begin{equation}\label{eq:friction}
\tau_w \approx \frac{1}{2} \rho C_{f} \overline{u}_{max}^2,
\end{equation}
in which $C_f$ is a coefficient representative of the frictional resistance in the upper region of the canopy. An alternative interpretation consistent with prior work on submerged canopy flows \cite{nepf2012flow} would be that the mean current penetrates into the canopy to a vertical distance comparable to the drag length scale $L_D$, such that the integral in equation~(\ref{eq:dragbalance}) scales as $\int_{0}^{h_v} C_{Dc} a \overline{u}_c^2 dz \sim C_{Dc} a L_D \overline{u}_{max}^2 \approx C_{Dc} \overline{u}_{max}^2$. This argument yields an expression similar to that shown in equation~(\ref{eq:friction}).
Combining equation~(\ref{eq:wavestress}) with the modified formulation shown in equation~(\ref{eq:friction}), and again assuming that the quantities $C_{Dw}$, $a$, and $U_c$ are uniform over the height of the canopy leads to:
\begin{equation}
\frac{k}{\omega} \frac{2}{3\pi} \rho C_{Dw} a h_v U_c^3 \approx \frac{1}{2} \rho C_{f} \overline{u}_{max}^2,
\end{equation}
or equivalently
\begin{equation}\label{eq:newdragbalance}
\overline{u}_{max} \approx U_c \sqrt{\frac{4}{3\pi}\frac{k}{\omega}\frac{C_{Dw}}{C_f} a h_v U_c}.
\end{equation}
Thus, accounting for the localization of the mean current in the upper region of the canopy also introduces a density dependence in the predicted magnitude. More specifically, equation~(\ref{eq:newdragbalance}) predicts that the magnitude of the mean current increases as the vegetation frontal area parameter, $a$, increases, which is broadly consistent with the experimental observations of \citeA{abdolahpour2017wave}. Unlike equations~(3)-(4), equation~(7) predicts that the magnitude of the mean current also depends on the canopy height, $h_v$. This parameter can be difficult to define for real aquatic canopies that are flexible and move in response to the fluid flow. For flexible vegetation, the effective blade length concept used in recent studies could be a useful surrogate for $h_v$ \cite{luhar2016wave,luhar2017seagrass,lei2019blade}.
\begin{figure}[t]
\centering
\includegraphics[width=12cm]{fig_ucmax.jpg}
\caption{Comparison between the physically-motivated scaling shown in equation~(\ref{eq:newumax}) and measured maximum mean currents. The datasets RL, RM, and RH correspond to the low, medium, and high-density rigid vegetation measurements from \citeA{abdolahpour2017wave}; FM and FH correspond to the medium and high-density flexible vegetation tests. Data from the experiments of \citeA{luhar2010wave} are also shown (abbreviated as LCIFN). \add{The amplitude of the vertical orbital excursion is estimated as $\xi_T \approx k h_v U_\infty/\omega$ and the drag length scale is estimated as $L_D \approx a^{-1}$.}}\label{fig:ucmax}
\end{figure}
Importantly, it can be shown that the modified formulation in equation~(\ref{eq:newdragbalance}) is similar in form to the expression proposed by \citeA{abdolahpour2017wave}.
Previous work shows that wave-induced oscillatory flows are not damped significantly inside vegetation canopies if the horizontal orbital excursion is smaller than, or comparable to, the drag length scale, $L_D$ (see figure 4 in \citeA{lowe2005oscillatory} and tables 1 and 3 in \citeA{luhar2010wave}). For such conditions, the magnitude of the in-canopy orbital velocity is expected to be similar to that at the interface, $U_c \approx U_\infty$. Further, for cases in which canopy height is much smaller than the wavelength, the vertical orbital excursion at the interface can be approximated as $\xi_T = W_\infty/\omega \approx k h_v U_\infty / \omega$. Here, $W_\infty \approx k h_v U_\infty$ is the vertical orbital velocity at the canopy interface. With these factors in mind, and noting that $a \approx L_D^{-1}$, the expression in equation~(\ref{eq:newdragbalance}) yields the following physically-motivated scaling for the maximum mean current:
\begin{equation}\label{eq:newumax}
\overline{u}_{max} \sim U_c \sqrt{a \frac{k h_v}{\omega} U_c} \sim U_\infty^{rms} \left(\frac{\xi_T}{L_D}\right)^{0.5}.
\end{equation}
This expression bears a strong resemblance to the empirical formulation in equation~(\ref{eq:abdolahpour_umax}) developed by \citeA{abdolahpour2017wave}. The exponent for the $(\xi_T/L_D$) term is different, though this difference can perhaps be attributed to variations in the wave drag and friction coefficients, $C_{Dw}$ and $C_f$, with flow conditions. Figure~\ref{fig:ucmax} confirms that the scaling shown in equation~(\ref{eq:newumax}) describes the maximum mean currents measured by \citeA{luhar2010wave} and \citeA{abdolahpour2017wave} reasonably well. The best-fit line obtained via linear regression ($ \overline{u}_{max} = 0.9 U_\infty^{rms} \sqrt{\xi_T/L_D}$) yields good agreement with the measured data ($r^2 = 0.74$). A power law of the form shown in equation~(\ref{eq:abdolahpour_umax}) leads to slightly better agreement with the measurements ($r^2 = 0.83$), albeit with two fitted parameters.
Thus, the predictive success of the formulation proposed by \citeA{abdolahpour2017wave} does not require the wave-driven mean current in submerged canopies to be Lagrangian in origin. A similar expression can also be developed using momentum and energy balance arguments similar to those made by \citeA{luhar2010wave}. Therefore, given that all prior measurements of the wave-driven mean flow in submerged canopies have come from fixed-point measurements, the (Eulerian) streaming flow interpretation proposed by \citeA{luhar2010wave} remains more appropriate. This streaming flow interpretation is also supported to some extent by recent numerical simulations that reproduce the emergence of a wave-driven mean flow in submerged canopies \cite{chen2019eulerian,chen2019wave}. Specifically, \citeA{chen2019wave} show that the Lagrangian mean velocity estimated at the canopy interface via particle tracking in the numerical simulations is approximately equal to the Eulerian mean velocity, i.e., Stokes drift is relatively small. It must be emphasized that this comment does not preclude the presence of the Stokes drift-like mean current described by \citeA{abdolahpour2017wave} in wave-driven flows over submerged canopies. Indeed, previous analytical efforts support its existence \cite{jacobsen2016wave}. However, the wave-driven mean currents measured in previous studies are unlikely to be a manifestation of this Lagrangian phenomenon. Perhaps future numerical simulations and experiments that involve explicit wave stress measurements or Lagrangian tracking of fluid parcels will provide greater insight into the relative importance of both mechanisms in driving mean flows over submerged canopies.
\acknowledgments
No new data were generated for this contribution. The data used in Figure~\ref{fig:ucmax} were sourced from Tables 1 and 2 in \citeA{abdolahpour2017wave} and from Table 1 in \citeA{luhar2010wave}.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 1,660 |
Alcohol law in Washington may refer to:
Alcohol law in Washington (state)
Alcohol law in Washington, D.C. | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 333 |
FUF-correspondents
The event group
SoMe Group
The Network for Global Sustainable Peace and Security
The Internship Program
The internship bank
Do you want an intern?
Tips for recruiters
Interview with Ronja
Recruitment and participants
About FUF
FUF 50 years
Ylva Christianson
Sofia Brännstrom
Become a FUF supporter
FUF award
FUF in social media
The development archive
Development archive.se
Articles, reports & debate
Our non-profit groups & networks
Current seminars & events
Internship, professional network & mentorship
An international network for young peacebuilders.
Here you will find all articles published in Utvecklingsmagasinet and on the previous website Biståndsdebatten.
Diana Janse on the government's aid policy: "To prioritize is to prioritize away"
- We have had to look at the priorities and prioritize after that, it is based on a need to find funding for Ukraine, says State Secretary Diana Janse about the government's new aid policy, which includes cuts in several areas. Photo: The Association for Development Issues (FUF).
Of: Alice Mutambala
The government's new aid policy means increased support to Ukraine, but also several reductions – including in support to the UN, information work and research. These priorities and away priorities were in focus when Diana Janse, State Secretary for International Development Cooperation, met civil society in an armchair conversation at FUF.
January 25, 2023, News
the XNUMX% target
Promoting local democracy: "Must make your voice heard"
In November, the International Center for Local Democracy (ICLD) concluded the 2022 round of the Women's Leadership Program. The final workshop was held in Kigali, Rwanda. Pictured are this year's participants together with Rwanda's Minister for Gender Equality Jeannette Bayisenge and Sweden's Ambassador to Rwanda Johanna Teague. Photo: ICLD.
Of: Agnes Durbeej-Hjalt
Every year, the International Center for Local Democracy (ICLD) organizes a leadership program for women in local political positions of power in low- and middle-income countries. The aim is to strengthen women in their leadership role to contribute to the development of local democracy. Development magazine has interviewed Anne Scheffer Leander, responsible for the program, about how the promotion of local democracy actually works in practice.
January 23, 2023, Interview
women's autonomy
Independence from fossil fuels is crucial for human security
Nations today are faced with the Energy Trilemma; how to achieve energy security, energy equity and environmental sustainability – at the same time. And transitioning towards renewable forms of energy is essential to achieve human security worldwide, according to Marie Stjernquist Desatnik at Naturskyddsföreningen (the Swedish Society for Nature Conservation, SSNC). Image: A military attack on energy infrastructure. Photo by: Ecoaction.
Of: Marie Stjernquist Desatnik
The world's addiction to fossils fuel is the main contributor to the climate crisis, and it impacts peace and security worldwide. This was clearly demonstrated in 2022 by Russia's invasion of Ukraine. But why is it so difficult for nations to move away from fossil fuels? Part of it can be explained by the so-called energy trilemma, according to Marie Stjernquist desatnik, Senior Climate Policy Advisor at The Nature Conservation Society (the Swedish Society for Nature Conservation, SSNC). She argues That ttransitioning towards renewable forms of energy is essential to Achieve human security worldwide.
January 17, 2023, Guest analysis, Guest piece, Magazine
Everything you need to know about the new foreign espionage laws
In November, the Riksdag voted through the new laws on foreign espionage – something that has met with strong criticism from both the media industry and former whistleblowers. Photo: Johannes Jansson. Source: Wikimedia commons.
Of: Vilma Ellemark
On January 1, the controversial foreign espionage laws came into force in Sweden. Critics fear that the laws make it more difficult for journalists and whistleblowers to report on wrongdoing in international collaborations. But how can espionage laws restrict the media? And why were the laws voted through despite the criticism? The development magazine explains what you need to know about the law changes.
January 13, 2023, Development magazine explains
Freedom of the press and expression
You should know this ahead of Sweden's EU presidency
On 1 January 2023, Sweden takes over the presidency of the Council of the European Union. The development magazine helps you figure out what that means. Photo: Christian Lue. Source: Unsplash.
Of: Elianne Kjellman
From 1 January 2023 and six months ahead, the Swedish government takes over the presidency of the Council of the European Union. Some are hopeful and believe that the influential task will mean increased support for Ukraine, while others fear that it will be destructive to the EU's climate policy. The development magazine explains how the presidency works, and some things you should know to keep up with the debate on the subject.
December 22, 2022, Development magazine explains
What is required for a world where everyone is free to decide about their body and sexuality?
A new UN commission has tried to point out a path towards a world where everyone has the opportunity to exercise their sexual and reproductive rights. This is written by Hans Linde, union chairman at RFSU and member of the UN commission. Pictured: Demonstration for the right to abortion in Argentina. Photo: ProtoplasmaKid. Source: Wikimedia commons.
Of: Hans Linde
Large parts of the world's population have little opportunity to make decisions about their own body and sexuality, despite the fact that the world's countries have time and again set ambitious goals. It is not difficult to see challenges, while a series of advances show that change is possible. A new UN commission has tried to point out a path towards a world where everyone has the opportunity to exercise their sexual and reproductive rights. It writes Hans Linde, union chairman at RFSU and member of the UN commission.
December 21, 2022, Guest chronicle
LGBTQ +
LGBTQI people
Actionable action is required to counter the illegal international arms flow
In order to regain security on our streets in Sweden, and a more peaceful world globally, it is more urgent than ever to both prevent and stop the illegal flow of weapons. This is written by Olle Thorell (S) and Magdalena Thuresson (M), members of parliament for the foreign affairs committee, as well as Karin Olofsson, secretary general of the Parliamentary Forum for light weapons issues. Photo: St. Louis Circuit Attorney's Office. Source: Wikimedia commons.
Of: Karin Olofsson, Magdalena Thuresson and Olle Thorell
The violence resulting from illegal weapons have devastating consequences worldwider – human, social and economic. For sustainable development and peace force is required to stop the illegal flow of weapons. Wednesday, December 14 special attention is paid to the issue in riksdagen when parliamentarians, civil society, experts and other representatives gather for the Parliamentarian Forum for Light Weapons-of questions (The Forum's) 20th anniversary seminar.
December 14, 2022, Debate
Infrastructure and climate adaptations promote women's work in Kenya
Diversification, i.e. having several different income-generating activities, is vital for many poor women in rural Kenya. Various actors should therefore take measures to promote diversification. That's what Ella Ihre, master's student in rural development and natural resource management at SLU, writes in a guest analysis. Photo: Ella Ihre. Location: Kitui, Kenya.
Of: Ella Ihre
Att have several income-generating activities have become an increasingly important survival strategy for women in rural Kenya. Improved infrastructure, climate adaptations and self-help groups can promote women's work and thus their own livelihood.
December 13, 2022, Guest analysis
New foreign policy makes the future uncertain for gender equality projects in Latin America
Maja Magnusson, press officer and information officer at Svalorna Latinamerika, is concerned that reduced aid and scrapped feminist foreign policy could affect gender equality work in Latin America. Photo: Swallows Latin America.
The new direction of Swedish foreign policy has caused concern among many organizations that work with global development issues. - We are worried about severe cuts, says Maja Magnusson, press officer and information officer at Svalorna Latin America.
December 9, 2022, Interview
Feminist foreign policy
Lula da Silva's win could be a new but difficult direction for Brazil
Brazil's new president, Luiz Inacio Lula Da Silva, has promised to stop the deforestation of the Amazon and fight poverty in the country. But he faces extensive challenges during his presidency. Photo: Alexander Bonilla. Source: Flickr.
Of: Liljan Daoud
On October 30, the Brazilian election results showed that the country is moving in a new direction with the presidential candidate Squid Da Silva at the head. But att change direction for the country after four years for right-wing nationalist Jair Bolsonaros rule may be more difficult than expected a new economic reality.
December 8, 2022, Development magazine explains
Participate in the debate
Do you have important knowledge or perspectives about global development and Sweden's role in the world? Then you can write a debate article.
How to use "
Current debate
Week 49: Soccer World Cup and UN meeting on biological diversity sparks debate
Deep dive into Swedish development policy
The Development Archive collects documents about Sweden's role in global development - from the 1960s to today.
Choose between our various newsletters.
Surveillance around the world (approx. 50 times / year) Invitations to events (approx. 30 times / year)
Leave the following fields blank
The Swedish Development Forum is a politically and religiously independent non-profit association. Our purpose is to inform and create debate about global development and Sweden's role in the world.
Email: fuf@fuf.se
The Swedish Development Forum
There are several reasons to become a member of our association. For many, membership means supporting the association's purpose of increasing knowledge and commitment to sustainable global development. For others, membership is a door opener to an internship or commitment.
Regardless, we hope you want to join and become a member.
Shortcuts to
Write a guest article
© 2023 FUF.se | Knowledge, debate and commitment to a fair and sustainable world | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 9,568 |
{"url":"https:\/\/www.aimsciences.org\/article\/doi\/10.3934\/dcds.2018204","text":"# American Institute of Mathematical Sciences\n\nSeptember\u00a0 2018,\u00a038(9):\u00a04657-4674. doi:\u00a010.3934\/dcds.2018204\n\n## Lyapunov stability for regular equations and applications to the Liebau phenomenon\n\n 1 School of Mathematics and Physics, Changzhou University, Changzhou 213164, China 2 Department of Mathematics, Nanjing University, Nanjing 210093, China 3 Departamento de Matem\u00e1ticas, Universidade de Vigo, 32004, Pabell\u00f3n 3, Campus de Ourense, Spain 4 Department of Functional Analysis, Faculty of Mathematics and Natural Sciences, University of Rzesz\u00f3w, Pigonia 1, 35-959 Rzesz\u00f3w, Poland\n\n* Corresponding author: J. A. Cid\n\nReceived\u00a0 December 2017 Revised\u00a0 March 2018 Published\u00a0 June 2018\n\nFund Project: F. Wang was sponsored by Qing Lan Project of Jiangsu Province, and was supported by the National Natural Science Foundation of China (Grant No. 11501055 and No. 11401166), Natural Science Foundation of the Jiangsu Higher Education Institutions of China (Grant No. 15KJB110001), China Postdoctoral Science Foundation funded project (Grant No. 2017M610315), Hainan Natural Science Foundation (Grant No.117005), Jiangsu Planned Projects for Postdoctoral Research Funds. J. A. Cid was partially supported by Ministerio de Educaci\u00f3n y Ciencia, Spain, and FEDER, Project MTM2017-85054-C2-1-P. M. Zima was partially supported by the Centre for Innovation and Transfer of Natural Science and Engineering Knowledge of University of Rzesz\u00f3w.\n\nWe study the existence and stability of periodic solutions of two kinds of regular equations by means of classical topological techniques like the Kolmogorov-Arnold-Moser (KAM) theory, the Moser twist theorem, the averaging method and the method of upper and lower solutions in the reversed order. As an application, we present some results on the existence and stability of $T$-periodic solutions of a Liebau-type equation.\n\nCitation: Feng Wang, Jos\u00e9 \u00c1ngel Cid, Miros\u0142awa Zima. Lyapunov stability for regular equations and applications to the Liebau phenomenon. Discrete & Continuous Dynamical Systems, 2018, 38 (9) : 4657-4674. doi: 10.3934\/dcds.2018204\n##### References:\n\nshow all references\n\n##### References:\n$2\\pi$-periodic solution of equation (39) with $b = 1.55$ and $c = 0.4$\n$2\\pi$-periodic positive solution of equation (40) with $b = 3\/2$ and $c = 0.133333$\n [1] Yanmin Niu, Xiong Li. An application of Moser's twist theorem to superlinear impulsive differential equations. Discrete & Continuous Dynamical Systems, 2019, 39 (1) : 431-445. doi: 10.3934\/dcds.2019017 [2] Michele V. Bartuccelli, G. Gentile, Kyriakos V. Georgiou. Kam theory, Lindstedt series and the stability of the upside-down pendulum. Discrete & Continuous Dynamical Systems, 2003, 9 (2) : 413-426. doi: 10.3934\/dcds.2003.9.413 [3] Pedro Teixeira. Dacorogna-Moser theorem on the Jacobian determinant equation with control of support. Discrete & Continuous Dynamical Systems, 2017, 37 (7) : 4071-4089. doi: 10.3934\/dcds.2017173 [4] Sigurdur Freyr Hafstein. A constructive converse Lyapunov theorem on exponential stability. Discrete & Continuous Dynamical Systems, 2004, 10 (3) : 657-678. doi: 10.3934\/dcds.2004.10.657 [5] Viktor L. Ginzburg and Basak Z. Gurel. The Generalized Weinstein--Moser Theorem. Electronic Research Announcements, 2007, 14: 20-29. doi: 10.3934\/era.2007.14.20 [6] Florian Wagener. A parametrised version of Moser's modifying terms theorem. Discrete & Continuous Dynamical Systems - S, 2010, 3 (4) : 719-768. doi: 10.3934\/dcdss.2010.3.719 [7] Andrea Davini, Maxime Zavidovique. Weak KAM theory for nonregular commuting Hamiltonians. Discrete & Continuous Dynamical Systems - B, 2013, 18 (1) : 57-94. doi: 10.3934\/dcdsb.2013.18.57 [8] Antonio Fern\u00e1ndez, Pedro L. Garc\u00eda. Regular discretizations in optimal control theory. Journal of Geometric Mechanics, 2013, 5 (4) : 415-432. doi: 10.3934\/jgm.2013.5.415 [9] Salvador Addas-Zanata. Stability for the vertical rotation interval of twist mappings. Discrete & Continuous Dynamical Systems, 2006, 14 (4) : 631-642. doi: 10.3934\/dcds.2006.14.631 [10] Huiping Jin. Boundedness in a class of duffing equations with oscillating potentials via the twist theorem. Communications on Pure & Applied Analysis, 2011, 10 (1) : 179-192. doi: 10.3934\/cpaa.2011.10.179 [11] Meina Gao, Jianjun Liu. A degenerate KAM theorem for partial differential equations with periodic boundary conditions. Discrete & Continuous Dynamical Systems, 2020, 40 (10) : 5911-5928. doi: 10.3934\/dcds.2020252 [12] Daniel N\u00fa\u00f1ez, Pedro J. Torres. Periodic solutions of twist type of an earth satellite equation. Discrete & Continuous Dynamical Systems, 2001, 7 (2) : 303-306. doi: 10.3934\/dcds.2001.7.303 [13] Diogo Gomes, Levon Nurbekyan. An infinite-dimensional weak KAM theory via random variables. Discrete & Continuous Dynamical Systems, 2016, 36 (11) : 6167-6185. doi: 10.3934\/dcds.2016069 [14] Xifeng Su, Lin Wang, Jun Yan. Weak KAM theory for HAMILTON-JACOBI equations depending on unknown functions. Discrete & Continuous Dynamical Systems, 2016, 36 (11) : 6487-6522. doi: 10.3934\/dcds.2016080 [15] Dongfeng Yan. KAM Tori for generalized Benjamin-Ono equation. Communications on Pure & Applied Analysis, 2015, 14 (3) : 941-957. doi: 10.3934\/cpaa.2015.14.941 [16] Linfeng Mei, Wei Dong, Changhe Guo. Concentration phenomenon in a nonlocal equation modeling phytoplankton growth. Discrete & Continuous Dynamical Systems - B, 2015, 20 (2) : 587-597. doi: 10.3934\/dcdsb.2015.20.587 [17] Olivier Bonnefon, J\u00e9r\u00f4me Coville, Guillaume Legendre. Concentration phenomenon in some non-local equation. Discrete & Continuous Dynamical Systems - B, 2017, 22 (3) : 763-781. doi: 10.3934\/dcdsb.2017037 [18] Juli\u00e1n L\u00f3pez-G\u00f3mez, Eduardo Mu\u00f1oz-Hern\u00e1ndez, Fabio Zanolin. On the applicability of the poincar\u00e9\u2013Birkhoff twist theorem to a class of planar periodic predator-prey models. Discrete & Continuous Dynamical Systems, 2020, 40 (4) : 2393-2419. doi: 10.3934\/dcds.2020119 [19] Alexander J. Zaslavski. Stability of a turnpike phenomenon for a class of optimal control systems in metric spaces. Numerical Algebra, Control & Optimization, 2011, 1 (2) : 245-260. doi: 10.3934\/naco.2011.1.245 [20] Xiaocai Wang, Junxiang Xu, Dongfeng Zhang. A KAM theorem for the elliptic lower dimensional tori with one normal frequency in reversible systems. Discrete & Continuous Dynamical Systems, 2017, 37 (4) : 2141-2160. doi: 10.3934\/dcds.2017092\n\n2020\u00a0Impact Factor:\u00a01.392","date":"2021-12-08 09:57:05","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.40982261300086975, \"perplexity\": 4349.358171355421}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2021-49\/segments\/1637964363465.47\/warc\/CC-MAIN-20211208083545-20211208113545-00224.warc.gz\"}"} | null | null |
{"url":"https:\/\/www.physicsforums.com\/threads\/identical-particles-spin-fermions-etc.392969\/","text":"# Identical particles, spin, fermions, etc.\n\n## Homework Statement\n\nI got two particles, spin-(1\/2), in a box of finite length and I must compute the energy and wavefunctions for the three lowest states. The particles are in a singlet spin state.\n\n## Homework Equations\n\n$$E = \\epsilon_{1} + \\epsilon_{2} +...$$\n\n## The Attempt at a Solution\n\nI got the wavefunctions down.\n\nJust want to clarify some uncertainty here, if the ground state is just going to be for n = 1, 2, then would the first excited state be n = 1, 3, and second excited state n = 2, 3?\n\nI am also assuming they're fermions.","date":"2022-05-28 01:12:47","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.6933912634849548, \"perplexity\": 660.1610225177565}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2022-21\/segments\/1652663011588.83\/warc\/CC-MAIN-20220528000300-20220528030300-00384.warc.gz\"}"} | null | null |
{"url":"http:\/\/blog.mindymallory.com\/2018\/02\/machine-learning-and-econometrics-model-selection-and-assessment-statistical-learning-style\/","text":"Machine Learning and Econometrics: Model Selection and Assessment Statistical Learning Style\n\nThis is the second in a series of posts where I document my own process in figuring out how machine learning relates to the classic econometrics one learns in a graduate program in economics. Note that I am a humble practitioner of applied econometrics, so the ideas I am working through are not new, or may first take on them might not even be fully correct. But, I think many of us applied economists are starting to learn and dabble in this area and I thought it might be fruitful to community if I learn publicly in these blog posts. These posts are certainly going to solidify my own understanding and serve as helpful notes for my own purposes.\n\nI had at least three people reach out after my first machine learning post \u2013 two in academic positions saying that they are starting to use these methods in their own research and one former classmate in the corporate world who reached out to say these methods are already deeply embedded in their business. Further I saw @DrKeIthHCoble, Ashok Mishra, @shanferrell, and @SpacePlowboy just dropped an AEPP article on the topic, Big Data in Agriculture: A Challenge for the Future. I\u2019m even more convinced now is a really great time to invest in learning this machine learning stuff. At the end I do an Ag example by fitting models of the relationship between corn prices received by farmers and stocks to use.\n\nFlexibility versus Interpretability\n\nI started going through An Introduction to Statistical Learning, and the first thing that struck me is that linear regression gets two whole chapters devoted to it (Chapters 3 and 6). I was a bit surprised because my naive view was that linear regression was something primitive and completely separate from the concepts of machine learning, whereas in this book, linear regression is presented as a baseline or starting place for the concepts of machine learning. This left me with a question. Why is econometrics as usually presented as something separate methodologically from machine learning?\n\nIn chapter 2, I think I got the answer to my question. The authors note that there is always a tension between flexibility and interpret ability of a model. Linear regression is quite inflexible, but it is readily interpret-able. Non-linear models can be quite complex in how an independent variable is functionally related to the dependent variable. In economics, we care about interpretability. We go through great pains to find instruments, design experiments, get random samples, in order to argue causality of one variable on another. Inference and interpretability matter a great deal to us, so inflexible models are often attractive for this purpose. Additionally, less flexible models often perform fairly well compared to more flexible models in terms of predictive accuracy, at least in out of sample testing, due to the problem of over-fitting in flexible models. So you get a lot of mileage out of an inflexible model like linear regression, and more flexible models might not perform much better on medium data anyway.\n\nOur analysis is often naturally constrained in terms of the number of independent variables one might include. First, economic theory often suggests what things might be important independent variables, so there is less need to throw everything into a regression and see if it predicts. Or, you might be constrained by the scarcity of relevant data. If you conduct a survey, you can only ask so many questions and then you only have that many potential independent variables. To use a concept from my first machine learning post, we often have \u2018medium data\u2019 not big data.\n\nI think there are good reasons why econometrics has gravitated to linear regression models as our bread and butter.\n\nEconometrics:\n\n\u2022 We care very much about inference, less emphasis on prediction $$\\Rightarrow$$ Linear regression often works well\n\u2022 We often have medium data $$\\Rightarrow$$ Linear regression often works well.\n\nSo does that mean we should scoff at this statistical learning stuff? No I don\u2019t think so. Reading into chapter 5 (Re-sampling Methods) and chapter 6 (Linear Model Selection and Regularization), I think there are really nice opportunities to get a lot of benefit even in a fairly inflexible model and even with medium data. Chapter 5 covers re-sampling methods including Cross-Validation and Bootstrap methods. Bootstrap is ubiquitous in econometrics, but cross-validation could be successfully utilized more, I think. Among those of us working with large \u2018medium data\u2019, like the Census or Ag Census, the methods are chapter 6 are fairly commonly employed, I think.\n\nStatistical Learning:\n\n\u2022 More focus on prediction $$\\Rightarrow$$ Larger baseline set of models to choose from. Just so long as it predicts, who cares about causality!\n\u2022 Means much more effort exerted at the model selection stage.\n\nChapters 2 and 5 discuss the bias-variance trade-off in model selection and the k-Fold cross validation method of model selection, respectively. I briefly summarize these concepts next.\n\nA key to mastering model assessment and model selection is to understand the bias-variance trade-off. If you have a model, $$y = f(x) + \\epsilon$$, so that $$y$$ is a function of $$f$$ plus some noise. Then, if we want to find out how $$x$$ affects $$y$$, or use known values of $$x$$ to predict $$y$$, we need to find a function $$\\hat{f}(x)$$ that is as close as possible to $$f$$. The most common way to assess if our $$\\hat{f}$$ is good or not is with mean squared error (MSE), or root mean squared error where we take the square root of the MSE. MSE is defined like this.\n\n$MSE = \\frac{1}{n}\\sum_{i=1}^n (y_i \u2013 \\hat{f}(x_i))^2$\n\nIt just takes all the model\u2019s predictions, $$\\hat{f}(x_i)$$, calculates the square of how far they are from the actual value, $$y_i$$, and averages them. So a low MSE is good \u2013 your predictions were not far away from the actual values.\n\nSo what contributes to a model\u2019s errors? Head over to Wikipedia for a proof, but for any particular observation the expectation of the terms contributing to the MSE can be broken down as follows,\n\n$E(y_i \u2013 \\hat{f}x_i)^2 = Var(\\hat{f}(x_i)) + Bias(\\hat{f}(x_i))^2 + Var(\\epsilon_i),$\n\nwhere, $$Bias(\\hat{f}(x_i)) = E(\\hat{f}(x_i) \u2013 f(x_i))$$. Clearly to get a low MSE you need a model that will give you low variance and low bias. But, typically these things move in opposite directions. You get a high variance in $$\\hat{f}$$ with a more flexible model because when a model is flexible (think for example of a high degree polynomial versus a linear model where the polynomial has many more parameters to estimate) different training data sets will make the fitted function \u2018wiggle\u2019 around much more than the linear model. Conversely, models that are less flexible have higher bias, because it can not accommodate the true shape of the data generating process as easily as a more flexible model.\n\nIn ISL, figure 2.11 illustrates this very well.\n\nThis figure is taken from \u201cAn Introduction to Statistical Learning, with applications in R\u201d (Springer, 2013) with permission from the authors: G. James, D. Witten, T. Hastie and R. Tibshirani\n\nHere you see a scatter-plot of a data set with variables X and Y as circles in the left panel. To model the data they fit a linear model (in gold), and increasingly higher degree polynomials in black, blue, and green. Of course, the higher the degree of the polynomial the more \u2018wiggly\u2019 the $$\\hat{f}$$. Then in the right panel, they plot the MSE of these different candidate $$\\hat{f}$$\u2019s. The training set MSE is in grey and the test set (out of sample in the parlance of price forecasting) MSE is in red.\n\nThis illustrates an important point. Yes, variance and bias of a model move in opposite directions, but not necessarily at the same rate (as flexibility increases I mean). Here, when you move from a linear, to a 3rd degree, to a 5th degree polynomial, you get dramatic reductions in the MSE of both the training set and the test set.\n\nThis is because the reduction in bias as you move away from the linear model overwhelms the increase in variance as you move toward a higher degree polynomial. Though, after about a 5th degree polynomial, the gains disappear and you do not get much more out of adding higher polynomial terms to the $$\\hat{f}$$. So, if this were a model selection exercise in a real research problem, we would probably select a 5th degree polynomial.\n\nThe approach of using MSE for model selection seems to be pretty ubiquitous in machine learning contexts. In economics, it is commonly used to select among competing forecasting models, but I don\u2019t think it is used that widely for model selection in models where inference is the goal.\n\nCross Validation\n\nCross validation is a technique for model selection that I do not believe is widely used by economists, but I think it has a lot of promise. It does not seem to me to require a particularly large data set, so it could be an effective tool even on our \u2018medium\u2019 data sets.\n\nThe idea behind it is pretty simple. At the model selection stage, you will have a number of candidate models. Conceptually, the example above is pretty simple, your candidate models are polynomials of higher and higher degree. But, you could have a number of candidate models that look very different from one another. The MSE approach to model selection is to just see which one predicts the best on a \u2018hold out\u2019 data set. That is basically what we did in the example shown in figure 2.11.\n\nCross Validation just takes this one step further. In k-Fold cross validation you do the MSE exercise with k different randomly selected hold out samples for every model you are considering. An illustration for a 5-Fold cross validation sample split is shown in figure 5.5 from the ISL book.\n\nThis figure is taken from \u201cAn Introduction to Statistical Learning, with applications in R\u201d (Springer, 2013) with permission from the authors: G. James, D. Witten, T. Hastie and R. Tibshirani\n\nThe advantage of this is that it allows the variance and bias of the fitted models to be revealed a little more completely. By using different subsets of your data as the test set you get a sense of how much individual observations are moving around your MSE estimates. When conducting a k-Fold cross validation, you typically just average the MSE\u2019s given by each of the k model estimates.\n\nAn Ag Example\n\nTo illustrate the potential of k-Fold cross validation in agricultural economics I will use it in a simple example on a pretty small data set. Every month the USDA puts out the World Agricultural Supply and Demand Estimates (WASDE). This report is followed very closely, especially during the growing season and harvest of commodities important to U.S. agriculture. It publishes what are called \u2018balance sheets\u2019 because they state in a table expectations for supply and demand from various sources for each commodity.\n\nFor store-able commodities the WASDE also have an estimate of ending stocks, the amount of the grain that is not consumed in the same marketing year it was grown in, and thus carried over to be consumed during the next marketing year. Ending stocks are an important indicator or scarcity or surplus, and thus correlate with prices quite nicely. Rather than simply use ending stocks, a ratio called $$Stocks$$ $$to$$ $$Use$$ has come to be important in price analysis because it allows ending stocks to be expressed in a way that is not influenced by the (potentially growing) size of the market.\n\n$Stocks \\text{ } to \\text{ } Use_t = \\frac{Ending \\text{ } Stocks_t}{Total \\text{ } Use_t}$\n\nStocks to Use is simply the ratio of ending stocks to the total amount of the commodity \u2018used\u2019.\n\nThe Data\n\nData from historical WASDE reports can be retrieved from the USDA\u2019s Feed Grains Database. If you want to follow along, download the .csv file containing ending stocks for corn in the the U.S. and the rest of the world (ROW), as well as average prices received by farmers in the U.S. The following code imports the .csv file (make sure to modify the file path in read.csv() to wherever you put the stocks.csv file if you are following along). Then the code creates the stocks to use variable in the line that calls the mutate() function.\n\n# If you haven't installed any of the packages listed below, do so with the \"install.packages('tibble')\" command.\nlibrary(tibble)\nlibrary(dplyr)\nlibrary(tidyr)\nlibrary(ggplot2)\nlibrary(knitr)\nlibrary(kableExtra)\nlibrary(gridExtra)\nlibrary(boot)\nstocks <- as_tibble(stocks)\nstocks <- mutate(stocks, USStockUse = USEndingStocks\/USTotalUse, WorldStockUse = ROWEndingStocks\/WorldTotalUse)\n\nstocks %>% kable(caption = \"U.S. and World Ending Stocks, Total Use, Prices Recieved by Farmers, and Stocks to USE, 1975-2017\", \"html\") %>%\nkable_styling(bootstrap_options = c(\"striped\", \"hover\"))\nU.S. and World Ending Stocks, Total Use, Prices Recieved by Farmers, and Stocks to USE, 1975-2017\nYear USEndingStocks ROWEndingStocks USTotalUse WorldTotalUse PriceRecievedFarmers USStockUse WorldStockUse\n1975 633.200 36411 5767.054 228199 2.54 0.1097961 0.1595581\n1976 1135.600 39491 5789.200 235034 2.15 0.1961584 0.1680225\n1977 1435.900 40833 6207.139 246973 2.02 0.2313304 0.1653339\n1978 1709.500 47957 6995.479 254029 2.25 0.2443721 0.1887855\n1979 2034.300 59481 7604.060 273641 2.52 0.2675281 0.2173687\n1980 1392.100 67180 7282.444 293625 3.11 0.1911584 0.2287952\n1981 2536.600 62725 6974.706 290686 2.50 0.3636856 0.2157827\n1982 3523.100 60273 7249.090 279377 2.55 0.4860058 0.2157407\n1983 1006.300 63421 6692.759 287033 3.21 0.1503565 0.2209537\n1984 1648.200 76287 7031.963 297524 2.63 0.2343869 0.2564062\n1985 4039.522 75069 6494.029 285517 2.23 0.6220363 0.2629230\n1986 4881.693 80862 7385.350 298388 1.50 0.6609968 0.2709962\n1987 4259.086 89488 7757.318 304440 1.94 0.5490410 0.2939430\n1988 1930.428 96217 7260.121 319881 2.54 0.2658947 0.3007900\n1989 1344.457 98715 8119.826 327783 2.36 0.1655771 0.3011596\n1990 1521.245 102761 7760.655 319954 2.28 0.1960202 0.3211743\n1991 1100.311 113106 7915.336 332232 2.37 0.1390100 0.3404428\n1992 2112.981 109068 8471.119 339172 2.07 0.2494335 0.3215714\n1993 850.143 107849 7621.383 349304 2.50 0.1115471 0.3087540\n1994 1557.840 113777 9352.380 353437 2.26 0.1665715 0.3219159\n1995 425.942 122467 8548.436 376204 3.24 0.0498269 0.3255335\n1996 883.161 143886 8788.599 382278 2.71 0.1004894 0.3763910\n1997 1307.803 133982 8791.000 388191 2.43 0.1487661 0.3451445\n1998 1786.977 145972 9298.317 395867 1.94 0.1921828 0.3687400\n1999 1717.549 150779 9514.784 412536 1.82 0.1805137 0.3654930\n2000 1899.108 126880 9740.316 412710 1.85 0.1949740 0.3074314\n2001 1596.426 110808 9815.402 424591 1.97 0.1626450 0.2609759\n2002 1086.673 99276 9490.986 427821 2.32 0.1144953 0.2320503\n2003 958.091 80334 10229.950 438453 2.42 0.0936555 0.1832215\n2004 2113.972 77364 10660.530 465941 2.06 0.1982990 0.1660382\n2005 1967.161 73472 11267.804 475772 2.00 0.1745825 0.1544269\n2006 1303.647 75639 11206.620 499570 3.04 0.1163283 0.1514082\n2007 1624.150 86418 12737.393 515187 4.20 0.1275104 0.1677410\n2008 1673.311 100739 12007.572 526638 4.06 0.1393547 0.1912870\n2009 1707.787 97474 13041.023 546250 3.55 0.1309550 0.1784421\n2010 1127.645 93924 13033.141 570041 5.18 0.0865214 0.1647671\n2011 989.027 103071 12481.947 607875 6.22 0.0792366 0.1695595\n2012 821.185 112089 11082.899 606563 6.89 0.0740948 0.1847937\n2013 1231.904 142987 13454.039 661861 4.46 0.0915639 0.2160378\n2014 1731.164 165766 13747.918 686099 3.70 0.1259219 0.2416065\n2015 1737.058 170837 13663.635 669447 3.61 0.1271300 0.2551912\n2016 2293.303 171509 14648.801 747315 3.36 0.1565523 0.2295003\n2017 2352.370 143333 14595.000 749749 3.30 0.1611764 0.1911746\n\nSource: USDA Feedgrains Database\n\nThis is clearly not big data if I can print the whole data set right in the blog post! We have 43 years of data. Note that the 2017 observation is an expectation. We are not sure what carryout for the 2017 marketing year will be. The U.S. ending stocks and total use are in millions of bushels. The World ending stocks and total use are in 1,000 MT.\n\nNow lets just plot the U.S. and World stocks to use versus price to get a sense of what the relationship looks like.\n\nus <- ggplot(stocks, aes(x = USStockUse, y = PriceRecievedFarmers)) + geom_point() + theme_bw() + xlim(0, .7)\n\nROW <- ggplot(stocks, aes(x = WorldStockUse, y = PriceRecievedFarmers)) + geom_point() + theme_bw() + xlim(0, .7)\n\ngrid.arrange(us, ROW, nrow = 1, top = \"U.S. and World Stocks to Use vs Prices Recieved by U.S. Farmers, 1975-2017\")\n\nIn the U.S. panel, a clear non-linear relationship if evident. The points from 2010-2012 had low stocks to use and exceptionally high prices. The points with the highest stocks to use and lowest prices are from the 1980\u2019s when the U.S. government was in the business of holding stocks to support prices. Despite the non-linearity, there is clearly a relationship between stocks to use and prices for corn, as we would expect.\n\nIn a farmdoc Daily article Darrel Good and Scott Irwin propose,\n\n$Price = \\alpha + \\beta \\frac{1}{Stocks \\text{ } to \\text{ } Use} + \\epsilon,$\n\nas a model for \u2018predicting\u2019 the average price received by farmers variable. This certainly seems like a sensible choice, given that the shape of the relationship resembles $$y = \\frac{1}{x}$$, but in this example, we will see if we can find another functional form that performs better in terms of cross validation MSE. We will also consider if the log of the stocks to use variable might fit, since this could also produce close to the correct curved shape (with a negative coefficient of course). I should note that in the farmdoc daily article, Good and Irwin use a much shorter sample that possibly reflects more closely current supply and demand dynamics better. But, in our case, we need the sample size to do the more data intensive cross validation.\n\nWe will use a 5-Fold cross validation to assess the models. Since World Stocks to Use might give additional predictive power, we will work it into some of our specifications. We will consider each of the following model types, and we will try them with the polynomial terms with degree from 1 to 5:\n\nModel Functional Form\nModel 1 $$Price = \\beta_0 + \\sum_{i=1}^n \\beta_i \\Big(\\frac{1}{US \\text{ } Stocks \\text{ } to \\text{ } Use} \\Big)^i + \\epsilon$$\nModel 2 $$Price = \\beta_0 + \\sum_{i=1}^n \\beta_i \\Big(\\frac{1}{US \\text{ } Stocks \\text{ } to \\text{ } Use} \\Big)^i + \\sum_{i=1}^n \\gamma_i \\Big(\\frac{1}{World \\text{ } Stocks \\text{ } to \\text{ } Use} \\Big)^i + \\epsilon$$\nModel 3 $$Price = \\beta_0 + \\sum_{i=1}^n \\beta_i \\Big(log(US \\text{ } Stocks \\text{ } to \\text{ } Use \\Big)^i + \\epsilon$$\nModel 4 $$Price = \\beta_0 + \\sum_{i=1}^n \\beta_i \\Big(log(US \\text{ } Stocks \\text{ } to \\text{ } Use \\Big)^i + \\sum_{i=1}^n \\gamma_i \\Big(log(World \\text{ } Stocks \\text{ } to \\text{ } Use \\Big)^i + \\epsilon$$\nModel 5 $$Price = \\beta_0 + \\sum_{i=1}^n \\beta_i \\Big(\\frac{1}{US \\text{ } Stocks \\text{ } to \\text{ } Use} \\Big)^i + \\sum_{i=1}^n \\gamma_i \\Big(log(World \\text{ } Stocks \\text{ } to \\text{ } Use \\Big)^i + \\epsilon$$\n\nIn the code below, each for loop is fitting one of the models 1-5 and looping over the polynomial degree. So in total, we have fit 25 different models. In addition to that the line with the cv.glm() function is performing the k-Fold cross validation, i.e. generating 5 test and hold out samples, calculating the MSE of each and then averaging it. The cv.XXXX vectors are storing the cross validation MSE to plot and display below.\n\nset.seed(17)\ncv.us=rep(0,5)\ncv.World=rep(0,5)\ncv.Lus=rep(0,5)\ncv.LWorld=rep(0,5)\ncv.World2=rep(0,5)\nfor (i in 1:5){\nglm.fit=glm(PriceRecievedFarmers~poly(1\/USStockUse, i) ,data=stocks)\ncv.us[i]=cv.glm(stocks,glm.fit,K=5)$delta[1] } for (i in 1:5){ glm.fit.World=glm(PriceRecievedFarmers~poly(1\/USStockUse, i) + poly(1\/WorldStockUse, i) ,data=stocks) cv.World[i]=cv.glm(stocks,glm.fit.World,K=5)$delta[1]\n}\n\nfor (i in 1:5){\nglm.fit=glm(PriceRecievedFarmers~poly(log(USStockUse), i) ,data=stocks)\ncv.Lus[i]=cv.glm(stocks,glm.fit,K=5)$delta[1] } for (i in 1:5){ glm.fit.World=glm(PriceRecievedFarmers~poly(log(USStockUse), i) + poly(log(WorldStockUse), i),data=stocks) cv.LWorld[i]=cv.glm(stocks,glm.fit.World,K=5)$delta[1]\n}\n\nfor (i in 1:5){\nglm.fit.World=glm(PriceRecievedFarmers~poly(1\/USStockUse, i) + poly(log(WorldStockUse), i),data=stocks)\ncv.World2[i]=cv.glm(stocks,glm.fit.World,K=5)$delta[1] } res_tibble <- cbind(cv.us, cv.World, cv.Lus, cv.LWorld, cv.World2) %>% as_tibble() %>% add_column(PolynomialDegree = seq(1:5)) %>% round(2) colnames(res_tibble) <- c('Model 1', 'Model 2', 'Model 3', 'Model 4', 'Model 5', 'PolynomialDegree') p1 <- ggplot(res_tibble, aes(x = PolynomialDegree, y = cv.us)) + geom_line() + ylim(0, 75) + labs(x = 'Model 1 Poly Degree', y = 'Cross Validation MSE') + theme_bw() p2 <- ggplot(res_tibble, aes(x = PolynomialDegree, y = cv.World)) + geom_line() + ylim(0, 75) + labs(x = 'Model 2 Poly Degree', y = '') + theme_bw() p3 <- ggplot(res_tibble, aes(x = PolynomialDegree, y = cv.Lus)) + geom_line() + ylim(0, 75) + labs(x = 'Model 3 Poly Degree', y = '') + theme_bw() p4 <- ggplot(res_tibble, aes(x = PolynomialDegree, y = cv.LWorld)) + geom_line() + ylim(0, 75) + labs(x = 'Model 4 Poly Degree', y = '') + theme_bw() p5 <- ggplot(res_tibble, aes(x = PolynomialDegree, y = cv.World2)) + geom_line() + ylim(0, 75) + labs(x = 'Model 5 Poly Degree', y = '') + theme_bw() grid.arrange(p1, p2, p3, p4, p5, nrow = 1, top = \"Cross Validation MSE for Competing Models\") The figure shows the cross validation MSE we get from each of the five models fit with polynomial degree 1:5. Remember, to get the cross validation MSE the cv.glm() function with k = 5 is creating 5 different non-overlapping test and hold out samples. The MSE plotted in the figure is average of the MSE from each of the 5 different hold out samples. In the table below we present the same information, the cross validation MSE by model type and for each polynomial degree. Since there were several models with very similar MSE we can see exactly which models are getting the minimum MSE. Recall that Model 1 with a 1 degree polynomial is the model proposed by Good and Irwin in the farmdoc Daily article. This model does quite well, it comes in third, and the models that do better only do marginally better. The first place model is Model 5 with polynomial degree 1; the second place model is Model 4 with polynomial degree 2. Now to get a sense of whether or not these models are providing economically different predictions, we show predictions from the top three models in the table below. Rank Specification 2017 Price 1 $$Price = \\beta_0 + \\beta_1 \\frac{1}{US \\text{ } Stocks \\text{ } to \\text{ } Use} + \\gamma_1 log(World \\text{ } Stocks \\text{ } to \\text{ } Use) + \\epsilon$$ 3.06 2 $$Price = \\beta_0 + \\sum_{i=1}^2 \\beta_i \\Big(log(US \\text{ } Stocks \\text{ } to \\text{ } Use \\Big)^i + \\sum_{i=1}^2 \\gamma_i \\Big(log(World \\text{ } Stocks \\text{ } to \\text{ } Use \\Big)^i + \\epsilon$$ 3.15 3 $$Price = \\beta_0 + \\beta_1 \\frac{1}{US \\text{ } Stocks \\text{ } to \\text{ } Use} + \\epsilon$$ 2.77 Currently, the March 2018 futures contract is trading at around$3.65, which is significantly higher than each of these predictions, but if you look back at the scatter-plot of the actual data, \\$3.65 is well within the typical variability for a stocks to use value of 0.16 which is our current expectation for the 2017\/18 marketing year.\n\nThat\u2019s It!\n\nThat\u2019s it for this time! I hope you enjoyed this explanation and toy example of cross validation. I certainly learned a lot writing it! I think you would only consider using cross validation for model selection if your data set was at least modestly bigger that the one in this post. However, this example goes to show that the technique can be useful even in medium data!\n\nIn the next post I will talk about Tree-Based Methods, Random Forests, Boosting, and Bagging from chapter 8 of ISL. I really currently know zero about these methods, but I have heard a lot of buzz about them. It is my sense that these are \u2018real\u2019 machine learning topics, whereas the cross validation and model selection stuff is more like necessary background.\n\nStay Tuned!\n\nReposts\n\n\u2022 Ana\n\u2022 Rstats\n\u2022 tomas nilsson\n\nMentions\n\n\u2022 Abraham Mathew\n\u2022 Mubashir Qasim\n\u2022 mindymallory\n\n1. Edward\n\nGreat information and well articulated. Greatly appreciate this wonderful lesson. Waiting for the next post.\n\n\u2022 mindymallory\n\nThank you!\n\n2. There are some tidy modeling packages that can get rid of some of those loops. Would you be interested in a modified version of the code that you\u2019ve shown?\n\n3. Certainly!\n\nWebmentions\n\n\u2022 Machine Learning and Econometrics: Model Selection and Assessment Statistical Learning Style blog.mindymallory.com\/2018\/02\/machin\u2026\n\n\u2022 Mubashir Qasim February 28, 2018\n\nMubashir Qasim mentioned this article on mqasim.me.\n\n\u2022 mindymallory mentioned this article on blog.mindymallory.com.","date":"2020-10-20 08:11:10","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 2, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 1, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.6123844385147095, \"perplexity\": 1442.2048991206875}, \"config\": {\"markdown_headings\": false, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.3, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2020-45\/segments\/1603107871231.19\/warc\/CC-MAIN-20201020080044-20201020110044-00081.warc.gz\"}"} | null | null |
\section{Iterative Row Sampling for $\ell_2$}
\label{sec:algo2}
We start by presenting our algorithm for computing row sampling
in the $\ell_2$ setting.
Crucial to our approach is the following basis-free definition of
statistical leverage scores of $\leveragev$:
\begin{align*}
\leverage_i
\defequal \veca_i (\mata^T \mata)^{+} \veca_i^{T}, \quad \textrm{for } i=1,\ldots,n,
\end{align*}
where $\veca_i$ is the $i$-th row of $\mata$.
To our knowledge, the first near tight bounds for row sampling using
statistical leverage scores were given in \cite{AhlswedeW02},
and various extensions and simplifications were made since
\cite{RudelsonV07,VershyninNotes, Harvey11notes,AvronT11}.
They can be stated as follows:
\begin{lemma}
\label{lem:samplel2}
If $\approxleveragev$ is a set of probabilities such that
$\approxleveragev \geq \leveragev$, then for any constants
$c$ and $\epsilon$, there exists a function
$\textsc{Sample}(\mata, O(\log{d}, \epsilon) \approxleveragev)$ which returns $\matb$
containing
$O(\log d \nbr{\approxleveragev}_1\epsilon^{-2})$ rows and satisfying
\begin{align*}
(1 - \epsilon) \| \mata \vecx \|_2
\leq \| \matb \vecx \|_2
\leq (1 + \epsilon) \| \mata \vecx \|_2,
\qquad \forall \vecx\in\Re^d
\end{align*}
with probability at least $1 - d^{-c}$.
\end{lemma}
The importance of statistical leverage scores can be reflected
in the following fact, which implies that we can obtain $\matb$
with $O(d\log{d})$ rows.
\begin{fact}
\label{fact:leveragesum} (see e.g.~\cite{SpielmanS08}) Given $n\times d$ matrix $\mata$, and let $\leveragev$ be the
leverage score w.r.t.~$\mata$. Assume $\mata$ has rank $r$, then
\begin{align*}
\sum_{i = 1}^n \leverage_i = r \leq d
\end{align*}
\end{fact}
Although it is tempting to directly obtain high quality
approximations of the leverage scores, their computation
also requires a high quality approximation of $\mata^T \mata$,
leading us back to the original problem of row sampling.
Our way around this issue relies on the robustness of concentration
bounds such as Lemma~\ref{lem:samplel2}.
Sampling using even crude estimates on leverage scores can lead
to high quality approximations
\cite{DasguptaDHKM09,DrineasM10, DrineasMMS11,DrineasMMW11,AvronT11}.
Therefore, we will not approximate $\mata^T \mata$ directly,
and instead obtain a sequence of gradually better approximations.
The need to compute sampling probabilities using crude approximations
leads us to define a generalization of statistical leverage scores.
\subsection{Generalized Stretch and its Estimation}
\label{subsec:generalizedstretch}
The use of different matrices to upper bound stretch has
found many uses in combinatorial preconditioning, where it's
termed stretch \cite{SpielmanW09,KoutisLP12,DrineasM10}.
We will draw from them and term our generalization
of leverage scores \textbf{generalized stretch}.
We will use $\str{\matb}{\veca_i}$ to denote the approximate
leverage score of row $i$ computed as follows:
\begin{align}
\str{\matb}{\veca_i}
\defequal \veca_i (\matb^T \matb) ^{\dag} \veca_i
\end{align}
Under this definition, the original definition of statistical leverage
score $\leverage_i$ equals to $\str{\mata}{\veca_i}$.
We will refer to $\matb$ as the reference used to compute stretch.
It can be shown that when $\matb_1$ and $\matb_2$ are reasonably
close to each other, stretch can be used as upper bounds for
leverage scores in a way that satisfies Lemma~\ref{lem:samplel2}.
\begin{lemma}
\label{lem:referenceswitch}
If $\matb_1$ and $\matb_2$ satisfies:
\begin{align*}
\frac{1}{\kappa} \matb_1^T \matb_1
\preceq \matb_2^T \matb_2
\preceq \matb_1^T \matb_1
\end{align*}
Then for any vector $\vecx$ we have:
\begin{align*}
\str{\matb_1}{\vecx} \leq \str{\matb_2}{\vecx} \leq \kappa \str{\matb_1}{\vecx}
\end{align*}
\end{lemma}
The proof will be shown in Appendix~\ref{sec:leverageproofs}.
The stretch notation can also be extended to a set of rows, aka.~a matrix.
If $\mata$ is a matrix with $n$ rows, $\str{\matb}{\mata}$ denotes:
\begin{align}
\str{\matb}{\mata}
\defequal \sum_{i = 1}^{n} \str{\matb}{\veca_{i}}.
\end{align}
This view is useful as it allows us to write stretch
as the $\ell_2$ norm of a vector, or more generally
the stretch of a set of rows as the Frobenius norm of a matrix.
\begin{fact}
\label{fact:stretchclosedform}
The generalized stretch of the $i^{th}$ row of $\mata$ w.r.t $\matb$ equals
to its $\ell_2^2$ norm under the transformation $(\matb \matb^T)^\invsqr$:
\begin{align*}
\str{\matb}{\veca_i}
= \| (\matb \matb^T)^\invsqr \veca_i^T \|_2^2
= \| \veca_i (\matb \matb^T)^\invsqr \|_2^2
\end{align*}
and the total stretch of all rows is
\begin{align*}
\str{\matb}{\mata}
= \| (\matb \matb^T)^\invsqr \mata^T \|_F^2
= \|\mata (\matb \matb^T)^\invsqr \|_F^2
\end{align*}
\end{fact}
This representation leads to faster algorithms for estimating stretch
using the Johnson-Lindenstrauss transform.
This tool is used in a variety of settings from estimating effective
resistances \cite{SpielmanS08} to more generally leverage scores
\cite{DrineasMMW11}.
We will use the following randomized projection theorem:
\begin{lemma}
\label{lem:jl} (Lemma 2.2 from \cite{dasgupta2003elementary})
Let $\vecy$ be a unit vector in $\Re^d$. Then for any positive integer $k\le d$, let
$\matu$ be a $k\times d$ matrix with entries chosen independently from the Gaussian
distribution $\Ncal(0,1)$. Let $\vecx = \matu \vecy$ and
$L=\|\vecx\|_2^2$. Then for any $\projerror >1$,
\begin{enumerate}
\item \label{part:expectation} $\mathbb E(L) = k$
\item \label{part:upper} $\prob{L \ge {\projerror k}} <
\exp\rbr{\frac{k}{2}(1-\projerror+\ln{\projerror})}$
\item \label{part:lower} $\prob{L \le \frac{k}{\projerror }} <
\exp\rbr{\frac{k}{2}(1-\projerror^{-1}-\ln{\projerror})}$
\end{enumerate}
\end{lemma}
We will also use this lemma in our reduction step to bound the
distortion when rows are combined.
Note that the requirements of Lemma~\ref{lem:samplel2}
and the guarantees of \textsc{Sample} allows our estimates
to have larger error.
This means we can use fewer vectors in the projection, and
scale up the results to correct potential underestimates.
Therefore, we can trade the coefficient on the leading term
$\nnz(\mata)$ with a higher number of sampled row count.
The bound below accounts for both error incurred by $\matb$,
and the larger error caused by this error.
\begin{lemma}
\label{lem:approxstretch}
For any constant $c$, there is a routine
$\textsc{ApproxStr}(\mata, \matb, \kappa, \projerror)$, shown in Algorithm~\ref{alg:approxstretch},
that when given a $n \times d$ matrix $\mata$ where $n = \poly(d)$,
and an approximation $\matb$ with $m$ rows such that:
\begin{align*}
\frac{1}{\kappa} \mata^T \mata \preceq \matb^T \matb \preceq \mata^T \mata
\end{align*}
return in
$O( (\nnz(A) + d^{2} ) \log_{\projerror}{d} + (m+d)d^{\omega-1})$
time and upper bounds $\approxleverage_i$ such that with probability at least $1 - d^{-c}$
\begin{enumerate}
\item \label{part:l2stretchupper} for all $i$, $\approxleverage_i \geq \leverage_i$.
\item \label{part:l2stretchsum} $\| \approxleveragev \|_1 \leq O(\projerror^2 \kappa d
)$.
\end{enumerate}
\end{lemma}
\subsection{Reductions and Recovery}
\label{sec:rowproj}
Our reduction and recovery processes are based on projecting $\mata$
to one with fewer rows, and moving the estimates on the projection
back to the original matrix.
Our key operation is to combine every $R$ rows into $k$ rows, where
$R$ and $k$ are set to $d^{\theta}$ and $O(c / \theta)$ respectively.
By padding $\mata$ with additional rows of zeros, we may assume
that the number of rows is divisible by $R$.
We will use $\nblock = n/R$ to denote the number of blocks,
and use the notation $\cdot_{(b)}$ to index into the $b$\textsuperscript{th} block.
Our key step is then a $(R, k)$-reduction of the rows:
\begin{definition}
\label{def:reduction}
A $(R, k)$-reduction of $\mata$ describes the following procedure:
\begin{enumerate}
\item For each block $\mata_{(b)}$, pick $\matu_{(b)}$ to
be a $k \times R$ random Gaussian matrix
with entries picked independently from $\mathcal{N}(0, 1)$ and
compute $\matashort_{(b)} = \matu_{(b)} \mata_{(b)}$.
\item Concatenate the blocks $\matashort_{(b)}$ together vertically to form $\matashort$.
\end{enumerate}
\end{definition}
We first show that projections preserve the stretch of blocks
w.r.t. $\mata$.
This can be done by bounding the effect of $\matu_{(b)}$ on
the norm of each column of $\mata_{(b)} (\mata^T \mata)^\invsqr$.
It follows directly from properties of the Johnson-Lindenstrauss
projections described in Lemma \ref{lem:jl}, and we'll give
its proof in Appendix~\ref{sec:rowcombineproofs}.
\begin{lemma}
\label{lem:goodapprox}
Assume $R = d^{\theta} \ge e^2$ for some constant $\theta$ and
let $\matashort$ be a $(R, k)$-projection of $\mata$.
For any constant $c > 0$ there exists a constant
$k = O(c / \theta)$ such that
\begin{align*}
\str{\mata}{\matashort_{(b)}}
\geq \frac{k}{R} \str{\mata}{\mata_{(b)}}
\end{align*}
holds for all block $b=1,\ldots,n_b$
with probability at least $1 - d^{-c}$.
\end{lemma}
We next show that we can change the reference from $\mata$
to $\matashort$, and use $\str{\matashort}{\matashort_{(b)}}$
as upper bounds for $\str{\mata}{\matashort_{(b)}}$.
As a first step, we need to relate $\mata^T \mata$ to
$\matashort^T\matashort$.
Since each $\matashort_{(b)}$ is formed by merging rows
of $\matashort_{(b)} = \matu_{(b)} \mata_{(b)}$,
$\matashort_{(b)}^T\matashort_{(b)}$ can
be upper bounded by $\mata_{(b)}^T\mata_{(b)}$ times
a suitable term depending on $\matu_{(b)}$.
We prove the following in Appendix~\ref{sec:rowcombineproofs}.
\begin{lemma}
\label{lem:shortupper}
The following holds for each block $b$:
\begin{align*}
\matashort_{(b)}^T \matashort_{(b)}
\preceq \|\matu_{(b)} \|_F^2 \cdot \mata_{(b)}^T \mata_{(b)}
\end{align*}
\end{lemma}
However, generalized stretches w.r.t.~$\mata$ and $\matashort$
are evaluated under the norms given by the inverses of these
matrices, $(\mata^T\mata)^{+}$ and $(\matashort^T\matashort)^{+}$.
As a result, we need to bound the operator bound between these two
pseudoinverses, which we obtain using the following lemma.
\begin{lemma}
\label{lem:pseudoinversereverse}
Let $\matc$ and $\matd$ be symmetric positive semi-definite matrices and let
$\matproj$ be the orthogonal projection operator onto the range space of
$\matc$. Then:
\begin{align*} \matproj \matc^{+} \matproj \succeq \matproj (\matc + \matd)^{+}
\matproj
\end{align*}
\end{lemma}
This is straightforward when both $\matc$ and $\matd$ are
full rank, or share the same null space.
However, as pseudo-inverses do not act on the null space,
it is crucial that we're only considering vectors of the form $\veca'_i$.
This Lemma is proven in Appendix \ref{sec:rowcombineproofs}.
Combining it with bounds in the other direction allows us to bound
the distortion caused by switching reference from $\mata$ to $\matashort$.
\begin{lemma}
\label{lem:leverageupper}
For any constant $c$, there exists
a constant $c'$,
such that with probability at most $1 - d^{-c}$,
we have for each row $i$ of $\matashort$, denoted by $\vecashort_i$, satisfies
\begin{align*}
c' k R \log d \cdot \str{\matashort}{\vecashort_i}
\geq \str{\mata}{\vecashort_i}
\end{align*}
\end{lemma}
\Proof Denote by $\mata_{(b)}$ the $b$-th block of $\mata$ and $\matashort_{(b)}$ the
corresponding block in $\matashort$, by Lemma~\ref{lem:shortupper},
\begin{align*}
\matashort_{(b)}^T \matashort_{(b)}
\preceq \nbr{\matu_{(b)}}_F^2\mata_{(b)}^T
\mata_{(b)}
\end{align*}
Since each
$\matu_{(b)}$ consists of $k \times R$ independent random variables chosen from
$\mathcal{N}(0, 1)$, $\| \matu_{(b)} \|_F^2$ is distributed as $\mathcal{N}(0, kR)$. This
gives:
\begin{align}
\prob{\| \matu_{(b)} \|_F^2 > \ell kR}
\leq \exp(-\ell)
\end{align}
As $n=\poly(d)$, this probability can
be bounded by $d^{-c}n^{-1}$ for an appropriate choice of $\ell = O(\log{d})$.
By a union bound over all the blocks, we have
$\| \matu_{(b)} \|_F^2 \le \ell kR $
for all $b$ with probability of at least $1 - d^{-c}$.
Applying Lemma~\ref{lem:shortupper} and summing over these blocks gives:
\begin{align*}
\matashort^T \matashort \preceq \ell kR \cdot \mata^T \mata
\end{align*}
Let $\matproj$ the projection operator onto the range space of $\matashort^T
\matashort$. Applying Lemma~\ref{lem:pseudoinversereverse} with $\matc = \matashort^T
\matashort$ and $\matd = \ell kR \mata^T \mata - \matashort^T \matashort$ gives
\begin{align*}
\matproj \rbr{\mata^T
\mata}^\dag\matproj \preceq \ell kR \cdot \matproj\rbr{\matashort^T
\matashort}^\dag \matproj
\end{align*}
Further note that $\vecashort_i$ is completely contained within the range space of
$\matashort^T \matashort$.
Therefore for all $i$, $\matproj \vecashort_i = \vecashort_i$ and:
\begin{align*}
\str{\mata}{\vecashort_i}
& = \vecashort_i \matproj \rbr{\mata^T \mata}^\dag\matproj \vecashort_i^T\\
& \leq \ell kR \cdot \vecashort_i \matproj \rbr{\matashort^T \matashort}^\dag\matproj \vecashort_i^T\\
& = \ell kR \cdot \str{\matashort}{\vecashort_i}
\end{align*}
Therefore
\begin{align*}
\Pr \sbr{ \ell kR \cdot \str{\matashort}{\vecashort_i} \geq \str{\mata}{\vecashort_i}}
& \ge \Pr \sbr{ \matproj \matashort^T \matashort \matproj \preceq \ell kR \cdot \matproj \mata^T \mata \matproj } \nonumber \\
& \ge 1 - d^{-c}.
\end{align*}
\QED
Combining Lemmas~\ref{lem:leverageupper}~and~\ref{lem:goodapprox}
shows that with high probability, scaling up $\str{\matashort}{\matashort_{(b)}}$
by $O(R^2 \log{d})$ gives upper bounds
for the leverages scores in the original blocks of $\mata$.
\begin{corollary}
\label{cor:projectiongood}
For any constant $c$, there exists a setting of constants
such that for any $R = d^{\theta}$, we have with probability
at least $1 - d^{-c}$
\begin{align*}
c' R^2 \log{d} \cdot \str{\matashort}{\matashort_{(b)}}
\geq \str{\mata}{\mata_{(b)}}
\end{align*}
holds for all $b$.
\end{corollary}
\subsection{Iterative Algorithm}
It remains to algorithmize the estimates that we obtain
using this projection process.
Projecting $\mata$ to $\matashort$ gives a matrix with
fewer rows, and a way to reduce the sizes of our problems.
A fast algorithm follows by examining the sequence of matrices
$\mata = \mata(0), \mata(1), \ldots \mata(L)$ obtained
using such projections.
Once $\mata(L)$ has fewer than $\nnz(\mata) d^{-3}$ rows,
$\mata(L)^T \mata(L)$ can be approximated directly.
This then allows us to approximate the statistical leverage
scores of the rows of $\mata(L)$
Corollary \ref{cor:projectiongood} shows that stretches computed
on $\mata(l)$, $\approxleverage(l)$ can serve as sampling
probabilities in $\mata(l - 1)$.
This means we can gradually propagate solutions backwards
from $\mata(L)$ to $\mata(0)$.
We do so by maintaining the invariant that $\matb(l)$
has a small number of rows and is close to $\mata(l)$.
The total generalized stretch of $\mata(l)$ w.r.t. $\matb(l)$
can be used as upper bounds of the statistical leverage scores
of $\mata(l - 1)$ after suitable scaling..
This allows the sampling process to compute $\matb(l - 1)$,
keeping the invariant for $l - 1$.
Pseudocode of the algorithm is shown in Algorithm \ref{alg:rowsamplel2}, which is
illustrated in Figure~\ref{fig:rowsample}.
\begin{algo}[ht]
\qquad
$\textsc{RowSampleL2}(\mata, R, \epsilon)$
\vspace{0.05cm}
\underline{Input:}
Reduction rate $R$,
$n \times d$ matrix $\mata$,
allowed approximation error $\epsilon$,
failure probability $\delta = d^{-c}$.
\underline{Output:}
Sparsifier $\matb$ that contains
$O(R^{5} d \log{d} / \epsilon^{2})$
scaled rows of $\mata$
such that $(1 - \epsilon) \mata^T \mata
\preceq \matb^T \matb
\preceq (1 + \epsilon) \mata^T \mata$.
\begin{algorithmic}
\STATE{Set $L = \lceil \log_{R} (n / d) \rceil$}
\STATE{Set $\epsilon(0) = \epsilon / 3$, $\epsilon(1) \ldots \epsilon(l) = 1/2$}
\STATE{$\mata(0) = \mata$}
\FOR{$l = 1 \ldots L$}
\STATE{Let $\mata(l)$ be a $(R, k)$-projection of $\mata(l - 1)$}
\ENDFOR
\STATE{$\matb(L) \leftarrow \mata(L)$}
\FOR{$i = L \ldots 1$}
\STATE{$\approxleveragev'(l) \leftarrow
O(R^3 \log{d}) \cdot \textsc{ApproxStr} (\mata(l), \sqrt{\frac{2}{3}}\matb(l), R, R)$}
\STATE{Compute $\approxleverage(l - 1)$ by setting each entry in $\approxleverage(l - 1)_{(b)}$
to $|\approxleveragev'(l)_{(b)}|_1$}
\STATE{$\matb(l - 1) \leftarrow \textsc{Sample}(\mata(l - 1), \approxleverage(l - 1), \epsilon(l))$}
\ENDFOR
\STATE{$\approxleveragev'(0) \leftarrow
\textsc{ApproxStr} (\matb(0), \matb(0), 2, 2)$}
\RETURN{$\textsc{Sample}(\matb(0), \approxleveragev'(0), \epsilon / 3)$}
\end{algorithmic}
\caption{Row Sampling using Projections}
\label{alg:rowsamplel2}
\end{algo}
\begin{figure}[th!]
\centering
\includegraphics[width=12cm]{rowsampling}
\caption{Illustration of Algorithm~\ref{alg:rowsamplel2} by using $L=2$. There are
mainly two stages with 9 steps. On the reduction stage, we obtain shorter $\mata(1)$ and
$\mata(2)$ by iteratively doing $(R,r)$-projection. On the next recovery stage, we
approximate the leverage scores of $\mata(1)$ by the ones computed from $\mata(2)$ and
$\matb(2)$. Then $\matb(1)$ is sampled based on this approximated scores, which will be
used to further obtain the approximated leverage scores of $A(0)$. The final step
which samples $\matb(0)$ once again is not shown here.}
\label{fig:rowsample}
\end{figure}
Sampling probabilities for $\mata(l - 1)$ are obtained by
computing the stretch of $\mata(l)$ w.r.t. $\matb(l)$.
We first show these values, $\approxleverage(l - 1)$, are
with high probability upper bounds for the statistical
leverage scores of $\mata(l - 1)$, $\leverage(l - 1)$.
\begin{lemma}
\label{lem:recovery}
Assume $\mata(l)$ and $\matb(l)$ satisfy the following condition
\begin{align*}
\frac{1}{2} \mata(l)^T \mata(l)\preceq
\matb(l)^T \matb(l)
\preceq \frac{3}{2} \mata(l)^T \mata(l)
\end{align*}
Then for any constant $c$, there is a setting of the constants
such that
\begin{itemize}
\item $\approxleveragev(l - 1) \geq \leveragev(l - 1)$
\item $\| \approxleveragev(l - 1) \|_1 \leq O(dR^3 \log{d})$
\end{itemize}
holds with
probability at least $1 - d^{-c}$.
\end{lemma}
\Proof
The given condition implies that $\sqrt{\frac{2}{3}}\matb(l)$
satisfies the condition needed for Lemma \ref{lem:approxstretch}
with $\kappa = 3$. Let the constants $c'=c+\log_d 2$, then with probability
at least $1 - d^{-c'}$ we have:
\begin{align*}
\approxleveragev'(l) \geq O(R^2\log d) \leveragev(l)
\end{align*}
Since $\mata(l)$ is a projection of $\mata(l - 1)$, we
can index corresponding blocks in them.
Apply Corollary \ref{cor:projectiongood}, then with probability at least $1-d^{-c'}$, we have
\begin{align*}
O(R^2 \log d) \nbr{\leveragev(l)_{(b)}}_1 \ge \nbr{\leveragev(l-1)_{(b)}}_1
\end{align*} for all blocks. As each entries of $\approxleveragev(l-1)$ in block $b$ is
assigned with $\nbr{\approxleveragev '(l)_{(b)}}_1$, by the union bound, then for all $i$ in block $b$
\begin{align*}
\approxleveragev(l-1)_i = \nbr{\approxleveragev'(l)_{(b)}}_1 \ge \nbr{\leveragev(l-1)_{(b)}}_1 \ge \leveragev(l-1)_{i}
\end{align*}
holds for all blocks $b$ with probability at least $1-2d^{-c'}$, which is equal to $1-d^{-c}$ by the
definition of $c'$.
It remains to upper bound $\nbr{\approxleveragev(l - 1)}_1$.
Lemma \ref{lem:approxstretch} Part \ref{part:l2stretchsum} gives,
with probability at least $1 - d^{-c}$,
$\nbr{\approxleveragev'(l)}_1 \leq O(dR^2\log d)$.
As each $\nbr{\approxleveragev'(l)_{(b)}}_1$ is assigned to the $R$
entries in $\approxleveragev(l - 1)_{(b)}$, we get
$\nbr{\approxleveragev(l - 1) }_1 \leq O ( d R^{3} \log{d} )$ with the same probability.
\QED
Combining these with the fact that the number of rows decrease
by a factor of $O(R)$ per iteration completes the algorithm.
Our main result for $\ell_2$ row sampling is
obtained by setting $R$ to $d^{\theta}$.
Applying Lemma~\ref{lem:recovery} inductively backwards in $l$
gives the overall bound.
\begin{theorem}
\label{thm:algol2}
For any constant $c$, there is a setting of constants
such that if $\textsc{RowSampleL2}$, shown in Algorithm~\ref{alg:rowsamplel2}, is ran with
$R = d^{\theta}$, then with probability at least $1 - d^{-c}$ it returns $\matb$
in $O(\nnz(\mata) + d^{\omega + 4 \theta} \epsilon^{-2})$ time
such that:
\begin{align*}
(1 - \epsilon) \mata^T \mata
\preceq \matb^T \matb
\preceq (1 + \epsilon) \mata^T \mata
\end{align*}
and $\matb$ has
${O}(d \log{d} \epsilon^{-2})$
rows, each being a scaled copy of some row of $\mata$,
\end{theorem}
\Proof
We first show correctness via.~induction backwards on $l$.
Define $c'=c+1$, we show that $\matb(l)$
has $O(d R^{4} \log{d}\epsilon(l)^{-2})$ rows
and satisfies $$(1 - \epsilon(l)) \mata(l)^T \mata(l)^T
\preceq \matb(l)^T \matb(l)
\preceq (1 + \epsilon(l)) \mata(l)^T \mata(l)^T,$$
with probability at least
$1 - 3(L - l) d^{c'}$ for each $l$.
As $k=O({c}/{\theta})$ is a constant, one $(R,k)$-projection decreases the number of
rows by a factor of $O(R)$. After $L=\log_{R}(n / d)$ projections, we get that $\mata(L)$
has $O(d)$ rows.
Therefore the base case where $l = L$ follows from
$\matb(L) = \mata(L)$.
For the inductive step, we assume that the inductive hypothesis
holds for $l \geq 1$ and try to show it for $l - 1$.
As $\epsilon(l)$ was set to $1/2$, we have:
\begin{align*}
\frac{1}{2} \mata(l)^T \mata(l)\preceq
\matb(l)^T \matb(l)
\preceq \frac{3}{2} \mata(l)^T \mata(l)
\end{align*}
This allows us to invoke Lemma \ref{lem:recovery},
which combined with Lemma \ref{lem:samplel2}
gives that with probability $1 - d^{-c' }$,
the inductive hypothesis also holds for $l - 1$.
The final sampling step on $\matb(0)$ with $R=2$ guarantees that
$\nbr{\approxleveragev'(0)}_1 \le O(d)$, which gives a final row
count of $O(d \log d/\epsilon^2)$.
The overall failure probability follows from union bounding this
with the failure probabilities from the hypothesis
and Lemma \ref{lem:recovery}.
We now bound the total running time, starting with the projections. Since $k=O(1)$, each
$(R,k)$-projection reduces $R$ rows into $O(1)$ rows, so the sparsity patterns are kept,
namely $\nnz(\mata(l + 1)) = O(\nnz(\mata(l)))$. As $\matu_{(b)}$ has $k$ rows for all
$b$, then the cost of constructing $\mata(l)$ from $\mata(l-1)$ is $O(\nnz(\mata))$.
Note that since $R = d^{\theta}$,
$L = \log_{R}(n / d) = \log_R(\poly(d))$ is a constant.
So we get a total cost of $O(\nnz(\mata))$ over all $L$ projections.
Since $\matb(l)$ has $O(d R^{3} \log^2 d \epsilon(l)^{-2})$ rows,
Lemma \ref{lem:approxstretch} gives that each call to $\textsc{ApproxStr}$ takes
$O(\nnz(\mata) + d^{\omega+4\theta} \epsilon^{-2})$ time, where we upper bound
$\log^2{d}$ by $d^\theta$. The cost of the final step on $\matb(0)$ can be
bounded similarly.
\QED
\section{Background}
\label{sec:background}
In this section we outline key results from previous works on row sampling.
These works show that statistical leverage scores are closely
associated the probabilities needed for row sampling,
and give algorithms that efficiently approximate these values.
In addition, we formalize the observation implicit in earlier works
that both the sampling and estimation algorithms are very robust.
The high error-tolerance of these algorithms makes them ideal
as core routines to build iterative algorithms upon.
Most of the results mentioned in this section are direct adaptations
from earlier works, where they're presented in much more detail.
For completeness, we give their proofs in Appendix \ref{sec:backgroundproofs}.
Most of the presentation will use standard linear algebraic notations.
We use $||\vecx||_p$ to denote the $L_p$ norm of a vector.
The two values of $p$ that we'll use are $p=1$ and $p=2$,
which correspond to $||\vecx||_1 = \sum_{i} |x_i|$
and $||\vecx||_2 = \sqrt{\sum_{i} x_i^2}$.
For two vectors $\vecx$ and $\vecy$, $\vecx \geq \vecy$ means
$\vecx$ is entry-wise greater or equal to $\vecy$, aka.
$\vecx_i \geq \vecy_i$ for all $i$.
Given a matrix $\mata$, we use $\mata_{i, :}$, or $\veca_i$
to denote the $i^{th}$ row of $\mata$.
Note that $\veca_i$ is a row vector of length $d$.
We will also use its Forbenius norm, $||\mata||_F$
to denote the $2$-norm of all its entries.
Formally, $||\mata||_F^2 = \sqrt{\sum_{i, j} \mata_{i, j}^2}$.
The spectral theorem states that any symmetric matrix
$\matc$ has a full complement of orthonormal eigenvectors.
Let them and their eigenvalues
be $(\vecu_1, \lambda_1), (\vecu_2, \lambda_2), \ldots (\vecu_n, \lambda_n)$.
Here $\vecu_j$ is a length $d$ column vector, $\lambda_j$ is a scalar
and they satisfy $\mata^T \mata \vecu_j = \lambda_j \vecu_j$.
Without loss of generality we assume that $\lambda_j$s are in increasing
order: $\lambda_1 \leq \lambda_2 \leq \ldots \leq \lambda_n$.
Then if $\lambda_{k}$ is the first non-zero eigenvalue, we have:
\begin{align*}
\matc = \sum_{j = k}^{n} \lambda_j \vecu_j \vecu_j^T
\end{align*}
We will use $\lambda_{\max}$ to denote the largest eigenvalue,
and $\lambda_{\min}$ to denote the smallest \textbf{non-zero} eigenvalue.
Suppose $\lambda_k$ is the first non-zero eigenvalue,
the pseudoinverse of $\matc$, $\matc^{+}$ can be defined as:
\begin{align*}
\matc^{+} = \sum_{j = k}^{n} \frac{1}{\lambda_j} \vecu_j \vecu_j^T
\end{align*}
This is a linear operator that preserves the null space of $\matc$,
while acting as its inverse on the rank space.
A matrix $\matc$ is positive semi-definite
if all its eigenvalues are non-negative,
or equivalently $\vecx^T \matc \vecx \geq 0$
for all vectors $\vecx$.
Similarities between matrices is defined using a partial order on matrices.
Given two matrices $\mata$ and $\matb$, $\mata \preceq \matb$
denotes that $\matb - \mata$ is positive semi-definite.
We will use $\elementsum$ to specifically to denote $\mata^T \mata$.
An alternate view of row sampling is that we're given $n$
PSD matrices $\element_1 \ldots \element_n$
where $\element_i = \veca_i^T \veca_i$;
and the goal is to find a small subset of them such
that their weighted sum is close to $\elementsum$.
Furthermore, we can assign weights of zero to elements
that are not selected, giving a weight vector $\weightv \in \Re^{n}$.
The formal requirement of row sampling can be described as:
\begin{itemize}
\item For some parameter $\kappa$ we have $\elementsum
\preceq \sum_{i = 1}^n \weight_i \element_i
\preceq \kappa \elementsum$
\item $|\{ i: w_i \neq 0\}|$, the support of $\vecw$, is small.
\end{itemize}
The work by Clarkson and Woodruff \cite{ClarksonW12} obtained
approximations to $\mata$ by applying a (randomized) linear
transformation $\mats$ to get $\matb = \mats \mata$.
In our case, such a matrix can be constructed by letting each
row correspond to a non-zero weight in $\weightv$.
This row in $\mats$ then has one non-zero entry equaling
to the square root of the weight.
This is similar to the method used by Clarkson and Woodruff in that
each column has at most one non-zero entry, but has the
additional property that each row has at most one non-zero entry,
that's also non-negative.
\subsection{Row Sampling Using Statistical Leverage Scores}
\label{subsec:sample}
Matrix concentration bounds can be viewed as generalizations
of single-variable concentration bounds.
To our knowledge, the first nearly-tight bounds that encapsulates
row sampling was given by Ahlswede and Winter \cite{AhlswedeW02}.
Similar bounds were given as part of a much larger set of results
by Rudelson and Vershynin \cite{RudelsonV07}, although simplifications
of their proofs are similar to previous works \cite{VershyninNotes, Harvey11notes}.
These results identified statistical leverage scores as the crucial
numbers corresponding to sampling probabilities.
Formally, the statistical leverage score of a row of $\mata$, $\veca_i$
is defined as:
\begin{align*}
\leverage_i = \veca_i \elementsum^{+} \veca_i^{T}
\end{align*}
Where $\elementsum^{+}$ is the pseudoinverse of $\elementsum$.
Although these values have been studied in statistics,
their use in algorithms is more recent.
Spielman and Srivastava used these bounds
in their spectral sparsification algorithm \cite{SpielmanS08}.
However, their algorithm was restricted to the setting where $\mata$
is the edge-vertex incidence matrix of some graph.
Works by Drineas, Mahoney, Avron and Toledo generalized this
sampling scheme to arbitrary PSD matrices \cite{DrineasM10,AvronT11}.
For our algorithms, we have crude approximations of leverage scores,
but only need to bound the number of samples.
Such extensions are immediate from the presentations given in
\cite{VershyninNotes, Harvey11notes}.
We use the statement obtained by combining Theorems 5.4. and 6.2.
from \cite{AvronT11}, as
it gives guarantees for sampling with upper bounds of leverage scores.
\begin{lemma}
\label{lem:sparsify}
(Theorem 5.4, 6.2 from \cite{AvronT11})
Let $\mata$ be a $n \times d$ matrix and $\elementsum$ be its inner product,
$\elementsum = \mata^T \mata$.
Suppose $\approxleveragev$ is a length $n$ vector such that
$\approxleverage_i \geq \leverage_i$.
Associate the probability with every row:
\begin{align}
p_i = \frac{\approxleverage_i}{||\approxleverage||_1}
\end{align}
and let $\sample_1 \ldots \sample_{M}$ be i.i.d. random matrices defined by:
\begin{align}
\sample_{i} = p_{J_i}^{-1} \element_{J_i}
\end{align}
Where $J_1 \ldots J_{M}$ are random integers between $1$ and $n$ which take
value $i$ with probability $p_i$.
Then there exist an absolute constant $C$ such that
given any error parameter $\epsilon$,
choosing $M = C ||\approxleverage||_1 \log(||\approxleverage||_1) / \epsilon^2$ gives:
\begin{align*}
\prob{(1 - \epsilon) K \preceq \frac{1}{M} \sum_{i} \sample_i \preceq (1 + \epsilon) K}
\geq & 1 - \frac{1}{\poly(M)}
\end{align*}
Furthermore, this process, which we denote as
$\textsc{Sample}(\mata, \approxleveragev, \epsilon)$
can run in $O(n + M \log{n})$ time.
\end{lemma}
Note that the total number of sample
depends on the sum of the upper bounds.
In the case we use the exact scores, the following fact
implies about $O(d\log{d})$ samples suffice.
\begin{fact}
\label{fact:leveragesum} (see e.g. \cite{SpielmanS08})
\begin{align*}
\sum_{i = 1}^n \leverage_i = r \leq d
\end{align*}
\end{fact}
The sampling process described in Lemma \ref{lem:sparsify} is with replacement,
and is similar to the framework described in
\cite{AhlswedeW02, RudelsonV07,Harvey11notes}.
The running time can be obtained by computing partial sums of
$\approxleveragev$ and binary search for the entry where the cumulative
probability meets our threshold.
Ipsen and Wentworth showed that a variety of different sampling methods
lead to similar results both theoretically and experimentally \cite{IpsenW12}.
Since $\approxleverage_i$ only needs to be upper bounds for $\leverage_i$,
we can also use poor approximations of leverage scores by scaling them up
by the approximation factor.
This scaling leads to an increases in the number of rows sampled
by the same factor as the approximation ratio.
However, it allows us to obtain a much more accurate estimate of
$\mata$ compared to the accuracy of the approximate
statistical leverage scores.
\subsection{Generalized Stretch and Their Properties}
\label{subsec:leverageproperties}
As our algorithm is iterative and its output is approximate,
we will not be able to compute $\elementsum$ exactly.
Therefore, all the statistical leverage score estimations in our algorithms
will be done using an approximation $\elementsumapprox$
in place of $\elementsum$.
As a result, we will incorporate the matrix that we compute
these scores by, $\elementsum$ as part of our notation.
This is a common notion used in the design of combinatorial
preconditioners, where $\elementsumapprox$ is often chosen
to be a simpler matrix than $\elementsum$.
In the tree setting, Spielman and Woo \cite{SpielmanW09}
showed that when $\mata$ is an edge-vertex incidence
matrix and $\elementsumapprox$ corresponds to a spanning
tree, $\veca_i \elementsumapprox \veca_i^T$ equals to the
combinatorial stretch of the edge $i$ w.r.t. the tree.
This motivates us to use generalized stretch to
describe this term for arbitrary matrices.
Suppose we're given a factorization of $\elementsumapprox$
as $\matb^T \matb$, we will use $\str{\matb}{\veca_i}$
to denote:
\begin{align}
\str{\matb}{\veca_i}
:= \veca_i \elementsumapprox^{+} \veca_i
= \veca_i (\matb^T \matb)^{+} \veca_i
\end{align}
Note that under this notation, the original definition of statistical
leverage score of row $i$, $\leverage_i$ equals to
$\str{\mata}{\veca_i}$.
We will also use this generalized notion to denote leverage scores
from this point and on, but still use $\approxleverage$ to denote
the approximate bounds of leverage scores computed by our algorithms.
Instead of measuring the stretch of a single row of $\mata$,
we can also incorporate the stretch of a subset of the rows
into our notation.
If $\mata$ is a matrix with $n$ rows, we use the notation
$\str{\matb}{\mata}$ to denote:
\begin{align}
\str{\matb}{\mata}
= \sum_{i = 1}^{n} \str{\matb}{\veca_{i}}
\end{align}
The following fact is also crucial for our analysis:
\begin{fact}
\label{fact:stretchclosedform}
Let $\elementsumapprox = \matb^T \matb$.
The generalized stretch of the $i^{th}$ row w.r.t $\matb$ equals to its
$L_2^2$ norm under the transformation $\elementsumapprox^{+1/2}$:
\begin{align*}
\str{\matb}{\veca_i}
=& ||\elementsumapprox^{+1/2} \veca_i^T||_2^2
= ||\veca_i \elementsumapprox^{+1/2}||_2^2
\end{align*}
and the total stretch of all rows is
\begin{align*}
\str{\matb}{\mata}
= & || \elementsumapprox^{+1/2} \mata^T||_F^2
= ||\matb \elementsumapprox^{+1/2}||_F^2
\end{align*}
Where $\elementsumapprox^{+1/2}$ is the $1/2$ power of the
pseudo-inverse of $\elementsumapprox$ and $||\cdot||_F$ denotes
the Forbenius norm.
\end{fact}
Computing stretch using a different matrix, $\str{\matb}{\mata}$,
is a standard step when analyzing graph based preconditioners,
and done implicitly in \cite{KoutisLP12}.
It was shown by Avron, Maymounkov and Toledo that similar
matrices can be used in place of each other in least squares
regression \cite{AvronMT10}.
The same also holds for generalized stretch, where
similar matrices can be used to approximate stretch
up to the same factor as their difference.
This allows us to define the notion of $S$-stretch base.
\begin{definition}
\label{def:lowstretch}
A matrix $\matb$ is a $S$-stretch base for $\mata$ if:
\begin{enumerate}
\item \label{part:pointwise}
$\str{\matb}{\veca_i} \geq \leverage_i$
\item \label{part:total}
$\str{\matb}{\mata} \leq S$
\end{enumerate}
\end{definition}
This definition is similar to the objective of the column
subset selection problem studied by Avron and Boutsidis \cite{AvronB12}.
Its two conditions are consequences of the requirements
on sampling probabilities described in Lemma \ref{lem:sparsify}.
Condition \ref{part:pointwise} implies
that $\str{\mata}{\veca_i}$ can be used
as sampling probabilities;
while condition \ref{part:total} means if $\kappa = \poly(d)$,
the total number of rows needed for a constant error
can be bounded by $O(\kappa d \log{d})$.
Works on spectral sparsifiers of graphs showed
that matrices similar to $\mata$, $\matb$, can still lead
to sampling probabilities \cite{SpielmanS08, KoutisLP12}.
One sufficient condition is that $\matb^T \matb$ is spectrally
close to $\mata^T \mata$.
It can be formalized using Definition \ref{def:lowstretch}
as follows:
\begin{lemma}
\label{lem:baseswitch}
For fixed $\mata$ and $\elementsum = \mata^T \mata$,
if $\elementsumapprox = \matb^T \matb$ satisfies:
\begin{align*}
\frac{1}{\kappa} \elementsum
\preceq & \elementsumapprox
\preceq \elementsum
\end{align*}
Then $\matb$
is a $\kappa$-stretch base for $\mata$.
\end{lemma}
Using different bases play crucial roles in
both of our algorithms described in Sections
\ref{sec:simple} and \ref{sec:rowcombine}.
\subsection{Estimation of Generalized Stretch}
\label{subsec:estimatestretch}
Fact \ref{fact:stretchclosedform} shows that
gives that $\str{\mata}{\veca_i}$
is the $L_2$ norm of a vector.
Combining this norm using the Johnson-Lindenstrauss transform
(e.g. \cite{Achlioptas01}) the leads to faster approximations
of all leverage scores.
This was first used by Spielman and Srivastava to approximate
effective resistances \cite{SpielmanS08}.
Direct applications of this reduction, or similar algorithms
given in \cite{DrineasMMW11} lead to a running time of
at least $\Omega(\nnz(\mata) \log{n})$.
However, the definition of generalized stretch are only
one sided bounds pointwise, which means our estimates
can also have large, one sided error.
We can use fewer vectors in the projection, and scale up
the results to correct potential underestimates.
This trades off the coefficient on the leading term at the
cost of more elements sampled.
This way of remedying one-sided error in the Johnson-Lindenstrauss
transform was first shown in \cite{KoutisLP12} and relies on a version
of the projection theorem with fewer vectors.
We use the following version given as Lemma 7 in \cite{IndykM98}:
\begin{lemma}
\label{lem:jl} (Lemma 7 from \cite{IndykM98})
Let $u$ be a unit vector in $\Re^\nu$.
For any given positive integers $k$, let $U_1, \ldots, U_k$ be random vectors
chosen independently from the $\nu$-dimensional Gaussian distribution $N^\nu(0, 1)$.
For $X_i = u^T U_i$, define $W = W(u) = (X_1, \ldots, X_k)$ and
$L = L(u) = \|W\|^2_2$. Then for any $\beta > 1$:
\begin{enumerate}
\item \label{part:expectation}
$E(L) = k$
\item \label{part:upper}
$\prob{L \geq \beta k} < O(k) \exp(-\frac{k}{2} (\beta - (1 + \ln{\beta})) )$
\item \label{part:lower}
$\prob{L \leq k / \beta} < O(k) \exp(-\frac{k}{2} (\beta^{-1} - (1 - \ln{\beta})) )$
\end{enumerate}
\end{lemma}
The other observation needed to apply this lemma is that
$\elementsumapprox^{+1/2}$ from Fact \ref{fact:stretchclosedform}
can be replaced by any matrix whose product with its
transpose equals to $\elementsumapprox$.
As $\elementsumapprox = \matb^T \matb$,\
$\elementsumapprox^{+}
= \elementsumapprox^{+} \matb^T \matb \elementsumapprox^{+}
= (\matb \elementsumapprox^{+})^T \matb \elementsumapprox^{+}$.
Using this matrix in place of $\elementsumapprox^{+1/2}$ avoids
computing the $1/2$ power of $\elementsumapprox$.
Pseudocode of our estimation algorithm is shown in Algorithm
\ref{alg:approxstretch},
while the error analysis is nearly identical to the ones given in
Section 4 of \cite{SpielmanS08} and Section 3.2. of \cite{DrineasMMW11}.
\begin{algo}[ht]
\qquad
$\textsc{ApproxStr}(\mata, \matb, \beta, \delta)$
\vspace{0.05cm}
\underline{Input:}
Matrix $\mata$, approximation $\matb$ such that
$\matb^T \matb$ is a $\kappa$-stretch base for $\mata$,
value $\kappa$,
parameter $\beta$ indicating allowed estimation error.
Failure probability $\delta$.
\underline{Output:}
Upper bounds for stretches of rows of $\mata$
measured w.r.t. $\elementsumapprox$:
$\approxleverage_1 \ldots \approxleverage_n$.
\begin{algorithmic}
\STATE{Compute $\elementsumapprox = \matb^T \matb$}
\STATE{Compute $\elementsum^{+}$}
\STATE{Let $k = O(\log_{\beta} (1 / \delta))$}
\STATE{Let $\matu$ be a $k \times n$ matrix with
each entry is picked independently from $N(0, 1)$}
\STATE{Let $\approxleverage_i$ be $\frac{\beta}{k} ||\matu \mataapprox \elementsumapprox^{+} \veca_i^T||_2^2$.}
\RETURN{$\approxleveragev$}
\end{algorithmic}
\caption{Algorithm for Upper Bounding Stretch}
\label{alg:approxstretch}
\end{algo}
\begin{lemma}
\label{lem:approxstretchjl}
For each $i$, with probability at least $1 - \delta$ we have:
\begin{align*}
||\matu \mataapprox \elementsumapprox^{+} \veca_i^T||_2^2
\geq \frac{1}{\beta} \str{\elementsumapprox}{\veca_i}
\end{align*}
\end{lemma}
\Proof
We can rewrite $\elementsumapprox^{+}$ as
$\elementsumapprox^{+} \mataapprox^T \mataapprox \elementsumapprox^{+}$ to get:
\begin{align}
\leveragescore{\elementsumapprox}{\veca_i}
= & \veca_i \elementsumapprox^{+} \veca_i^T \nonumber \\
= & \veca_i \elementsumapprox^{+} \elementsumapprox
\elementsumapprox^{+} \veca_i^T \nonumber \\
= & \veca_i \elementsumapprox^{+} (\mataapprox^T \mataapprox)
\elementsumapprox^{+} \veca_i^T \nonumber \\
= & \veca_i \elementsumapprox^{+} \mataapprox^T
\mataapprox \elementsumapprox^{+} \veca_i^T \nonumber \\
= & ||\mataapprox \elementsumapprox^{+} \veca_i^T||_2^2
\end{align}
By Lemma \ref{lem:jl} Part \ref{part:lower} we have:
\begin{align}
& \Pr \left[\frac{1}{k} ||\matu \mataapprox \elementsumapprox^{+}\veca_i^T||_2^2 < \frac{1}{\beta} ||\mataapprox \elementsumapprox^{+}\veca_i^T||_2^2 \right] \nonumber \\
\leq & \exp\left(-\frac{k}{2} (\beta^{-1} - (1 - \ln{\beta})) \right)\nonumber \\
\leq & \exp\left(-\frac{k}{2} (\ln{\beta} - 1) \right) \nonumber\\
\leq & \exp\left(-\frac{k}{2} \frac{\ln{\beta}}{2} \right)
= \beta^{-\frac{k}{4}}
\end{align}
By a suitable choice of constants in $k = O(\log_{\beta}{(1/\delta)})$ this can
be made less than $\delta$.
\QED
Bounding the total of $\approxleverage_i$, as well as
the running time gives the following guarantees about
\textsc{ApproxStr}:
\begin{lemma}
\label{lem:approxstretch}
Let $\mata$ be a $n \times d$ matrix, and
$\matb$ an approximation with $\tilde{n}$ rows such that
$\elementsumapprox = \matb^T \matb$
is a $\kappa$-stretch base for $\mata$.
Then $\textsc{ApproxStr}(\mata, \matb, \beta, \delta)$ runs in
$O( (\nnz(A) + \nnz(\mataapprox) + d^{2} ) \log_{\beta}{(1 / \delta)}
+ (\tilde{n} + d) d^{\omega - 1} \log{d} \epsilon^{-2})$ time
returns upper bounds $\approxleverage_i$ such that:
\begin{enumerate}
\item \label{part:jlupper} For each $i$, with probability at least
$1 - \delta$ we have $\approxleverage_i \geq \leverage_i$
\item \label{part:jlsum} $||\approxleverage||_1 \leq O(\beta \kappa d \log{(1/\delta)})$ with
probability at least $1 - \delta$.
\end{enumerate}
\end{lemma}
\Proof
Lemma \ref{lem:approxstretchjl} gives
\begin{align*}
||\matu \mataapprox \elementsumapprox^{+} \veca_i^T||_2^2
\geq \frac{1}{\beta} \leveragescore{\elementsumapprox}{\veca_i}
\end{align*}
This and Part \ref{part:pointwise} of Definition \ref{def:lowstretch}
means scaling the estimates up by a factor of $\beta$ suffices
to give upper bounds of the leverage scores.
The upper bound on $\sum_{i} \approxleverage_i$ then can be obtained
similar to the proof of Lemma \ref{lem:approxstretchjl},
along with the bound on $\str{\elementsumapprox}{mata}$
given in Part \ref{part:upper} of Lemma \ref{lem:jl}.
Note that:
\begin{align}
\sum_{i} \approxleverage_i
= & \frac{\kappa \beta}{k} ||\matu \mataapprox \elementsumapprox^{+} \veca_i^T||_2^2 \nonumber \\
= & \frac{\kappa \beta}{k} ||\matu \mataapprox \elementsumapprox^{+} \mata^T||_F^2
\end{align}
Let $\vecy$ be the vector that's the row norms of
$\matb \elementsumapprox^{+} \mata$.
Note that
$||y||_2^2
= \sum_{i=1}^{n} ||\matb \elementsumapprox^{+} \veca_i^T||_2^2 \nonumber \\
= \str{\elementsumapprox}{\mata} \leq \kappa d$,
where the last inequality follows from
Part \ref{part:total} of Definition \ref{def:lowstretch}.
Part \ref{part:upper} of Lemma \ref{lem:jl} can be used to
bound $\frac{1}{k} ||\matu \vecy||_2^2$.
Note that when $t > 10$, $t - 1 - \ln{t} \geq t / 2$.
If $k$ is larger than some absolute constant, this gives:
\begin{align}
& \prob{\frac{1}{k} ||\matu \vecy||_2^2
> \beta \kappa d \geq \log(1/\delta) ||\vecy||_2^2} \nonumber \\
\leq & O \left( k \exp(-\frac{k}{2} \frac{\log(1/\delta)}{2} ) \right)
\leq \delta
\end{align}
It remains to bound the running time of $\textsc{LeverageUpper}$.
Finding $\elementsum$ takes $O(\tilde{n} d^{\omega - 1})$ time,
while inverting it takes an additional $d^{\omega}$ time.
Computing $\matu \mataapprox$ can be done in $O(\nnz(\mataapprox)k)$ time,
and multiplying it on the right by $\elementsum^{+}$ to
obtain $\matu \mataapprox \elementsumapprox^{+}$ takes $O(kd^2)$ time.
It remains to evaluate
$\matu \mataapprox \elementsumapprox^{+} \veca_i^T$
for each row $i$.
This can be done by summing $\nnz(\veca_i)$ length $k$ vectors,
giving a total of $\nnz(\mata) k$ over all $n$ vectors.
Therefore the total cost for computing the estimates is
$O(k(\nnz(\mata) + \nnz(\mataapprox) + d^2) + (\tilde{n} + d)d^{\omega - 1})$.
\QED
\section{Introduction}
\label{sec:intro}
Least squares and $\ell_p$ regression are among the most common
computational linear algebraic operations.
In the simplest form, given a matrix $\mata$ and a vector
$\vecb$, the regression problem aims to find $\vecx$ that
minimizes:
\begin{align*}
\nbr{\mata \vecx - \vecb}_p
\end{align*}
Where $\nbr{\cdot}_p$ denotes the $p$-norm of a vector,
aka.~$\nbr{\vecz}_p = (\sum_i |z_i|^p)^{1/p}$.
The case of $p = 2$ is equivalent to the problem of solving the positive
semi-definite linear system $\mata^T \mata$ \cite{Strang93},
and is one of the most extensively studied algorithmic question.
Over the past two decades, it was shown that $\ell_1$ regression
has good properties in recovering structural information \cite{Candez06Survey}.
These results make regression algorithms a key tool in data analysis,
machine learning, as well as a subroutine in other algorithms.
The ever growing sizes of data raises the natural question
of algorithmic efficiency of regression routines.
In the most general setting, the answer is far from satisfying with
the only general purpose tool being convex optimization.
When $\mata$ is $n \times d$, the state of the theoretical
runtime is about $O((n+d)^{3/2}d)$ \cite{Vaidya89}.
In fact, even in the $\ell_2$ case, the best general purpose
algorithm takes $O(nd^{\omega - 1})$ time where
$\omega \approx 2.3727$ \cite{Vassilevskawilliams12}.
Both of these bounds take more than quadratic time, and more
prohibitively quadratic space, making them unsuitable for modern data
where the number of non-zeros in $\mata$, $\nnz(\mata)$ is often
$10^9$ or more.
As a result, there has been significant interest in either first-order
methods with low per-step cost \cite{Nesterov07,ClarksonHW12},
or faster algorithms taking advantage of additional structures of $\mata$.
One case where significant runtime improvements are possible
is when $\mata$ is tall and thin, aka.~$n \gg d$.
They appear in applications involving many data points in a smaller
number of dimensions, or a few objects on which much data have
been collected.
These instances are sufficiently common that experimental speedups for
finding QR factorizations of such matrices have been studied in the
distributed~\cite{SongLHD10, AgulloCDHL10}
and MapReduce settings~\cite{ConstantineG11}.
Evidences for faster algorithms are perhaps more clear
in the $\ell_2$ setting, where finding $\vecx$ is equivalent to a
linear system solve involving the $d \times d$ matrix $\mata^T \mata$.
When $n \gg d$, the cost of inverting this matrix, $O(d^{\omega})$
is less than the cost of examining the non-zeros in $\mata$.
Faster algorithms for approximating $\mata^T \mata$ were first studied
in the setting of approximation matrix multiplication
~\cite{DrineasKM04a,DrineasKM04b,DrineasKM04c}.
Subsequent approaches were based on finding a shorter matrix
$\matb$ such that solving a regression problem on $\matb$
leads to a similar answer \cite{DrineasMM06,DasguptaDHKM09}.
The running time of these routines were also gradually reduced
\cite{Magdonismail10,DrineasMMW11,ClarksonDMMMW12},
leading to algorithms that run in input sparsity time\cite{ClarksonW12,MahoneyM12}.
These algorithms run in time proportional to the number of non-zeros
in $\mata$, $\nnz(\mata)$, plus a $\poly(d)$ term.
An approach common to these algorithms is that they aim
to reduce $\mata$ to $\poly(d)$ sized approximation
using a single transformation.
This transformation is performed in $O(\nnz(\mata))$ time, after which
the problem size only depends on $d$, giving the $\poly(d)$ term.
This is done by either obtaining high quality sampling probabilities
\cite{DrineasMMW11,ClarksonDMMMW12}, or by directly creating $\matb$
via. a randomized transform \cite{ClarksonW12,MahoneyM12,NelsonN12}.
These algorithms are appealing due to simplicity, speed, and that they can be
adapted naturally in the streaming setting.
On the other hand, experimental works have shown that practical
performances are often optimized by applying higher error variants
of these algorithms in an iterative fashion \cite{AvronMT10}.
In this paper, we design algorithms motivated by these practical adaptations
whose performances match or improve over the current best.
Our algorithms construct $\matb$ containing $\poly(d)$ rows of $\mata$
and run in $O(\nnz(\mata) + d^{\omega + \theta})$ time.
Here the last term is due to computing inverses and change of basis matrices,
and is a lower order term since regression routines involving $d \times d$
matrices take at least $d^{\omega}$ time.
In Table~\ref{table:tableall} we give a quick comparison of our results with
previous ones in the $\ell_2$ and $\ell_1$ settings can be found .
These two norms encompass most of the regression problems
solved in practice \cite{Candez06Survey}.
To simplify the comparison, we do not distinguish between
$\log{d}$ and $\log{n}$, and assume that $\mata$ has full column rank.
We will also omit the big-O notation along with factors of
$\epsilon$ and $\theta$.
\renewcommand{\arraystretch}{1.2}
\begin{table}[ht]
\begin{center}
\begin{tabular}{|l|c|c|c|c|}
\hline
&\multicolumn{2}{|c|}{\textbf{$\ell_2$}}
&\multicolumn{2}{|c|}{\textbf{$\ell_1$}}\\
\cline{2-5}
& Runtime & \# Rows
& Runtime & \# Rows\\
\hline
Dasgupta et al. \cite{DasguptaDHKM09}
& \multicolumn{2}{|c|}{-}
& $nd^5\log{d}$ & $d^{2.5}$\\
\hline
Magdon-Ismail \cite{Magdonismail10}
& $nd^{2} / \log{d}$ & $d\log^{2}d$
& \multicolumn{2}{|c|}{-} \\
\hline
Sohler \& Woodruff \cite{SohlerW11}
& \multicolumn{2}{|c|}{-}
& $n d^{\omega - 1 + \theta}$ & $d^{3.5}$\\
\hline
Drineals et al. \cite{DrineasMMW11}
& $nd\log{d}$ & $d\log{d}$
& \multicolumn{2}{|c|}{-} \\
\hline
Clarkson et al. \cite{ClarksonDMMMW12}
& \multicolumn{2}{|c|}{-}
& $nd\log{d}$ & $d^{4.5} \log^{1.5}{d}$\\
\hline
Clarkson \& Woodruff \cite{ClarksonW12}
& $\nnz(\mata)$ & $d^2\log{d}$
& $\nnz(\mata) + d^{7} $ & $d^{8} \poly(\log{d})$\\
\hline
Mahoney \& Meng \cite{MahoneyM12}
& $\nnz(\mata)$ & $d^2$
& $\nnz(\mata) \log{n} + d^{8}$ & $d^{3.5}$\\
\hline
Nelson \& Nguyen \cite{NelsonN12} & $\nnz(\mata)$ & $d^{1 + \theta}$
& \multicolumn{2}{|c|}{Similar to \cite{ClarksonW12}~and~\cite{MahoneyM12}}\\
\hline
\textbf{This paper}
& $\nnz(\mata) + d^{\omega + \theta}$ & $d \log{d}$
& $\nnz(\mata) + d^{\omega + \theta}$ & $d^{3.66}$\\
\hline
\end{tabular}
\caption{Comparison of runtime and size of $\matb$ for
$\ell_2$ and $\ell_1$, $\theta$ is any constant that's $> 0$}
\label{table:tableall}
\end{center}
\end{table}
As with previous results, our approaches and bounds for
$\ell_2$ and $\ell_p$ are fairly different.
We will state them in more details and give a more
detailed comparison with previous results in Section~\ref{sec:overview}.
The key idea that drives our algorithms is that a constant factor
reduction of problem size suffices for a linear time algorithm.
This is a much weaker requirement than reducing directly
to $\poly(d)$ sized instances, and allows us to reexamine
statistical projections with weaker guarantees.
In the $\ell_2$ setting, projections that do not
even preserve the column space of $\mata$ can still give good
enough sampling probabilities.
For the $\ell_p$ setting, estimating the probabilities
in the `wrong' norm (e.g.~$\ell_2$) still leads to significant reductions.
Most of the subroutines that we'll use have either
been used as the final error correction step
\cite{DasguptaDHKM09,ClarksonDMMMW12,ClarksonW12},
or are known in folklore.
However, by combining these tools with techniques originally developed
in graph sparsification and combinatorial preconditioning \cite{KoutisLP12},
we are able to convert them into much more powerful algorithms.
A consequence of the simplicity of the routines used is
that we obtain a smaller number of rows in $\matb$ in the $\ell_2$
setting, as well as a smaller running time in the $\ell_p$ setting.
We believe these reductions in the $\poly(d)$ term are crucial for
closing the gap between theory and practice of these algorithms.
\section{Properties and Estimation of Stretch and Leverage Scores}
\label{sec:leverageproofs}
\subsection{Properties of Generalized Stretch}
We now give proofs for estimating leverage scores and
row sampling that we stated in
Sections~\ref{sec:algo2}~and~\ref{sec:pnorm}.
\Proofof{Fact \ref{fact:leveragesum}}
\begin{align}
\sum_{i = 1}^n \str{\mata}{\veca_i}
& = \sum_{i = 1}^n \veca_i (\mata^T \mata)^{\dag} \veca_i^T \nonumber\\
& = \sum_{i = 1}^n \trace{(\mata^T \mata)^{\dag} \veca_i^T \veca_i} \nonumber\\
& = \trace{(\mata^T \mata)^{\dag } \sum_{i = 1}^n \veca_i^T \veca_i} \nonumber \\
& = \trace{(\mata^T \mata)^{\dag } \mata^T \mata} = r
\end{align}
\QED
\Proofof{Fact \ref{fact:stretchclosedform}}
Note that both stretch and the Frobenius norm acts
on the rows independently.
Therefore it suffices to prove this when $\mata'$ has a single row,
aka. $\mata' = \veca$.
In this case the cyclic property of trace gives:
\begin{align}
\str{\mata}{\veca}
& = \veca (\mata^T \mata)^{\dag } \veca^T \nonumber \\
& = \veca (\mata^T \mata)^{\dag 1/2} (\mata^T \mata)^{\dag 1/2} \veca^T \nonumber \\
& = \nbr{\mata^{\dag 1/2} \veca^T}_2^2
\end{align}
\QED
\Proofof{Lemma \ref{lem:referenceswitch}}
The condition given implies that the null spaces
of $\matb_1^T \matb_1$ and $\matb_2^T \matb_2$ are identical, giving:
\begin{align}
(\matb_1^T \matb_1)^{\dag}
\preceq (\matb_2^T \matb_2)^{\dag}
\preceq \kappa (\matb_1^T \matb_1)^{\dag}
\end{align}
Applying this to the vector $\vecx$ gives:
\begin{align}
\vecx (\matb_1^T \matb_1)^{\dag} \vecx^T
\leq & \vecx (\matb_2^T \matb_2)^{\dag} \vecx^T
\leq \kappa \vecx (\matb_1^T \matb_1)^{\dag} \vecx^T
\end{align}
\QED
\subsection{Estimation of Generalized Stretch}
Based on this fact, we can estimate these scores using
randomized projections in a way that's by now standard
\cite{SpielmanS08,DrineasMMW11}.
Pseudocode of our estimation algorithm is shown in Algorithm
\ref{alg:approxstretch},
while the error analysis is nearly identical to the ones given in
Section 4 of \cite{SpielmanS08} and Section 3.2. of \cite{DrineasMMW11}.
\begin{algo}[ht]
\qquad
$\textsc{ApproxStr}(\mata, \matb, \kappa, \projerror)$
\vspace{0.05cm}
\underline{Input:}
A $n\times d$ matrix $\mata$, approximation $m \times d$ matrix $\matb$ such that
$\frac{1}{\kappa} \mata^T \mata \preceq \matb^T \matb \preceq \mata^T \mata$,
parameter $\projerror \ge e^2$ indicating allowed estimation error.
\underline{Output:}
Upper bounds for stretches of rows of $\mata$
measured
$\approxleverage_1 \ldots \approxleverage_n$.
\begin{algorithmic}
\STATE{Compute $\matc = (\matb^T \matb)^\invsqr$}
\STATE{Let $k = O(\log_{\projerror} (1 / \delta))$}
\STATE{Let $\matu$ be a $k \times d$ matrix with
each entry is picked independently from $\Ncal(0, 1)$}
\STATE{Let $\approxleverage_i = \frac{\projerror}{d} \nbr{\matu \matc \veca_i^T}_2^2$.}
\RETURN{$\approxleveragev$}
\end{algorithmic}
\caption{Algorithm for Upper Bounding Stretch}
\label{alg:approxstretch}
\end{algo}
We remark that $(\matb^T \matb)^\invsqr$
can be replaced by any matrix whose product with its
transpose equals to $\matb^T \matb$.
nee candidate for this is $\matb (\matb^T \matb)^{\dag}$, and
using it would avoid computing the $1/2$ power of a matrix.
However, from a theoretical point of view both of these operations
take $O(m d^{\omega - 1})$ time, and we omit this extra step
for simplicity.
\Proofof{Lemma~\ref{lem:approxstretch}}
Since $\matb^T\matb \preceq \mata^T\mata$ by assumption,
then $\rbr{\mata^T\mata}^\dag \preceq \rbr{\matb^T\matb}^\dag$. Denote by $\tau'_i =
\str{\matb}{\veca_i} = \veca_i \rbr{\matb^T \matb}^\dag \veca_i^T$, note that $\tau_i =
\str{\mata}{\veca_i} = \veca_i \rbr{\mata^T \mata}^\dag \veca_i^T$, we have $\tau'_i \ge
\tau_i$. Next we show u $\tilde \tau_i \ge \tau'_i$ holds with large probability.
By Lemma \ref{lem:jl} Part \ref{part:lower} we have:
\begin{align*}
\Pr \sbr{\tilde \tau_i \le \tau'_i} &= \Pr \left[\frac{1}{k} \nbr{\matu \matc \veca_i^T}_2^2
\le \frac{1}{\projerror } \nbr{ \matc \veca_i^T}_2^2\right] \\
&\leq \exp\left(\frac{k}{2} (1 - \projerror^{-1} - \ln{\projerror})) \right) \\
&\leq \exp\left(-\frac{k}{2} \frac{\ln{\projerror}}{2} \right) \\
& = \projerror^{-\frac{k}{4}},
\end{align*}
where the last inequality is due to the assumption that $R \le e^2$.
By a suitable choice of constants in $k = O(\log_{\projerror}{nd^{c}})=O(\log_{\projerror}d)$
this can be made the above probability less than $n^{-1}d^{-c}$, taking a union bound over the $n$
rows gives Part~\ref{part:l2stretchupper}.
The upper bound on $\|\approxleveragev\|_1$ can be obtained
similarly. From Lemma~\ref{lem:referenceswitch}, we have $\tau'_i \le \kappa \tau_i$ holds
for all $i$. Then using Part \ref{part:upper} of Lemma \ref{lem:jl}:
\begin{align*}
\Pr \sbr{\tilde \tau_i \ge R^2 \tau'_i} &= \Pr \sbr{ \frac{1}{k} \nbr{\matu \matc \veca_i^T}_2^2
\ge {\projerror} \nbr{\matc \veca_i^T}_2^2} \\
&\leq \exp\left(\frac{k}{2} (1 - \projerror + \ln{\projerror}) \right) \\
&\leq \exp\left(-\frac{k}{2} \ln{\projerror} \right) \\
& = \projerror^{-\frac{k}{2}},
\end{align*}
the last inequality is due to the fact that $R - 2\ln R$ increases w.r.t.~$R$ and $R-2\ln
R \ge 1$ holds when $R=e^2$. The above probability will be less than $n^{-1}d^{-c}$ if
choosing the same constants $k$ as before. Then $\| \approxleveragev\|_1 \le R^2 \| \leveragev' \|_1$
holds with probability at least $1-d^{-c}$. Together with $\| \leveragev' \|_1 \le \kappa \|
\leveragev \|_1$, then we obtain the upper bound of $\| \approxleveragev\|_1$.
It remains to bound the running time of $\textsc{LeverageUpper}$.
Finding $\matb^T\matb$ takes $O(n_b d^{\omega - 1})$ time,
while inverting it takes an additional $d^{\omega}$ time.
Computing $\matu \matc$ can be done in $O(kd^2)$ time,
and it It remains to evaluate $\matu \matc \veca_i^T$
for all rows $i$.
This can be done by summing $\nnz(\veca_i)$ length $k$ vectors,
giving a total of $\nnz(\mata) k$ over all $n$ vectors.
Therefore the total cost for computing the estimates is
$O(k(\nnz(\mata) + d^2) + (n_b + d)d^{\omega - 1})$.
\QED
\subsection{Estimation of $p$-Norm Leverage Scores}
We will estimate the values of $\nbr{\matu_{i*}}_p$ using similar
dimensionality reduction theorems.
Specifically, we utilize a result on $p$-stable distributions first
shown by Indyk \cite{Indyk06}.
\begin{lemma}
\label{lem:pstable}
(Theorem 4 of \cite{Indyk06})
For any $p \in (0, 2)$, any $c$ and any error factor $R$, there exist a
$d \times O(\log_{R} d)$ matrix $\Pi$ such that for any vector
$\vecz \in \Re^{d}$, we can obtain estimates $\approxleverage_i$
such that with probability $1 - d^{-c}$:
\begin{align*}
\frac{1}{R} \nbr{\vecz}_p \leq \approxleverage_i \leq R \approxleverage_i
\end{align*}
\end{lemma}
Note that the result from \cite{Indyk06} was only stated in terms of obtaining
$1 \pm \epsilon$ approximations, which leads to a factor of $\log{d}$
on the leading term.
However, these bounds can be obtained analogously by the fact
that $p$-stable distributions have bounded derivative.
We can now apply this projection matrix to $\mata \matc$ and
examine the rows of $\mata \matc \Pi^T$, which can in turn be
computed in $O(\nnz(\mata) \log_{R}d)$ time.
We can no longer use these projections when $p \geq 2$.
As a result, we will instead use the $L_2$ norm as an estimate
and apply the random projection given in Lemma~\ref{lem:jl}.
Fact~\ref{fact:holdersimple} gives that this leads to an extra
distortion by a factor of $O(d^{(|\frac{1}{2} - \frac{1}{p}|)p}) = O(d^{\frac{p}{2} - 1})$.
This distortion can be accounted for in the number of rows returned.
Pseudocode of this estimation and sampling routine is given in
Algorithm~\ref{alg:estimatesamplelp}
\begin{algo}[ht]
\qquad
$\textsc{EstimateAndSampleP}(\mata, \matc, \alpha, \beta, p, \epsilon)$
\vspace{0.05cm}
\underline{Input:}
$n \times d$ matrix $\mata$,
$\matc$ such that $\mata \matc$ is a $(\alpha, \beta, p)$
well-conditioned basis for $\mata$
projection error $R$, and output error $\epsilon$
\underline{Output:}
Matrix $\matb$
\begin{algorithmic}[1]
\STATE{Compute projection matrix $\Pi \in \Re^{O(\log_{R}{d}) \times d}$}
\STATE{Compute $d \times d_1$ matrix $\matc \Pi^T$}
\STATE{Compute estimates of $\approxleveragep_i$
from the rows of $\mata (\matc \Pi^T)$}
\STATE{Compute probabilities $p_i = O\left(R^{2p} (\alpha \beta)^{p} \frac{\approxleveragep_i}{\sum_{i} \approxleveragep_i}\right)$}
\RETURN{$\textsc{Sample}(\mata, p, \epsilon)$}
\end{algorithmic}
\caption{Leverage Estimation and Sampling Routine for $p$-norm}
\label{alg:estimatesamplelp}
\end{algo}
\Proofof{Lemma~\ref{lem:estimateandsamplelp}}
Applying a union bound over the $n = \poly(d)$ rows of $\mata$
gives that with probability at least $1 - d^{-c - 1}$, we have:
\begin{align*}
\nbr{\mata \matc_{i*}}_p^p \leq R^{p} \approxleveragep_i\\
\approxleveragep_i \leq R^{p} \nbr{\mata \matc_{i*}}_p^p
\end{align*}
Therefore we have:
\begin{align*}
R^{2p} \frac{\approxleveragep_i}{\sum_{i} \approxleveragep_i}
\geq & \frac{\nbr{\mata \matc}_p^p}{\sum_{i} \approxleverage_i}
\geq \frac{\nbr{\mata \matc}_p^p}{\sum_{i} \nbr{\mata \matc_{i*}}_p^p}
\end{align*}
The guarantees on the output then follows from computing
Lemma~\ref{lem:samplelp}, while the total running time follows
from the cost of evaluating $\mata (\matc \Pi^T)$.
\QED
\section{Overview}
\label{sec:overview}
We start by formalizing the requirements needed for $\matb$ to be a
good approximation to $\mata$.
In the $\ell_2$ setting it is similar to $\matb^T \matb$ being an approximation
to $\mata^T\mata$, but looking for $\matb$ instead of $\matb^T \matb$ has
the advantage of being extendible to $\ell_p$ norms \cite{DasguptaDHKM09}.
The requirement for $\matb$ is:
\begin{align*}
(1 - \epsilon) \|\mata \vecx\|_p
\leq \|\matb \vecx\|_p
\leq (1 + \epsilon) \|\mata \vecx\|_p,
\qquad \forall \vecx \in \Re^{d}
\end{align*}
Finding such a $\matb$ is equivalent to reducing the size of a
regression problem involving $\mata$ since:
\begin{align*}
\min_{\vecx} \|\mata \vecx - \vecb\|_p
= \min_{\vecx} \nbr{[\mata, \vecb]
\begin{bmatrix}
\vecx \\ -1
\end{bmatrix}}_p
\end{align*}
This means finding a shorter $(1 \pm \epsilon)$ approximation to the
$n \times (d + 1)$ matrix $[\mata, \vecb]$, and solving a regression
problem on this approximation gives a solution within
$1 + O(\epsilon)$ of the minimum.
Row sampling is one of the first studied approaches for finding
such $\matb$ \cite{DrineasMM06,Magdonismail10,DasguptaDHKM09}.
It aims to build $\matb$ consisting of a set of rescaled
rows of $\mata$ chosen according to some distribution.
While it appears to be a even more restrictive way of generating $\matb$,
it nevertheless leads to a row count within a factor of $\log{d}$ of the
best known bounds~\cite{BatsonSS09,BoutsidisDM11}.
In $\ell_2$, there exists a distribution that produces with high probability
a good approximation $\matb$ with $O(d \log{d})$ rows
~\cite{AhlswedeW02,RudelsonV07,VershyninNotes,Harvey11notes};
while under $\ell_p$ norm, $\poly(d)$ rows is also known~\cite{DasguptaDHKM09}.
It was first shown that row sampling can speed up $\ell_2$
this can be viewed as a small subset that preserves most of the structure.
These smaller equivalents have been studied as
coresets under a variety of objectives~\cite{BadoiuHP02,AgarwalHV05}.
However, various properties of the $\ell_p$ norm, especially
in the case of $p = 2$, makes row sampling a more specialized instance.
The main framework of our algorithm is iterative in nature and relies on
the two-way connection between row sampling and estimation
of sampling probabilities.
A crude approximation to $\mata$, $\mata'$ allows us to compute equally
crude approximations of sampling probabilities, while such probabilities
in turn lead to higher quality approximations.
The computation of these sampling probabilities can in turn be sped up
using a high quality approximation of $\mata'$.
Our algorithm is based on observing that as long as $\mata'$ has smaller
size, we have made enough progress for an iterative algorithm.
A single step in this algorithm consists of computing a small but crude
approximation $\mata'$, finding a higher quality approximation to $\mata'$,
and using this approximation to find estimates of sampling probabilities
of the rows of $\mata$.
This leads to a tail-recursive process that can also be viewed as an iterative
one where the calls generate a sequence of gradually shrinking matrices,
and sampling probabilities are propagated back up the sequence.
An example of such a sequence is given in Figure \ref{fig:flowchart}.
\begin{figure}[t!]
\begin{center}
\begin{tikzpicture}[x=1cm, y=1cm]
\usetikzlibrary{arrows,positioning}
\tikzset{
roundrect/.style={
rectangle,
rounded corners,
draw=black,
text width=25,
minimum height = 0.6,
text centered},
roundrectwide/.style={
rectangle,
rounded corners,
draw=black,
text width=50,
minimum height = 0.6,
text centered},
approxstretch/.style={
draw=black,
text width=10,
minimum height = 0.6,
text centered},
blank/.style={
text width=10},
arrow/.style={
->,
thick,
shorten <=2pt,
shorten >=2pt,},
empty/.style={white}
}
\draw node[roundrectwide](aa){$\mata = \mata(0)$};
\draw node[roundrect, right=0.5 of aa](ab){$\mata(1)$};
\draw node[blank, right = 0.3 of ab](amid) {$\ldots$};
\draw node[roundrectwide, right = 0.3 of amid](ay){$\mata(L - 1)$};
\draw node[roundrect, right=0.5 of ay](az) {$\mata(L)$};
\draw (aa) edge[arrow] (ab);
\draw (ab) edge[arrow] (amid);
\draw (amid) edge[arrow] (ay);
\draw (ay) edge[arrow] (az);
\draw node[roundrectwide, below=0.5 of aa](ba) {$\matb = \matb(0)$};
\draw node[roundrect, below=0.5 of ab](bb) {$\matb(1)$};
\draw node[blank, below = 0.5 of amid](bmid){$\ldots$};
\draw node[roundrectwide, below = 0.5 of ay](by) {$\matb(L - 1)$};
\draw node[roundrect, below=0.5 of az](bz) {$\matb(L)$};
\draw node[blank, below=0.5 of bb](dummyb) {};
\draw node[blank, below=0.5 of by](dummyy) {};
\draw node[blank, below=0.5 of bz](dummyz) {};
\draw node[roundrect, left=0.1 of dummyz](lz) {$p(L)$};
\draw node[blank, right= 0.3 of dummyb](lmidl){$\ldots$};
\draw node[blank, left=0.1 of dummyy](lmidr) {$\ldots$};
\draw node[roundrect, left=0.1 of dummyb](lb) {$p(1)$};
\draw (aa) edge[empty] node[rotate=90,black] {$\approx$}(ba);
\draw (ab) edge[empty] node[rotate=90,black] {$\approx$}(bb);
\draw (ay) edge[empty] node[rotate=90,black] {$\approx$}(by);
\draw (az) edge[empty] node[rotate=90,black] {$=$}(bz);
\draw (bz) edge[arrow] (lz);
\draw (by) edge[arrow] (lmidr);
\draw (bb) edge[arrow](lb);
\draw (lz) edge[arrow] (by);
\draw (lmidl) edge[arrow] (bb);
\draw (lb) edge[arrow] (ba);
\end{tikzpicture}
\end{center}
\caption{Main workflow of our algorithms when viewed as an
iterative process.
Sequence of gradually smaller matrices generated are on top,
and the computed sampling probabilities and resulting
approximations are below.}
\label{fig:flowchart}
\end{figure}
We will term the creation of the coarse approximation as reduction,
and the computation of the more accurate approximation based on it
recovery.
As in the figure, we will label the matrices $\mata$ that we generate,
as well as their approximations using the indices $(l)$.
\begin{itemize}
\item reduction: creates a smaller version of $\mata(l)$,
$\mata(l + 1)$ with fewer rows either by a projection or a coarser row
sampling process. Equilvaent to moving rightwards in the diagram.
\item recovery: finds a small, high quality approximation
of $\mata(l)$, $\matb(l)$ using information obtained from $\mata(l)$, $\mata(l + 1)$,
and $\matb(l + 1)$.
This is done by estimating leverage scores $\vecp(l)$ and is equivalent
to moving leftwards in the diagram.
\end{itemize}
Both our $\ell_2$ and $\ell_p$ algorithms can be
viewed as giving reduction and recovery routines.
In the $\ell_2$ setting our reduction step consists of a simple
random projection, which incurs a fairly large distortion and may not
even preserve the null space.
Our key technical components in Section~\ref{sec:algo2} show
that one-sided bounds on these projections are sufficient for recovery.
This allows us to set the difference incurred by the reduction to
$\kappa = d^{\theta}$ for a arbitrarily small $\theta > 0$,
while obtaining a reduction factor of $\kappa^{O(1)} = d^{O(\theta)}$.
This error is absorbed by the sampling process, and does not
accumulate across the iterations.
\begin{theorem}
\label{thm:rowsamplel2}
Given a $n \times d$ matrix $\mata$ along with failure probability
$\delta = d^{-c}$ and allowed error $\epsilon$.
For any constant $\theta > 0$,
we can find in $O( \nnz(A) + d^{\omega + \theta} \epsilon^{-2})$ time,
with probability at least $1 - \delta$, a matrix $\matb$ consisting of
$O(d\log{d}\epsilon^{-2})$ rescaled rows of $\mata$ such that
$$(1-\epsilon)\|\mata \vecx\|_2 \le \|\matb \vecx\|_2 \le (1+\epsilon) \|\mata \vecx\|_2$$
for all vectors $\vecx \in \Re^{d}$.
\end{theorem}
This bound improves the $O(d^2)$ rows obtained in the first results
with input-sparsity runtime \cite{ClarksonW12}, and matches
the best bound known using oblivious projections \cite{NelsonN12},
which was obtained concurrently.
A closer comparison with \cite{NelsonN12} shows that
our bounds does not have a factor of $\epsilon^{-1}$ on the leading term
$\nnz(\mata)$, but has worse dependencies on $\theta$.
For $\ell_p$ norms, we show that significant size
reductions can be made if we perform row sampling using sampling
probabilities obtained in a different norm.
Specifically, if $\mata(i)$ has $n(i)$ rows, $\mata(i + 1)$ has
$O(n(i)^{c_p} \poly(d))$ where $c_p < 1$ if the intermediate
norm $\ell_{p'}$ is chosen appropriately.
This means the number of rows will reduce doubly exponentially
as we iterative, and quickly becomes $O(\poly(d))$.
This allows us to invoke our algorithms from Section~\ref{sec:algo2} ,
as well as $\ell_p'$ approximations under different norms to compute
these probabilities.
The analysis is also more direct as such samples have stronger
guarantees than randomized projections,
We can set $\kappa$ to a constant, and recover an
approximation to $\mata$ after each iteration instead of going
gradually back up the sequence of matrices.
Our projection and recovery methods are similar to the ones
used to for increasing the accuracy of $\ell_1$ row sampling
in \cite{ClarksonDMMMW12}.
However, to our knowledge, our result is the first that uses
$\ell_2$ row sampling as the primary routine.
This leads to the first algorithms for $p \neq 1, 2$ that do
not use ellipsoidal rounding.
In Section~\ref{subsec:oneshot} we present a one step variant
that computes sampling probabilities under the $\ell_2$ norm.
It gives $\matb$ with about $d^{\frac{4}{p}}$ rows when $p \leq 2$
and $d^{\frac{3p - 2}{4 - p}}$ rows when $2 \leq d < 4$.
We can further iterate upon this algorithm, and compute sampling
probabilities under $\ell_{p'}$ norm for some $p'$ between $2$ and $p$.
A two-level version of this algorithm for $\ell_1$ is analyzed
in Section~\ref{subsec:again}, giving the following:
\begin{theorem}
\label{thm:rowsamplel1}
Given a $n \times d$ matrix $\mata$ along with failure probability
$d^{-c}$ and allowed error $\epsilon$.
For any constant $\theta > 0$,
we can find in $O( \nnz(A) + d^{\omega + \theta} \epsilon^{-2})$ time,
with probability at least $1 - d^{-c}$, a matrix $\matb$ consisting of
$O(d^{4\sqrt{2} - 2 + \theta})$ rescaled rows of $\mata$ such that
$$(1-\epsilon)\nbr{\mata \vecx}_1 \le \nbr{\matb \vecx}_1
\leq (1+ \epsilon) \nbr{\mata \vecx}_1$$
for all vectors $\vecx \in \Re^d$.
\end{theorem}
This method readily leads to $\matb$ with $\poly(d)$ rows when $p \ge 4$,
and fewer rows than the above bound when $1 \le p < 4$.
However, such extensions are limited by the discontinuity between
bounds on the sampling process in the $\ell_2$
~\cite{AhlswedeW02,RudelsonV07,VershyninNotes,Harvey11notes}
and $\ell_p$ settings~\cite{DasguptaDHKM09}.
As a result, we only show the algorithm for $\ell_1$
in order to simplify the presentation.
An additional strength of our approach is that the randomized routines
used hold with high probability.
Most of the earlier results that run in time nearly-linear in the size of
$\mata$ have a constant success probability instead, and will require
boosting to improve this probability.
Also, as our algorithm is row sampling based, each row in our output
is a scaled copy of some row of the original matrix.
This means specialized structure for rows of $\mata$ are likely to be
preserved in the smaller regression problem instance.
Our results also show a much tighter connection between $\ell_2$
and $\ell_p$ row sampling, namely that finding good $\ell_2$
approximations alone is sufficient for iterative reductions in matrix size.
The main drawback of our algorithm in the $\ell_2$ setting
is that it does not immediately extend to computing low-rank approximations.
The method given in \cite{ClarksonW12} relies crucially on
first transform being oblivious, although our algorithm can
be incorporated in a limited way as the second step.
Also, our algorithms for $\ell_p$ row-sampling in Section~\ref{sec:pnorm}
invokes concentration bounds from~\cite{DasguptaDHKM09} in a
black-box manner, even though our sampling probabilities obtained
by scaling up probabilities related to $\ell_2$.
We believe investigating the possibilities of extending our approaches to
low-rank approximations and obtaining tighter concentration are natural
directions for future work.
\section{Algorithm for Preserving $\ell_p$-norm}
\label{sec:pnorm}
We now turn to the more general problem of finding $\matb$
with $\poly(d)$ rows such that:
\begin{align*}
(1 - \epsilon) \nbr{\mata \vecx}_p
\leq \nbr{\matb \vecx}_p
\leq (1 + \epsilon) \nbr{\mata \vecx}_p
\qquad \forall \vecx \in \Re^{d}
\end{align*}
We will make repeated use of the following (tight) inequality
between $\ell_2$ and $\ell_p$ norms, which can be obtained
by direct applications of power-mean and H\"{o}lder's inequalities.
\begin{fact}
\label{fact:holdersimple}
Let $\vecx$ be any vector in $\Re^{d}$, and $p$ and $q$
any two norms where $1 \leq p \leq q$, we have:
\begin{align*}
\nbr{\vecx}_q \le \nbr{\vecx}_p
& \le d^{\frac{1}{q}-\frac{1}{p}}\nbr{\vecx}_q
\end{align*}
\end{fact}
We will use this Fact with one of $p$ or $q$ being $2$,
in which case it gives:
\begin{itemize}
\item If $1 \leq p \leq 2$, $\nbr{\vecx}_2 \le \nbr{\vecx}_p \le d^{\frac{1}{2}-\frac{1}{p}}\nbr{\vecx}_2$
\item If $2 \leq p$, $d^{\frac{1}{p} - \frac{1}{2}} \nbr{\vecx}_2 \le \nbr{\vecx}_p \le \nbr{\vecx}_2$
\end{itemize}
As $\mata \vecx \in \Re^{n}$, its $\ell_2$ and $\ell_p$ norms can differ
by a factor of $\poly(n)$.
This means the $\ell_2$ row sampling algorithm from
Section~\ref{sec:algo2} can lead to $\poly(n)$ distortion.
Our algorithm in this section can be viewed as a way to reduce
this distortion via. a series of iterative steps.
Once again, our algorithm is built around a sampling concentration bound.
The sampling probabilities are based on the definition of a well-conditioned
basis, which is more flexible than $\ell_2$ statistical leverage scores.
\begin{definition}
\label{def:wellcondbasis}
Let $\mata$ be an $n \times d$ matrix of rank $r$, $p \in [1, \infty]$ and
$q$ be its dual norm such that $\frac{1}{p} + \frac{1}{q} = 1$.
Then an $n \times r$ matrix $\matu$ is an $(\alpha, \beta, p)$-well-conditioned
basis for the column space of $\mata$ if the columns of $\matu$ span the
column space of $\mata$ and:
\begin{enumerate}
\item $\vertiii{\matu}_p \leq \alpha$.
\item For all $\vecx \in \Re^{r}$, $\nbr{\vecx}_q
\leq \beta \nbr{\matu \vecx}_p$.
\end{enumerate}
\end{definition}
A $\ell_p$ analog of the sampling concentration result given in
Lemma \ref{lem:samplel2} was shown in \cite{DasguptaDHKM09}.
It can be viewed a generalization of Lemma~\ref{lem:samplel2}.
\begin{lemma}
\label{lem:samplelp}
(Theorem 6 of \cite{DasguptaDHKM09})
Let $\mata$ be a $n \times d$ matrix with rank $r$,
$\epsilon \leq 1/7$, and let $p \in [1, \infty)$.
Let $\matu$ be an $(\alpha, \beta, p)$-well-conditioned basis for $\mata$.
Then for any sampling probabilities $\vecp \in \Re^{n}$ such that:
\begin{align*}
p_i & \geq c_p (\alpha \beta)^{p} \frac{\nbr{\matu_{i*}}^p_p}{\vertiii{\matu}^p_p},
\end{align*}
where $\matu_{i*}$ is the $i$-th row of $\matu$ and $c_p$ is a constant depending only on
$p$. Then with probability at least $1 - d^{-c}$,
$\textsc{Sample}(\mata, p, \epsilon)$ returns $\matb$ satisfying
\begin{align*}
(1-\epsilon) \nbr{\mata \vecx}_p \le \nbr{\matb \vecx}_p \leq (1+\epsilon) \nbr{\mata \vecx}_p
\qquad \forall \vecx \in \Re^{d}
\end{align*}
\end{lemma}
We omitted the reductions of probabilities that are more than $1$ since
this step is included in our formulation of \textsc{Sample}.
Several additional steps are needed to turn this into an
algorithmic routine, the first being computing $\matu$.
A na\"{i}ve approach for this requires matrix multiplication, and the
size of the outcome may be more than $\nnz(\mata)$.
Alternatively, we can find a linear transform used to create it,
aka. a matrix $\matc$ such that $\matu = \mata \matc$.
The estimation of $\nbr{(\mata \matq)_{i*}}_p^p$ and sampling
can then be done in a way similar to Section~\ref{sec:algo2}.
When $1 \leq p \leq 2$, we can compute $O(1)$ approximations
using $p$-stable distributions \cite{Indyk06} in a way analogous
to Section 4.2.1. of Clarkson et al. \cite{ClarksonDMMMW12}.
When $2 \leq p$, we will use the $2$-norm as a surrogate at
the cost of more rows.
As all of our calls to \textsc{Sample} will be using probabilities
estimated via. the same matrix, we will the estimation
of $p$-norm leverage scores and sampling as a single blackbox.
\begin{lemma}
\label{lem:estimateandsamplelp}
For any constant $c$, there exist an algorithm
$\textsc{EstimateAndSampleP}(\mata, \matc, \alpha, \beta, R, \epsilon)$
that given a $\mata$, $\matc$ such that $\mata \matc$ is a
$(\alpha, \beta, p)$-well-conditioned basis for $\mata$,
returns a matrix $\matb$ with probability at least $1 - d^{-c}$ such
that:
\begin{equation*}
(1-\epsilon) \|\mata \vecx\|_p \le \|\matb \vecx\|_p \le (1+\epsilon) \|\mata \vecx\|_p
\end{equation*}
in $O(\nnz(\mata) \log_{R}(d) + R d^{\omega} \log{d})$ time and
the number of rows in $\matb$ can be bounded by:
\begin{equation*}
\begin{cases}
O((\alpha \beta R)^{p} d \log(d) \epsilon^{-2}) & \textrm{if }1 \leq p \leq 2 \\
O((\alpha \beta R)^{p} d^{\frac{p}{2}} \log(d) \epsilon^{-2}) & \textrm{if }2 \leq p
\end{cases}
\end{equation*}
\end{lemma}
\subsection{Sampling Using $\ell_2$-leverage scores}
\label{subsec:oneshot}
Our starting point is the observation that a good basis for $\ell_2$,
specifically a nearly orthonormal basis of $\mata$
still allows us to reduce number of rows substantially under $\ell_p$.
\begin{lemma}
\label{lem:simplebasis}
If $\matc \in \Re^{d \times r}$ satisfies
$\frac{1}{2} (\mata^T \mata)^{\dag}
\preceq \matc \matc^T \preceq \frac{3}{2} (\mata^T \mata)^{\dag} $
then $\matu = \mata \matc$ is a $(\alpha, \beta, p)$-well-conditioned basis
for $\mata$ where
$\alpha \beta \leq O(n^{|\frac{1}{2} - \frac{1}{p}|} d^{|\frac{1}{2} - \frac{1}{p}| + \frac{1}{2}} )$.
\end{lemma}
\Proof
We start by show that $\matu^T \matu$ is close to the identity matrix
as an operator.
Also, since $\matc^T \matc$ is a full rank matrix and
$\matc^T (\matc \matc^T)^{\dag} \matc$ is a projection operator
onto the column space of $\matc$, we have
$\matc^T (\matc \matc^T)^{\dag} \matc = \mati.$
Taking pseudoinverses of the given condition on $\matc$ gives:
\begin{align*}
\frac{2}{3} (\matc \matc^T)^{\dag}
& \preceq \mata^T \mata \preceq 2 (\matc \matc^T)^{\dag}
\end{align*}
Substituting it into $\matu = \mata \matc$ then gives:
\begin{align*}
\matu^T \matu
= \matc^T \mata^T \mata \matc
\preceq 2\matc^T (\matc \matc^T)^{\dag} \matc
= 2\mati
\end{align*}
and
\begin{align*}
\frac{2}{3}\mati \preceq \frac{2}{3}\matc^T (\matc \matc^T)^{\dag} \matc \preceq
\matu^T \matu
\end{align*}
This allows us to infer that $\vertiii{\matu}_2 \leq \sqrt{2d}$,
and for any vector $\vecx$, $\nbr{\vecx }_2 \leq \sqrt 2 \nbr{\matu \vecx}_2$.
Next we find values of $\alpha$ and $\beta$ that meet the
requirements of a well-conditioned basis given in
Definition~\ref{def:wellcondbasis}. Let $q$ be the dual norm for $p$ which
satisfies $\frac{1}{p}+\frac{1}{q}=1$.
First consider the case where $1 \leq p \leq 2$.
We can view all entries of the matrix $\matu$ as a vector
of length $nr \leq nd$ vector.
Apply Fact \ref{fact:holdersimple} gives:
\begin{align*}
\vertiii{\matu}_p
& \le (nd)^{\frac{1}{p}-\frac{1}{2}}\vertiii{\matu}_2
\end{align*}
Which gives $\vertiii{\matu}_2 \le \sqrt{2} d^{\frac{1}{2}}$ and therefore
$\alpha = \sqrt{2} (nd)^{\frac{1}{p}-\frac{1}{2}}d^{\frac{1}{2}}$.
For the second part, given any vector $\vecx$, we have
\begin{align*}
\nbr{\vecx}_q
& \leq \nbr{\vecx}_2
&& \text{(by Fact~\ref{fact:holdersimple} on $\vecx$ since $q \leq 2$)}\\
& \leq \sqrt 2\nbr{\matu \vecx}_2\\
& \leq \sqrt 2\nbr{\matu \vecx}_p
&& \text{(by Fact~\ref{fact:holdersimple} on $\matu \vecx$ since $1 \leq p \leq 2$)}\\
\end{align*}
which means $\beta = \sqrt 2$ suffices.
Now we consider the case where $p \geq 2$ similarly.
\begin{align*}
\vertiii{\matu}_p \le \vertiii{\matu}_2 \le \sqrt{2} d^{1/2}
\end{align*}
and:
\begin{align*}
\nbr{\vecx}_q
& \le d^{\frac{1}{q}-\frac{1}{2}}\nbr{\vecx}_2
&& \text{(by Fact~\ref{fact:holdersimple} on $\vecx$ since $q \leq 2$)}\\
&= d^{\frac{1}{2} - \frac{1}{p}}\nbr{\vecx}_2
&& \text{(since $\frac{1}{q} = 1 - \frac{1}{p}$)}\\
& \leq \sqrt 2 d^{\frac{1}{2}-\frac{1}{p}}\nbr{\matu \vecx}_2\\
& \le \sqrt 2 d^{\frac{1}{q}-\frac{1}{2}}n^{\frac{1}{2}-\frac{1}{p}}\nbr{\matu \vecx}_p
&& \text{(by Fact~\ref{fact:holdersimple} on $\matu \vecx$ with $2 \leq p$)}\\
& = \sqrt 2 (nd)^{\frac{1}{2}-\frac{1}{p}}\nbr{\matu \vecx}_p\
\end{align*}
Combining the bounds from these two cases on $p$ gives that
$U$ is a $(\alpha,\beta,p)-$well-conditioned basis, where
\begin{equation*}
\alpha =
\begin{cases}
\sqrt{2} d^{\frac{1}{2}} & \textrm{for } p \ge 2\\
\sqrt{2} (nd)^{\frac{1}{p}-\frac{1}{2}}d^{\frac{1}{2}} & \textrm{otherwise }
\end{cases}
\quad \textrm{and} \quad
\beta =
\begin{cases}
\sqrt 2 (nd)^{\frac{1}{2}-\frac{1}{p}} & \textrm{for } p \ge 2\\
\sqrt 2 & \textrm{otherwise}
\end{cases}
\end{equation*}
It can be checked that in both cases the stated bound on
$\alpha \beta$ holds.
\QED
One way to generate such a nearly-orthonormal basis is by the
$L_2$ approximation that we computed in Section~\ref{sec:algo2}.
This leads to a fast algorithm, but the dependency on $n$ in this
bound precludes a single application of sampling using the values given because each time
we transfer $n$ rows into $O(p|\frac{1}{2}-\frac{1}{p}|)$ rows.
However, note that when $p < 4$,
$p |\frac{1}{2} - \frac{1}{p}| = |1 - \frac{p}{2}| < 1$.
This means it can be used as a reduction step in an iterative algorithm
where the number of rows will decrease geometrically.
Therefore, we can use this process as a reduction routine.
For inductive purposes, we will also state the routine to compute
the basis via. an approximation of $\mata$, $\mataapprox$.
Pseudocode of our reduction algorithm is given in Algorithm~\ref{alg:reductionlp}.
\begin{algo}[ht]
\qquad
$\textsc{ReduceP}(\mata, \mataapprox, \epsilon)$
\vspace{0.05cm}
\underline{Input:}
$n \times d$ matrix $\mata$ and its approximated
matrix $\mataapprox$, $p$-norm and error parameter $\epsilon$
\underline{Output:}
Matrix $\matb$
\begin{algorithmic}[1]
\STATE{$\matashort \gets \textsc{RowCombine}(\mataapprox, p, 1/3, d^{-c - 1})$}
\STATE{Perform SVD on $\matashort^T \matashort$ and then construct $\matc$ by dropping
the zero singular values and corresponding singular vectors such that $\matc^T\matc = (\matashort^T \matashort)^{\dag}$ }
\IF{$1 \leq p \leq 2$}
\STATE{$\alpha \leftarrow \sqrt{2} (nd)^{\frac{1}{p}-\frac{1}{2}}d^{\frac{1}{2}}$,
$\beta \leftarrow \sqrt{2}$}
\ELSE
\STATE{$\alpha \leftarrow \sqrt{2} d^{\frac{1}{2}}$,
$\beta \leftarrow \sqrt 2 (nd)^{\frac{1}{2}-\frac{1}{p}}$}
\ENDIF
\STATE{$\matb \leftarrow \textsc{EstimeAndSampleP}(\mata, \matc, 2 \alpha, 2 \beta, p, d^{\frac{\theta}{2p}}, \epsilon)$}
\RETURN{$\matb$}
\end{algorithmic}
\caption{Reduction Step for Preserving $\ell_p$ Norm}
\label{alg:reductionlp}
\end{algo}
\begin{lemma}
\label{lem:reductionlp}
For any constant $c$, there exist a setting of constants
in $\textsc{ReduceP}$ such that if $\mata$ and $\mataapprox$ satisfy
\begin{equation*}
\frac{1}{2} \nbr{\mata \vecx}_p \le \nbr{\mataapprox \vecx}_p
\leq \frac{3}{2} \nbr{\mata \vecx}_p \qquad \forall \vecx \in \Re^{d}
\end{equation*}
and $\mataapprox$ has $\tilde{n}$ rows, then
$\textsc{ReduceP}(\mata, \mataapprox, \epsilon)$
returns in $O(\nnz(\mata) \log{d+\theta} + d^{\omega+\theta} \log{d})$ time
a matrix $\matb$ such that with probability at least $1 - d^{-c}$:
\begin{equation*}
(1-\epsilon) \nbr{\mata \vecx}_p \le \nbr{\matb \vecx}_p
\leq (1+\epsilon) \nbr{\mata \vecx}_p \qquad \forall \vecx \in \Re^{d}
\end{equation*}
And the number of rows in $\matb$ can be bounded by:
\begin{align*}
\begin{cases}
O(n^{1 - \frac{p}{2}} d^{2 + \theta} \epsilon^{-2}) &\text{if } 1 \leq p \leq 2\\
O(n^{\frac{p}{2} - 1} d^{\frac{3}{2}p - 1 + \theta} \epsilon^{-2}) &\text{if } 2 \leq p
\end{cases}
\end{align*}
\end{lemma}
The proof will be in two steps: we first show that $\mataapprox \matc$ is a
well-conditioned basis for $\mataapprox$, and use the following Lemma
to show that this implies that $\mata \matc$ is a well-conditioned
basis for $\mata$.
\begin{lemma}
\label{lem:basereverse}
If $\mata$ and $\mataapprox$ are such that for all $\vecx \in \Re^{d}$,
$ \frac{1}{2}\nbr{\mata \vecx}_p \le \|\mataapprox \vecx\|_p \leq \frac{3}{2} \nbr{\mata \vecx}_p$,
and $\matc$ is such that $\matuapprox = \mataapprox \matc$ is an
$(\alpha, \beta, p)$-well-conditioned basis for $\mata$, then
$\mata \matc$ is also an $(2 \alpha, 2 \beta, p)$-well-conditioned
basis for $\mata$.
\end{lemma}
\Proof
It suffices to verify both conditions of Definition~\ref{def:wellcondbasis}
holds for $\matu = \mata \matc$.
For $\vertiii{\matu}_p$, we can treat its $p$\textsuperscript{th}
power as a summation over the columns of $\matu$ and get:
\begin{align*}
\vertiii{\matu}_p^p
& = \sum_{j = 1}^d \nbr{\matu_{*j}}_p^p
= \sum_{j = 1}^d \nbr{\mata \matc_{*j}}_p^p \\
& \leq \sum_{j = 1}^d {2}^p \nbr{\tilde \mata \matc_{*j}}_p^p && \text{(by
assumption $\frac{1}{2}\nbr{\mata \vecx}_p \le \|\mataapprox \vecx\|_p$)}\\
& = {2}^p \vertiii{\matuapprox}^p_p = 2^p \alpha^p
\end{align*}
The other condition can be obtained by direct substitution.
By the condition given, we have that for all $\vecz \in \Re^{d}$:
\begin{align*}
\nbr{\vecz}_q
& \leq \beta \nbr{\matuapprox \vecz}_p
= \beta \nbr{\mataapprox \matc \vecz}_p
\end{align*}
Applying the fact that $\nbr{\mata \vecx}_p \leq 2 \|{\mataapprox \vecx}\|_p$
to the vector $\matc \vecz$ gives:
\begin{align*}
\nbr{\vecz}_q
& \leq \beta (2 \nbr{\mata \matc \vecz}_p)
= 2 \beta \nbr{\matu \vecz}_p
\end{align*}
\QED
\Proofof{Lemma~\ref{lem:reductionlp}}
By the guarantees of \textsc{RowCombineL2} given in Theorem~\ref{thm:algol2},
we can set its constants so that with probability at least $1 - d^{-c'}$ we have:
\begin{align*}
\frac{1}{2} \mataapprox^T \mataapprox
\preceq \matashort^T \matashort
\preceq \frac{3}{2} \mataapprox^T \mataapprox.
\end{align*}
As $\matc^T \matc = (\matashort^T \matashort)^\dag$, then the condition of
Lemma~\ref{lem:simplebasis} is satisfied, so $\tilde \mata \matc$ is a well-conditioned
basis of $\tilde \mata$. Furthermore, by Lemma~\ref{lem:basereverse}, $\mata \matc$ is also a
well-conditioned basis of $\mata$.
The guarantees for $\matb$ then follows from Lemma~\ref{lem:estimateandsamplelp}. The
probability can be obtained by a simply union bound with $c'=c+\log 2$.
\QED
Iterating this reduction routine with $\mataapprox = \mata$
gives a way to reduce the row count
from $n$ to $\poly(d)$ in $O(\log\log(n / d))$ iterations when $p < 4$.
Two issues remain: the approximation errors will accumulate across
the iterations, and it's rather difficult (although possible if
additional factors of $d$ are lost) to bound the reductions of non-zeros
since different rows may have different numbers of them.
We will address these two issues systematically before giving
our complete algorithm.
The only situation where a large decrease in the number of rows
does not significantly decrease the overall number of non-zeros
is when most of the non-zeros are in a few rows.
A simple way to get around this is to `bucket' the rows of $\mata$
by their number of non-zeros, and compute $\poly(d)$ sized
samples of each bucket separately.
This incurs an extra factor of $\log{d}$ in the final number of
rows, but ensures a geometric reduction in problem sizes
as we iterate.
The error buildup can in turn be addressed by sampling on the rows of
the initial $\mata$ using the latest approximation for it $\mataapprox$.
However, since the algorithm can take up to $O(\log{d})$ iterations,
we need to perform this on a reduced version of $\mata$ instead to
obtain a $O(\nnz(\mata))$ running time.
Pseudocode of our algorithm for a single partition where the number of
non-zeros in each row are within a constant factor of each other
is given in Algorithm~\ref{alg:rowsamplelp}.
\begin{algo}[ht]
\caption{Algorithm for Producing Row Sample of Size $\poly(d)$ that Preserves $\ell_p$-norm}
\label{alg:rowsamplelp}
\qquad
$\textsc{RowSampleP}(\mata, p, \epsilon, \delta)$
\vspace{0.05cm}
\underline{Input:}
$n \times d$ matrix $\mata$, $p$, error parameter $\epsilon$, failure probability $\delta = d^{-c}$
\underline{Output:}
Matrix $\matb$
\begin{algorithmic}[1]
\IF{$1 \leq p \leq 2$}
\STATE{$n^{*} \leftarrow O(d^{\frac{4}{p} + \theta}
\log^{\frac{2}{p}}d)$}
\ELSE
\STATE{$n^{*} \leftarrow O(d^{\frac{3}{2}p - 1 + \theta}
\log^{\frac{3p - 2}{4 - p}}{d})$}
\ENDIF
\IF{$\mata$ has $n^{*}$ or fewer rows}
\RETURN{$\mata$}
\ENDIF
\STATE{$\mataapprox_0, \mataapprox \leftarrow \textsc{ReduceP}(\mata, \mata, 1/5)$}
\WHILE{$\mataapprox$ has more than $\bar{n}$ rows}
\STATE{$\mataapprox \leftarrow \textsc{ReduceP}(\mataapprox_0, \mataapprox, 1/5)$}
\ENDWHILE
\STATE{$\matb \leftarrow \textsc{ReduceP}(\mata, \mataapprox, \epsilon / 2)$}
\RETURN{$\matb$}
\end{algorithmic}
\end{algo}
\begin{lemma}
\label{lem:rowsamplelp}
For any $c$, there is a setting of constants in \textsc{RowSample} such that
given a matrix $\mata$ where each row has between $[s, 2s]$ nonzeros and $p < 4$.
$\textsc{RowSampleP}(\mata, p, \epsilon)$
with probability $1 - d^{-c}$ returns
in $O(\nnz(\mata) + d^{\omega} \log{d})$ time a matrix $\matb$
such that:
\begin{align*}
(1-\epsilon)\nbr{\mata \vecx}_p \le \nbr{\matb \vecx}_p
\leq (1+\epsilon) \nbr{\mata \vecx}_p
\end{align*}
And the number of rows in $\matb$ can be bounded by
\begin{align*}
\begin{cases}
O(d^{\frac{4}{p} + \theta } \epsilon^{-2})
&\text{if } 1 \leq p \leq 2\\
O(d^{\frac{3}{2}p - 1 + \theta } \epsilon^{-2}) &\text{if } 2 \leq p \leq 4
\end{cases}
\end{align*}
\end{lemma}
\Proof
For correctness, we can show by induction that as long as
all calls to $\textsc{ReduceP}$ succeeds,
$\left| \nbr{\mataapprox_0 \vecx}_p - \nbr{\mataapprox \vecx}_p \right|
\leq 1/5 \nbr{\mataapprox_0 \vecx}_p$ for all $\vecx \in \Re^{d}$.
This can be combined with the guarantee between
$\mata$ and $\mataapprox$ to give:
$\left| \nbr{\mata \vecx}_p - \nbr{\mataapprox \vecx}_p \right|
\leq 1/2 \nbr{\mata \vecx}_p$ for all $\vecx \in \Re^{d}$,
which allows us to obtain the bound on $\matb$.
The analysis below shows that there can be at most $O(\log{d})$
calls to $\textsc{ReduceP}$, so calling each with success probability
at least $1 - d^{-c - 2}$ gives an overall success probability of
at least $1 - d^{-c - 1}$.
To bound the runtime, we first show that if $\matb$ has $n_b$ rows, then
in the next iteration the number of rows in $\matb$
can be bounded by $(n_b / n*)^{c_p} n*$
where $c_p < 1$ is a constant based on $p$.
When $1 \leq p \leq 2$, Lemma~\ref{lem:reductionlp} gives that
there exist some constant $c_0$ such that the new row count can be bounded by:
\begin{align*}
c_0 n_b^{1 - \frac{p}{2} }d^{2 + \theta} \log(d)
= (n_b c_0^{-\frac{2}{p}} d^{-\frac{4}{p} - \frac{2 \theta}{p}} \log^{-\frac{2}{p}} {d})^{1 - \frac{p}{2}} c_0^{\frac{2}{p}} d^{\frac{4}{p} + \frac{2 \theta}{p}} \log^{\frac{2}{p}}{d}
\end{align*}
So $n^{*} = c_0^{\frac{2}{p}} d^{\frac{4}{p} + O(\theta)} \log^{\frac{2}{p}}{d}$
and $c_p = 1 - \frac{p}{2}$ suffices.
Similarly for the case where $2 \leq p$, it can be checked that
\begin{align*}
n^{*} = c_0^{\frac{2}{4 - p}} d^{\frac{3p - 2}{4 - p} + O(\theta)} \log^{\frac{2}{4 - p}}{d}
\end{align*}
Gives that the new row count can be bounded by $(n_b / n^{*})^{c_p} n^{*}$
where $c_p = \frac{p}{2} - 1$.
As we can set $\theta$ to any arbitrary constant, the constant
in front of its exponent can also be removed.
Therefore in $O(\log_{c_p^{-1}}(\log(n / n^{*})) = O(\log\log{n})$ iterations
the number of rows in $\matb$ decreases below $2 n^{*}$.
Also, the number of rows in $\mataapprox$ is at most
$(n / n^{*})^{c_p} n^{*} = n (n / n^{*})^{c_p - 1}$.
This means the total cost to obtain the final $\matb$
can be bounded by $O(\nnz(\mata) +
(\nnz(\mata) (n / n^{*})^{c_p - 1} + d^{\omega + \theta} \log(n / n^{*})))$
Since $\log{t} \leq O(t^{1 - c_p})$, the first two terms can be
bounded by $O(\nnz(\mata))$.
The overall runtime bound then follows by applying Lemma~\ref{lem:reductionlp}
to the final call of $\textsc{ReduceP}$.
\QED
\subsection{Fewer Rows by Iterating Again}
\label{subsec:again}
A closer look at the proof of Lemma~\ref{lem:rowsamplelp}
shows that a significant increase in the number of rows comes
from dividing by the $1 - |1 - \frac{p}{2}|$ term in the
exponent of $n$.
As a result, the row count can be further reduced if the leverage
scores are computed via. a $p'$-norm approximation where $q$
is between $2$ and $p$.
For simplicity we only show this improvement for
the case where $1 \leq p \leq p' \leq 2$.
We will start by proving a generalization of Lemma~\ref{lem:simplebasis}.
\begin{lemma}
\label{lem:basisq}
If $\mata$ has rank $r$, $1 \leq p \leq p' \leq 2$,
and $\mataapprox$ is a matrix with $\tilde{n}$ rows such that
for all vectors $\vecx$ we have
$\frac{1}{2}\nbr{\mata \vecx}_q \le \nbr{\mataapprox \vecx}_q
\leq \frac{3}{2} \nbr{\mata\vecx}_q$,
and $\matc$ is a $d \times r$ matrix such that
$\frac{1}{2} (\mataapprox^T \mataapprox)^{\dag}
\preceq \matc \matc^T
\preceq \frac{3}{2} (\mataapprox^T \mataapprox)^{\dag}$,
then $\matu = \mata \matc$ is a $(\alpha, \beta, p)$-well-conditioned
basis for $\mata$ where $\alpha \beta \leq
O(n^{\frac{1}{p} - \frac{1}{p'}} \tilde{n}^{\frac{1}{p'} - \frac{1}{2}}
d^{\frac{1}{p}} )$.
\end{lemma}
\Proof
Let $\tilde{\matu} = \mataapprox \matc$.
Similar to the proof of Lemma~\ref{lem:simplebasis}, we have
$\vertiii{\tilde{\matu}}_2 \leq \sqrt{2 d}$,
and $\nbr{\vecx }_2 \leq \sqrt{2} \nbr{\tilde{\matu} \vecx}_2$ for any vector $\vecx$.
Once again, let $q$ be the dual norm for $p$ such that $\frac{1}{p}+\frac{1}{q}=1$.
We have:
\begin{align*}
\vertiii{\mata \matc}_p
& \le (nd)^{\frac{1}{p}-\frac{1}{p'}}\vertiii{\mata \matc}_{p'} \\
& \le (nd)^{\frac{1}{p}-\frac{1}{p'}} \left( 3/2 \vertiii{\mataapprox \matc}_{p'} \right)\\
& \le 3/2 (nd)^{\frac{1}{p}-\frac{1}{p'}}
(\tilde{n}d)^{\frac{1}{p'}-\frac{1}{2}}\vertiii{\mataapprox \matc}_2
\end{align*}
Which gives $\alpha = O(n^{\frac{1}{p} - \frac{1}{p'}}
\tilde{n}^{\frac{1}{p'} - \frac{1}{2}} d^{\frac{1}{p}})$.
Also,
\begin{align*}
\nbr{\vecx}_q
\leq \nbr{\vecx}_2
\leq 2\nbr{\mataapprox \matc \vecx}_{2}
\leq 3\nbr{\mata \matc \vecx}_{p'}
\leq 3 \nbr{\mata \matc \vecx}_{p}
\end{align*}
Which gives $\beta = O(1)$.
\QED
This allows us to compute leverage scores via. a $\ell_{p'}$-norm approximation.
By Lemma~\ref{lem:rowsamplelp}, such a matrix has
$\tilde{n} = O(d^{\frac{4}{p'}} \log^{\frac{2}{p'}}{d})$ rows.
By Lemma~\ref{lem:estimateandsamplelp}, the resulting number
of rows can be bounded by:
\begin{align*}
& O\left( \left(n^{\frac{1}{p} - \frac{1}{p'}}
\tilde{n}^{\frac{1}{p'} - \frac{1}{2}} d^{\frac{1}{p}} R \right)^{p}
d \log{d} \right)
= O \left( n^{1 - \frac{p}{p'}}
\left(d^{\frac{4}{p'}} \log^{\frac{2}{p'}}{d} \right)^{\frac{p}{p'} - \frac{p}{2}}
R^{p} d^2 \log^{\frac{2 p}{p'} + 1}{d} \right)\\
\end{align*}
This leads to a result analogous to Lemma~\ref{lem:reductionlp}.
Solving for the fixed point of this process
allows us to prove Theorem~\ref{thm:rowsamplel1}.
\Proofof{Theorem~\ref{thm:rowsamplel1}}
Similar to the proof of Lemma~\ref{lem:rowsamplelp},
in each iteration we reduce the number of rows from $n$
to $O \left( n^{1 - \frac{p}{p'}}
\left(d^{\frac{4}{p'}} \log^{\frac{2}{p'}}{d} \right)^{\frac{p}{p'} - \frac{p}{2}}
R^{p} d^2 \log^{\frac{2 p}{p'} + 1}{d} \right)$.
Ignoring terms in $R$ and $\log{d}$, we have that the
number of rows converges doubly exponentially towards:
\begin{align*}
\left( \left(d^{\frac{4}{p'}}\right)^{\frac{p}{p'} - \frac{p}{2}}
d^2\right)^{\frac{p'}{p}}
& = d^{\frac{4}{p'} - 2 + 2 \frac{p'}{p}}
= d^{\frac{4}{p'} + 2 p' - 2}
\end{align*}
This is minimized when $p' = \sqrt{2}$, giving
$\frac{4}{p'} + 2 p' - 2 = 4 \sqrt{2} - 2$.
As we can set $R = d^{O(\theta)}$,
the number of rows in $\matb$ can be bounded by
$O(d^{4 \sqrt{2} - 2 + \theta})$ for any constant $\theta$.
\QED
This method can be used to reduce the number of rows
for all values of $1 \leq p \leq 2$.
A calculation similar to the above proof leads to a row
count of $O(d^{\sqrt{\frac{8}{p}} - 2})$.
However, using three or more steps does not lead to
a significantly better bound since we can only obtain
samples with about $d$ rows when $p = 2$.
For $p \ge 4$, multiple steps of this approach also allows
us to compute $\poly(d)$ sized samples for any value of $p$.
We omit this extension as it leads to a significantly higher
row count.
\section{Preliminaries}
\label{sec:prelim}
We begin by stating key notations and definitions that we will use
for the rest of this paper.
We will use $\|\vecx\|_p$ to denote the $\ell_p$ norm of a vector.
The two values of $p$ that we'll use are $p=1$ and $p=2$,
which correspond to $\|\vecx\|_1 = \sum_{i} |x_i|$
and $\|\vecx\|_2 = \sqrt{\sum_{i} x_i^2}$.
For two vectors $\vecx$ and $\vecy$, $\vecx \geq \vecy$ means
$\vecx$ is entry-wise greater or equal to $\vecy$, aka.~$\vecx_i \geq \vecy_i$ for all $i$.
For a matrix $\mata$, we use $\mata_{i*}$, or $\veca_i$
to denote the $i$\textsuperscript{th} row of $\mata$, and
$\mata_{*j}$ to denote its $j$\textsuperscript{th} column.
Note that if $\mata \in \Re^{n \times d}$, $\veca_i$ is a row vector
of length $d$.
We will also use the generalized $p$-norm $\vertiii{\cdot}_p$
of a matrix, which essentially treats all entries of the matrix as
a single vector.
Specifically, $\vertiii{\mata}_p = (\sum_{ij} |\mata_{ij}|^{p})^{1/p}$.
When $p = 2$, it is known as the Frobenius norm, $\|\cdot\|_F$.
A matrix $\matc$ is positive semi-definite
if all its eigenvalues are non-negative,
or equivalently $\vecx^T \matc \vecx \geq 0$
for all vectors $\vecx$.
Since $\vecx^T (\mata^T \mata) \vecx = \|\mata \vecx\|_2^2$,
$\mata^T \mata$ is positive semi-definite for any $\mata$.
Similarity between matrices is defined via. a partial order on matrices.
Given two matrices $\matc_1$ and $\matc_2$, $\matc_1 \preceq \matc_2$
denotes that $\matc_2 - \matc_1$ is positive semi-definite.
The connection between this notation and row sampling is clear
in the case of $\ell_2$, specifically $\mata^T \mata \preceq \matb^T \matb$
is equivalent to $\|\mata \vecx\|_2 \leq \|\matb \vecx\|_2$.
We will also define the pseudoinverse of $\matc$, $\matc^{\dag}$
as the linear operator that's zero on the null space of $\matc$,
while acting as its inverse on the rank space.
For operators that act on the same space, spectral orderings of
pseudoinverses behaves the same as with scalars.
Specifically, if $\matc_1$ and $\matc_2$ have the same
null space and $\matc_1 \preceq \matc_2$,
then $\matc_2^{\dag} \preceq \matc_1^{\dag}$.
Given a subspace of $\Re^{d}$, an orthogonal projector onto it,
$\matproj$ is a symmetric positive-semidefinite matrix taking
vectors into their projection in this space.
For example, if this space is rank space of some positive semi-definite
matrix $\matc$, then an orthogonal projection operator is given
by $\matc \matc^{\dag}$.
Our algorithms are designed around the following algorithmic fact:
for any norm $p$ and any matrix $\mata \in \Re^{n \times d}$,
there exist a distribution on its rows such that sampling $\poly(d)$
entries from this distribution and rescaling them gives $\matb$
such that with probability at least $1 - d^{-c}$:
\begin{align*}
(1 - \epsilon) \|\mata \vecx\|_p
\leq \|\matb \vecx\|_p
\leq (1 + \epsilon) \|\mata \vecx\|_p,
\qquad \forall \vecx \in \Re^{d}.
\end{align*}
This sampling process can be formalized in several ways, leading to
similar results both theoretically and experimentally \cite{IpsenW12}.
We will treat it as a blackbox $\textsc{Sample}(\mata, \vecp)$
that takes a set of probabilities over the rows of $\mata$ and
samples them accordingly.
It keeps row $i$ or $\mata$ with probability $\min \{ 1, p_i\}$, and
rescales it appropriately so the expected value of this row is preserved.
The two key properties of $\textsc{Sample}(\mata, \vecp)$ that we
will use repeatedly are:
\begin{itemize}
\item It returns $\matb$ with at most $O(|\vecp|_1)$ rows.
\item Its running time can be bounded by $O(n + |\vecp|_1 \log{n})$.
\end{itemize}
The convergence of sampling relies on matrix Chernoff bounds,
which can be viewed as generalizations of single variate
concentration bounds.
Necessary conditions on the probabilities can be formalized in several
ways, with the most common being statistical leverage scores.
Although these values have been studied in statistics,
their use in algorithms is more recent.
To our knowledge, their first use in a limited row sampling setting
was in spectral sparsification of graphs \cite{SpielmanS08}.
The most general definition of $p$-norm leverage scores is based on
the row norms of a basis of the column space of $\mata$.
However, significant simpliciations are possible when $p = 2$,
and this alternate view is crucial for in our algorithm.
As a result, we will state the relevant convergence results
for $\textsc{Sample}$ separately in
Sections~\ref{sec:algo2}~and~\ref{sec:pnorm}.
They show that statistical leverage scores are closely
associated the probabilities needed for row sampling,
and give algorithms that efficiently approximate these values.
We will also formalize an observation implicit in previous results
that both the sampling and estimation algorithms are very robust.
The high error-tolerance of these algorithms makes them ideal
as core routines to build iterative algorithms upon.
One issue with the various concentration bounds that we will prove
is that they hold with high probability in $d$.
That is, the fail with probability $1 - d^{-c}$ for some constant $c$.
In cases where $n \gg \poly(d)$, this will prevent
us from taking a union bound over many sampling steps.
However, it can be shown that in such cases, padding all sampling
probabilities with $1 / \poly(d)$ in the sampling process will narrow
the key steps back down to $\poly(d)$ ones.
This leads to a matrix with $O(\nnz(\mata) / \poly(d))$ rows,
which can in turn be handled in $O(\nnz(\mata))$ time using
routines that run in $O(n \poly(d))$ time (e.g. \cite{DasguptaDHKM09}).
Therefore for the rest of this paper we will assume $n = \poly(d)$.
\section{Deferred Proofs from Section~\ref{sec:algo2}}
\label{sec:rowcombineproofs}
\Proofof{Lemma \ref{lem:goodapprox}}
Let $\matc = \rbr{\mata^T \mata}^\invsqr$,
by Fact \ref{fact:stretchclosedform} we have that:
$
\str{\mata}{\mata_{(b)}}
= \|\mata_{(b)} \matc\|_F^2
$
and
$
\str{\mata}{\matashort_{(b)}}
= \|\matashort_{(b)} \matc\|_F^2
$.
Furthermore, since $\matashort_{(b)} = \matu_{(b)} \mata_{(b)}$,
we have:
\begin{align*}
\str{\mata}{\matashort_{(b)}}
= \|\matu_{(b)} \mata_{(b)} \matc\|_F^2
\end{align*}
Next we upper bound this term by using similar technology from the proof of
Lemma~\ref{lem:approxstretch}. Let $\vecy_i$ be the $i$-th column of
$\mata_{(b)}\matc$. As the entries of $\matu_{(b)}$ are independent standard Gaussian
random variables,
it is easy to see that $\mathbb{E} \sbr{ \nbr{\matu_{(b)} \vecy_i}_2^2} =
k\nbr{\vecy_i}_2^2$ for any $i$.
By Lemma \ref{lem:jl}, we have that:
\begin{align*}
\prob{\|\matu_{(b)} \vecy_{i} \|_2^2
\le \frac{k}{ R} \|\vecy_{i}\|_2^2}
\leq \exp \left( \frac{k}{2} \rbr{1-R^{-1} - \ln{R}} \right)
\le R^{-\frac{k}{4}}
\end{align*}
Where the last inequality is by $1-R^{-1} - \ln{R}\le -\frac{1}{2}\ln{R}$ with
the assumption that $R\ge e^2$.
If we $k$ to $4(c+1)\theta^{-1}\log_d n$ and substitute $R = d^\theta$,
we get:
\begin{align*}
R^{{-\frac{k}{4}}} \le d^{-\frac{k\theta}{4}} = d^{-c-1}n^{-1}.
\end{align*}
Using the union bound, we have
\begin{align*}
\Pr \sbr{\str{\mata}{\matashort_{(b)}} \le \frac{k}{R} \str{\mata}{\mata_{(b)}}} =
\Pr \sbr{\sum_{i=1}^d \|\matu_{(b)} \vecy_{i} \|_2^2 \le \sum_{i=1}^d \frac{k}{ R}
\|\vecy_{i}\|_2^2}
\le d^{-c}n^{-1}
\end{align*}
Apply the union bound again, the above holds for all $b=1,\ldots,n_b$ with probability at
most $d^{-c}$.
By the assumption that $n=\poly(d)$, $k = O(c/\theta)$ suffices.
\QED
\Proofof{Lemma \ref{lem:shortupper}}
By definition we have $\matashort_{(b)} = \matu_{(b)} \mata_{(b)}$.
Let $\vecx$ be any vector in $\Re^{d}$, we first have
\begin{align*}
\|\matu_{(b)} \vecx\|_2^2
\leq \|\matu_{(b)}\|_2^2 \|\vecx\|_2^2 \le \|\matu_{(b)}\|_F^2 \|\vecx\|_2^2
\end{align*}
and then
\begin{align*}
\vecx^T \matashort_{(b)}^T \matashort_{(b)} \vecx
& = \|\matashort_{(b)} \vecx\|_2^2 \\
& = \|\matu_{(b)}\mata_{(b)} \vecx\|_2^2 \\
& \leq \|\matu_{(b)}\|_F^2 \|\mata_{(b)} \vecx\|_2^2\\
& =\|\matu_{(b)}\|_F^2 \cdot \vecx^T \mata_{(b)}^T\mata_{(b)} \vecx
\end{align*}
\QED
\Proofof{Lemma \ref{lem:pseudoinversereverse}}
Consider an orthonormal basis for the range space of $\matc$,
$\vecv_1 \ldots \vecv_{\textrm{rank}(\matc)}$.
Since $\matc + \matd \succeq \matc$, this basis
can be extended to an orthonormal basis to the range space
of $\matc + \matd$ by adding
$\vecv_{\textrm{rank}(\matc)+1} \ldots \vecv_{\textrm{rank}(\matc + \matd)}$.
It suffices to prove the claim under this basis system.
Here $\matc$ and $\matd$ can be rewritten as by proper rotation:
\begin{align*}
\matc =
\begin{bmatrix}
\matc_{11} & \matzero \\
\matzero & \matzero
\end{bmatrix}
\textrm{ and }
\matd =
\begin{bmatrix}
\matd_{11} & \matd_{12} \\
\matd_{12}^T & \matd_{22} \\
\end{bmatrix},
\end{align*}
where $\matc_{11}$ and $\matd_{22}$ are strictly
positive definite.
Furthermore, since $\matd$ is positive semi-definite we have that
$\matd_{11} - \matd_{12} \matd_{22}^{-1} \matd_{12}^T$ is
also positive semi-definite.
For any vector $\vecx$, $\matproj_\matc \vecx$ gives a vector that's non-zero
only in the first $\textrm{rank}(\matc)$ entries.
Let this part be $\vecx_{1}$.
Then evaluating $(\matc + \matd)^{\dag} \matproj_\matc \vecx =
[ \vecy_{1} ; \vecy_{2} ]$
becomes solving the following system:
\begin{align*}
(\matc_{11} + \matd_{11}) \vecy_1 + \matd_{12} \vecy_2 &= \vecx_1 \\
\matd_{12}^T \vecy_1 + \matd_{22} \vecy_2 &= \veczero
\end{align*}
The second equation gives $\vecy_2 =
-\matd_{22}^{-1} \matd_{12}^T \vecy_1$.
Substituting it into the first one gives:
\begin{align*}
\rbr{\matc_{11} + \matd_{11}
- \matd_{12} \matd_{22}^{-1} \matd_{12}^T} \vecy_1 = \vecx_1
\end{align*}
Note that this is the same as taking the partial Cholesky
factorization onto the range space of $\matproj_\matc$.
Combining things gives:
\begin{align*}
\vecx^T \matproj_\matc (\matc + \matd)^{\dag} \matproj_\matc \vecx
= \vecx_{1}^T (\matc_{11} + \matd_{11}
- \matd_{12} \matd_{22}^{-1} \matd_{12}^T )^{-1}
\vecx_{1}
\end{align*}
Since both $\matd_{11} - \matd_{12} \matd_{22}^{-1} \matd_{12}^T$ and $\matd_{11}$
are positive definite, we have
$\matc_{11} \preceq \matc + \matd_{11} - \matd_{12} \matd_{22}^{-1} \matd_{12}^T$ and therefore:
\begin{align*}
\vecx^T \matproj_\matc (\matc + \matd)_2^\dag \matproj_\matc \vecx
&= \vecx_1^T (\matc_{11} + \matd_{11}
- \matd_{12} \matd_{22}^{-1} \matd_{12}^T)
\vecx_1^T\nonumber \\
&\le \vecx_1^T \matc_{11}^{-1} \vecx_1^T \nonumber \\
&= \vecx^T \matproj_\matc \matc^{+} \matproj_\matc \vecx
\end{align*}
holds for every $\vecx$.
\QED
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 367 |
Q: Representing in a Jtable attributes from an object that is inside of another object. JAVA I am trying to represent in a JTable the attributes from an object that is inside of another object that is inside of a List. This attributes are a representation of data in my DB.
here is my entity:
@Entity
@Table(name="DEPARTAMENTO")
public class Departamento implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="SEQ_ID_DPTO" )
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_ID_DPTO")
@Column(name="ID_DPTO")
private long idDpto;
@Column(name="NOMBRE")
private String nombre;
@ManyToOne
@JoinColumn(name="ID_ZONA")
private Zona zona;
@OneToMany(mappedBy="departamento")
private List<Localidad> localidads;
public Departamento() {
}
public long getIdDpto() {
return this.idDpto;
}
public void setIdDpto(long idDpto) {
this.idDpto = idDpto;
}
public String getNombre() {
return this.nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Zona getZona() {
return this.zona;
}
public void setZona(Zona zona) {
this.zona = zona;
}
public List<Localidad> getLocalidads() {
return this.localidads;
}
public void setLocalidads(List<Localidad> localidads) {
this.localidads = localidads;
}
public Localidad addLocalidad(Localidad localidad) {
getLocalidads().add(localidad);
localidad.setDepartamento(this);
return localidad;
}
public Localidad removeLocalidad(Localidad localidad) {
getLocalidads().remove(localidad);
localidad.setDepartamento(null);
return localidad;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return nombre;
}
}
I get all this data through an EJB:
@Stateless
@LocalBean
public class BeanDepartamento implements BeanDepartamentoRemote {
public BeanDepartamento() {
}
@PersistenceContext
EntityManager em;
@Override
public void crear(Departamento departamento) throws ServiciosException {
try {
em.persist(departamento);
em.flush();
System.out.println("Se creo departamento con Éxito");
} catch (Exception e) {
System.out.println("No se puedo crear departamento");
}
}
@Override
public void actualizar(Departamento departamento) throws ServiciosException {
try {
Departamento d=em.find(Departamento.class, departamento.getIdDpto());
em.detach(d);
d.setNombre(departamento.getNombre());
em.merge(d);
em.flush();
System.out.println("Departamento actualizado con éxito");
} catch (Exception e) {
System.out.println("No se pudo crear departmaneto");
}
}
@Override
public void borrar(Departamento departamento) throws ServiciosException {
try {
Departamento d=em.find(Departamento.class, departamento.getIdDpto());
em.remove(d);
em.flush();
System.out.println("Departamento borrado con éxito");
} catch (Exception e) {
System.out.println("No se pudo eliminar departamento");
}
}
@Override
public List<Departamento> ObtenerTodos() {
TypedQuery<Departamento> query=em.createQuery("SELECT d FROM Departamento
d",Departamento.class);
return query.getResultList();
}
@Override
public void asignarZona(Departamento departamento, Zona zona) throws ServiciosException {
try {
Departamento d=em.find(Departamento.class, departamento.getIdDpto());
d.setZona(em.find(Zona.class, zona.getIdZona()));
em.flush();
System.out.println("Zona asignada con éxito");
} catch (Exception e) {
System.out.println("No se pudo asignar zona");
}
}
@Override
public List<Departamento> ObtenerDepartamentoPorFiltro(String filtro) {
TypedQuery<Departamento> query=em.createQuery("SELECT d FROM Departamento d WHERE d.nombre LIKE
:parametro",Departamento.class).setParameter("parametro", "%"+filtro+"%");
return query.getResultList();
}
}
This is how I am trying to fill in my JTable:
public void mostrarDpto() {
try {
BeanDepartamentoRemote departamentoBean = (BeanDepartamentoRemote)
InitialContext.doLookup("pdt-
final/BeanDepartamento!com.dmente.bean.BeanDepartamentoRemote");
List<Departamento> Departamento= departamentoBean.ObtenerTodos();
String[] columnas= {"ID", "Nombre","Zona"};
Object matriz[][]=new Object[Departamento.size()][3];
for (int i = 0; i < matriz.length; i++) {
matriz[i][0]=Long.toString(Departamento.get(i).getIdDpto());
matriz[i][1]=Departamento.get(i).getNombre();
matriz[i][2]=Departamento.get(i).getZona().toString(); //no me carga el nombre o id
}
tbMod.setModel(new DefaultTableModel(
matriz,columnas
));
Departamento.clear();
} catch (NamingException e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
The problem is this line: matriz[i][2]=Departamento.get(i).getZona().toString();, when I run my project with this line my JFrame isnt't opening, but I dont have any error message, if I comment this line, everything works fine(just don't show myzona.name` attribute).
It's the first time working with swing, it's for a study project, so I kinda lost here for why is the reason that not represents this data in my JTable.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 8,619 |
import subprocess
import re
__author__ = 'm'
RootPassword = b'k'
InfoRegex = {
'SerialNumber': re.compile("Serial Number:[ \t]*([^\n\t ]*)"),
'ModelNumber': re.compile("Model Number:[ \t]*([0-9a-zA-Z_\(\)\-+., ]+)"),
'FirmwareRevision': re.compile("irmware Revision:[ \t]*([0-9a-zA-Z_\(\)\-+ ]+)")
}
class HdParm:
InfoStr = ''
Path = ''
SerialNumber = ''
ModelNumber = ''
FirmwareRevision=''
@staticmethod
def getinfofield(regexp, infostr):
"""
Search hdparm -I output using a given regexp. If found, return the first
matched group, otherwise None.
:param regexp the regular expression to be used. Must contain a match group
:param infostr output of "hdparm -I /dev/sdX" command
:return: matched string or None
"""
result = regexp.search(infostr)
if result:
return result.group(1)
return None
def __init__(self, path):
self.Path = path
self.getinfo()
self.parseinfo()
def getinfo(self):
hdparm_shell = subprocess.Popen(
['sudo', '-S', 'hdparm', '-I', self.Path],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE
)
self.InfoStr = str(hdparm_shell.communicate(input=RootPassword + b"\n")[0])
def parseinfo(self):
self.SerialNumber = HdParm.getinfofield(InfoRegex['SerialNumber'], self.InfoStr)
self.ModelNumber = HdParm.getinfofield(InfoRegex['ModelNumber'], self.InfoStr)
self.FirmwareRevision = HdParm.getinfofield(InfoRegex['FirmwareRevision'], self.InfoStr)
"""
/dev/sdb:
ATA device, with non-removable media
Model Number: SAMSUNG SP1603C
Serial Number: S0CSJ1KP200399
Firmware Revision: VL100-50
Standards:
Used: ATA/ATAPI-7 T13 1532D revision 4a
Supported: 7 6 5 4 & some of 8
Configuration:
Logical max current
cylinders 16383 16383
heads 16 16
sectors/track 63 63
--
CHS current addressable sectors: 16514064
LBA user addressable sectors: 268435455
LBA48 user addressable sectors: 312581808
Logical/Physical Sector size: 512 bytes
device size with M = 1024*1024: 152627 MBytes
device size with M = 1000*1000: 160041 MBytes (160 GB)
cache/buffer size = 8192 KBytes (type=DualPortCache)
Capabilities:
LBA, IORDY(can be disabled)
Queue depth: 32
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16 Current = 16
Recommended acoustic management value: 254, current value: 0
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 udma7
Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4
Cycle time: no flow control=120ns IORDY flow control=120ns
Commands/features:
Enabled Supported:
SMART feature set
Security Mode feature set
* Power Management feature set
* Write cache
* Look-ahead
* Host Protected Area feature set
* WRITE_BUFFER command
* READ_BUFFER command
* NOP cmd
* DOWNLOAD_MICROCODE
SET_MAX security extension
Automatic Acoustic Management feature set
* 48-bit Address feature set
* Device Configuration Overlay feature set
* Mandatory FLUSH_CACHE
* FLUSH_CACHE_EXT
* SMART error logging
* SMART self-test
* General Purpose Logging feature set
* Segmented DOWNLOAD_MICROCODE
* Gen1 signaling speed (1.5Gb/s)
* Gen2 signaling speed (3.0Gb/s)
* Native Command Queueing (NCQ)
* Host-initiated interface power management
* Phy event counters
* DMA Setup Auto-Activate optimization
Device-initiated interface power management
* Software settings preservation
* SMART Command Transport (SCT) feature set
* SCT Read/Write Long (AC1), obsolete
* SCT Write Same (AC2)
* SCT Error Recovery Control (AC3)
* SCT Features Control (AC4)
* SCT Data Tables (AC5)
Security:
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
supported: enhanced erase
66min for SECURITY ERASE UNIT. 66min for ENHANCED SECURITY ERASE UNIT.
Checksum: correct
"""
| {
"redpajama_set_name": "RedPajamaGithub"
} | 8,891 |
Contested Bodies
Home » History » Latin American
Please selectNewUsed
It is often thought that slaveholders only began to show an interest in female slaves' reproductive health after the British government banned the importation of Africans into its West Indian colonies in 1807. However, as Sasha Turner shows in this illuminating study, for almost thirty years before the slave trade ended, Jamaican slaveholders and doctors adjusted slave women's labor, discipline, and health care to increase birth rates and ensure that infants lived to become adult workers. Although slaves' interests in healthy pregnancies and babies aligned with those of their masters, enslaved mothers, healers, family, and community members distrusted their owners' medicine and benevolence. Turner contends that the social bonds and cultural practices created around reproductive health care and childbirth challenged the economic purposes slaveholders gave to birthing and raising children.
Through powerful stories that place the reader on the ground in plantation-era Jamaica, Contested Bodies reveals enslaved women's contrasting ideas about maternity and raising children, which put them at odds not only with their owners but sometimes with abolitionists and enslaved men. Turner argues that, as the source of new labor, these women created rituals, customs, and relationships around pregnancy, childbirth, and childrearing that enabled them at times to dictate the nature and pace of their work as well as their value. Drawing on a wide range of sources--including plantation records, abolitionist treatises, legislative documents, slave narratives, runaway advertisements, proslavery literature, and planter correspondence--Contested Bodies yields a fresh account of how the end of the slave trade changed the bodily experiences of those still enslaved in Jamaica.
Sasha Turner
University of Pennsylvania Press | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,964 |
\section{Typical Data Processing Chain}
\begin{figure*}[t]
\begin{center}
\includegraphics[angle=0,width=120mm]{D5_f1}
\caption{
A \textit{target diagram}: slightly simplified object model that is a view of
the dependencies of ``targets'' to the ocean of raw observational data of
astronomical wide-field imaging. The arrows indicate the backward chaining to
the raw data, not the progression through any processing pipeline. The colors
provide a visual grouping of similar types of data products.
}\label{fig:target}
\end{center}
\end{figure*}
{\sf Astro-WISE} was originally designed to handle the large datasets from the OmegaCAM instrument such as the KiDS survey \citep{P157_adassxxi}.
The backbone of {\sf Astro-WISE} is set by the way it captures all science products obtained in survey operations in an object-oriented data model.
Figure~\ref{fig:target} shows the main astronomical classes in the {\sf Astro-WISE} environment, the basic elements of the data processing chain.
Each block is a class and each instance of a class is called a \textit{Target}.
The class incorporates a method to derive the data of the Target from other objects, called its \textit{dependencies}.
The user has an ability to combine recipes in a pipeline to process the data by directly requesting the final required data product he or she is interested in.
All processing parameters, along with the full data lineage, are saved in the metadata through the persistence of all objects.
In the demo the user goes from a {\it RawScienceFrame} (raw frame observed by the VST and ingested in {\sf Astro-WISE}) to a {\it SourceList} (the catalog produced from reduced, regridded and coadded images)\footnote{\url{http://www.astro-wise.org/portal/howtos/man_howto_tutorial_science/man_howto_tutorial_science.shtml}}, using the {\sf Astro-WISE} infrastructure through the web services described below.
An {\sf Astro-WISE} node is the building element of {\sf Astro-WISE} infrastructure.
It consists of data storage element (dataserver, which stores all the files with images), metadata database (RDBMS, which keeps metadata including links between data items),
computing elements (Distributed Processing Unit) and a number of interfaces and services which allow to the user to browse and process data stored in the system (see~\citet{JOGC} for more technical details).
\section{Services and Interfaces}
The main language for the system is Python, but each user can develop her/his own application or use an existing application
which can be wrapped into Python. Usually, users develop pipelines or workflows using existing ``blocks'' with the
help of pre-defined Python libraries and classes. The user can also change an existing data model if necessary or implement a new one.
The Command Line Interface of {\sf Astro-WISE}, {\tt AWE} ({\sf Astro-WISE} Environment), can be installed on a site without any other components of {\sf Astro-WISE} (data server and metadata
database). Basically the {\tt AWE} prompt is a link to a local Python installation with the {\sf Astro-WISE} libraries and environments.
Apart from the {\tt AWE} prompt, {\sf Astro-WISE} supports a range of web interfaces. This makes it possible for a user to work with data stored in {\sf Astro-WISE}
without the {\tt AWE} prompt using a web browser only. The web interfaces are divided into two types: data browsing/exploration and data processing/qualification.
The first group includes:
\begin{itemize}
\item dbviewer\footnote{\url{http://dbview.astro-wise.org}} -- the metadata database interface which allows browsing and querying all attributes of all persistent objects stored in the system,
\item Go-WISE\footnote{\url{http://gowise.astro-wise.org}} -- allows querying on a limited subset of attributes of the data model (coordinate range and object name), and provides results of all projects,
\item image cut out service\footnote{\url{http://cutout.astro-wise.org}} and color image maker\footnote{\url{http://rgb.astro-wise.org}} -- these two services are for
the astronomical image data type and allows creation of cut-outs of an image or the creation of a pseudo-color RGB image from three different images of the same part of sky,
\item skymap\footnote{\url{http://skymap.astro-wise.org}} -- exploration tool of the {\sf Astro-WISE} system using the GoogleSky interface.
\end{itemize}
Data processing / qualification interfaces are:
\begin{itemize}
\item target processor\footnote{\url{http://process.astro-wise.org}} -- the main web tool to process the data in {\sf Astro-WISE}. This web interface allows the user to go through pre-defined
processing chains submitting jobs on the {\sf Astro-WISE} computing resources with the ability to select the computing node of {\sf Astro-WISE}.
The Target Processor allows for implicit collaboration by indicating that objects can be reprocessed when another scientist has created improved versions of the objects that it depends on,
\item quality service\footnote{\url{http://quality.astro-wise.org}} -- allows the estimation the quality of the data processing and set a flag highlighting the quality of the data,
\item CalTS\footnote{\url{http://calts.astro-wise.org}} -- web interface for qualifying and time stamping calibration data.
\end{itemize}
The exact set of web interfaces depends on the data model implemented in the system. The web interfaces described above are for the optical image
data processing and follow the requirements for this particular data model and data processing chain. {\sf Astro-WISE} allows the implementation
of new
web interfaces for the data model and for data processing defined by the user. The developer of the new web interface will use pre-defined
classes and libraries of {\sf Astro-WISE} to create it.
\section{Data publishing and External Data}
Data access interfaces from the Virtual Observatory exist as separate services\footnote{\url{http://www.astro-wise.org/portal/aw_vo.shtml}}, that enables browsing the metadata database and retrieving the data from dataservers.
{\sf Astro-WISE} supports the Simple Image Access Protocol for images and ConeSearch for sources.
Each data entity in {\sf Astro-WISE} has a persistent attribute which shows scope of visibility for this entity, which allows the creator of the object to specify with whom to share the object.
\section{Conclusion}
The demo of {\sf Astro-WISE} is based on the {\sf Astro-WISE} guided tour and tutorial, which can be found on the {\sf Astro-WISE} website.
It shows how the request driven way of processing and full data lineage gives {\sf Astro-WISE} the power to handle the large datasets produced by surveys such as KIDS.
The user can apply standard data processing using target processing or can develop his/her own recipe for the data processing using the {\sf Astro-WISE} pipeline as the building blocks.
\acknowledgements
{\sf Astro-WISE} is an on-going project which started from a FP5 RTD programme funded
by the EC Action ``Enhancing Access to Research Infrastructures''. This work is
supported by FP7 specific programme ``Capacities - Optimising the use and
development of research infrastructures''.
This work is supported by Target\footnote{\url{http://www.rug.nl/target}}, a public-private R\&D programme for information systems for large scale sensor networks.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 7,496 |
{"url":"https:\/\/simple.wikipedia.org\/wiki\/Riemann_zeta_function","text":"# Riemann zeta function\n\nRiemann zeta function \u03b6(s) in the complex plane. The color of a point s shows the value of \u03b6(s): strong colors are for values close to zero and hue encodes the value's argument. The white spot at s= 1 is the pole of the zeta function; the black spots on the negative real axis and on the critical line Re(s) = 1\/2 are its zeros.\nThe coloring of the complex function-values used above: positive real values are presented in red.\n\nIn mathematics, the Riemann zeta function is an important function in number theory. It is related to the distribution of prime numbers. It also has uses in other areas such as physics, probability theory, and applied statistics. It is named after the German mathematician Bernhard Riemann, who wrote about it in the memoir \"On the Number of Primes Less Than a Given Quantity\", published in 1859.\n\nThe Riemann hypothesis is a conjecture about the distribution of the zeros of the Riemann zeta function. Many mathematicians consider the Riemann hypothesis to be the most important unsolved problem in pure mathematics. [1] In the year 2000, the Clay Mathematics Institute included the Riemann hypothesis as one of their Millennium Prize Problems, promising a reward of US\\$1 million to anyone who could solve it.\n\n## Definition\n\nWhen using mathematical symbols to describe the Riemann zeta function, it is represented as an infinite series:\n\n${\\displaystyle \\zeta (s)=\\sum _{n=1}^{\\infty }{\\frac {1}{n^{s}}},\\quad \\mathrm {Re} (s)>1.}$\n\nwhere ${\\displaystyle \\mathrm {Re} (s)}$ is the real part of the complex number ${\\displaystyle s}$. For example, if ${\\displaystyle s=a+ib}$, then ${\\displaystyle \\mathrm {Re} (s)=a}$ (where ${\\displaystyle i^{2}=-1}$).\n\nThis makes a sequence. The first few terms of this sequence would be,\n\n${\\displaystyle {\\frac {1}{1^{s}}}+{\\frac {1}{2^{s}}}+{\\frac {1}{3^{s}}}\\ldots }$ and so on\n\nHowever, this doesn't apply for numbers where ${\\displaystyle \\mathrm {Re} (s)<1}$. This is because, if we interpret this function as an infinite sum, the sum does not converge, it instead diverges. This means that instead of nearing a specific value, it will get infinitely large. Riemann used analytic continuation, so that he could give a value to all numbers except 1. ${\\displaystyle \\zeta (1)}$ represents the harmonic series, which diverges, meaning that the sum does not near any specific number.\n\nLeonhard Euler discovered the first results about the series that this function represents in the eighteenth century. He proved that the Zeta function can be written as an infinite product of prime numbers. In mathematical notation:\n\n${\\displaystyle \\zeta (s)=\\prod _{p|{\\text{prime}}}{\\frac {1}{1-p^{-s}}}}$\n\nThis is an infinite product. ${\\displaystyle p|{\\text{prime}}}$ means that only prime numbers are included in the product. The first few terms of the product would look like:\n\n${\\displaystyle {\\frac {1}{1-2^{-s}}}\\cdot {\\frac {1}{1-3^{-s}}}\\cdot {\\frac {1}{1-5^{-s}}}\\cdot {\\frac {1}{1-7^{-s}}}\\ldots }$\n\n## Zeros, the critical line, and the Riemann hypothesis\n\nMathematicians are interested in those values of ${\\displaystyle s}$ for which the function is equal to zero. The Riemann hypothesis conjectures that all the \"non-trivial zeros\" have a real part one half (meaning for a complex number in the form ${\\displaystyle s=a+ib}$), all the non-trivial zeros are guessed to be of the form ${\\displaystyle s=1\/2+ik}$ for some value k. Because all of the non-trivial zeros are guessed to have a real part of 1\/2, this region is called the \"critical strip\". So far, all of the computed nontrivial zeros are on this line.\n\nProving or disproving the hypothesis has been very difficult, and is still troubling mathematicians to this day.\n\n## References\n\n1. Riemann, Bernhard. \"On the Number of Prime Numbers less than a Given Quantity\" (PDF).","date":"2020-01-22 12:06:56","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 15, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.9220760464668274, \"perplexity\": 232.39826287677025}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2020-05\/segments\/1579250606975.49\/warc\/CC-MAIN-20200122101729-20200122130729-00033.warc.gz\"}"} | null | null |
require_relative '../test_base'
class ProcessSpawnerTest < TestBase
def self.id58_prefix
'h9U'
end
# - - - - - - - - - - - - - - - - - - - - -
test 'S3e', %w(
a simple object-wrapper to allow instance-level stubbing
) do
r,w = IO.pipe
processor = ProcessSpawner.new
pid = processor.spawn('printf hello', out:w)
w.close
echoed = r.read
processor.detach(pid)
processor.kill(:TERM, pid)
assert_equal 'hello', echoed
end
end
| {
"redpajama_set_name": "RedPajamaGithub"
} | 2,760 |
Q: After opening iOS app "continue userActivity:" method isn't called - Firebase dynamic link I have successfully integrated Firebase dynamic links and when I click on dynamic link then my app is opening.
The issues I'm facing is after opening app from dynamic links, continue userActivity: method should be called, but nothing happens.
I've checked the all the possible thing but didn't recognised the issue.
I've searched the SO for this but none of the answer helped me.
My Code:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
GIDSignIn.sharedInstance().clientID = kGoogleSignInClientId
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
// DynamicLinks.performDiagnostics(completion: nil)
FirebaseApp.configure()
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if url.absoluteString.contains(kFBAppId) {
return FBSDKApplicationDelegate.sharedInstance().application(app, open: url, options: options)
}
if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
print(dynamicLink.url ?? URL(string: "test") as Any)
return true
}
return GIDSignIn.sharedInstance().handle(url, sourceApplication: options[.sourceApplication] as? String, annotation: options[.annotation])
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
//This method is not getting called
}
A: I don't know whether they keep their doc. up to date or not.
I have just copy-pasted the code from the Google's official Firebase dynamic link document.
Why was the continue userActivity: method is not called?
The reason is (See the difference in following method)
Copy pasted from google doc. - Wrong one
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
}
I wrote this (without copy paste from google doc.) - Correct one
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
}
I've made bold the difference.
This is what I was trying for many hours. It is really very frustrating for me to blindly trust on google doc.:-|
Hope this may help other.
A: Additional answer for those using separate SceneDelegate.swift apart from AppDelegate.swift:
This method in AppDelegate >
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if userActivity.activityType == CSSearchableItemActionType {
}
is now in SceneDelegate >
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
}
A: You need to check two times.
*
*When app. is running in the background and is opening from Link:
Delegate method is:func checkForTransferedTicket(_ userActivity: NSUserActivity) { }
*When app. is NOT running in background and is opening from Link:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession,options connectionOptions: UIScene.ConnectionOptions) { if let userActivity = connectionOptions.userActivities.first {
print(userActivity)
}
}
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 3,045 |
#region License
#endregion
using System;
using System.Text.RegularExpressions;
namespace Contoso.Primitives.Converters
{
/// <summary>
/// HostnameConverter
/// </summary>
public class HostnameConverter : ConverterBase
{
public const string HostnamePattern = @"^(?:([left-zA-Z0-9](?:[left-zA-Z0-9\-]{0,61}[left-zA-Z0-9])?\.)+([left-zA-Z]{2,6})(:\d{1,5})?)|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d{1,5})?)?$";
public class FormatAttrib { }
public class ParseAttrib { }
public HostnameConverter()
: this(new ConvertFormatter(), new ConvertParser()) { }
public HostnameConverter(IConvertFormatter formatter, IConvertParser parser)
: base(Prime.Type, Prime.FormFieldMeta, formatter, parser) { }
public class ConvertFormatter : ConvertFormatterBase<string, FormatAttrib, ParseAttrib>
{
public ConvertFormatter()
: base(Prime.Format, Prime.TryParse) { }
}
public class ConvertParser : ConvertParserBase<string, ParseAttrib>
{
public ConvertParser()
: base(Prime.TryParse) { }
}
/// <summary>
/// Prime
/// </summary>
public static class Prime
{
public static string Format(string value, FormatAttrib param)
{
return value;
}
public static bool TryParse(string text, ParseAttrib param, out string value)
{
if (string.IsNullOrEmpty(text))
{
value = string.Empty; return false;
}
// static has cached version
if (!Regex.IsMatch(text, HostnamePattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline))
{
value = string.Empty; return false;
}
value = text; return true;
}
public static Type Type
{
get { return typeof(string); }
}
public static IConvertFormFieldMeta FormFieldMeta
{
get
{
return new ConvertFormFieldMeta
{
GetBinderType = (int applicationType) => "Text",
GetMaxLength = (int applicationType) => 100,
GetSize = (int applicationType, int length) => "100",
};
}
}
}
}
} | {
"redpajama_set_name": "RedPajamaGithub"
} | 5,170 |
Рихимеки () је град у Финској, у јужном делу државе. Рихимеки је други по величини и значају град округа Ужа Тавастија, где град са окружењем чини истоимену општину Рихимеки.
Географија
Град Рихимеки се налази у јужном делу Финске. Од главног града државе, Хелсинкија, град је удаљен 70 km северно.
Рељеф: Рихимеки се сместио у југоисточном делу Скандинавије, у историјској области Тавастија. Подручје града је равничарско до брежуљкасто, а надморска висина се креће око 100 м.
Клима у Рихимекију је континентална, мада је за ово за финске услова блажа клима. Стога су зиме нешто блаже, а дуге, а лета свежа.
Воде: Рихимеки нема излаз на воду, али се око града налази низ малих језера.
Историја
Рихимеки је релативно младо насеље, које се развило око железничке станице крајем 19. века. Насеље је добило градска права 1922. године
Последњих пар деценија град се брзо развио у савремено градско насеље јужног дела државе.
Становништво
Према процени из 2012. године у Рихимекију је живело 28.065 становника, док је број становника општине био 29.053.
Етнички и језички састав: Рихимеки је одувек био претежно насељен Финцима. Последњих деценија, са јачањем усељавања у Финску, становништво града је постало шароликије. По последњим подацима преовлађују Финци (97,0%), присутни су и у веома малом броју Швеђани (0,4%), док су остало усељеници.
Види још
Списак градова у Финској
Ужа Тавастија
Референце
Спољашње везе
www.riihimaki.fi Званична страница општине Рихимеки
Градови у Финској
Википројект географија/Насеља у Финској
Ужа Тавастија | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 4,707 |
Obituary for Vynard S. Hagans | House of Wheat Funeral Home, Inc.
HAGANS, Vynard S., age 82, of Dayton, born March 13, 1937 in Redfox, Kentucky, passed away Friday, April 12, 2019. He worked at General Motors for over 30 years. He leaves to cherish his memory his sisters, Artie Christine Hagans and Ella Sue Williams; special nephew, Steven (Charise) Hagans; a host of nieces, nephews, other relatives and friends. Funeral service will be held 11 am Thursday, April 18, 2019 at the House of Wheat Funeral Home, Inc., 2107 N. Gettysburg Ave. Rev. Wilbert O. Shanklin officiating. Visitation 8:30-11 am. Family will receive friends 10-11 am. | {
"redpajama_set_name": "RedPajamaC4"
} | 457 |
{"url":"https:\/\/zbmath.org\/?q=an:1265.11093","text":"The least common multiple of a sequence of products of linear polynomials.(English)Zbl\u00a01265.11093\n\nLet $$f(x)$$ be the product of linear polynomials with integer coefficients. Extending several earlier results, the authors prove that $$\\log\\text{lcm}(f(1),\\dots,f(n))\\sim An$$ as $$n\\to\\infty$$, where $$A$$ is a constant depending only on $$f$$.\n\nMSC:\n\n 11N37 Asymptotic results on arithmetic functions 11A05 Multiplicative structure; Euclidean algorithm; greatest common divisors 11B25 Arithmetic progressions\nFull Text:\n\nReferences:\n\n [1] P. Bateman, J. Kalb and A. Stenger, A limit involving least common multiples, Amer. Math. Monthly, 109 (2002), 393\u2013394. \u00b7 Zbl\u00a01124.11300 [2] P. L. Chebyshev, Memoire sur les nombres premiers, J. Math. Pures Appl., 17 (1852), 366\u2013390. [3] B. Farhi, Nontrivial lower bounds for the least common multiple of some finite sequences of integers, J. Number Theory, 125 (2007), 393\u2013411. \u00b7 Zbl\u00a01124.11005 [4] B. Farhi and D. Kane, New results on the least common multiple of consecutive integers, Proc. Amer. Math. Soc., 137 (2009), 1933\u20131939. \u00b7 Zbl\u00a01229.11007 [5] H. Davenport, Multiplicative Number Theory, 2nd ed., Springer-Verlag (New York, 1980). \u00b7 Zbl\u00a00453.10002 [6] D. Hanson, On the product of the primes, Canad. Math. Bull., 15 (1972), 33\u201337. \u00b7 Zbl\u00a00231.10008 [7] S. Hong and G. Qian, The least common multiple of consecutive arithmetic progression terms, Proc. Edinburgh Math. Soc., 54 (2011), 431\u2013441. \u00b7 Zbl\u00a01304.11008 [8] S. Hong and Y. Yang, On the periodicity of an arithmetical function, C.R. Acad. Sci. Paris, Ser. I, 346 (2008), 717\u2013721. \u00b7 Zbl\u00a01213.11014 [9] M. Nair, On Chebyshev-type inequalities for primes, Amer. Math. Monthly, 89 (1982), 126\u2013129. \u00b7 Zbl\u00a00494.10004 [10] A. Selberg, An elementary proof of the prime-number theorem for arithmetic progressions, Canad. J. Math., 2 (1950), 66\u201378. \u00b7 Zbl\u00a00036.30605\nThis reference list is based on information provided by the publisher or from digital mathematics libraries. Its items are heuristically matched to zbMATH identifiers and may contain data conversion errors. It attempts to reflect the references listed in the original paper as accurately as possible without claiming the completeness or perfect precision of the matching.","date":"2022-07-02 15:14:10","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.7517160177230835, \"perplexity\": 735.2716496126525}, \"config\": {\"markdown_headings\": false, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2022-27\/segments\/1656104141372.60\/warc\/CC-MAIN-20220702131941-20220702161941-00759.warc.gz\"}"} | null | null |
{"url":"https:\/\/www.physicsforums.com\/threads\/solving-a-system-of-nonlinear-equations.904886\/","text":"# Solving a system of nonlinear equations\n\nThis is actually not a homework problem, but a problem I'm encountering while working on a little project and I'm not sure if it's even solvable or if it makes sense what I'm doing\n\n1. Homework Statement\n\nFirst, I have the equation\n$$p_{ij} = \\frac{1}{2}\\left( \\tanh{(-\\frac{\\theta_i + \\theta_j}{2} + 2Kp_{ij} )} + 1 \\right)$$\nwhere ##1 \\leq i,j \\leq N##. ##N## and ##K## are known quantities and ##\\theta_i, \\theta_j## are unknown.\n\n## Homework Equations\n\nThe ##N## equations are $$C_i = \\sum_{j\\neq i}p_{ij}^* = \\frac{N-1}{2} + \\frac{1}{2}\\sum_{j\\neq i} \\tanh{\\left( - \\frac{\\theta_i + \\theta_j}{2} + 2Kp_{ij}^* \\right)}$$\nwhere ##C_i## is a known quantity and ##p_{ij}^*## is the solution to the equation in the problem statement.\nI want to solve for ##\\theta_i, \\theta_j##.\n\n## The Attempt at a Solution\n\nI don't necessarily need to solve this exactly, it can be done numerically.\nI first tried to solve this problem by expanding the tanh to first order, which simply gives me a system of ##N## linear equations.\n\nI feel as if this system of equations is only solvable if instead of the ##2Kp_{ij}^*## in the argument of the tanh, I had ##2K\\sum_{j\\neq i}p_{ij}##. This way, I would have the value of ##\\sum_{j\\neq i}p_{ij}^* = C_i (\\textrm{given})## for every ##i##, I could plug this value into the tanh, and then solve for ##\\theta_i##.\n\nIs this problem solvable? Or do I not have enough information. To me it seems that I have ##N## unknown quantities (##\\theta_i##) and ##N## equations, which should be doable. or am I missing something?\n\nRelated Calculus and Beyond Homework Help News on Phys.org\nRay Vickson\nHomework Helper\nDearly Missed\nThis is actually not a homework problem, but a problem I'm encountering while working on a little project and I'm not sure if it's even solvable or if it makes sense what I'm doing\n\n1. Homework Statement\n\nFirst, I have the equation\n$$p_{ij} = \\frac{1}{2}\\left( \\tanh{(-\\frac{\\theta_i + \\theta_j}{2} + 2Kp_{ij} )} + 1 \\right)$$\nwhere ##1 \\leq i,j \\leq N##. ##N## and ##K## are known quantities and ##\\theta_i, \\theta_j## are unknown.\n\n## Homework Equations\n\nThe ##N## equations are $$C_i = \\sum_{j\\neq i}p_{ij}^* = \\frac{N-1}{2} + \\frac{1}{2}\\sum_{j\\neq i} \\tanh{\\left( - \\frac{\\theta_i + \\theta_j}{2} + 2Kp_{ij}^* \\right)}$$\nwhere ##C_i## is a known quantity and ##p_{ij}^*## is the solution to the equation in the problem statement.\nI want to solve for ##\\theta_i, \\theta_j##.\n\n## The Attempt at a Solution\n\nI don't necessarily need to solve this exactly, it can be done numerically.\nI first tried to solve this problem by expanding the tanh to first order, which simply gives me a system of ##N## linear equations.\n\nI feel as if this system of equations is only solvable if instead of the ##2Kp_{ij}^*## in the argument of the tanh, I had ##2K\\sum_{j\\neq i}p_{ij}##. This way, I would have the value of ##\\sum_{j\\neq i}p_{ij}^* = C_i (\\textrm{given})## for every ##i##, I could plug this value into the tanh, and then solve for ##\\theta_i##.\n\nIs this problem solvable? Or do I not have enough information. To me it seems that I have ##N## unknown quantities (##\\theta_i##) and ##N## equations, which should be doable. or am I missing something?\nNewton-Raphson ought to be able to do it, but getting a good starting point might be difficult. One possible way would be to start with an \"easy\"version, then gradually move to the exact version in a series of steps, using the solution of the previous step as a (hopefully) good starting point for the next step.\n\nFor example, you could start with the approximate problem in which ##C_i = \\bar{C}## for all ##i = 1,2, \\ldots, N##, with ##\\bar{C}## equal to the average of the true ##C_i## values. Then all ##p_{ij}## are equal to a common value ##p##, and all ##\\theta_i## equal some common value ##\\theta## in the solution of the approximate problem. The solution is ##p = \\bar{C}\/(N-1)## and ##\\theta## solves ##2p = 1 + \\tanh(2Kp -\\theta)##, so is easy to obtain. Then, you can work towards the numerical solution of the true problem by solving a sequence of problems with ##C_i = C_i(t) = (1-t)\\bar{C} + t C_i(\\text{true})## for a sequence of ##t##-values going from 0 to 1. The solution of the current ##t##-problem can be used as the starting point of the next-##t## problem. It might not work to go all the way from ##t=0## to ##t=1## in one step, but going in several smaller steps ought to work.\n\nLast edited:\nDougias and dumbperson\nRay Vickson\nHomework Helper\nDearly Missed\nThis is actually not a homework problem, but a problem I'm encountering while working on a little project and I'm not sure if it's even solvable or if it makes sense what I'm doing\n\n1. Homework Statement\n\nFirst, I have the equation\n$$p_{ij} = \\frac{1}{2}\\left( \\tanh{(-\\frac{\\theta_i + \\theta_j}{2} + 2Kp_{ij} )} + 1 \\right)$$\nwhere ##1 \\leq i,j \\leq N##. ##N## and ##K## are known quantities and ##\\theta_i, \\theta_j## are unknown.\n\n## Homework Equations\n\nThe ##N## equations are $$C_i = \\sum_{j\\neq i}p_{ij}^* = \\frac{N-1}{2} + \\frac{1}{2}\\sum_{j\\neq i} \\tanh{\\left( - \\frac{\\theta_i + \\theta_j}{2} + 2Kp_{ij}^* \\right)}$$\nwhere ##C_i## is a known quantity and ##p_{ij}^*## is the solution to the equation in the problem statement.\nI want to solve for ##\\theta_i, \\theta_j##.\n\nIs this problem solvable? Or do I not have enough information. To me it seems that I have ##N## unknown quantities (##\\theta_i##) and ##N## equations, which should be doable. or am I missing something?\nMy response in #2 was a bit too hasty.\n\nFor ##N = 2## there is either no solution or infinitely many solutions. Letting ##\\theta_i \/2 = u_i##, the system for ##N=2## reads as\n$$\\begin{array}{ccl}2 p_{12} &=& 1 + \\tanh( 2 K p_{12} - u_1-u_2)\\\\ 2 p_{21} &=& 1 + \\tanh( 2 K p_{21} - u_2 - u_2) \\\\ C_1 &=& p_{12} \\\\ C_2 &=& p_{21} \\end{array}$$\nThe first two equations are the same, so ##p_{12} = p_{21} = p.## Then the last two equations read as ##C_1 = p## and ##C_2 = p.## If ##C_1 \\neq C_2## the system has no solution; if ##C_1 = C_2 = C## then we have ##p = C##, and the first equation gives a simple solution for ##u_1 + u_2##. However, we cannot obtain ##u_1## and ##u_2## separately.\n\nFor ##N = 3## we can get an exact, complete solution. First, the ##p_{ij}## equations imply that ##p_{ij} = p_{ji}##, so we have three ##p##-variables ##p_{12}, p_{13}, p_{23}##. The ##p##-##C## equations read as\n$$\\begin{array}{ccc} p_{12}+p_{13} &=& C_1\\\\ p_{12}+p_{23} &=& C_2 \\\\ p_{13} + p_{23} &=& C_3 \\end{array}$$\nFor given ##C_i## this system has a unique solution for ##p_{12}, p_{13}, p_{23}##, and getting it is just a matter of elementary algebra.\n\nNow each ##u_i + u_j## can be determined by solving the equations connecting the ##p##'s to the ##u##'s:\n$$u_i + u_j = 2Kp_{ij} -\\text{arctanh}(2 p_{ij}-1),$$\nfor ##ij = 12, 13, 23.## In a way similar to the ##p##-##C## equations, these last three equations also have a unique solution that can be obtained by elementary (but increasingly messy) algebra.\n\nFor ##N \\geq 4## I think you need to start using numerical methods, and you have the correct number of equations and variables to make it probable that the problem is solvable.\n\ndumbperson\nMy response in #2 was a bit too hasty.\n...\n.\n\nharuspex\nHomework Helper\nGold Member\nthe ##p_{ij}## equations imply that ##p_{ij} = p_{ji}##\nI can see how to show that if K<1 (any N), but how do you show it generally?\n\nRay Vickson\nHomework Helper\nDearly Missed\nI can see how to show that if K<1 (any N), but how do you show it generally?\nGood point: for some ##K > 1## and some ##\\theta_i, \\theta_j## there are three positive roots to the equation\n$$2x = 1 + \\tanh(2*K*x -(\\theta_i + \\theta_j)\/2),$$\nso we could have ##p_{ij}## equal to one of the roots and ##p_{ji}## equal to one of the others. However, I don't see any way of handling such a situation numerically, since requiring two ##p##s to be two separate numerical roots of some common equation is not something that can be implemented in any way that I can see. If we did have multi-armed formulas for the ##p##s, we could set one ##p## to one arm of those formulas and the other ##p## to another arm, but if all we have are numerical methods, I think we are out of luck.\n\nHowever, at least we can say that there exists a solution in which ##p_{ij} = p_{ji}## for all ##i \\neq j.## However, the possible existence of multiple roots---even in this case---could cause real problems for a nonlinear solver such as Newton-Raphson, so it is probably even more important than I first hinted at to sneak up on a solution by small steps from some easily-solved starting approximation.\n\nFor the OP: the method I suggested to solve a sequence of problems in working towards the true solution is a well-known technique that falls under the general title of \"homotopy method\". There is a large literature on this topic, and a Google search under \"homotopy method for nonlinear equations\" will lead you to numerous relevant sources.\n\nLast edited:\ndumbperson\nMy response in #2 was a bit too hasty.\n\nFor ##N \\geq 4## I think you need to start using numerical methods, and you have the correct number of equations and variables to make it probable that the problem is solvable.\nHey Ray,\n\nIn general, we have ##N(N-1)\/2## different ##p_{ij}## variables, correct? But we have ##N## amount of ##p-C## equations. So we have the right amount of equations \/ variables if ##N(N-1)\/2 = N##, which is true for ## N =3 ##. Am I missing something or is this then not solvable if ##N\\neq 3## ?\n\nLast edited:\nHey Ray,\n\nIn general, we have ##N(N-1)\/2## different ##p_{ij}## variables, correct? But we have ##N## amount of ##p-C## equations. So we have the right amount of equations \/ variables if ##N(N-1)\/2 = N##, which is true for ## N =3 ##. Am I missing something or is this then not solvable if ##N\\neq 3## ?\nAh, after solving the ##p-C## equations, we have ##N(N-1)\/2 - N## unknown ##p_{ij}## variables left. In total (with the ##u_i##), we have ##N(N-1)\/2 - N + N = N(N-1)\/2 ## unknown variables left. We have ##N(N-1)\/2## equations that connect the ##p##'s to the ##u##'s, so it should be solvable numerically, I guess","date":"2020-07-09 02:45:13","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.869498610496521, \"perplexity\": 1083.375958492299}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2020-29\/segments\/1593655897844.44\/warc\/CC-MAIN-20200709002952-20200709032952-00343.warc.gz\"}"} | null | null |
Hundreds of thousands of expatriates like you trust SpeedyPin Phone Cards to keep in touch with family and friends for less. At SpeedyPin, Expats will find superior phone cards with cheap international rates backed by our 100% Guarantee. Make international calls from the USA for as low as 0.6¢/min.
TIP: Use a prepaid phone card to make international calls from your USA cell phone because the rates can be significantly lower than your carrier's international rates. | {
"redpajama_set_name": "RedPajamaC4"
} | 8,574 |
\section{Introduction}
The connection between the theory of integrable systems and numerical algorithms related to the Pad\'{e} approximants~\cite{Brezinski-CFPA,Brezinski,Gragg} was observed many times since the first papers on the subject~\cite{Moser,ChCh,GRP,PGR,PGR-LMP,Hirota-1993}, see also more recent works \cite{NagaiTokihiroSatsuma,BrezinskiHeHuRedivo-ZagliaSun,HeHuSunWeniger,Brezinski-CA-XX,BrezinskiRedivo-Zaglia,NagaoYamada}. According to authors of \cite{CHHL} \emph{the connection between convergence acceleration algorithms and integrable systems brings a different and fresh look to both domains and could be of benefit to them.} Due to the Hankel (or Toeplitz) structure of determinants used in the Pad\'{e} theory constructions, there exists close connection of the subject with the theory of orthogonal polynomials~\cite{Ismail}.
It is well known (see for example recent textbook~\cite{IDS} where the relationship of discrete integrable systems to Pad\'{e} approximants is discussed in detail) that the relation can be described via the discrete-time Toda chain equations~\cite{Hirota-2dT} which is in fact one of the Frobenius identities~\cite{Baker} found long time ago. The subclass of solutions of the discrete-time Toda chain equations relevant in the Pad\'{e} theory is given by restriction to half-infinite chain. In the literature there are known also other special solutions of the equations, like the finite or periodic chain reductions, or infinite chain soliton solutions. Even more developed theory exists for its continuous time version~\cite{Toda-TL,Moser,Berezansky}.
The aforementioned Toda chain equations can be obtained as a particular integrable reduction of the Hirota discrete Kadomtsev--Petviashvili (KP) system~\cite{Hirota}, published initially under the name of \emph{discrete analogue of a generalized Toda equation}. Such a reduction can be applied also on the finite field level~\cite{Bialecki-1DT,BialeckiDoliwa}. We would like to stress that the Hirota system plays distinguished role in the theory of integrable systems and their applications~\cite{Miwa,Shiota,FWN-Capel,KNS-rev}. In particular, it is known that majority of known integrable systems can be obtained as its reductions and/or approporiate continuous limits~\cite{Zabrodin} or subsystems \cite{Doliwa-Des-red,doliwakp}. Moreover, the non-commutative version of the Hirota system~\cite{Nimmo-NCHM}, its $A$-root lattice symmetry structure~\cite{Dol-AN} and geometric interpretation~\cite{Dol-Des} allow to study integrable systems from additional perspectives. The geometric approach to discrete soliton equations initiated in \cite{BP1,DS-AL,BP2,DCN,MQL}, see also \cite{BobSur}, often allows to formulate crucial properties of such systems in terms of incidence geometry statements and provides a meaning for various involved calculations. The integrable systems in non-commutative variables are of special interest recent years~\cite{EGR,Kupershmidt,BobenkoSuris-NC,DMH,RetakhRubtsov,GilsonNimmo,Kondo,LiNimmo,DoliwaKashaev,DoliwaNoumi}. They link, in particular, the classical integrable systems with quantum integrability.
Having in mind the \emph{substantial practical advantage}~\cite{Baker} of the Wynn recurrence~\cite{Wynn} in the theory of Pad\'{e} approximants, we asked initially about its place within the integrable systems theory. In~\cite{IDS}, in regard for this subject its authors refer to the paper \cite{KR-M-X}, where the recurrence is obtained by application of the reduction group method to the Lax--Darboux schemes associated with nonlinear
Schr\"{o}dinger type equations. We would like also to point
another recent work~\cite{Kels} where multidimensional consistency approach was applied, among others, to the Wynn recurrence.
Our answer for the question is that the recurrence can be obtained, in full analogy with the derivation of the discrete-time Toda equations from the Hirota system, as a symmetry reduction of the discrete KP equation in its Schwarzian form. Having known the geometric meaning of the discrete Schwarzian KP equation~\cite{DoliwaKosiorek} this result points out towards the corresponding geometric interpretation of the recurrence itself. Because the projective geometric meaning is valid also in the arbitrary skew field case, then one can ask about validity of the recurrence and the Pad\'{e} approximation for the non-commutative series and the corresponding non-commutative rational functions. Fortunately, a substantial part of such theory can be found in the literature~\cite{Draux-rev,Draux-OP-PA,Draux}. Moreover, studies of the non-commutative Pad\'{e} approximants with the help of quasideterminants, which replace determinants in the non-commutative linear algebra, have been initiated already~\cite{Quasideterminants-GR1,Quasideterminants,NCSF}. We supplement this approach by deriving in such a formalism the non-commutative analogs of the basic Frobenius identities. This allows us to construct the non-commutative version of the discrete-time Toda chain equations together with the corresponding linear problem, what enables to investigate integrability of the system. We therefore obtain the Wynn recurrence within that full integrability scheme. As an application of the non-commutative Pad\'{e} approximants we studied the characteristic series of the Fibonacci language, which is the paradygmatic example of a regular language. We also found that the same reduction of the discrete Schwarzian KP equation, but in the complex field case~\cite{KoSchief-Men}, was investigated in connection with the theory of circle packings and discrete analytic functions~\cite{Schramm,BobenkoPinkall-DSIS}. Our paper connects therefore two approximation problems, whose relation was not known before. We supplement also previously known generation of the packings by discussion of the generic initial boundary data and related consistency of the construction to the tangential Miquel theorem.
The structure of the paper is as follows. In Section~\ref{sec:q-det} we present the non-commutative Pad\'{e} theory in terms of quasideterminants and we give its application to the characteristic series of the Fibonacci language. In the first part of Section~\ref{sec:q-det-F} we derive, staying still within the quasideterminantal formalism, the non-commutative analogs of basic Frobenius identities. Then we abandon such particular interpretation of the equations and study them within more general context of lattice integrable systems. They become the non-commutative discrete-time Toda chain equations and their linear problem. Section~\ref{sec:nc-W-r} is devoted exclusively to the non-commutative Wynn recurrence. We first show how its solution can be constructed from solutions of the linear problem introduced previously. Then we present its geometric meaning within the context of projective line over arbitrary skew field. We also show how it can be derved as a dimensional dimensional symmetry reduction of the non-commutative discrete Kadomtsev--Petviashvili equation in its Schwarzian form. In the final Section~\ref{sec:W-circle} we present conformal geometry meaning of the complex field version of the Wynn recurrence.
Througout the paper we assume that the Reader knows basic elements of the Pad\'{e} approximation theory, as covered for example in the first part of~\cite{Baker}.
\section{Non-commutative Pad\'{e} approximants and quasideterminants} \label{sec:q-det}
Pad\'{e} approximants of series in non-commuting symbols were studied in \cite{Draux-rev,Draux-OP-PA,Draux}. The analogy with the commutative case became even more direct when the quasideterminants~\cite{Quasideterminants-GR1,Quasideterminants}, which replace the standard determinants in the non-commutative linear algebra, have been applied \cite{NCSF} to investigate their properties. We first recall the relevant properties of the quasideterminants needed in that context. Then we give an appliaction of the theory to study regular languages on example of the characteristic series of the Fibonacci language.
\subsection{Quasideterminants}
\label{sec:CF-Q}
In this Section we recall, following~\cite{Quasideterminants-GR1} the definition and basic properties of quasideterminants.
\begin{Def}
Given square matrix $X=(x_{ij})_{i,j=1,\dots,n}$ with formal entries $x_{ij}$. In the free division ring~\cite{Cohn} generated by the set $\{ x_{ij}\}_{i,j=1,\dots,n}$ consider the formal inverse matrix $Y=X^{-1}= (y_{ij})_{i,j=1,\dots,n}$ to $X$.
The $(i,j)$th quasideterminant $|X|_{ij}$ of $X$ is the inverse $(y_{ji})^{-1}$ of the $(j,i)$th element of $Y$.
\end{Def}
Quasideterminants can be computed using the following recurrence relation. For $n\geq 2$ let $X^{ij}$ be the square matrix obtained from $X$ by deleting the $i$th row and the $j$th column (with index $i/j$ skipped from the row/column enumeration), then
\begin{equation} \label{eq:QD-exp}
|X|_{ij} =
x_{ij} - \sum_{\substack{ i^\prime \neq i \\ j^\prime \neq j }} x_{i j^\prime} |X^{ij}|_{i^\prime j^\prime }^{-1} x_{i^\prime j}
\end{equation}
provided all terms in the right-hand side are defined.
Sometimes it is convenient to use the following more explicit notation
\begin{equation}
|X|_{ij} = \left| \begin{matrix}
x_{11} & \cdots & x_{1j} & \cdots & x_{1n} \\
\vdots & & \vdots & & \vdots \\
x_{i1} & \cdots & \boxed{x_{ij}} & \cdots & x_{in} \\
\vdots & & \vdots & & \vdots \\
x_{n1} & \cdots & x_{nj} & \cdots & x_{nn}
\end{matrix} \right| .
\end{equation}
To study non-commutative Pad\'{e} approximants we will need several properties of quasideterminats, which we list below:
\begin{itemize}
\item row and column operations,
\item homological relations,
\item Sylvester's identity.
\end{itemize}
\subsubsection{Row and column operations}
(i) The quasideterminant $|X|_{ij}$ does not depend on permutations of rows and columns in the matrix $X$ that do not involve the $i$th row and the $j$th column.
(ii) Let the matrix $\tilde{X}$ be obtained from the matrix $X$ by multiplying the $k$th row by the element $\lambda$ of the division ring from the left, then
\begin{equation}
|\tilde{X}|_{ij} = \begin{cases} \lambda|X|_{ij} & \text{if} \quad i = k, \\
|X|_{ij} & \text{if} \quad i\neq k \quad \text{and} \; \lambda \; \text{is invertible} . \end{cases}
\end{equation}
(iii) Let the matrix $\hat{X}$ be obtained from the matrix $X$ by multiplying the $k$th column by the element $\mu$ of the division ring from the right, then
\begin{equation}
|\hat{X}|_{ij} = \begin{cases} |X|_{ik} \, \mu & \text{if} \quad j = k, \\
|X|_{ij} & \text{if} \quad j\neq k \quad \text{and} \; \mu \; \text{is invertible} . \end{cases}
\end{equation}
(iv)
Let the matrix $\tilde{X}$ is constructed by adding to some row of the matrix $X$ its $k$th row multiplied by a scalar $\lambda$ from the left, then
\begin{equation}
|X|_{ij} = |\tilde{X}|_{ij}, \qquad i = 1, \dots , k-1, k+1, \dots , n, \quad j=1,\dots , n.
\end{equation}
(v) Let the matrix $\hat{X}$ is constructed by addition to some column of the matrix $X$ its $l$th column multiplied by a scalar $\mu$ from the right, then
\begin{equation}
|X|_{ij} = |\hat{X}|_{ij}, \qquad i = 1, \dots , n, \quad j=1,\dots , l-1, l+1 , \dots ,n.
\end{equation}
\subsubsection{Homological relations}
(i) Row homological relations:
\begin{equation}
-|X|_{ij} \cdot |X^{i k}|_{sj}^{-1} = |X|_{ik} \cdot |X^{ij}|_{sk}^{-1}, \qquad s\neq i.
\end{equation}
(ii) Column homological relations:
\begin{equation} \label{eq:chr}
- |X^{kj}|_{is}^{-1} \cdot |X|_{ij}= |X^{ij}|_{ks}^{-1} \cdot |X|_{kj} , \qquad s\neq j.
\end{equation}
\subsubsection{Sylvester's identity}
Let $X_0 = (x_{ij})$, $i,j = 1,\dots ,k$, be a submatrix of $X$ that is invertible. For $p,q = k+1,\dots ,n$, set
\begin{equation*}
c_{pq} = \begin{vmatrix}
&&& x_{1q} \\
& X_0 & & \vdots\\
&&& x_{kq} \\
x_{p1} & \dots & x_{pk} & \boxed{x_{pq}}
\end{vmatrix} \; ,
\end{equation*}
and consider the $(n-k) \times (n-k)$ matrix $C = (c_{pq})$, $p,q = k+1,\dots , n$. Then for $i,j = k+1,\dots , n$,
\begin{equation}
|X|_{ij} = |C|_{ij} \; .
\end{equation}
In applications Sylvester's identity is usually used in conjunction with row/column permutations.
\subsection{Pad\'{e} approximants of non-commutative series in terms of quasideterminants} \label{sec:ncP}
The results presented below were given in \cite{NCSF}.
Consider a noncommutative formal series
\begin{equation}
F(t) = S_0 + S_1 t + S_2 t^2 + \dots + S_n t^n + \dots ,
\end{equation}
where the parameter $t$ commutes with the coefficients $S_i$, $i=0,1,2,.\dots $. Set
\begin{equation}
F_k(t) = S_0 + S_1 t + \dots + S_k t^k,
\end{equation}
as its polynomial of degree $k$ truncation, where also by definition $F_k(t) = 0 $ for $k<0$. Define polynomials
\begin{equation} \label{eq:PQ-P}
P_{m,n}(t) = \left| \begin{matrix}
\boxed{F_m(t)} & S_{m+1} & \cdots & S_{m+n} \\
t F_{m-1}(t) & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
t^n F_{m-n}(t) & S_{m-n+1} &\cdots & S_m
\end{matrix} \right| , \quad
Q_{m,n}(t) = \left| \begin{matrix}
\boxed{1} & S_{m+1} & \cdots & S_{m+n} \\
t & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
t^n & S_{m-n+1} &\cdots & S_m
\end{matrix} \right| ,
\end{equation}
of degrees $m$ and $n$ in parameter $t$, respectively. Then the fraction $Q_{m,n}(t)^{-1} P_{m,n}(t) = [m/n]_L$ agrees with $F(t)$ up to terms of order $m+n$ inclusively
\begin{equation} \label{eq:QFP}
Q_{m,n}(t) F(t) = P_{m,n}(t) + O(t^{m+n+1}).
\end{equation}
The proof is based on expanding the left hand side of \eqref{eq:QFP} in powers of $t$ and checking that the coefficients, by formula \eqref{eq:QD-exp}, can be nicely written in terms of certain quasideterminants. The quasideterminants, which multiply $t^k$, $k=0,\dots , m$, coincide with the corresponding coefficients of $P_{m,n}(t)$, while the quasideterminats which multiply $t^k$, $k=m+1,\dots , m+n$, vanish (their matrices have two columns identical).
\begin{Rem}
There exist analogous quasideterminantal expressions for Pad\'{e} approximants $[m/n]_R$ with denominators on the right side. The matrices of quasideterminants representing the polynomials of the new nominator and denominator are transpose of those given by \eqref{eq:PQ-P}.
\end{Rem}
\subsection{The Fibonacci language} \label{sec:Fib}
Consider the language over alphabet $\{ a,b \}$ consisting of words with two consecutive letters $b$ prohibited. Its characteristic series
\begin{equation}
F = 1 + a + b + aa + ab + ba + aaa + aab + aba + baa + bab + \dots
\end{equation}
where $1$ represents the empty word, can be read-out from the corresponding deterministic finite state automaton \cite{Berstel-Reutenauer,Sakarovitch} visualized on Figure~\ref{fig:Fibonacci-a}.
\begin{figure}[h!]
\includegraphics[width=4cm]{Fibonacci-automaton.pdf}
\caption{Deterministic finite state automaton accepting the Fibonacci language}
\label{fig:Fibonacci-a}
\end{figure}
In terms of the initial state labeled by $1$, the final states $1$ and $2$, and the transition matrix whose elements are given by labels of the edges of the automaton graph, the chracteristic series is given by
\begin{equation}
F = \left( \begin{array}{cc} 1 & 0 \end{array} \right)
\left( \begin{array}{cc} a & b \\ a & 0 \end{array} \right)^* \left( \begin{array}{c} 1 \\ 1 \end{array} \right) ,
\end{equation}
were for a square matrix $M$ its Kleene's star $M^*$ is defined as
\begin{equation}
M^* = I + M + M^2 + M^3 + \dots = (I-M)^{-1}.
\end{equation}
The series can be represented by the corresponding non-commutative rational function expression
\begin{equation}
F = [1-(a+ba)]^{-1}(1+b).
\end{equation}
In order to apply the Pad\'{e} approximation technique in quasideterminantal formalism let us split the characteristic series into homogeneous terms by the transformation $a\mapsto at$, $b\mapsto bt$ what gives the formal series $F(t)$ with coefficients $S_k$ being the formal sum of the Fibonacci words of length $k$. They satisfy the following recurrence relations (which can be also read off from the automaton)
\begin{equation} \label{eq:rec-Fib}
S_0 = 1, \quad S_1 = a+b, \quad S_k = a S_{k-1} + ba S_{k-2} = S_{k-1} a + S_{k-2}ab, \qquad k> 1,
\end{equation}
i.e., after/before the letter $a$ there can be $a$ or $b$, while after/before the letter $b$ there can be only the letter~$a$.
Recall that the number $f_k$ of the Fibonacci words of length $k$ satisfies the well known recurrence relation (transform $S_k$ to $f_k$ using the substitution $a\mapsto 1$, $b\mapsto 1$)
\begin{equation} \label{eq:fib-rec}
f_0 = 1, \quad f_1 = 2, \quad f_{k} = f_{k-1} + f_{k-2}, \qquad k>1.
\end{equation}
The corresponding generating function
\begin{equation}
f(t) = \sum_{k=0}^\infty f_k t^k,
\end{equation}
which can be found using the recurrence \eqref{eq:fib-rec}, reads
\begin{equation}
f(t) = \frac{1+t}{1-t-t^2} = 1 + 2t + 3 t^2 + 5 t^3 + \dots \, ,
\end{equation}
and coincides with $[1/2]$ Pad\'{e} approximation of the series.
Using the row and column operations applied to the quasideterminants \eqref{eq:PQ-P} representing the nominator and the denominator of the left Pad\'{e} approximant $[1/2]_L$ we obtain
\begin{equation}
P_{1,2}(t) = 1 + bt, \qquad Q_{1,2}(t) = 1 - at - ba t^2.
\end{equation}
Their ratio agrees with the series $F(t)$ due to the formula (for more details on topology in the space of formal series see~\cite{Sakarovitch})
\begin{equation}
(1 - at - ba t^2)^{-1} (1 + bt) = F_n(t) +
(1 - at - ba t^2)^{-1}(t^{n+1}S_{n+1} + t^{n+2}ba S_n),\quad n\geq 0,
\end{equation}
what can be shown inductively using the recurrence \eqref{eq:rec-Fib}.
\begin{Cor} Because we started with the rational series then $[m/n]_L = [1/2]_L$ for $m\geq 1$ and $n\geq 2$. In particular, formulas \eqref{eq:PQ-P} give
\begin{align}
P_{m,2}(t) = (-1)^{m-1} P_{1,2}(t), & \qquad Q_{m,2}(t) = (-1)^{m-1} Q_{1,2}(t), & & m \geq 1 ,\\
P_{1,n}(t) = P_{1,2}(t), &\qquad Q_{1,n}(t) = Q_{1,2}(t) , & &n \geq 2, \\
P_{m,n} (t) = 0, & \qquad Q_{m,n}(t) = 0 , & m > 1 \quad & \text{and} \quad n >2.
\end{align}
\end{Cor}
\begin{Rem}
Similar results can be obtained for right Pad\'{e} approximants of the series, where
\begin{equation}
[1/2]_R = (1+bt)(1-at - ab t^2)^{-1}.
\end{equation}
\end{Rem}
\begin{Rem}
Fibonacci language is a paradigmatic example of a regular (called also rational) language~\cite{Berstel-Reutenauer,Sakarovitch}. The reasoning above applies, in principle, also to other such languages.
\end{Rem}
\section{Quasideterminantal analogs of the Frobenius identities} \label{sec:q-det-F}
In this Section we derive certain recurrences which will play the role of the Frobenius identities~\cite{Baker}.
We use the notation introduced in Section~\ref{sec:ncP}.
\subsection{Non-commutative discrete-time Toda chain equations}
The central role in what follows is played by the following quasideterminant
\begin{equation}
\rho_{m,n} = \left| \begin{matrix}
\boxed{S_m} & S_{m+1} & \cdots & S_{m+n} \\
S_{m-1} & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
S_{m-n} & S_{m-n+1} &\cdots & S_m
\end{matrix} \right| \; ,
\end{equation}
which in the \emph{commutative} case reduces to the ratio
\begin{equation} \label{eq:rho-D}
\rho_{m,n} = \frac{\Delta_{m,n+1}}{\Delta_{m,n}}, \qquad
\Delta_{m,n} = \left| \begin{matrix}
S_m & S_{m+1} & \cdots & S_{m+n-1} \\
S_{m-1} & S_m & \cdots & S_{m+n-2} \\
\vdots & \vdots & \ddots & \vdots \\
S_{m-n+1} & S_{m-n+2} &\cdots & S_m
\end{matrix} \right| \; ,
\end{equation}
of the determinants, which play in turn central role in the theory of the Pad\'{e} approximants.
\begin{Th}
The quasideterminants $\rho_{m,n}$ satisfy the nonlinear equation
\begin{equation} \label{eq:nc-D-T}
\rho_{m+1,n} \left( \rho_{m,n-1}^{-1} - \rho_{m,n}^{-1} \right) \rho_{m-1,n} = \rho_{m,n+1} - \rho_{m,n},
\end{equation}
which in the commutative case is a consequence of the Frobenius identity~\cite{Baker}
\begin{equation} \label{eq:D-T}
\Delta_{m,n}^2 = \Delta_{m+1,n} \Delta_{m-1 ,n} + \Delta_{m,n+1} \Delta_{m,n-1}.
\end{equation}
\end{Th}
\begin{Rem}
In the theory of integrable systems equation \eqref{eq:D-T} is called the discrete-time Toda chain equation~\cite{Hirota-2dT} in bilinear form.
\end{Rem}
\begin{proof}
For the purpose of the proof denote $\rho^1_{m,n} = \rho_{m,n}$, while
\begin{equation*}
\rho^2_{m,n} = \left| \begin{matrix}
S_m & \cdots & \boxed{S_{m+n}} \\
\vdots & \ddots & \vdots \\
S_{m-n} &\cdots & S_m
\end{matrix} \right| \; ,
\quad
\rho^3_{m,n} = \left| \begin{matrix}
S_m & \cdots & S_{m+n} \\
\vdots & \ddots & \vdots \\
\boxed{S_{m-n}} &\cdots & S_m
\end{matrix} \right| \; , \quad
\rho^4_{m,n} = \left| \begin{matrix}
S_m & \cdots & S_{m+n} \\
\vdots & \ddots & \vdots \\
S_{m-n} &\cdots & \boxed{S_m }
\end{matrix} \right| \; .
\end{equation*}
Application of Sylvester's identity to quasideterminants of the matrix
\begin{equation*}
X = \begin{pmatrix}
S_m & S_{m+1} & \cdots & S_{m+n+1} \\
S_{m-1} & S_m & \cdots & S_{m+n} \\
\vdots & \vdots & \ddots & \vdots \\
S_{m-n-1} & S_{m-n} &\cdots & S_m
\end{pmatrix} \; ,
\end{equation*}
with repect to rows $p_1 = 1$, $p_2 = n+2$, and columns
$q_1 = 1$, $q_2 = n+2$, gives (among others)
\begin{align} \label{eq:rho-1234}
\rho^1_{m,n+1} = & \rho^1_{m,n} - \rho^2_{m+1 , n} \left( \rho^4_{m,n} \right)^{-1} \rho^3_{m-1,n} ,\\
\rho^3_{m,n+1} = & \rho^3_{m-1,n} - \rho^4_{m,n} \left( \rho^2_{m+1,n} \right)^{-1} \rho^1_{m,n}.
\end{align}
Eliminating $\rho^2_{m+1 , n} \left( \rho^4_{m,n} \right)^{-1} $ from the above equations we obtain
\begin{equation} \label{eq:rho-1-3}
\rho^3_{m,n+1} = \rho^3_{m-1,n} \left( \rho^1_{m,n+1} - \rho^1_{m,n} \right)^{-1} \rho^1_{m,n+1} .
\end{equation}
From the other hand, the column homological relations \eqref{eq:chr} when applied to $X$ and indices $i=n+2$, $j=1$, $k=1$ and $s=2$ give
\begin{equation} \label{eq:chr-1-3}
-\left( \rho^3_{m,n}\right)^{-1} \rho^3_{m,n+1} = \left( \rho^1_{m+1,n}\right)^{-1} \rho^1_{m,n+1}.
\end{equation}
Elimination of $\rho^3_{m,n}$ from equations \eqref{eq:rho-1-3} and \eqref{eq:chr-1-3} leads to the non-commutative discrete-time Toda chain equation~\eqref{eq:nc-D-T}.
Finally, by substituting in the commutative case expression \eqref{eq:rho-D} into equation~\eqref{eq:nc-D-T} we obtain
\begin{equation*}
\frac{ \Delta_{m,n+1} \Delta_{m,n-1} - \Delta_{m,n}^2}{\Delta_{m+1,n} \Delta_{m-1 ,n}} =
\frac{ \Delta_{m,n+2} \Delta_{m,n} - \Delta_{m,n+1}^2}{\Delta_{m+1,n+1} \Delta_{m-1 ,n+1}} .
\end{equation*}
which is immediate consequence of the discrete-time Toda chain equation~\eqref{eq:D-T}.
\end{proof}
\begin{Rem}
Also other quasideterminants $\rho^i_{m,n}$, $i = 2,3,4$, in the commutative case reduce to ratios of the determinats $\Delta_{m,n}$, in particular
\begin{equation}
\rho^3_{m,n} = (-1)^{n+2} \; \frac{\Delta_{m,n+1}}{\Delta_{m+1,n}}.
\end{equation}
\end{Rem}
\begin{Ex}
Going back to the Fibonacci language of Section~\ref{sec:Fib} one can check that in such case
$\rho_{1,1} = b^2(a+b)^{-1}$, $\rho_{1,2+\ell} = \rho_{1,2} = b$ for $\ell\geq 0$, and $\rho_{1+k,1+\ell}= 0$ for $k>0$ and $\ell>0$.
\end{Ex}
\subsection{Non-commutative analogs of Frobenius identities involving the polynomials}
Other Frobenius identities of the classical commutative theory involve the nominator $p_{m,n}(t)$ or denominator $q_{m,n}(t)$ of the Pad\'{e} approximants
\begin{equation}
p_{m,n}(t) = \left| \begin{matrix}
F_m(t) & S_{m+1} & \cdots & S_{m+n} \\
t F_{m-1}(t) & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
t^n F_{m-n}(t) & S_{m-n+1} &\cdots & S_m
\end{matrix} \right| ,
\quad q_{m,n}(t) = \left| \begin{matrix}
1 & S_{m+1} & \cdots & S_{m+n} \\
t & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
t^n & S_{m-n+1} &\cdots & S_m
\end{matrix} \right| .
\end{equation}
Their relation to the previous expressions follow from definition of the quasideterminants (for commuting symbols) and are given by
\begin{equation}
p_{m,n}(t) = P_{m,n}(t) \Delta_{m,n}, \qquad
q_{m,n}(t) = Q_{m,n}(t) \Delta_{m,n}.
\end{equation}
Below we present the non-commutative variants of the Frobenius identities
\begin{align}
\Delta_{m,n+1} w_{m+1,n+1}(t) - \Delta_{m+1,n+1} w_{m,n+1}(t) & = t \Delta_{m+1,n+2} w_{m,n}(t), \\
\Delta_{m,n+1} w_{m+1,n}(t) - \Delta_{m+1,n}w_{m,n+1}(t) & = t \Delta_{m+1,n+1} w_{m,n}(t),
\end{align}
satisfied by any linear combination $w_{m,n}(t)$ of $p_{m,n}(t)$ and $q_{m,n}(t)$.
\begin{Th}
For arbitrary non-commutative formal power series $\lambda(t)$, and $\mu(t)$ the (right) linear combination
\begin{equation}
W_{m,n}(t) = P_{m,n}(t) \lambda(t) + Q_{m,n}(t) \mu(t),
\end{equation}
satifies equations
\begin{align} \label{eq:F-W-1t}
W_{m+1,n+1}(t) - W_{m,n+1}(t) & = t \rho_{m+1,n+1}\rho^{-1}_{m,n} W_{m,n}(t),\\
\label{eq:F-W-2t}
W_{m+1,n}(t) - W_{m,n+1}(t) & = t \rho_{m+1,n}\rho^{-1}_{m,n} W_{m,n}(t) .
\end{align}
\end{Th}
\begin{proof}
We will show the result for $W_{m,n}(t)$ being either $P_{m,n}(t)$ or $Q_{m,n}(t)$, because then the conclusion follows from linearity of the equations. We can write
\begin{equation} \label{eq:W-P}
W_{m,n}(t) = \left| \begin{matrix}
\boxed{C_m(t)} & S_{m+1} & \cdots & S_{m+n} \\
t C_{m-1}(t) & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
t^n C_{m-n}(t) & S_{m-n+1} &\cdots & S_m
\end{matrix} \right|,
\end{equation}
where $C_k(t) = F_k(t)$ when $W_{m,n}(t) = P_{m,n}(t)$, and $C_k(t) = 1$ when $W_{m,n}(t) = Q_{m,n}(t)$, for all $k\in{\mathbb Z}$. The possibility of applying the same proof follows form the observation that in both cases we have
\begin{equation} \label{eq:W-k-P}
W_{m,n}(t) = \left| \begin{matrix}
\boxed{C_{m+i}(t)} & S_{m+1} & \cdots & S_{m+n} \\
t C_{m-1+i}(t) & S_m & \cdots & S_{m+n-1} \\
\vdots & \vdots & \ddots & \vdots \\
t^n C_{m-n+i}(t) & S_{m-n+1} &\cdots & S_m
\end{matrix} \right|, \qquad i = 0, \dots , n.
\end{equation}
For the denominators this is trivial, and for the nominators it can be shown using column operations.
Application of Sylvester's identity to the matrix
\begin{equation}
\begin{pmatrix}
C_{m+1}(t) & S_{m+2} & \cdots & S_{m+n+2} \\
t C_{m}(t) & S_{m+1} & \cdots & S_{m+n+1} \\
\vdots & \vdots & \ddots & \vdots \\
t^{n+2} C_{m-n}(t) & S_{m-n+1} &\cdots & S_{m+1}
\end{pmatrix} ,
\end{equation}
with rows $p_1 = 1$, $p_2 = n+2$ and columns $q_1 = 1$, $q_2 = n+2$ gives
\begin{equation}
W_{m+1,n+1}(t) = W_{m+1,n}(t) + t \rho^2_{m+2,n}(\rho^{4}_{m+1,n})^{-1} \rho^3_{m,n-1} (\rho^1_{m+1,n-1})^{-1} W_{m,n}(t),
\end{equation}
where the homological column relations were also used. Equation~\eqref{eq:rho-1234} allows then to write
\begin{equation} \label{eq:W-F-1-long}
W_{m+1,n+1}(t) = W_{m+1,n}(t) - t (\rho^1_{m+1,n+1} - \rho^{1}_{m+1,n}) (\rho^3_{m,n})^{-1} \rho^3_{m,n-1} (\rho^1_{m+1,n-1})^{-1} W_{m,n}(t).
\end{equation}
Applying in turn Sylvester's identity to the matrix
\begin{equation}
\begin{pmatrix}
C_{m+1}(t) & S_{m+1} & \cdots & S_{m+n+1} \\
t C_{m}(t) & S_{m} & \cdots & S_{m+n} \\
\vdots & \vdots & \ddots & \vdots \\
t^{n+1} C_{m-n}(t) & S_{m-n} &\cdots & S_{m}
\end{pmatrix} ,
\end{equation}
with rows $p_1 = 1$, $p_2 = n+2$ and columns $q_1 = 1$, $q_2 = 2$ we obtain
\begin{equation} \label{eq:W-F-2}
W_{m,n+1}(t) = W_{m+1,n}(t) + t \rho^1_{m+1,n}(\rho^{3}_{m,n})^{-1} \rho^3_{m,n-1} (\rho^1_{m+1,n-1})^{-1} W_{m,n}(t),
\end{equation}
where apart from the homological column relations we used also identity~\eqref{eq:W-k-P} for $i=1$. When we subtract equation \eqref{eq:W-F-2} from \eqref{eq:W-F-1-long} we obtain
\begin{equation} \label{eq:W-F-3}
W_{m+1,n+1}(t) = W_{m,n+1}(t) - t \rho^1_{m+1,n+1} (\rho^3_{m,n})^{-1} \rho^3_{m,n-1} (\rho^1_{m+1,n-1})^{-1} W_{m,n}(t).
\end{equation}
Finally, with the help of the homological relations \eqref{eq:chr-1-3} equations \eqref{eq:W-F-3} and \eqref{eq:W-F-2} can be brought to the form of \eqref{eq:F-W-1t} and \eqref{eq:F-W-2t}, respectively.
\end{proof}
\begin{Cor}
Equation \eqref{eq:W-F-1-long}, which can be brought to the form
\begin{equation} \label{eq:W-F-1}
W_{m+1,n+1}(t) = W_{m+1,n}(t) + t (\rho_{m+1,n+1} - \rho_{m+1,n}) \rho_{m,n}^{-1} W_{m,n}(t),
\end{equation}
is the non-commutative variant of the Frobenius identity
\begin{equation}
\Delta_{m+1,n} w_{m+1,n+1}(t) - \Delta_{m+1,n+1} w_{m+1,n}(t) = - t \Delta_{m+2,n+1} w_{m,n}(t).
\end{equation}
\end{Cor}
\subsection{Integrability of the non-commutative discrete time Toda chain equations}
Our approach will be typical to analogous works in the theory of integrable systems. After having derived several identities satisfied by the quasideterminants used to find Pad\'{e} approximants, we abandon such a specific interpretation and consider the equations within more general context of non-commutative integrable systems.
Motivated by interpretation of the Frobenius identities in the commutative case as discrete-time Toda chain equations~\cite{Hirota-1993} and the corresponding spectral problem let us devote this Section to presentation of the non-commutative version of the equation in the formalism known from applications to $\varepsilon$-algorithm~\cite{NagaiTokihiroSatsuma} or orthogonal polynomials~\cite{PGR-LMP}. In the context of non-commutative continued fractions and the corresponding LR-algorithm a non-commutative system of such form was obtained by Wynn~\cite{Wynn-NCF}, while its non-autonomous generalization for double-sided non-commutative continued fractions was given in \cite{Doliwa-NCCF}.
\begin{Prop}
The compatibility of the linear system
\begin{align} \label{eq:lin-W1}
W_{m+1,n+1}(t) & = W_{m,n+1}(t) + tD_{m,n}W_{m,n}(t), \\
\label{eq:lin-W2}
W_{m+1,n}(t) & = W_{m,n+1}(t) + t E_{m,n}W_{m,n}(t),
\end{align} is provided by equations
\begin{gather} \label{eq:ncT-1}
D_{m+1,n} E_{m,n} = E_{m+1,n+1} D_{m,n} \\
\label{eq:ncT-2}
D_{m+1,n-1} + E_{m,n} = D_{m,n} + E_{m+1,n}.
\end{gather}
\end{Prop}
\begin{proof}
Given $W_{m,n}$ and $W_{m+1,n}$ one can find $W_{m+2,n}$ in two different ways:
\begin{enumerate}
\item via intermediate steps through $W_{m,n-1}$ and $W_{m+1,n-1}$,
\item via intermediate steps through $W_{m,n+1}$ and $W_{m+1,n+1}$.
\end{enumerate}
Comparison of the resulting formulas gives the statement.
\end{proof}
\begin{Cor}
The first equation \eqref{eq:ncT-1} of the nonlinear system can be resolved introducing the potential $\rho_{m,n}$ such that
\begin{equation}
D_{m,n} = \rho_{m+1,n+1} \rho^{-1}_{m,n}, \qquad
E_{m,n} = \rho_{m+1,n} \rho^{-1}_{m,n},
\end{equation}
while the second equation \eqref{eq:ncT-2} gives \eqref{eq:nc-D-T}.
\end{Cor}
\section{Non-commutative Wynn recurrence}
\label{sec:nc-W-r}
In \cite{Draux-rev} it was also shown that Pad\'{e} approximants in non-commuting symbols satisfy the Wynn recurrence. In this Section we show that the Wynn recurrence follows from properties of the non-commutative Frobenius identities. Because our result is valid in the more general context of discrete non-commutative integrable systems we will not use the Pad\'{e} table notation.
We also provide geometric meaning of the recurrence as a relation between five points of a projective line. In the classical Pad\'{e} approximation it will be the projective line over the field of (semiinfinite) Laurent series over the complex or real numbers whose proper subfield is the field of rational functions.
The geometric meaning of the Wynn recurrence retains its validity also in the non-commutative case, in particular for Mal'cev--Neumann series~\cite{Malcev,Neumann} and the universal ring of fractions by Cohn~\cite{Cohn}.
\subsection{Derivation of the Wynn recurrence} \label{sec:Wynn-derivation}
Notice that the immediate consequence of the linear system \eqref{eq:lin-W1}-\eqref{eq:lin-W2} is the equation
\begin{equation} \label{eq:lin-W3}
W_{m+1,n+1}(t) = W_{m+1,n}(t) + t C_{m,n}W_{m,n}(t), \qquad \text{where} \quad
C_{m,n} = D_{m,n} - E_{m,n}.
\end{equation}
\begin{Prop}
If $ P_{m,n}(t)$ and $Q_{m,n}(t)$ are nontrivial solutions of the linear system \eqref{eq:lin-W1}-\eqref{eq:lin-W2}, then the function $R_{m,n}(t) = Q^{-1}_{m,n}(t) P_{m,n}(t)$ satifies the non-commutative Wynn recurrence
\begin{equation} \label{eq:nc-W} \begin{split}
(R_{m+1,n}(t) - R_{m,n}(t) )^{-1} + (R_{m-1,n}(t) - R_{m,n}(t) )^{-1}= \\
(R_{m,n+1}(t) - R_{m,n}(t) )^{-1} + (R_{m,n-1}(t) - R_{m,n}(t) )^{-1}. \end{split}
\end{equation}
\end{Prop}
\begin{proof}
Inserting such $R_{m,n}(t)$ in the linear system \eqref{eq:lin-W1}-\eqref{eq:lin-W2} and \eqref{eq:lin-W3}
we obtain the following equations
\begin{align*}
Q_{m,n+1}(t) (R_{m,n+1}(t) - R_{m-1,n}(t)) & =
Q_{m,n}(t) (R_{m,n}(t) - R_{m-1,n}(t)), \\
Q_{m+1,n}(t) (R_{m+1,n}(t) - R_{m,n-1}(t)) & =
Q_{m,n}(t) (R_{m,n}(t) - R_{m,n-1}(t)), \\
Q_{m+1,n}(t) (R_{m+1,n}(t) - R_{m,n}(t)) & =
Q_{m,n+1}(t) (R_{m,n+1}(t) - R_{m,n}(t)).
\end{align*}
Elimination of $Q_{m,n}(t)$ and its shifts leads directly to the equation
\begin{gather}
(R_{m,n}(t) - R_{m-1,n}(t))^{-1}
(R_{m,n}(t) - R_{m,n-1}(t)) = \\ \nonumber
(R_{m,n+1}(t) - R_{m-1,n}(t))^{-1}
(R_{m+1,n}(t) - R_{m,n}(t))
(R_{m+1,n}(t) - R_{m,n}(t))^{-1}
(R_{m+1,n}(t) - R_{m,n-1}(t)),
\end{gather}
equivalent to the Wynn recurrence.
\end{proof}
\begin{Cor}
Two systems analogous to equations \eqref{eq:ncT-1}-\eqref{eq:ncT-2} which involve other pairs of unknown functions have the form
\begin{gather} \label{eq:ncT-1-CD}
D_{m+1,n} C_{m,n} = C_{m,n+1} D_{m,n} \\
\label{eq:ncT-2-CD}
D_{m+1,n-1} + C_{m+1,n} = D_{m+1,n} + C_{m,n},
\end{gather}
and
\begin{gather} \label{eq:ncT-1-CE}
D_{m,n+1} E_{m,n} = E_{m+1,n+1} C_{m,n} \\
\label{eq:ncT-2-CE}
C_{m+1,n} + E_{m+1,n} = C_{m,n+1} + E_{m+1,n+1}.
\end{gather}
\end{Cor}
\begin{Rem}
Notice that the Wynn recurrence is valid in the more general context of the linear problem of the non-commutative discrete-time Toda equations.
In the standard application to Pad\'{e} approximation we are looking for $R_{m,n}(t)$, $m,n\geq 0$ with the initial boundary data of consisting of $R_{m,-1}(t) = \infty$, $R_{m,0}(t) = F_m(t)$, and $R_{-1,n} = 0$. For the general case with $(m,n)\in\mathbb{Z}^2$ as the initial boundary date one can take, for example, the values of $R_{m,-1}$ and $R_{m,0}$ for $m\in\mathbb{Z}$.
\end{Rem}
All the above results have their "transposed" version with reversed order of multiplication. The proof of the follwing result is left to the Reader as an excercise.
\begin{Prop}
(i) The compatibility of the linear system
\begin{align} \label{eq:lin-W1-r}
\widetilde{W}_{m+1,n+1}(t) & = \widetilde{W}_{m,n+1}(t) + t\widetilde{W}_{m,n}(t) \widetilde{D}_{m,n}, \\
\label{eq:lin-W2-r}
\widetilde{W}_{m+1,n}(t) & = \widetilde{W}_{m,n+1}(t) + t \widetilde{W}_{m,n}(t) \widetilde{E}_{m,n},
\end{align} is provided by equations
\begin{gather} \label{eq:ncT-1-r}
\widetilde{E}_{m,n} \widetilde{D}_{m+1,n} = \widetilde{D}_{m,n} \widetilde{E}_{m+1,n+1} \\
\label{eq:ncT-2-r}
\widetilde{D}_{m+1,n-1} + \widetilde{E}_{m,n} = \widetilde{D}_{m,n} + \widetilde{E}_{m+1,n}.
\end{gather}
(ii) The first equation \eqref{eq:ncT-1-r} of the nonlinear system can be resolved introducing the potential $\widetilde{\rho}_{m,n}$ such that
\begin{equation}
\widetilde{D}_{m,n} = \widetilde{\rho}^{-1}_{m,n} \widetilde{\rho}_{m+1,n+1} , \qquad
\widetilde{E}_{m,n} =\widetilde{\rho}^{-1}_{m,n} \widetilde{\rho}_{m+1,n} ,
\end{equation}
while the second equation \eqref{eq:ncT-2-r} gives \begin{equation} \label{eq:nc-D-T-r}
\widetilde{\rho}_{m-1,n} \left( \widetilde{\rho}_{m,n-1}^{-1} - \widetilde{\rho}_{m,n}^{-1} \right) \widetilde{\rho}_{m+1,n} = \widetilde{\rho}_{m,n+1} - \widetilde{\rho}_{m,n}.
\end{equation}
(iii) If $ \widetilde{P}_{m,n}(t)$ and $\widetilde{Q}_{m,n}(t)$ are nontrivial solutions of the linear system \eqref{eq:lin-W1-r}-\eqref{eq:lin-W2-r}, then the function $\widetilde{R}_{m,n}(t) = \widetilde{P}_{m,n}(t) \widetilde{Q}^{-1}_{m,n}(t) $ satifies the non-commutative Wynn recurrence
\eqref{eq:nc-W}.
\end{Prop}
\subsection{Geometry of the Wynn recurrence}
\label{sec:proj-geome}
This Section is devoted to the geometric meaning of the Wynn recurrence interpreted as the relation between five points of a projective line. We consider geometry over arbitrary (including skew) field $\mathbb{D}$. The original case studied by Wynn~\cite{Wynn} dealt with the field of rational functions, however the non-commuting variables were also within his interest~\cite{Wynn-NCF}. Our approach will follow that used recently in \cite{DoliwaKosiorek} to provide geometric meaning of the non-commutative discrete Schwarzian Kadomtsev--Petviashvili equation.
\begin{Prop} \label{prop:Wynn-geom}
Interpreted as a relation between five points of the projective (base) line the Wynn recurrence~\eqref{eq:nc-W} is equivalent the following construction of the point $R_{m,n+1}$ once the points $R_{m-1,n}$, $R_{m,n-1}$, $R_{m,n}$ and $R_{m+1,n}$ are given (see Figure \ref{fig:Wynn-geometry-12}):
\begin{figure}[h!]
\begin{center}
\includegraphics[width=9cm]{Wynn-geometry-mn.pdf}
\end{center}
\caption{Geometric meaning of the Wynn recurrence}
\label{fig:Wynn-geometry-12}
\end{figure}
\begin{itemize}
\item select any point $A$ outside the base line,
\item on the line $\langle A, R_{m,n} \rangle$ select any point $B$ different from $A$ and $R_{m,n}$,
\item define point $C$ as the intersection of lines $\langle A, R_{m,n-1} \rangle$ and $\langle B, R_{m-1,n} \rangle$,
\item define point $D$ as the intersection of lines $\langle C, R_{m,n} \rangle$ and $\langle A, R_{m+1,n} \rangle$,
\item point $R_{m,n+1}$ is the intersection of the line $\langle B, D \rangle$ with the base line.
\end{itemize}
\end{Prop}
\begin{proof}
The above arbitrariness of the points $A$ and $B$ in the construction is known in the projective geometry~\cite{Coxeter-PG} and follows from the Desargues theorem. We will use the freedom to simplify the calculation.
Consider the non-homogeneous coordinates where the base line (except from the infinity point) is given by the first coordinate $\{ (x,0) \colon x\in {\mathbb D} \}$. As $A$ we choose the point of the infinity line where the lines parallel to the second coordinate line meet. Then as the point $B$ on the line through $(R_{m,n},0)$ and parallel to that line we take the point $B=(R_{m,n},1)$. From now on there is no freedom in the construction.
The coordinates of the point $C$
\begin{equation}
C=(R_{m,n-1}, t), \qquad t =
1 - (R_{m,n-1} - R_{m,n})(R_{m-1,n} - R_{m,n})^{-1}
\end{equation}
can be found from the equation
\begin{equation*}
(R_{m,n-1},t) = (R_{m-1,n} , 0 ) + s \left[ (R_{m,n},1) - (R_{m-1,n},0) \right],
\end{equation*}
where by the standard convention when representing vectors as rows we multiply them by scalars from the left. Similar calculation gives coordinates of the point $D$
\begin{equation}
D=(R_{m+1,n}, t^\prime), \qquad t^\prime =
(R_{m+1,n} - R_{m,n})[(R_{m,n-1} - R_{m,n})^{-1} - (R_{m-1,n} - R_{m,n})^{-1}] .
\end{equation}
Finally, $R_{m,n+1}$ can be calculated from the equation
\begin{equation*}
(R_{m,n+1},0) = (R_{m,n} , 1 ) + s^\prime \left[ (R_{m+1,n}, t^\prime) - (R_{m,n},1) \right],
\end{equation*}
which gives $s^\prime = (1-t^\prime)^{-1}$ and leads to the Wynn recurrence \eqref{eq:nc-W}.
\end{proof}
\begin{Rem}
In defining coordinates on projective line~\cite{Coxeter-PG} the above construction provides the additive structure in the (skew) field.\footnote{We thank Jaros{\l}aw Kosiorek for pointing us such a geometric interpretation of the construction.} Indeed, when $R_{m,n}$ is moved to the infinity point, and points $R_{m,n-1}, R_{m-1,n}$, $R_{m+1,n}$ are identified with $0, a, b$, respectively, then $R_{m,n+1}$ represents $a+b$, see Figure~\ref{fig:Wynn-addition} (here parallel lines intersect in the corresponding points $A$, $B$ or $R_{m,n}$ of the infinity line).
\begin{figure}[h!]
\begin{center}
\includegraphics[width=9cm]{Wynn-addition.pdf}
\end{center}
\caption{Additive structure of a projective line}
\label{fig:Wynn-addition}
\end{figure}
Algebraic verification follows from the fact that in the limit $R_{m,n}\to\infty$ the Wynn recurrence reduces to
\begin{equation}
R_{m-1,n} + R_{m+1,n} = R_{m,n-1} + R_{m,n+1}, \qquad R_{m,n}=\infty .
\end{equation}
\end{Rem}
\subsection{Reduction of the non-commutative discrete Schwarzian KP equation} It is well known~\cite{KricheverLipanWiegmannZabrodin,Bialecki-1DT} that the discrete-time Toda chain system~\eqref{eq:D-T} can be obtained as a reduction of the discrete KP equation in its bilinear form~\cite{Hirota-2dT}. Let us derive the non-commutative Wynn recurrence as a corresponding reduction of the non-commutative discrete KP equation in its Schwarzian form~\cite{FWN-Capel,BoKo-N-KP}
\begin{equation} \label{eq:dSKP} \begin{split}
(R_{m,n+1,p+1} - R_{m,n,p+1})(R_{m,n+1,p+1} - R_{m,n+1,p})^{-1} (R_{m+1,n+1,p} - R_{m,n+1,p}) = \\=(R_{m+1,n,p+1} - R_{m,n,p+1}) (R_{m+1,n,p+1} - R_{m+1,n,p})^{-1}
(R_{m+1,n+1,p} - R_{m+1,n,p}),\end{split}
\end{equation}
where $R\colon {\mathbb Z}^3 \to {\mathbb D}$ is unknown function of three discrete variables.
\begin{Prop} \label{prop:Wynn-red}
Assume that the non-commutative discrete Schwarzian Kadomtsev--Petwiashvili equation~\eqref{eq:dSKP} is subject to the constraint
\begin{equation} \label{eq:red-SKP-W}
R_{m+1,n+1,p} = R_{m,n,p+1},
\end{equation}
then the equation reduces to the non-commutative Wynn recurrence~\eqref{eq:nc-W}.
\end{Prop}
\begin{proof}
Because of the reduction condition the function $R_{m,n,p}$ becomes effectively the function $R_{m,n}$ of two discrete variables.
Replacing the shift in the third variable in equation~\eqref{eq:dSKP} by simultaneous shifts on the first and second variables we get
\begin{equation*} \begin{split}
(R_{m+1,n+1} - R_{m+1,n})^{-1} [
(R_{m+2,n+1} - R_{m+1,n+1} )- (R_{m+1,n} - R_{m+1,n+1})]
(R_{m+2,n+1} - R_{m+1,n+1})^{-1} = \\
=(R_{m+1,n+1} - R_{m,n+1})^{-1} [
(R_{m+1,n+2} - R_{m+1,n+1} )- (R_{m,n+1} - R_{m+1,n+1})]
(R_{m+1,n+2} - R_{m+1,n+1})^{-1} ,
\end{split}
\end{equation*}
which after natural cancellations gives shifted recurrence \eqref{eq:nc-W}.
\end{proof}
\begin{Rem}
As it was shown in~\cite{DoliwaKosiorek} the non-commutative discrete Schwarzian KP equation can be interpreted as a relation between six points (called the quadrangular set) of the projective line visualized in Figure~\ref{fig:R-geometry-123}. The geometric meaning of the Wynn recurrence described in Proposition~\ref{prop:Wynn-geom} follows then by the application of the reduction condition~\eqref{eq:red-SKP-W}.
\end{Rem}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=9cm]{R-geometry-mnp.pdf}
\end{center}
\caption{Geometric meaning of the non-commutative discrete Schwarzian Kadomtsev--Petviashvili equation}
\label{fig:R-geometry-123}
\end{figure}
\begin{Rem}
The reduction condition~\eqref{eq:red-SKP-W} expresses invariance to the corresponding solution of the discrete Schwarzian KP equation~\eqref{eq:dSKP} with respect to a special translational symmetry of the equation.
\end{Rem}
\section{Wynn recurrence, circle packings and discrete analytic functions} \label{sec:W-circle}
Geometric interpretation of the \emph{complex} dSKP equation \eqref{eq:dSKP} was first presented in \cite{KoSchief-Men} in the context of the Menelaus theorem and of the Clifford configuration of circles in inversive geometry. One can find there also an equation equivalent to the Wynn recurrence obtained by application of the reduction condition~\eqref{eq:red-SKP-W}. Let us recall their results from our perspective~\cite{DoliwaKosiorek}. In studying the corresponding initial boundary value problem we discuss also geometric meaning of the compatibility of the relevant construction.
In this Section we study the Wynn recurrence in the complex projective line. Such a line, called in this context also the Riemann sphere or the conformal plane, has an additional structure which comes from the standard embedding of the field of real numbers in the complex numbers. The images of the real line under complex-homographic maps are circles or straight lines. By identifying the complex projective line with the (complex) plane supplemented by the infinity point, we identify the special circles passing through that point with straight lines. Homographic transformations preserve the structure (including the angles between circles) and may exchange the infinity point with ordinary ones. In particular, parallel lines are tangent at infinity.
The conformal plane construction of the point $R_{m,n+1,p+1}$ with the points $R_{m+1,n,p}$, $R_{m,n+1,p}$, $R_{m,n,p+1}$, $R_{m+1,n+1,p}$ and $R_{m+1,n,p+1}$ given reads as follows (see Figure~\ref{fig:Chain-Veblen}):
\begin{itemize}
\item by $I$ denote the intersection point of the circle passing through the points $R_{m+1,n,p}$, $R_{m,n+1,p}$, and $R_{m+1,n+1,p}$ with the circle passing through the points $R_{m+1,n,p}$, $R_{m,n,p+1}$, and $R_{m+1,n,p+1}$;
\item the point $R_{m,n+1,p+1}$ is the intersection of the circle passing through the points $I$, $R_{m,n+1,p}$, and $R_{m,n,p+1}$ with the circle passing through the points $I$, $R_{m+1,n+1,p}$, and $R_{m+1,n,p+1}$.
\end{itemize}
\begin{figure}[h!]
\begin{center}
\includegraphics[width=12cm]{Chain-Veblen-circles-R.pdf}
\end{center}
\caption{Circle geometry description of the complex discrete Schwarzian KP equation}
\label{fig:Chain-Veblen}
\end{figure}
\begin{Rem}
The proof \cite{KoSchief-Men} makes use of the invariance of the discrete Schwarzian KP equation with respect to the homographies and then, after shifting the intersection point $I$ to the infinity, follows by application of the celebrated Menelaus theorem of the affine geometry~\cite{Coxeter-GR}.
\end{Rem}
Application of the reduction condition~\eqref{eq:red-SKP-W} forces also the identification $I=R_{m+1,n+1,p}=R_{m,n,p+1}$, where we assume that no other coincidence among the initial points appears. This in turn implies double contact (tangency) of the two pairs of circles in the distinguished point:
\begin{itemize}
\item the circle passing through the points $R_{m+1,n,p}$, $R_{m,n+1,p}$, and $R_{m+1,n+1,p}$ is tangent at $I$ to the circle passing through the points $I=R_{m+1,n+1,p}$, and $R_{m+1,n,p+1}$,
\item the circle passing through the points $R_{m+1,n,p}$, $R_{m,n,p+1}$, and $R_{m+1,n,p+1}$ is tangent at $I$ to the circle passing through the points $I=R_{m,n,p+1}$ and $R_{m,n+1,p}$.
\end{itemize}
The reduced configuration of circles after transition to variables $m,n$ and overall shift (see the proof of Proposition~\ref{prop:Wynn-red}) is visualized in Figure~\ref{fig:Wynn-circles-P}. When the distinguished point $I=R_{m,n}$ is moved to infinity then the pairs of tangent circles become two pairs of parallel lines, and the points $R_{m\pm1,n}, R_{m,n\pm1}$ become vertices of the corresponding parallelogram. This point of view on the two-parameter families of pairwise tangent circles (the so called P-nets) in relation to discrete integrable equations was considerd in~\cite{BobenkoPinkall-DSIS}. When the circles intersect orthogonally (all the parallelograms are rectangles) and half of them is removed after the construction (see Figure~\ref{fig:Wynn-circle-init}) then the remaining systems of tangent circles is that considered by Schramm~\cite{Schramm} in the context of discrete complex analysis.
\begin{figure}[h!]
\begin{center}
\includegraphics[width=12cm]{Wynn-circles-P.pdf}
\end{center}
\caption{Two tangent pairs of circles as P-configuration}
\label{fig:Wynn-circles-P}
\end{figure}
\begin{Rem}
The contemporary interest in circle packings was initiated by Thurston's rediscovery of the Koebe-Andreev theorem \cite{Koebe} about circle packing realizations of cell complexes of a prescribed combinatorics and by his idea about
approximating the Riemann mapping by circle packings, see \cite{Thurston,Stephenson}. These results
demonstrate surprisingly close analogy to the classical theory and allow one to talk about an
emerging of the "discrete analytic function theory", containing the classical theory of analytic
functions as a small circles limit.
Circle patterns with the combinatorics of
the square grid introduced by Schramm~\cite{Schramm}
result in an analytic description, which is closer to the Cauchy-Riemann equations of complex analysis.
In \cite{BobenkoPinkall-DSIS} the description of Schramm's square grid circle patterns in conformal setting to an integrable system of Toda type is given. In the same paper it was found that such a system describes a generalization of the Schramm circle patterns, called the P-nets, i.e. discrete conformal maps with the parallelogram property.
It should be mentioned that the description of the Schramm circle packings in terms of the complex Wynn recurrence can be found in \cite{BobenkoHoffmann}, see equation (15) of the paper, although without any association to the Pad\'{e} theory.
\end{Rem}
The possibility of using the additional geometric (conformal) structure results in the reduction of initial boundary data with respect to the generic Wynn recurrence, as discussed in Section~\ref{sec:Wynn-derivation}. In such reduction it is enough to know $R_{m,0}$, $m\in\mathbb{Z}$, and $R_{0,1}$. Apart from the two "initial" circles: that passing through the points $R_{0,0}$, $R_{1,0}$ and $R_{0,1}$, and that passing through the points $R_{0,0}$, $R_{-1,0}$ and $R_{0,1}$, the other circles are constructed from two points, with prescribed tangency in one of them. Notice that the description of the lattice states that also at the second point the tangency is required. Such a compatibility of the construction is ensured by the following geometric result.
\begin{figure}
\begin{center}
\includegraphics[width=12cm]{Wynn-circle-init.pdf}
\end{center}
\caption{Construction of the circle lattice from the initial data represented by the black points (on the left) and the tangential Miquel theorem impying consistency of the construction (on the right)}
\label{fig:Wynn-circle-init}
\end{figure}
\begin{Th}[Tangential Miquel theorem]
Given four points $P_1, P_2, P_3$ and $P_4$ on the circle $\mathcal{C}$. Let
\begin{itemize}
\item $\mathcal{C}_1$ be a circle passing through $P_1$ and $P_2$,
\item $\mathcal{C}_2$ the circle tangent to $\mathcal{C}_1$ at $P_2$ and passing through $P_3$,
\item $\mathcal{C}_3$ the circle tangent to $\mathcal{C}_2$ at $P_3$ and passing through $P_4$,
\item $\mathcal{C}_4$ the circle tangent to $\mathcal{C}_3$ at $P_4$ and passing through $P_1$.
\end{itemize}
Then the circle $\mathcal{C}_4$ is also tangent to $\mathcal{C}_1$ at $P_1$.
\end{Th}
The proof is elementary, but it helps to shift one of the points (for example $P_1$) to infinity.
\begin{Rem}
The above result is a limiting version of the six-circles Miquel theorem~\cite{Herzer} which was used in~\cite{CDS} to prove consistency of the circular reduction with the geometric integrable construction of the multidimensional lattice of planar quadrilaterals~\cite{MQL}.
\end{Rem}
\bibliographystyle{amsplain}
\section{Conclusion and open problems}
Motivated by the application of the discrete-time Toda chain equations in the theory of Pad\'{e} approximants, as one of the Frobenius identities, we studied the integrability of the Wynn recurrence. We investigated non-commutative version of the Pad\'{e} theory using quasideterminants. The proper form of the corresponding non-commutative discrete-time Toda chain equations and of their linear problem was obtained in close analogy with the standard~\cite{Baker,Gragg} determinantal approach to Frobenius identities, whose non-commutative versions were presented as well. We provided, on example of the Fibonacci language, the problem of rational approximatins in the theory of formal languages, where the non-commutativity of symbols that build the series is inherent and cannot be discarded.
After deriving the non-commutative Wynn recurrence from the linear problem of the discrete-time Toda chain equations, we gave also its second derivation as a reduction of the discrete non-commutative Schwarzian Kadomtsev--Petviashvili equation, which allowed to discover the geometric construction behind the Wynn recurrence valid for arbitrary skew field/division ring. It turns out that the same reduction in the complex field case~\cite{KoSchief-Men} gives the circle packings relevant in the theory of "discrete complex analysis"~\cite{Schramm}. It is therefore remarkable that two different approximation schemata of complex analytic functions: by rational functions and by "discrete analytic functions", are described by the same integrable equation.
As we mentioned in the Introduction, in the literature there are known also other problems of numerical analysis related to integrable systems. In addition to looking for new examples of such a relationship, one can ask about the general reason explaining its existence.
The editor of series Mathematics and Its Applications writes in~\cite{NNMRA}:
\emph{Rational or Pad\'{e} approximation [...] is still something of a mystery to this editor. Not the basic idea itself, which is lucid enough. But why is the technique so enormously efficient, and numerically useful, in so many fields ranging from physics to electrical engineering with continued fractions, orthogonal polynomials, and completely integrable systems tossed in for good measure.}
Having in mind the special role played in the theory of integrable systems by Hirota's discrete KP equation~\cite{Hirota-2dT,KNS-rev,Zabrodin} one can start such an investigation by finding related problem which should contain existing examples as special cases. Because of the symmetry structure of the equation it is desirable that such problem would allow for arbitrary number of dimensions of discrete parameters. A good candidate is provided by the so called Hermite--Pad\'{e} approximation problem, and the research in this direction will be reported in a separate publication~\cite{Doliwa-Siemaszko-HP}.
\providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 2,458 |
import favIcon32 from './favicon-32.png';
import favIcon128 from './favicon-128.png';
import favIcon152 from './favicon-152.png';
import favIcon152Touch from './favicon-152-touch.png';
import favIcon167 from './favicon-167.png';
import favIcon167Touch from './favicon-167-touch.png';
import favIcon180 from './favicon-180.png';
import favIcon180Touch from './favicon-180-touch.png';
import favIcon192 from './favicon-192.png';
import favIcon196 from './favicon-196.png';
const favIcons = {
favIcon32,
favIcon128,
favIcon152,
favIcon152Touch,
favIcon167,
favIcon167Touch,
favIcon180,
favIcon180Touch,
favIcon192,
favIcon196
};
export default favIcons; | {
"redpajama_set_name": "RedPajamaGithub"
} | 5,638 |
\section{Introduction}
Reinforcement learning (RL) has achieved many successes in robot control~\citep{johannink2019residual}, game AI~\citep{vinyals2019grandmaster},
supply chain~\cite{NiHLTYDM021MultiGraph} and etc.
With function approximation like deep neural networks,
the policy can be learned efficiently by trial-and-error with reliable gradient updates.
However, RL is widely known to be unstable, poor in exploration, and struggling when the gradient signals are noisy and less informative.
By contrast, Evolutionary Algorithm (EA)~\citep{back1993overview} is a class of black-box optimization methods, which is demonstrated to be competitive with RL~\citep{such2017deep}.
EA models natural evolution processes by maintaining a population of individuals and searches for favorable solutions by iteration.
In each iteration, individuals with high fitness are selected to produce offspring by inheritance and variation, while those with low fitness are eliminated.
Different from RL, EA is gradient-free and offers several strengths: strong exploration ability, robustness, and stable convergence~\citep{sigaud2022combining}.
Despite the advantages, one major bottleneck of EA is the low sample efficiency due to the iterative evaluation of the population.
This issue becomes more stringent when the policy space is large~\citep{sigaud2022combining}.
\begin{comment}
Reinforcement learning (RL)~\citep{sutton2018reinforcement} has been successfully developed in recent years. Due to the development of deep learning~\citep{lecun2015deep}, RL combined with deep learning can solve many challenging problems and has been applied in many real-world scenarios~\citep{nguyen2020deep} such as robot control~\citep{johannink2019residual}, game AI~\citep{vinyals2019grandmaster} and recommendation system~\citep{zou2019reinforcement}.
Reinforcement learning has the advantage of high sample efficiency, which can fully exploit the generated samples, such as off-policy algorithms DDPG~\citep{lillicrap2015continuous} and TD3~\citep{fujimoto2018addressing} which reuse the
samples by maintaining a replay buffer.
However, RL faces the problem of poor exploration ability and has hyperparameter sensitive and brittle convergence properties~\citep{khadka2018evolution}.
Evolutionary Algorithms (EA)~\citep{back1993overview} are a class of intelligent optimization algorithms.
EA offers several strengths 1): EA has a strong exploration property. 2): EA has the robustness and stable convergence properties. However, EA suffers
from high sample complexity.
Specifically, EA discards the collected samples after obtaining the fitness, which results in a low sample efficiency.
When facing a complex problem with a high-dimensional state and action space, the sample efficiency problem will be more acute~\citep{khadka2018evolution,such2017deep}.
\end{comment}
Since EA and RL have distinct and complementary advantages,
a natural idea is to
combine these two heterogeneous policy optimization approaches
and devise better policy optimization algorithms.
Many efforts in recent years have been made
in this direction~\citep{khadka2018evolution,GangwaniP18GPO,khadka2019collaborative,bodnar2020proximal, wang2022surrogate, pourchot2018cem}.
One representative work is ERL~\citep{khadka2018evolution}
which combines Genetic Algorithm (GA)~\citep{mitchell1998introduction} and DDPG~\citep{lillicrap2015continuous}.
ERL maintains an evolution population and a RL agent meanwhile.
The population and the RL agent interact with each other in a coherent framework:
the RL agent learns by DDPG with diverse off-policy experiences collected by the population;
while the population includes a copy of the RL agent periodically among which genetic evolution operates.
In this way, EA and RL cooperate during policy optimization.
Subsequently, many variants and improvements of ERL are proposed, e.g.,
to incorporate Cross-Entropy Method (CEM)~\citep{pourchot2018cem} rather than GA~\citep{pourchot2018cem},
to devise gradient-based genetic operators~\citep{GangwaniP18GPO},
to use multiple parallel RL agents~\citep{khadka2019collaborative} and etc.
However, we observe that most existing methods seldom break the performance ceiling of either their EA or RL components (e.g., \textit{Swimmer} and \textit{Humanoid} on MuJoCo are dominated by EA and RL respectively).
This indicates that the strengths of EA and RL are not sufficiently blended.
We attribute this to two major drawbacks.
First, each agent of EA and RL learns its policy individually.
The state representation learned by individuals can inevitably be redundant yet specialized~\citep{DabneyBRDQBS21VIP},
thus slowing down the learning and limiting the convergence performance.
Second, typical evolutionary variation occurs at the level of parameter (e.g., network weights).
It guarantees no semantic level of evolution and may induce policy crash~\citep{bodnar2020proximal}.
\begin{comment}
ERL~\citep{khadka2018evolution} is proposed to merge Genetic Algorithm (GA) with DDPG and demonstrates its superiority in challenging continuous control tasks.
ERL maintains a RL agent and a population.
EA provides diverse experiences for the RL agent which exploits the data to improve sample efficiency.
In addition, RL injects its policy into the population to participate in the evolution of the population. Agents in the population are improved by genetic operators and the RL agent is improved based on gradient optimization.
CERL~\citep{khadka2019collaborative} extends ERL by maintaining multiple parallel RL agents with different hyperparameters instead of one agent.
CEM-RL~\citep{pourchot2018cem} improves the way RL affects EA by injecting gradients for half of the agents in the population instead of only injecting a RL policy periodically. In addition, CEM-RL uses Cross-Entropy Method (CEM) instead of Genetic Algorithms (GA).
PDERL~\citep{bodnar2020proximal} designs new crossover and mutation operators to solve the catastrophic forgetting problem caused by traditional operators at the parameter level.
The performance of the algorithm sometimes relies heavily on one of the EA or RL.
For example, the task (e.g., Swimmer) that can be easily solved by EA cannot be further improved or even solved by the hybrid framework~\citep{khadka2018evolution, khadka2019collaborative,bodnar2020proximal, wang2022surrogate, pourchot2018cem}.
\end{comment}
In the literature of linear approximation RL~\citep{sutton2018reinforcement} and state representation learning~\citep{ChungNJW19Twotimescale,DabneyBRDQBS21VIP,Kumar22DR3},
a policy is usually understood as the composition of nonlinear state features and linear policy weights.
Taking this inspiration,
we propose a new approach named
\textbf{E}volutionary \textbf{R}einforcement \textbf{L}earning with Two-scale State \textbf{Re}presentation and Policy \textbf{Re}presentation (ERL-Re$^2$\xspace) to address the aforementioned two drawbacks.
ERL-Re$^2$\xspace is devised based on a novel concept, i.e., \textit{two-scale} representation:
all EA and RL agents maintained in ERL-Re$^2$\xspace are composed of a \textit{shared} nonlinear state representation and an \textit{individual} linear policy representation.
The shared state representation takes the responsibility of learning general and expressive features of the environment, which is not specific to any single policy,
e.g., the common decision-related knowledge.
In particular, it is learned by following a unifying update direction derived from value function maximization regarding all EA and RL agents collectively.
Thanks to the expressivity of the shared state representation,
the individual policy representation can have a simple linear form.
It leads to a fundamental distinction of ERL-Re$^2$\xspace: evolution and reinforcement occur in the linear policy representation space rather than in a nonlinear parameter (e.g., policy network) space as the convention.
Thus, policy optimization can be more efficient with ERL-Re$^2$\xspace.
In addition, we propose novel \textit{behavior-level} crossover and mutation
that allow to
imposing variations on designated dimensions of action while incurring no interference on the others.
Compared to parameter-level operators,
our behavior-level operators have clear genetic semantics of behavior,
thus are more effective and stable.
Moreover, we further reduce the sample cost of EA by introducing a new surrogate of fitness, based on the convenient incorporation of Policy-extended Value Function Approximator (PeVFA) favored by the linear policy representations.
Without loss of generality,
we use GA and TD3 (and DDPG) for the concrete choices of EA and RL algorithms.
Finally, we evaluate ERL-Re$^2$\xspace on MuJoCo continuous control tasks with strong ERL baselines and typical RL algorithms,
along with a comprehensive study on ablation, hyperparameter analysis, etc.
We summarize our major contributions below: 1) We propose a novel approach ERL-Re$^2$\xspace to integrate EA and RL based on the concept of two-scale representation; 2) We devise behavior-level crossover and mutation which have clear genetic semantics; 3) We empirically show that ERL-Re$^2$\xspace consistently outperforms related methods and improves both its EA and RL components significantly on MuJoCo.
\begin{comment}
In this paper, we propose a novel framework ERL-Re$^2$\xspace to integrate EA and RL efficiently.
The cornerstone of ERL-Re$^2$\xspace is two-scale representation-based policy construction.
where each agent is composed of a shared state representation and an independent linear policy representation.
The policy construction enables the maximal common knowledge extraction from the experiences leading to more effective policy search.
Specifically,
we utilize a shared state representation as common knowledge to convey the information which is beneficial to the overall improvement.
The linear policy representations can provide more efficient exploration in a favorable policy space based on the shared state representation.
To guarantee that the common knowledge facilitates
population evolution, we introduce Policy Extension Value Function (PeVFA\xspace)~\citep{tang2020represent} which is a value approximator to provide generalized value estimation with policy embedding as additional input to avoid overfitting to the current policy in on-policy methods. We adopt PeVFA\xspace to off-policy methods and optimize it with the policy representations.
With the optimized PeVFA\xspace and RL critic, we can improve the shared state representation to make it beneficial to the population evolution and improvement of the RL agent.
For policy improvement, the RL agent optimizes its policy by the gradients through the RL critic.
For the agents in the population, we design novel crossover and mutation operators at the behavior level which are more stable than operators at the parameter level.
Moreover, we further improve the sample efficiency of EA by using n-step return as a surrogate of the fitness based on the policy representations and PeVFA\xspace.
Our experiments show that ERL-Re$^2$\xspace significantly improves both EA and RL, outperforming other baselines algorithms on the challenging continuous control tasks.
\end{comment}
\begin{comment}
We summarize our major contributions below:
1) We propose a novel approach ERL-Re$^2$\xspace to integrate EA and RL based on the concept of two-scale representation;
2) We devise behavior-level crossover and mutation which have clear genetic semantics;
3) We empirically show that ERL-Re$^2$\xspace consistently outperforms related methods and
improves both its EA and RL components significantly
on MuJoCo.
\end{comment}
\section{Background}
\vspace{-0.1cm}
\paragraph{Reinforcement Learning}
Consider a Markov decision process (MDP), defined by a tuple $\left\langle \mathcal{S},\mathcal{A}, \mathcal{P}, \mathcal{R}, \gamma, T \right\rangle$. At each step $t$, the agent uses a policy $\pi$ to select an action $a_{t} \sim \pi(s_t) \in \mathcal{A}$ according to the state $s_t \in \mathcal{S}$
and the environment transits to the next state $s_{t+1}$ according to transition function $\mathcal{P}(s_t,a_t)$ and the agent receives a reward $r_t = \mathcal{R}(s_t,a_t)$.
The return is defined as the discounted cumulative reward, denoted by $R_t = \sum_{i=t}^{T} \gamma^{i-t} r_{i}$ where $\gamma \in [0,1)$ is the discount factor
and $T$ is the maximum episode horizon.
The goal of RL is to learn an optimal policy $\pi^*$ that maximizes the expected return.
DDPG~\citep{lillicrap2015continuous} is a representative off-policy Actor-Critic algorithm,
consisting of a deterministic policy $\pi_{\omega}$ (i.e., the actor) and a state-action value function approximation $Q_{\psi}$ (i.e., the critic), with the parameters $\omega$ and $\psi$ respectively.
The critic is optimized with the Temporal Difference (TD)~\citep{sutton2018reinforcement} loss and the actor is updated by maximizing the estimated $Q$ value.
The loss functions are defined as:
$\mathcal{L}(\psi) = \mathbb{E}_{\mathcal{D}} [ (r + \gamma Q_{\psi^{\prime}} (s^{\prime}, \pi_{\omega^{\prime}}(s^{\prime}) ) -Q_{\psi} (s, a) )^{2} ]$ and $\mathcal{L(\omega)} = - \mathbb{E}_{\mathcal{D}} [Q_{\psi}(s, {\pi_{\omega}(s)}) ]$,
where the experiences $(s,a,r,s^{\prime})$ are sampled from the replay buffer $\mathcal{D}$,
$\psi^{\prime}$ and $\omega^{\prime}$ are the parameters of the target networks.
TD3~\citep{fujimoto2018addressing} improves DDPG by addressing overestimation issue mainly by clipped double-$Q$ learning.
Conventional value functions are defined on a specific policy. Recently, a new extension called Policy-extended Value Function Approximator (PeVFA\xspace)~\citep{tang2020represent} is proposed to
preserve the values of multiple policies.
Concretely, given some representation $\chi_{\pi}$ of policy $\pi$, a PeVFA parameterized by $\theta$ takes as input $\chi_{\pi}$ additionally, i.e., $\mathbb{Q}_{\theta}(s,a, \chi_{\pi})$.
Through the explicit policy representation $\chi_{\pi}$, one appealing characteristic of PeVFA is the value generalization among policies (or policy space).
PeVFA is originally proposed to leverage the local value generalization along the policy improvement path to improve online RL (we refer the reader to their original paper).
In our work, we adopt PeVFA for the value estimation of the EA population, which naturally fits the ability of PeVFA well.
Additionally, different from the on-policy learning of PeVFA adopted in~\citep{tang2020represent},
we propose a new off-policy learning algorithm of PeVFA which is described later.
\vspace{-0.2cm}
\paragraph{Evolutionary Algorithm}
Evolutionary Algorithm (EA)~\citep{back1993overview}
is a class of black-box optimization methods.
EA maintains a population of policies $\mathbb{P} = \{ \pi_1,\pi_2,...,\pi_n \}$ in which policy evolution is iteratively performed.
In each iteration, all agents interact with the environment for $e$ episodes to obtain Monte Carlo (MC) estimates of policy fitness $\{ f(\pi_1),f(\pi_2),...,f(\pi_n) \}$ where $f(\pi) = \frac{1}{e} \sum_{i=1}^{e}[\sum_{t=0}^{T} r_{t}\mid {\pi}]$.
The policy with higher fitness is more likely to be selected as parents to produce the next generation in many ways such as Genetic Algorithm (GA)~\citep{mitchell1998introduction} and Cross-Entropy Method (CEM)~\citep{pourchot2018cem}.
With GA, offspring are generated by applying genetic operators:
the parents $\pi_i$ and $\pi_j$ are selected randomly to produce offspring
$\pi_i^{\prime}$ and $\pi_j^{\prime}$
by performing the crossover operator, i.e., $\pi_i^{\prime},\pi_j^{\prime} = \texttt{Crossover}(\pi_i,\pi_j)$ or the mutation operator $\pi_i^{\prime} = \texttt{Mutation}(\pi_i)$.
In most prior methods, the crossover and mutation operate at the \textit{parameter level}.
Typically,
$k$-point crossover
randomly exchange segment-wise (network) parameters of parents
while Gaussian mutation adds Gaussian noises to the parameters.
Thanks to the diversity brought by abundant candidates and consistent variation, EA has strong exploration ability and convergence.
\section{Related work}
Recently, an emergent research field is integrating the advantages of EA and RL from different angles to devise new methods~\citep{sigaud2022combining},
for example, combining EA and RL for efficient policy optimization~\citep{khadka2018evolution,bodnar2020proximal}, using EA to approximate the greedy action selection in continuous action space~\citep{kalashnikov2018scalable, simmons2019q, shi2021soft, shao2022grac, ma2022evolutionary}, population-based hyperparameter tuning of RL~\citep{jaderberg2017population,pretorius2021population},
and genetic programming for interpretable RL policies~\citep{HeinUR18,Hein19}.
In this work, we focus on combining EA and RL for efficient policy optimization.
ERL~\citep{khadka2018evolution} first proposes a hybrid framework
where a DDPG agent is trained alongside a genetic population.
The RL agent benefits from the diverse experiences collected by the EA population, while the population periodically includes a copy of the RL agent.
In parallel, CEM-RL~\citep{pourchot2018cem} integrates CEM and TD3.
In particular, the critic function of TD3 is used to provide update gradients for half of the individuals in the CEM population.
Later, ERL serves as a popular framework upon which many improvements are made.
CERL~\citep{khadka2019collaborative} extends the single RL agent to multiple ones with different hyperparameter settings to make better use of the RL side.
GPO~\citep{GangwaniP18GPO} devises gradient-based crossover and mutation by policy distillation and policy gradient algorithms, respectively.
Further, PDERL~\citep{bodnar2020proximal} devises the $Q$-filtered distillation crossover and Proximal mutation to alleviate the policy crash caused by conventional genetic operators at the parameter level.
\begin{comment}
\end{comment}
All these works adopt no sharing among agents and each agent of EA and RL learns its own state representation,
which is inefficient and specialized.
By contrast, our approach ERL-Re$^2$\xspace makes use of a expressive state representation function which is shared and learned by all agents.
Another common point of these works is, evolution variations are imposed at the parameter level (i.e., policy network).
Despite the existence of GPO and PDERL,
the semantics of genetic operators on policy behavior cannot be guaranteed due to the nonlinearity nature of policy parameters.
In ERL-Re$^2$\xspace, we propose behavior-level crossover and mutation operators that have clear semantics with linear policy representations.
\section{Representation-based Evolutionary Reinforcement Learning}
In this section, we introduce the overview of ERL-Re$^2$\xspace to gain the holistic understanding of the key concept.
In addition, we introduce how ERL-Re$^2$\xspace can be realized by a general form of algorithm framework. We
defer the concrete implementation details in Sec.~\ref{sec:re_in_rep_space}.
\subsection{The Concept of Two-scale State Representation and Policy Representation}
\begin{wrapfigure}{r}{0.65\textwidth}
\centering
\vspace{-0.5cm}
\includegraphics[width=0.95\linewidth]{Sec3/Construction.pdf}
\vspace{-0.1cm}
\caption{The left represents ERL framework and the right represents ERL-Re$^2$\xspace framework. In ERL-Re$^2$\xspace, all the policies are composed of the nonlinear shared state representation $Z_{\phi}$ and an individual linear policy representation $W$.
}
\label{TSR motivation}
\vspace{-0.3cm}
\end{wrapfigure}
The previous algorithms that integrate EA and RL for policy optimization primarily follow the ERL interaction architecture shown on the left of Fig.~\ref{TSR motivation}, where the population's policies offer a variety of experiences for RL training and the RL side injects its policy into the population to participate in the iterative evolution. However, two significant issues exist: 1) each agent maintains an independent nonlinear policy and searches in parameter space, which is inefficient because each agent has to independently and repeatedly learn common and useful knowledge.
2) Parameter-level perturbations might result in catastrophic failures, making parameter-level evolution exceedingly unstable.
To address the aforementioned problems, we propose Two-scale Representation-based policy construction, based on which we maintain and optimize the EA population and RL agent.
The policy construction is illustrated on the right of Fig.~\ref{TSR motivation}.
Specifically, the policies for EA and RL agents are all composed of a \textit{shared} nonlinear state representation $z_t=Z_\phi(s_t) \in \mathbb{R}^{d}$ (given a state $s_t$) and an \textit{individual} linear policy representation $W \in \mathbb{R}^{(d + 1) \times |\mathcal{A}|}$.
We refer to the different representation scopes (shared/individual + state/policy representation) of the policy construction as the two scales.
The agent $i$ makes decisions by combining the shared state representation and the policy representation:
\begin{equation*}
\pi_{i}(s_t) = \texttt{act} ( Z_{\phi}(s_t)^{\mathsf{T}}W_{i,[1:d]} + W_{i,[d+1]} ) \in \mathbb{R}^{|\mathcal{A}|},
\end{equation*}
where $W_{[m(:n)]}$ denotes the slice of matrix $W$ that consists of row $m$ (to $n$) and $\texttt{act}(\cdot)$ denotes some activation function (e.g., \texttt{tanh})\footnote{We use deterministic policy for demonstration while the construction is compatible with stochastic policy.}.
In turn, we also denote the EA population by $\mathbb{P} = \{ W_1,W_2,...,W_n \}$ and the RL agent by $W_{rl}$.
Intuitively, we expect the shared state representation $Z_{\phi}$ to be useful to all possible policies encountered during the learning process.
It ought to contain the general decision-related features of the environment, e.g., common knowledge, while not specific to any single policy.
By sharing the state representation $Z_{\phi}$, it does not require each agent to learn how to represent the state independently.
Thus, higher efficiency and more expressive state representation can be fulfilled through learning in a collective manner with the EA population and RL agent.
Since $Z_{\phi}$ is responsible for expressivity, each individual policy representation can have a straightforward linear form that is easy to optimize and evaluate (with PeVFA).
\subsection{The Algorithm Framework of ERL-Re$^2$\xspace}
\begin{figure}
\vspace{-0.2cm}
\centering
\includegraphics[width=0.8\linewidth]{Sec3/overall.pdf}
\vspace{-0.25cm}
\caption{The optimization flow of ERL-Re$^2$\xspace. In an iterative fashion, the shared state representation and individual linear policy representations are optimized at two scales.
}
\label{overall flow}
\vspace{-0.4cm}
\end{figure}
Due to the representation-based policy construction, the state representation function $Z_{\phi}$ determines a policy space denoted by $\Pi(\phi)$,
where we optimize the individual representations of the EA and RL agents.
The optimization flow of ERL-Re$^2$\xspace is shown in Fig.~\ref{overall flow}.
The top and bottom panels depict the learning dynamics of $Z_{\phi}$ and the agents, respectively.
In each iteration $t$, the agents in the EA population $\mathbb{P}$ and the RL agent $W_{rl}$ evolve or reinforce their representations in the policy space $\Pi({\phi_t})$ provided by $Z_{\phi_t}$ (Sec.~\ref{how to update policy representation}).
After the optimization at the scale of individual representation,
the shared state representation is optimized (i.e., $\phi_t \rightarrow \phi_{t+1}$) towards a unifying direction,
derived from value function maximization
regarding all the EA and RL agents (Sec.~\ref{how to update the shared state representation}).
By this means, the shared state representation is optimized in the direction of a superior policy space for successive policy optimization.
In an iterative manner, the shared state representation and the individual policy representations
play distinct roles and complement each other in optimizing the EA and RL agents.
In principle, ERL-Re$^2$\xspace is a general framework that can be implemented with different EA and RL algorithms.
For the side of EA, we mainly consider Genetic Algorithm (GA)~\citep{mitchell1998introduction} as a representative choice while another popular choice CEM~\citep{pourchot2018cem} is also discussed in Appendix~\ref{Additional Discussion}.
Our linear policy representation can realized the genetic operations with clear semantics.
For the side of RL, we use DDPG~\citep{lillicrap2015continuous} and TD3~\citep{fujimoto2018addressing}.
For efficient knowledge sharing and policy optimization,
we learn a shared state representation by all the agents,
then we evolve and reinforce the policies in the policy representation space rather than in the original policy parameter space.
A general pseudo-code of ERL-Re$^2$\xspace is shown in Algorithm \ref{alg:TSR_ERL}.
In each iteration, the algorithm proceeds across three phases (denoted by blue).
First, each agent of EA and RL interacts with the environment and collects the experiences.
Specifically, the agents in the EA population $\mathbb{P}$ have the probability $1-p$ to rollout partially and estimate the surrogate fitness with higher sample efficiency (Line 5-6),
in contrast to the conventional way (Line 7-8).
Next, evolution and reinforcement update /optimize their policy representations in the linear policy space (Line 13-14).
The agents are optimized by EA and RL,
where RL agent learns with additional off-policy experiences collected by the agents in $\mathbb{P}$ (Line 14) and periodically injects its policy to $\mathbb{P}$ (Line 15).
Finally, the shared state representation is updated to provide superior policy space for the following iteration (Line 17).
\begin{comment}
\section{Two-scale Representation-based Evolutionary Reinforcement Learning}
\label{sec:method_overview}
In this section, we introduce the overview of ERL-Re$^2$\xspace to gain the holistic understanding of the key concept.
In addition, we introduce how ERL-Re$^2$\xspace can be realized by a general form of algorithm framework.
We defer the algorithmic details in Section~\ref{sec:re_in_rep_space}.
\subsection{The Concept of Two-scale Representation of State and Policy}
\label{overall Arch}
The cornerstone of ERL-Re$^2$\xspace is Two-scale Representation-based policy construction, based on which we maintain and optimize the EA population and RL agent.
Specifically, the policies for EA and RL agents are all composed of a \textit{shared} nonlinear state representation $z_t=Z_\phi(s_t) \in \mathbb{R}^{d}$ (given a state $s_t$) and an \textit{individual} linear policy representation $W \in \mathbb{R}^{(d + 1) \times |\mathcal{A}|}$.
We refer to the contrast between the scopes of the two components as the \textit{two scales}.
The agent $i$ makes decisions by combining the shared state representation and the policy representation
$\pi_{i}(s_t) = \texttt{act} ( Z_{\phi}(s_t)^{\mathsf{T}}W_{i,[1:d]} + W_{i,[d+1]} ) \in \mathbb{R}^{|\mathcal{A}|}$,
where $A_{[m(:n)]}$ denotes the slice of matrix $A$ that consists of row $m$ (to $n$) and $\texttt{act}(\cdot)$ denotes some activation function (e.g., \texttt{tanh})\footnote{We use deterministic policy for demonstration while ERL-Re$^2$\xspace construction is compatible with stochastic policy.}.
In turn, we also denote the EA population by $\mathbb{P} = \{ W_1,W_2,...,W_n \}$ and the RL agent by $W_{rl}$.
Intuitively, we expect the shared state representation $Z_{\phi}$ to be useful to all possible policies encountered during the learning process.
It ought to contain the general decision-related features of the environment, e.g., the common knowledge, while not specific to any single policy.
By sharing the state representation $Z_{\phi}$, it is free of learning state representation by each agent individually as done in prior works.
Thus, higher efficiency and more expressive state representation can be fulfilled through learning in a collective manner with the EA population and RL agent.
Thanks to the responsibility on expressivity taken by $Z_{\phi}$,
the individual policy representation can have a simple linear form which is efficient to optimize and evaluate (with PeVFA).
\end{comment}
\begin{comment}
The form of ERL-Re$^2$\xspace policy we propose is inspired by Two-timescale Network~\citep{ChungNJW19Twotimescale} and similar forms studied in State Representation~\citep{DabneyBRDQBS21VIP, Kumar22DR3}.
The key difference will be introduced along with our novel ERL concept in the next paragraph.
Note that we take deterministic policy for demonstration here while the ERL-Re$^2$\xspace policy construction is compatible with typical stochastic policy.
\end{comment}
\begin{comment}
Formally, for a state representation function $Z_{\phi}$,
it determines a policy space denoted by $\Pi(\phi)$ in which we optimize the EA population $\mathbb{P}$ and the RL agent $W_{rl}$.
This is illustrated at the bottom of Fig.~\ref{overall flow}.
\end{comment}
\begin{comment}
The optimization dynamics at the two scales are illustrated by the solid arrows in Fig.~\ref{overall flow}.
At iteration $t$,
the EA population $\mathbb{P}$ and the RL agent $W_{rl}$ are optimized to superior policy regions (Sec.~\ref{how to update policy representation}) within current policy space $\Pi(\phi_t)$.
In particular, the evolution is conducted by \textit{behavior-level} crossover and mutation operators rather than conventional parameter-level ones.
Moreover, taking advantage of the simplicity of policy representation, a novel surrogate of fitness function based on PeVFA $\mathbb{Q}_{\theta}(s,a,W_i)$,
is used to improve sample efficiency by reducing the cost of MC fitness estimation.
After the policy optimization at the scale of individuals,
the shared representation is updated to explore and reclaim a better policy space for successive policy optimization.
As shown in the upper panel of Fig.~\ref{overall flow}, this is realized by following a unifying direction derived from value function maximization of both the EA population $\mathbb{P}$ and the RL agent $W_{rl}$ (Sec.~\ref{how to update the shared state representation}).
\end{comment}
\begin{comment}
During each iteration,
agents explore in policy search space $\Pi(\phi)$ and optimize policy representations $(W_1,W_2,...,W_n)$ towards reward-maximizing direction based on the shared state representation $z_t=Z_{\phi}(s_t)$.
\thy{then the concrete}
Specifically, the RL agent is improved by the optimized critic $Q$ and agents in the population $\mathbb{N}$ are improved by genetic operators. Subsequently, to optimize the shared state representation, PeVFA\xspace $\mathbb{Q}(s,a,W_i)$ is introduced. We adopt it to the off-policy algorithm to provide generalized value estimates and train PeVFA\xspace through temporal difference (TD) learning. With optimized critic $Q$ and PeVFA\xspace $\mathbb{Q}$, we improve the shared state representation through gradients optimization to a unifying direction which is beneficial for all agents' improvement.
\thy{to merge this part into the next section}
For EA and RL interaction, EA provides generated samples to replay buffer, which is used to train the RL agent and PeVFA\xspace. RL injects its policy to the population to participate in population evolution. Moreover, EA and RL are further tightly tied together by shared state representations on policy improvement, which is the major difference between our framework and previous framework.
In addition, typical genetic operators are operated directly on neural network parameters, which can lead to catastrophic forgetting problems~\citep{bodnar2020proximal}. In ERL-Re$^2$\xspace, the novel genetic operators are proposed which operate at the behavior level, leading to more stable and effective evolution. To further improve the sample efficiency, we propose a novel fitness function which uses the n-step return based on PeVFA\xspace and the policy representations as a surrogate of the fitness.
We details these techniques in next section.
\end{comment}
\begin{comment}
To demonstrate the generality of ERL-Re$^2$\xspace, we integrate ERL-Re$^2$\xspace with DDPG and TD3 which are currently the two most used RL algorithms in the ERL direction.
In each generation, the agents in the population interact with the environment to obtain fitness and store the generated samples to replay buffer (Lines 4-8). In this process, we use MC return as a surrogate of the fitness with probability $p$ and use n-step return as a surrogate of the fitness with probability $1-p$.
Then we evaluate the RL agent and store samples (Line 9).
With the replay buffer, PeVFA\xspace and the RL critic are optimized (Line 10).
Subsequently, we perform genetic operators on policy representations in the population for evolution and perform gradient optimization to improve the RL agent (Lines 11-12).
With the optimized policies, we use the RL policy representation and $K$ policy representations uniformly sampled from the population to optimize the shared state representation according to Eq.\ref{uptdate the shared state representation} (Line 13).
Finally, we inject RL policy to the population periodical (Line 14).
Overall, we provide the technical details of ERL-Re$^2$\xspace, as well as how to combine ERL-Re$^2$\xspace with RL algorithms, which we then evaluate empirically in the following section \thy{to repair}.
\end{comment}
\section{Evolution and Reinforcement in Representation Space}
\label{sec:re_in_rep_space}
In this section, we present the algorithm details of how to optimize the two-scale representation. In addition, we introduce a novel surrogate of policy fitness to further improve the sample efficiency.
\begin{algorithm}[t]
\small
\caption{
ERL with Two-scale State Representation and Policy Representation
(ERL-Re$^2$\xspace)}
\label{alg:TSR_ERL}
\textbf{Input:} the EA population size $n$,
the probability $p$ of using MC estimate, the partial rollout length $H$\\
\textbf{Initialize:} a replay buffer $\mathcal{D}$, the shared state representation function $Z_\phi$, the RL agent $W_{rl}$, the EA population $\mathbb{P} = \{W_1, \cdots, W_n\}$,
the RL critic $Q_{\psi}$ and the PeVFA\xspace $\mathbb{Q}_{\theta}$ (target networks are omitted here)
\\
\Repeat{reaching maximum steps} {
\textcolor{blue}{\# Rollout the EA and RL agents with $Z_{\phi}$ and estimate the (surrogate) fitness}
\eIf{Random Number $>p$}{
Rollout each agent in $\mathbb{P}$ for $H$ steps and evaluate its fitness by the surrogate $\hat{f}(W)$ \Comment{see Eq.~\ref{n step return score}}
}{
Rollout each agent in $\mathbb{P}$ for one episode and evaluate its fitness by MC estimate
}
Rollout the RL agent for one episode
Store the experiences generated by $\mathbb{P}$ and $W_{rl}$ to $\mathcal{D}$
\textcolor{blue}{\# \textit{Individual} scale: evolution and reinforcement in the policy space}
Train PeVFA\xspace $\mathbb{Q_{\theta}}$ and RL critic $Q_{\psi}$ with $D$ \Comment{see Eq.~\ref{eq:value_approx}}
\textbf{Optimize the EA population:} perform the genetic operators (i.e., selection, crossover and mutation) at the behavior level for $\mathbb{P} = \{W_1, \cdots, W_n\}$ \Comment{see Eq.~\ref{eq:b_genetic_op}}
\textbf{Optimize the RL agent:} update $W_{rl}$ (by e.g., DDPG and TD3) according to $Q_{\psi}$ \Comment{see Eq.~\ref{update RL actor}}
Inject RL agent to the population $\mathbb{P}$ periodically
\textcolor{blue}{\# \textit{Common} scale: improving the policy space through optimizing $Z_{\phi}$}
\textbf{Update the shared state representation:}
optimize $Z_{\phi}$ with a unifying gradient direction derived from value function maximization regarding $\mathbb{Q}_{\theta}$ and $Q_{\psi}$
\Comment{see Eq.~\ref{eq:shared_state_rep_loss}}
}
\end{algorithm}
\subsection{Optimizing the Shared State Representation for A Superior Policy Space}
\label{how to update the shared state representation}
The shared state representation $Z_{\phi}$ designates the policy space $\Pi_{\phi}$, in which EA and RL are conducted.
As discussed in the previous section, the shared state representation takes the responsibility of learning useful features of the environment from the overall policy learning.
We argue that this is superior to the prior way, i.e., each agent learns its individual state representation which can be less efficient and limited in expressivity.
In this paper,
we propose to learn the shared state representation by the principle of \textit{value function maximization regarding all EA and RL agents}.
To be specific,
we first detail the value function approximation for both EA and RL agents.
For the EA agents, we learn a PeVFA $\mathbb{Q}_{\theta}(s,a,W_i)$ based on the linear policy representation $W_i$ in EA population $\mathbb{P}$;
for the RL agent, we learn a critic $Q_{\psi}(s,a)$. In principle, RL can use PeVFA as its critic. We experimentally show that both approaches can achieve similar performance in Appendix.\ref{ap:c4}.
The loss functions of $\mathbb{Q}_{\theta}$ and $Q_{\psi}$ are formulated below:
\vspace{-0.2cm}
\begin{equation}
\begin{aligned}
& \mathcal{L}_{\mathbb{Q}}(\theta)= \mathbb{E}_{(s,a,r,s^{\prime}) \sim \mathcal{D}, W_i \sim \mathbb{P}
} \left[\left(r + \gamma
\mathbb{Q}_{\theta^{\prime}} \left(s^{\prime}, \pi_{i}(s^{\prime}) ,W_i\right)
-\mathbb{Q}_{\theta}\left(s, a, W_{i}\right)\right)^{2}\right], \\
& \mathcal{L}_{Q}(\psi)= \mathbb{E}_{(s,a,r,s^{\prime}) \sim \mathcal{D}} \left[\left(r + \gamma
Q_{\psi^{\prime}} \left(s^\prime, \pi_{rl}^\prime(s^{\prime}) \right)
-Q_{\psi}\left(s, a \right)\right)^{2}\right],
\end{aligned}
\label{eq:value_approx}
\vspace{-0.2cm}
\end{equation}
where $D$ is the experience buffer collected by both the EA and RL agents, $\theta^{\prime}, \psi^{\prime}$ denote the target networks of the PeVFA and the RL critic,
$\pi_{rl}^\prime$ denote the target actor with policy representation $W_{rl}^{\prime}$,
and recall $\pi_i(s) = \texttt{act} ( Z_{\phi}(s)^{\mathsf{T}}W_{i,[1:d]} + W_{i,[d+1]} ) \in \mathbb{R}^{|\mathcal{A}|}$.
Note that we make $\mathbb{Q}_{\theta}$ and $Q_{\psi}$ take the raw state $s$ as input rather than $Z_{\phi}(s)$.
Since sharing state representation between actor and critic may induce interference and degenerated performance as designated by recent studies~\citep{CobbeHKS21PPG,RaileanuF21Decoupling}.
Another thing to notice is, to our knowledge, we are the first to train PeVFA in an off-policy fashion (Eq.~\ref{eq:value_approx}).
We discuss more on this in Appendix~\ref{Additional Discussion}.
For each agent of EA and RL, an individual update direction of the shared state representation $Z_{\phi}$ is now ready to obtain by $\nabla_{\phi} \mathbb{Q}_{\theta}(s,\pi_{i}(s),W_i)$ for any $W_i \in \mathbb{P}$ or $\nabla_{\phi} Q_{\psi}(s,\pi_{rl}(s))$
through $\pi_{i}$ and $\pi_{rl}$ respectively.
This is the value function maximization principle where we adjust $Z_{\phi}$ to induce superior policy (space) for the corresponding agent.
To be \textit{expressive}, $Z_{\phi}$ should not take either individual update direction solely;
instead, the natural way is to take a unifying update direction regarding all the agents (i.e., the currently \textit{targeted} policies).
Finally, the loss function of
$Z_{\phi}$ is defined:
\vspace{-0.2cm}
\begin{equation}
\mathcal{L}_{{Z}}(\phi)= - \mathbb{E}_{s \sim \mathcal{D}, \{W_j\}_{j=1}^{K} \sim \mathbb{P}
} \Big[ Q_{\psi} \left(s, \pi_{rl}\left(s\right) \right) + \sum_{j=1}^{K} \mathbb{Q}_{\theta}\left(s, \pi_{j} \left(s\right), W_j \right) \Big],
\label{eq:shared_state_rep_loss}
\vspace{-0.2cm}
\end{equation}
where $K$ is the size of the sampled subset of EA agents that engage in updating $Z_{\phi}$.
By minimizing Eq.~\ref{eq:shared_state_rep_loss},
the shared state representation $Z_{\phi}$ is optimized towards a superior policy space $\Pi_{\phi}$ pertaining to all the EA and RL agents iteratively,
as the learning dynamics depicted in Fig.~\ref{overall flow}.
Note that the value maximization is not the only possible choice.
For a step further, we also investigate on the incorporation of self-supervised state representation learning
in Appendix~\ref{Additional Experiments}.
\begin{comment}
To ensure the policies explore in a favorable space, the key problem is how to optimize the shared state representation to convey common knowledge which is benefit to all agents.
To facilitate the promotion of RL, we optimize the shared state representation by gradients from the RL critic, however, which may not contribute to the agents in the population. Thus we employ Policy Extension Value Function Approximation(PeVFA\xspace), which takes the policy representation as an additional input to the value function and can provide each agent in the population an generalized estimates to avoid overfitting to a particular policy.
To ensure that the shared state representation contributes to the evolution of the population, we uniformly sample the linear policy representation $W_i$ from the population to optimize the shared state representation network $Z_{\phi}$ by gradients based on PeVFA\xspace.
By mixing gradients from RL critic and PeVFA\xspace, we can provide a favorable space for policy search.
\begin{wrapfigure}{r}{0.7\linewidth}
\centering
\centering
\includegraphics[width=0.95\linewidth]{Sec3/update_state.pdf}
\caption{The process of optimizing the shared state representation.}
\label{Sec3:update shared network}
\end{wrapfigure}
The detailed learning process is shown in Fig.\ref{Sec3:update shared network}. Specifically, we use the generated samples from replay buffer to train the RL critic and PeVFA\xspace.
To optimize PeVFA\xspace, we uniformly sample the policy representation from the population with the data from replay buffer to approximate the value estimates of different policies.
\end{comment}
\begin{comment}
The loss of PeVFA\xspace $\mathcal{L}_{\mathbb{Q}}(\theta)$ is defined below:
\begin{equation}
\begin{aligned}
& \mathcal{L}_{\mathbb{Q}}(\theta)= \mathbb{E}_{s_t,a_t,r_t,s_{t+1} \sim \mathcal{D}, W_i \sim \mathbb{N}
}\left[\left(r_t + \gamma*
\mathbb{Q}_{\theta^{\prime}}\left(s_t, Z(s_{t+1})^{\mathsf{T}}W_i,W_{i} \right)
-\mathbb{Q}_{\theta}\left(s_t, a_t,W_{i} \right)\right)^{2}\right],
\end{aligned}
\label{update PeVFA}
\end{equation}
where $\mathcal{D}$ is the replay buffer, $\theta$ and $\theta^{\prime}$ are the parameters of the PeVFA\xspace's network and the target network. With the optimized PeVFA\xspace, we optimize the shared state presentation network through the following equation:
\begin{equation}
\begin{aligned}
& \mathcal{L}_{{Z}}^{EA}(\phi)= \mathbb{E}_{s_t \sim \mathcal{D}, W_i \sim \mathbb{N}
}\left[\left(-\mathbb{Q}\left(s_t, Z_\phi(s_t)^\mathsf{T}W_i,W_{i} \right)\right)^{2}\right].
\end{aligned}
\label{EA updates Z}
\end{equation}
The loss of the RL critic is defined below:
\begin{equation}
\begin{aligned}
& \mathcal{L}_{Q}(\psi)= \mathbb{E}_{s_t,a_t,r_t,s_{t+1} \sim \mathcal{D}}\left[\left(r_t + \gamma*
Q_{\psi^{\prime}}\left(s_t, Z^\prime(s_{t+1})^{\mathsf{T}}W_{rl},W_{rl} \right)
-Q_{\psi}\left(s_t, a_t, W_{rl} \right)\right)^{2}\right],
\end{aligned}
\label{RL Critic loss}
\end{equation}
where $W_{rl}$ is the policy representation of RL agent and $Z^\prime$ is the target shared state representation network.
With the optimized critic,
we optimize the shared state representation network through the following equation:
\begin{equation}
\begin{aligned}
& \mathcal{L}_{{Z}}^{RL}(\phi)= \mathbb{E}_{s_t \sim \mathcal{D}
}\left[\left(-Q\left(s_t, Z_\phi(s_t)^\mathsf{T}W_{rl},W_{rl} \right)\right)^{2}\right].
\end{aligned}
\label{RL updates Z}
\end{equation}
Thus the total loss for the shared state representation network is defined as:
\begin{equation}
\begin{aligned}
& \mathcal{L}_{Z}(\phi)= \mathcal{L}_{Z}^{EA}(\phi) + \mathcal{L}_{Z}^{RL}(\phi).
\end{aligned}
\label{uptdate the shared state representation}
\end{equation}
After training, the shared state representation network can convey a common knowledge that is effective for both EA and RL.
\end{comment}
\subsection{Optimizing the Policy Representation by Evolution and Reinforcement}
\label{how to update policy representation}
\vspace{-0.1cm}
Given the shared state representation $Z_{\phi}$, all the agents of EA and RL optimize their individual policy representation in the policy space $\Pi(\phi)$.
The fundamental distinction here is, that the evolution and reinforcement occur in the linear policy representation space rather than in a nonlinear policy network parameter space as the convention.
Thus, policy optimization can be efficiently conducted.
Moreover, the linear policy representation has a special characteristic:
it allows performing genetic operations at the behavior level.
We detail the policy representation optimization of EA and RL below.
The evolution of the EA population $\mathbb{P}$ mainly consists of:
1) interaction and selection, 2) genetic evolution.
For the process of interaction and selection,
most prior methods rollout each agent in $\mathbb{P}$ for one or several episodes and calculate the MC fitness.
The incurred sample cost is regarded as one major bottleneck of EA especially when the population is large.
To this end, we propose a novel surrogate fitness which is estimated based on the PeVFA $\mathbb{Q}_{\theta}$ (Eq.~\ref{eq:value_approx}) and partial rollout.
At the beginning of each iteration, we have a probability $p$ to rollout the EA population for $H$ steps.
For each agent $W_i$, the surrogate fitness is estimated by $H$-step TD:
\vspace{-0.2cm}
\begin{equation}
\hat{f}(W_i) = \sum_{t=0}^{H-1} \gamma^{t} r_{t} + \gamma^{H} \mathbb{Q}_{\theta}(s_H, \pi_{i}(s_H), W_i).
\label{n step return score}
\end{equation}
Thanks to the PeVFA $\mathbb{Q}_{\theta}$, the surrogate fitness can be conveniently estimated and reduce the sample cost effectively.
Moreover, $\hat{f}(W_i)$ is free of the off-policy bias in the surrogate proposed in the concurrent work~\citep{wang2022surrogate}, we experimentally prove that $\hat{f}(W_i)$ is more efficient.
According to the fitness estimated by MC or our surrogate, parents with high fitness are more likely to be selected as parents. The details of the selection process follow PDERL~\citep{bodnar2020proximal}.
For the process of genetic evolution, two genetic operators are involved: crossover and mutation.
Typical $k$-point crossover and Gaussian mutation that directly operate at the parameter level can easily lead to large fluctuations in the decision and even cause a crash to policy~\citep{GangwaniP18GPO,bodnar2020proximal}.
The reason behind this is that the policy parameter is highly nonlinear to behavior, thus the natural semantics could be hardly guaranteed by such parameter-level operators.
In contrast, recall the linear policy representation $W$ in a matrix form.
Each row $W_{[i]}$ determines the $i$-th dimension of action
and thus the change to $W_{[i]}$ does not affect the behavior of other dimensions.
Based on the granularity of clearer semantics,
we propose novel \textit{behavior-level} crossover and mutation,
as the illustration in Fig.\ref{fig:behavior_level_go}.
For the behavior-level crossover ($b\texttt{-Crossover}$), the offspring are produced by inheriting the behaviors of the parents at the corresponding randomly selected dimensions.
For the behavior-level mutation ($b\texttt{-Mutation}$), each dimension of behavior has the probability $\alpha$ to be perturbed.
Formally, we formulate the two operations below:
\vspace{-0.1cm}
\begin{equation}
\begin{aligned}
( W_{c_1}, W_{c_2} ) & = ( W_{p_1} \otimes_{d_1} W_{p_2}, W_{p_2} \otimes_{d_2} W_{p_1} ) = b\texttt{-Crossover}(W_{p_1}, W_{p_2}) , \\
W_{m_1} & = W_{p_1} \otimes_{\hat{d}_1} P_{1} = b\texttt{-Mutation}(W_{p_1}),
\end{aligned}
\label{eq:b_genetic_op}
\vspace{-0.1cm}
\end{equation}
\begin{wrapfigure}{r}{.51\linewidth}
\begin{minipage}[t]{1.0\linewidth}
\centering
\vspace{-0.6cm}
\includegraphics[width=1.0\linewidth]{Sec3/mutation_and_crossover_operators_2.pdf}
\vspace{-0.6cm}
\caption{Behavior-level crossover and mutation operators in ERL-Re$^2$\xspace.
The offspring and parents are indexed by $c_1,c_2,m_1,m_2$ and $p_1,p_2$ respectively.}
\label{fig:behavior_level_go}
\vspace{-0.3cm}
\end{minipage}
\end{wrapfigure}
where $d_1,d_2,\hat{d}_1$ are the randomly sampled subsets of all dimension indices, $P_1$ is the randomly generated perturbation matrix,
and we use $A \otimes_d B$ to denote $A$ being replaced by $B$ at the corresponding rows in $d$.
For the dimension selection and perturbation generation, we follow the same approach used in~\citep{bodnar2020proximal}
(detailed in Appendix~\ref{Details of the genetic algorithm}) and we analyze the hyperparameter choices specific to our approach in Sec.~\ref{subsec:abaltion_and_analysis}.
By imposing variations on specific behavior dimensions while incurring no interference on the others, our proposed operators (i.e., $b\texttt{-Crossover}$ and $b\texttt{-Mutation}$) can be more effective and stable,
as well as more informative in the sense of genetic semantics.
\begin{comment}
We now introduce how to optimize the policy representations of agents to achieve effective policy improvement.
\textbf{To optimize the policy representation of the RL agent}, we directly optimize the policy representations by maximizing $Q$ values.
The loss is defined below:
\begin{equation}
\begin{aligned}
& \mathcal{L}_{{(W_{rl}})}= \mathbb{E}_{s_t \sim \mathcal{D}
}\left[\left(-Q\left(s_t, Z(s_t)^\mathsf{T}W_{rl},W_{rl} \right)\right)^{2}\right].
\end{aligned}
\label{update RL actor}
\end{equation}
\end{comment}
As to the learning of the RL agent $W_{rl}$,
it resembles the conventional circumstance except done with respect to the linear policy representation.
Taking DDPG~\citep{lillicrap2015continuous} for a typical example, the loss function of $W_{rl}$ is defined below, based on the RL critic $Q_{\psi}$ (learned by Eq.~\ref{eq:value_approx}):
\vspace{-0.1cm}
\begin{equation}
\mathcal{L}_{\text{RL}}(W_{rl}) = - \mathbb{E}_{s \sim \mathcal{D}
} \Big[ Q_{\psi} \left(s, \pi_{rl}(s) \right) \Big].
\label{update RL actor}
\vspace{-0.1cm}
\end{equation}
The RL agent learns from the off-policy experience in the buffer $D$ collected also by the EA population.
Meanwhile, the EA population incorporates the RL policy representation $W_{rl}$ at the end of each iteration.
By such an interaction, EA and RL complement each other consistently and the respective advantages of gradient-based and gradient-free policy optimization are merged effectively.
\begin{comment}
\textbf{To optimize the policy representations of EA agents}, the typical crossover and mutation which directly operate at the parameter level can lead to large fluctuations in the decision and even cause the algorithm to crash~\citep{bodnar2020proximal}.
Thus we design novel behavior-level crossover and mutation operators based on policy representations.
Specifically, the policy representation $W_i \in \mathbb{R}^ {d \times |\mathcal{A}|}$ can be defined as a matrix, where $d$ is the dimensions of representations and $|\mathcal{A}|$ corresponds to the action dimension.
Due to the linear property of the policy representation, we can divide the policy representation into $|\mathcal{A}|$ vectors. This means that for the action of the $i$th dimension, we have a corresponding vector $W[:,i]$.
The change of each vector does not affect other behaviors.
Thus we can perform crossover and mutation directly at the behavior level.
\begin{wrapfigure}{r}{0.6\linewidth}
\centering
\centering
\includegraphics[width=0.95\linewidth]{Sec3/mutation_and_crossover_operators.pdf}
\caption{Crossover and mutation operators in ERL-Re$^2$\xspace.}
\label{fig:behavior_level_go}
\end{wrapfigure}
The process of crossover and mutation is shown in Fig.\ref{fig:behavior_level_go}.
When the two parents perform crossover, only the vector corresponding to the same dimension of the action is swapped, without affecting the decisions of other dimensions.
For mutation operator, we select each action with probability $\alpha$ and add the same kind of perturbation to a certain percentage (i.e., $\beta$) parameters of the vector such as resetting some parameters and adding Gaussian noise to some parameters.
\end{comment}
\begin{comment}
To further improve the sample efficiency of EA, we design a novel fitness function to improve sample efficiency in our framework. To evolve populations, agents in the population need to interact with the environment for one or even several episodes, however, the agents only need to obtain a ranking according to their fitness (i.e., returns).
In our framework, we propose to use n-step return according to PeVFA\xspace as a surrogate of the fitness obtained from real interaction with the environment. Specifically,
with the optimized PeVFA\xspace, we can directly predict the future returns of a particular policy in a given state.
Agents of the population only interact with the environment for a small number of steps, then we calculate the n-step return based on the interactive rewards and the PeVFA\xspace's predictions.
The n-step return $F(W_i)$ according to PeVFA\xspace is defined as below:
\begin{equation}
\begin{aligned}
& F(W_i) =\sum_{t=0}^{H-1} \gamma^{t} r_{t} + \gamma^{H} \mathbb{Q}(s_H,Z(s_{H})^{\mathsf{T}}W_i,W_i),
\end{aligned}
\label{n step return score}
\end{equation}
where $H$ is the step length of the agents interacting with the environment. We adopt this function with a probability $p$ to guarantee the accuracy of PeVFA\xspace evaluation.
\end{comment}
\section{Experiments}
\vspace{-0.1cm}
\subsection{Experimental Setups}
We evaluate ERL-Re$^2$\xspace on six MuJoCo~\citep{todorov2012mujoco} continuous control tasks as commonly used in the literature: \textit{HalfCheetach}, \textit{Swimmer}, \textit{Hopper}, \textit{Ant}, \textit{Walker}, \textit{Humanoid} (all in version 2).
For a comprehensive evaluation,
we implement two instances of ERL-Re$^2$\xspace based on DDPG~\citep{lillicrap2015continuous} and TD3~\citep{fujimoto2018addressing}, respectively.
We compare ERL-Re$^2$\xspace with the following baselines:
1) \textbf{basic baselines}, i.e., PPO~\citep{PPO}, SAC~\citep{SAC}, DDPG, TD3 and EA~\citep{mitchell1998introduction};
2) \textbf{ERL-related baselines}, including
ERL~\citep{khadka2018evolution}, CERL~\citep{khadka2019collaborative}, PDERL~\citep{bodnar2020proximal}, CEM-RL~\citep{pourchot2018cem}.
The ERL-related baselines are originally built on different RL algorithms (either DDPG or TD3), thus we modify them to obtain both the two versions for each of them.
We use the official implementation and \textit{stable-baseline3} for the mentioned baselines in our experiments.
For a fair comparison, we compare the methods built on the same RL algorithm (i.e., DDPG and TD3) and fine-tune them in each task to provide the best performance.
All statistics are obtained from 5 independent runs. This is consistent with the setting in ERL and PDERL. We report the average with 95\% confidence regions.
For the population size $n$, we consider the common choices and use the best one in $[5, 10]$ for each concerned method.
We implement our method ERL-Re$^2$\xspace based on the codebase of PDERL and the common hyperparameters remain the same.
For the hyperparameters specific to ERL-Re$^2$\xspace (both DDPG and TD3 version), we set $\alpha$ to 1.0 and select
$H$ from $[50,200]$, $K$ from $[1,3]$, $p$ from $[0.3,0.5,0.7,0.8]$ for different tasks.
All implementation details are provided in Appendix \ref{app:method_detail}.
\begin{figure}[t]
\vspace{-0.2cm}
\centering
\includegraphics[width=0.28\linewidth]{major_res/Swimmer_new_name.pdf}
\includegraphics[width=0.28\linewidth]{major_res/new_Ant_TD3_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/new_Walker_TD3_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/new_Human_TD3_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/new_Hopper_TD3_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/new_Hald_TD3_.pdf}
\vspace{-0.3cm}
\caption{Performance comparison between ERL-Re$^2$\xspace and baselines (all in the \textbf{TD3} version).}
\label{TD3 based major res}
\vspace{-0.5cm}
\end{figure}
\begin{figure}[t]
\centering
\includegraphics[width=0.28\linewidth]{major_res/Swimmer_new_name_DDPG_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/Ant_DDPG_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/Walker_DDPG_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/Human_DDPG_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/Hopper_DDPG_.pdf}
\includegraphics[width=0.28\linewidth]{major_res/Half_DDPG_.pdf}
\vspace{-0.3cm}
\caption{Performance comparison between ERL-Re$^2$\xspace and baselines (all in the \textbf{DDPG} version).}
\label{DDPG based major res}
\vspace{-0.4cm}
\end{figure}
\vspace{-0.1cm}
\subsection{Performance Evaluation}
We evaluate
ERL-Re$^2$\xspace and baselines in TD3 and DDPG versions separately.
The results in Fig.\ref{TD3 based major res} and Fig.\ref{DDPG based major res} show that both ERL-Re$^2$\xspace(TD3) and ERL-Re$^2$\xspace(DDPG) significantly outperform other methods in most tasks. It is worth noting that, to our knowledge, ERL-Re$^2$\xspace is the first algorithm that outperforms EA in \textit{Swimmer}.
We can see that both ERL-Re$^2$\xspace(TD3) and ERL-Re$^2$\xspace(DDPG) achieve a 5x improvement in convergence rate compared to EA and obtain higher and more stable performance. Moreover, in some more difficult environments such \textit{Humanoid} which is dominated by RL algorithms, ERL-Re$^2$\xspace also achieves significant improvements. Overall, ERL-Re$^2$\xspace is an effective and general framework that significantly improves both EA and RL in all the six tasks while other methods fails.
Beyond MuJoCo, we also demonstrate the performance improvement achieved by ERL-Re$^2$\xspace in several visual control tasks of DMC~\citep{abs-1801-00690} in Appendix~\ref{ap:c5}.
\begin{figure}[t]
\vspace{-0.2cm}
\centering
\subfloat[Different genetic operators]{
\centering
\includegraphics[width=0.245\linewidth]{other_exp/Swimmer_opeators_.pdf}
\includegraphics[width=0.245\linewidth]{other_exp/Ant_operators_.pdf}
\label{operators}
}
\subfloat[Different choices of surrogate fitness]{
\includegraphics[width=0.245\linewidth]{other_exp/n-step-return_Ant_.pdf}
\includegraphics[width=0.245\linewidth]{other_exp/n-step-return_Walker_.pdf}
\label{fitness function}
}
\vspace{-0.3cm}\\
\subfloat[Ablation study on $Z_{\phi}$ (terms in Eq.~\ref{eq:shared_state_rep_loss}) \& Different $K$]{
\centering
\includegraphics[width=0.245\linewidth]{other_exp/K_Ant_.pdf}
\includegraphics[width=0.245\linewidth]{other_exp/K_Walker_.pdf}
\label{ablation k}
}
\subfloat[Ablation study on surrogate fitness ]{
\centering
\includegraphics[width=0.245\linewidth]{other_exp/use4.3_new_name.pdf}
\includegraphics[width=0.245\linewidth]{other_exp/Human_use_.pdf}
\label{ablation F}
}
\vspace{-0.2cm}
\caption{Comparative evaluation of the components in ERL-Re$^2$\xspace and ablation study.}
\label{comprasions}
\vspace{-0.7cm}
\end{figure}
\begin{figure}[t]
\centering
\subfloat[Probability $\alpha$ of each action mutation]{
\centering
\includegraphics[width=0.245\linewidth]{other_exp/alpha_Ant_.pdf}
\includegraphics[width=0.245\linewidth]{other_exp/alpha_Walker_.pdf}
\label{ablation alpha}
}
\subfloat[Probability $p$ to use our surrogate fitness]{
\includegraphics[width=0.245\linewidth]{other_exp/P_swimmer_.pdf}
\includegraphics[width=0.245\linewidth]{other_exp/P_walker_.pdf}
\label{ablation p}
}
\vspace{-0.25cm}
\caption{Analysis of main hyperparameters.}
\label{ablation study}
\vspace{-0.6cm}
\end{figure}
\vspace{-0.1cm}
\subsection{Superiority of Components \& Parameter Analysis}
\label{subsec:abaltion_and_analysis}
We conduct experiments to compare our proposed genetic operators and surrogate fitness with other related methods.
In Fig.\ref{operators}, we compare the behavior-level operators with other alternatives. The results show that the behavior-level operators are more effective than other operators.
Next, we examine whether the surrogate fitness estimate $\hat{f}(W_i)$ (i.e., $H$-step TD (PeVFA\xspace)) is better than using the RL critic to evaluate fitness based on the latest state from replay buffer~\citep{wang2022surrogate} (i.e., buffer (Critic)).
The results in Fig.\ref{fitness function} show that using PeVFA\xspace is more effective than using the RL critic. This is because the RL critic cannot elude the off-policy bias while PeVFA is free of it thanks to the generalized approximation.
Second, we provide ablation study on how to update $Z_{\phi}$ and analyze the effect of different $K$. We evaluate ERL-Re$^2$\xspace(TD3) with different $K \in [1,3]$ and ERL-Re$^2$\xspace(TD3) with only PeVFA\xspace or critic to optimize the shared state representation.
The results in Fig.\ref{ablation k} demonstrate the conclusion of two aspects: 1) $K$ affects the results and appropriate tuning are beneficial; 2)
both the RL critic and PeVFA\xspace play important roles.
Only using the RL critic or PeVFA\xspace leads to inferior shared state representation, crippling the overall performance.
Third, we perform ablation experiments on $\hat{f}(W_i)$. The results in Fig.\ref{ablation F} show that using $\hat{f}(W_i)$ can deliver performance gains and achieve further improvement to ERL-Re$^2$\xspace especially in \textit{Swimmer}.
For hyperparameter analysis,
the results in Fig.\ref{ablation alpha} show that larger $\alpha$ is more effective and stable, which is mainly since that larger $\alpha$ can lead to stronger exploration.
Thus we use $\alpha=1.0$ on all tasks.
Finally,
the results in Fig.~\ref{ablation p} demonstrate that $p$ has an impact on performance and appropriate tuning for different tasks is necessary. It is worth noting that
setting $p$ to 1.0 also gives competitive performances, i.e., do not use the surrogate fitness $\hat{f}(W_i)$ (see blue in Fig.~\ref{ablation F}).
\vspace{-0.3cm}
\paragraph{Others} Due to space limitations, more experiments on
the hyperparameter analysis of $H$, $\beta$, different combinations of genetic operators, incorporating self-supervised state representation learning,
the interplay between the EA population and the RL agent and etc.
are placed in Appendix~\ref{Additional Experiments}.
\vspace{-0.1cm}
\section{Conclusion}
\vspace{-0.1cm}
\label{conclusion and limitations}
We propose a novel approach called ERL-Re$^2$\xspace to fuse the distinct advantages of EA and RL for efficient policy optimization.
In ERL-Re$^2$\xspace, all agents are composed of the shared state representation and an individual policy representation.
The shared state representation is endowed with expressive and useful features of the environment by value function maximization regarding all the agents.
For the optimization of individual policy representation, we propose behavior-level genetic operators and a new surrogate of policy fitness to improve effectiveness and efficiency.
In our experiments, we demonstrate the significant superiority of ERL-Re$^2$\xspace compared with various baselines on MuJoCo.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 7,090 |
{"url":"https:\/\/www.quizover.com\/course\/section\/independent-events-probability-by-openstax","text":"# 0.12 Probability \u00a0(Page 8\/8)\n\n Page 8 \/ 8\n\n## Independent events\n\nIn [link] , we considered conditional probabilities. In some examples, the probability of an event changed when additional information was provided. For instance, the probability of obtaining a king from a deck of cards, changed from $4\/\\text{52}$ to $4\/\\text{12}$ , when we were given the condition that a face card had already shown. This is not always the case. The additional information may or may not alter the probability of the event. For example consider the following example.\n\nA card is drawn from a deck. Find the following probabilities.\n\n1. The card is a king.\n2. The card is a king given that a red card has shown.\n1. Clearly, $P\\left(\\text{The card is a king}\\right)=4\/\\text{52}=1\/\\text{13}$ .\n\n2. To find $P\\left(\\text{The card is a king}\\mid \\text{A red card has shown}\\right)$ , we reason as follows:\n\nSince a red card has shown, there are only twenty six possibilities. Of the 26 red cards, there are two kings. Therefore,\n\n$P\\left(\\text{The card is a king}\\mid \\text{A red card has shown}\\right)=2\/\\text{26}=1\/\\text{13}$ .\n\nThe reader should observe that in the above example,\n\n$P\\left(\\text{The card is a king}\\mid \\text{A red card has shown}\\right)=P\\left(\\text{The card is a king}\\right)$\n\nIn other words, the additional information, a red card has shown, did not affect the probability of obtaining a king. Whenever the probability of an event $E$ is not affected by the occurrence of another event $F$ , and vice versa, we say that the two events $E$ and $F$ are independent . This leads to the following definition.\n\nTwo Events $E$ and $F$ are independent if and only if at least one of the following two conditions is true.\n\n1. $P\\left(E\\mid F\\right)=P\\left(E\\right)$ or\n2. $P\\left(F\\mid E\\right)=P\\left(F\\right)$\n\nIf the events are not independent, then they are dependent.\n\nNext, we need to develop a test to determine whether two events are independent.\n\nWe recall the conditional probability formula.\n\n$P\\left(E\\mid F\\right)=\\frac{P\\left(E\\cap F\\right)}{P\\left(F\\right)}$\n\nMultiplying both sides by $P\\left(F\\right)$ , we get\n\n$P\\left(E\\cap F\\right)=P\\left(E\\mid F\\right)P\\left(F\\right)$\n\nNow if the two events are independent, then by definition\n\n$P\\left(E\\mid F\\right)=P\\left(E\\right)$\n\nSubstituting, $P\\left(E\\cap F\\right)=P\\left(E\\right)P\\left(F\\right)$\n\nWe state it formally as follows.\n\n## Test for independence\n\nTwo Events $E$ and $F$ are independent if and only if\n$P\\left(E\\cap F\\right)=P\\left(E\\right)P\\left(F\\right)$\n\nThe table below shows the distribution of color-blind people by gender.\n\n Male(M) Female(F) Total Color-Blind(C) 6 1 7 Not Color-Blind (N) 46 47 93 Total 52 48 100\n\nWhere $M$ represents male, $F$ represents female, $C$ represents color-blind, and $N$ not color-blind. Use the independence test to determine whether the events color-blind and male are independent.\n\nAccording to the test, $C$ and $M$ are independent if and only if $P\\left(C\\cap M\\right)=P\\left(C\\right)P\\left(M\\right)$ .\n\n$P\\left(C\\right)P\\left(M\\right)=\\left(7\/\\text{100}\\right)\\left(\\text{52}\/\\text{100}\\right)=\\text{.}\\text{0364}$\n\nand $P\\left(C\\cap M\\right)=\\text{.}\\text{06}$\n\nClearly $\\text{.}\\text{0364}\\ne \\text{.}\\text{06}$\n\nTherefore, the two events are not independent. We may say they are dependent.\n\nIn a survey of 100 women, 45 wore makeup, and 55 did not. Of the 45 who wore makeup, 9 had a low self-image, and of the 55 who did not, 11 had a low self-image. Are the events \"wearing makeup\" and \"having a low self-image\" independent?\n\nLet $M$ be the event that a woman wears makeup, and $L$ the event that a woman has a low self-image. We have\n\n$P\\left(M\\cap L\\right)=9\/\\text{100}$ , $P\\left(M\\right)=\\text{45}\/\\text{100}$ and $P\\left(L\\right)=\\text{20}\/\\text{100}$\n\nIn order for two events to be independent, we must have\n\n$P\\left(M\\cap L\\right)=P\\left(M\\right)P\\left(L\\right)$\n\nSince $9\/\\text{100}=\\left(\\text{45}\/\\text{100}\\right)\\left(\\text{20}\/\\text{100}\\right)$\n\nThe two events \"wearing makeup\" and \"having a low self-image\" are independent.\n\nA coin is tossed three times, and the events $E$ , $F$ and $G$ are defined as follows:\n\n$E$ : The coin shows a head on the first toss.\n\n$F$ : At least two heads appear.\n\n$G$ : Heads appear in two successive tosses.\n\nDetermine whether the following events are independent.\n\n1. $E$ and $F$\n2. $F$ and $G$\n3. $E$ and $G$\n\nTo make things easier, we list the sample space, the events, their intersections and the corresponding probabilities.\n\n$S=\\left\\{\\text{HHH},\\text{HHT},\\text{HTH},\\text{HTT},\\text{THH},\\text{THT},\\text{TTH},\\text{TTT}\\right\\}$\n\n$E=\\left\\{\\text{HHH},\\text{HHT},\\text{HTH},\\text{HTT}\\right\\}$ , $P\\left(E\\right)=4\/8$ or $1\/2$\n\n$F=\\left\\{\\text{HHH},\\text{HHT},\\text{HTH},\\text{THH}\\right\\}$ , $P\\left(F\\right)=4\/8$ or $1\/2$\n\n$G=\\left\\{\\text{HHT},\\text{THH}\\right\\}$ , $P\\left(G\\right)=2\/8$ or $1\/4$\n\n$E\\cap F=\\left\\{\\text{HHH},\\text{HHT},\\text{HTH}\\right\\}$ , $P\\left(E\\cap F\\right)=3\/8$\n\n$E\\cap G=\\left\\{\\text{HHT},\\text{THH}\\right\\}$ , $P\\left(F\\cap G\\right)=2\/8$ or $1\/4$\n\n$E\\cap G=\\left\\{\\text{HHT}\\right\\}$ $P\\left(E\\cap G\\right)=1\/8$\n\n1. In order for $E$ and $F$ to be independent, we must have\n\n$P\\left(E\\cap F\\right)=P\\left(E\\right)P\\left(F\\right)$ .\n\nBut $3\/8\\ne 1\/2\\cdot 1\/2$\n\nTherefore, $E$ and $F$ are not independent.\n\n2. $F$ and $G$ will be independent if\n\n$P\\left(F\\cap G\\right)=P\\left(F\\right)P\\left(G\\right)$ .\n\nSince $1\/4\\ne 1\/2\\cdot 1\/4$\n\n$F$ and $G$ are not independent.\n\n3. We look at\n\n$P\\left(E\\cap G\\right)=P\\left(E\\right)P\\left(G\\right)$\n$1\/8=1\/2\\cdot 1\/4$\n\nTherefore, $E$ and $G$ are independent events.\n\nThe probability that Jaime will visit his aunt in Baltimore this year is $\\text{.}\\text{30}$ , and the probability that he will go river rafting on the Colorado river is $\\text{.}\\text{50}$ . If the two events are independent, what is the probability that Jaime will do both?\n\nLet $A$ be the event that Jaime will visit his aunt this year, and $R$ be the event that he will go river rafting.\n\nWe are given $P\\left(A\\right)=\\text{.}\\text{30}$ and $P\\left(R\\right)=\\text{.}\\text{50}$ , and we want to find $P\\left(A\\cap R\\right)$ .\n\nSince we are told that the events $A$ and $R$ are independent,\n\n$P\\left(A\\cap R\\right)=P\\left(A\\right)P\\left(R\\right)=\\left(\\text{.}\\text{30}\\right)\\left(\\text{.}\\text{50}\\right)=\\text{.}\\text{15}.$\n\nGiven $P\\left(B\\mid A\\right)=\\text{.}4$ . If $A$ and $B$ are independent, find $P\\left(B\\right)$ .\n\nIf $A$ and $B$ are independent, then by definition $P\\left(B\\mid A\\right)=P\\left(B\\right)$\n\nTherefore, $P\\left(B\\right)=\\text{.}4$\n\nGiven $P\\left(A\\right)=\\text{.}7$ , $P\\left(B\\mid A\\right)=\\text{.}5$ . Find $P\\left(A\\cap B\\right)$ .\n\nBy definition $P\\left(B\\mid A\\right)=\\frac{P\\left(A\\cap B\\right)}{P\\left(A\\right)}$\n\nSubstituting, we have\n\n$\\text{.}5=\\frac{P\\left(A\\cap B\\right)}{\\text{.}7}$\n\nTherefore, $P\\left(A\\cap B\\right)=\\text{.}\\text{35}$\n\nGiven $P\\left(A\\right)=.5$ , $P\\left(A\\cup B\\right)=.7$ , if $A$ and $B$ are independent, find $P\\left(B\\right)$ .\n\n$P\\left(A\\cup B\\right)=P\\left(A\\right)+P\\left(B\\right)\u2013P\\left(A\\cap B\\right)$\n\nSince $A$ and $B$ are independent, $P\\left(A\\cap B\\right)=P\\left(A\\right)P\\left(B\\right)$\n\nWe substitute for $P\\left(A\\cap B\\right)$ in the addition formula and get\n\n$P\\left(A\\cup B\\right)=P\\left(A\\right)+P\\left(B\\right)\u2013P\\left(A\\right)P\\left(B\\right)$\n\nBy letting $P\\left(B\\right)=x$ , and substituting values, we get\n\n$.7=.5+x\u2013.5x$\n$.7=.5+.5x$\n$.2=.5x$\n$.4=x$\n\nTherefore, $P\\left(B\\right)=.4$ .\n\nhow do you translate this in Algebraic Expressions\nNeed to simplify the expresin. 3\/7 (x+y)-1\/7 (x-1)=\n. After 3 months on a diet, Lisa had lost 12% of her original weight. She lost 21 pounds. What was Lisa's original weight?\nwhat's the easiest and fastest way to the synthesize AgNP?\nChina\nCied\ntypes of nano material\nI start with an easy one. carbon nanotubes woven into a long filament like a string\nPorter\nmany many of nanotubes\nPorter\nwhat is the k.e before it land\nYasmin\nwhat is the function of carbon nanotubes?\nCesar\nI'm interested in nanotube\nUday\nwhat is nanomaterials\u200b and their applications of sensors.\nwhat is nano technology\nwhat is system testing?\npreparation of nanomaterial\nYes, Nanotechnology has a very fast field of applications and their is always something new to do with it...\nwhat is system testing\nwhat is the application of nanotechnology?\nStotaw\nIn this morden time nanotechnology used in many field . 1-Electronics-manufacturad IC ,RAM,MRAM,solar panel etc 2-Helth and Medical-Nanomedicine,Drug Dilivery for cancer treatment etc 3- Atomobile -MEMS, Coating on car etc. and may other field for details you can check at Google\nAzam\nanybody can imagine what will be happen after 100 years from now in nano tech world\nPrasenjit\nafter 100 year this will be not nanotechnology maybe this technology name will be change . maybe aftet 100 year . we work on electron lable practically about its properties and behaviour by the different instruments\nAzam\nname doesn't matter , whatever it will be change... I'm taking about effect on circumstances of the microscopic world\nPrasenjit\nhow hard could it be to apply nanotechnology against viral infections such HIV or Ebola?\nDamian\nsilver nanoparticles could handle the job?\nDamian\nnot now but maybe in future only AgNP maybe any other nanomaterials\nAzam\nHello\nUday\nI'm interested in Nanotube\nUday\nthis technology will not going on for the long time , so I'm thinking about femtotechnology 10^-15\nPrasenjit\ncan nanotechnology change the direction of the face of the world\nAt high concentrations (>0.01 M), the relation between absorptivity coefficient and absorbance is no longer linear. This is due to the electrostatic interactions between the quantum dots in close proximity. If the concentration of the solution is high, another effect that is seen is the scattering of light from the large number of quantum dots. This assumption only works at low concentrations of the analyte. Presence of stray light.\nthe Beer law works very well for dilute solutions but fails for very high concentrations. why?\nhow did you get the value of 2000N.What calculations are needed to arrive at it\nPrivacy Information Security Software Version 1.1a\nGood\n8. It is known that 80% of the people wear seat belts, and 5% of the people quit smoking last year. If 4% of the people who wear seat belts quit smoking, are the events, wearing a seat belt and quitting smoking, independent?\nMr. Shamir employs two part-time typists, Inna and Jim for his typing needs. Inna charges $10 an hour and can type 6 pages an hour, while Jim charges$12 an hour and can type 8 pages per hour. Each typist must be employed at least 8 hours per week to keep them on the payroll. If Mr. Shamir has at least 208 pages to be typed, how many hours per week should he employ each student to minimize his typing costs, and what will be the total cost?\nAt De Anza College, 20% of the students take Finite Mathematics, 30% take Statistics and 10% take both. What percentage of the students take Finite Mathematics or Statistics?","date":"2018-07-23 11:43:37","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 125, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 1, \"mathjax_display_tex\": 0, \"mathjax_asciimath\": 0, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.6742503046989441, \"perplexity\": 793.7525292393618}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2018-30\/segments\/1531676596336.96\/warc\/CC-MAIN-20180723110342-20180723130342-00017.warc.gz\"}"} | null | null |
Q: Demonstrating the norm of a sum of vectors. I need help in this question, it's a true or false question, where it asks to prove or a counter proof of several items. There's one item in particular where I can't understand. If it's true, what properties or what I must use to prove.
Question: $\|u+v\|^2 = \|v\|^2 + 2 \|v\| \|u\| + \|u\|^2$,
where every $u$ and $v$ are vectors.
Just like this: https://i.stack.imgur.com/s7KaW.png
A: It is clearly false when $v=-u$.
If the norm is given by an inner product then we have $\|u+v\|^{2}=\|u\|^{2}+2 \langle u, v \rangle+\|u\|^{2}$ in the case of real scalars and $\|u+v\|^{2}=\|u\|^{2}+2 \Re \langle u, v \rangle+\|u\|^{2}$ in the case of complex scalars.
A: It's not true, just take $u=-v$.
A: $$\|u+v\|^2=(u+v)^2=u^2+2uv+v^2=\|u\|^2+2uv+\|v\|$$
but
$$uv\ne\|u\|\|v\|.$$
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 6,377 |
Blog of Horror
Trashy movie reviews from my home to yours. May contain spoilers, profanity, and meat by-products.
Sweeney Todd: The Demon Barber of Fleet Street (2007)
Directed by: Tim Burton
Written by: John Logan based on the Stephen Sondheim musical
Starring: Johnny Depp, Helena Bonham Carter, Alan Rickman, Jamie Campbell Bower, Jayne Wisener, Timothy Spall, Ed Sanders, Sacha Baron Cohen, Laura Michelle Kelly
First of all, I'm not really partial to musicals. In fact, I try to avoid musicals if I can, so ordinarily I wouldn't even bother with this, only it's Tim Burton and I do like him, sometimes.
It's about this barber who was fucked over by the world and decides to get his revenge by killing his clients. His landlady then bakes them into pies. Mmm, so tasty.
And I must say it was pretty awesome. It was gory enough to compensate for it being a musical. Johnny Depp & Helena Bonham Carter weird good/weird as usual and are surprisingly competent singers. On stage, they probably would have sucked, what with their voices being somewhat feeble.
Alan Rickman, on the other hand... I don't think he should sing. He doesn't sing all that much, but when he does it's really disturbing. I didn't like that at all.
The music itself was pretty good. I mean, it was annoying, but I got used to it. The songs weren't particularly memorable, but the lyrics were pretty good.
Moving on, it looked incredible, although on the scale of Tim Burtony movies, Beetlejuice being very Tim Burtony and, um, Planet of the Apes being WTF, it didn't rank terribly high. Although there was one scene where everything was stripey.
Otherwise, though, it was really dark. I mean, the only colour was red (and what a lot of red there was! My, my! The amount of blood was kind of cartoonish, actually).
So yeah, it was sort of beautiful. I liked it, anyway. The 'young lovers' theme was a little irritating but not terribly intrusive. It's overshadowed by the other love story, which is really much more interesting (the 'dead lovers' theme?).
At the end of the movie, though, I really wanted a meat pie. Terrible, isn't it?
So, very good fairytale, very bloody musical. Deliciously revolting. Johnny and Helena are both disgusting, but strangely sympathetic (and hot, but that's neither here nor there).
Pretty good. I won't go so far as to say it's the best thing Tim Burton's done since whatever, mostly because I can't remember everything he's ever done off the top of my head and I'm a little insecure about making statements like that, but it made me feel sort of happy and depressed at the same time, which is a good feeling.
I recommend it.
END COMMUNICATION
Posted by fingerwitch at 5:08 PM
Labels: horror, movies, musicals, serial killers
Look at Cats on Instagram
Lurk on Facebook
The Condemned
Creepshow 3
Kiss of the Vampire
serial killers (106)
top 100 (92)
sequels (74)
slashers (67)
mad scientists (42)
cults (36)
insanity (31)
zombies (ghouls) (30)
haunted houses (29)
rednecks (23)
universal classics (22)
remakes (21)
post apocalyptic (20)
possession (19)
killer robots (16)
cannibals (14)
evil kids (14)
splatter (13)
telvision (13)
comic adaptations (12)
jason voorhees (12)
mysteries (12)
zombies (general) (12)
killer plants (11)
hammer horror (10)
freddy kruger (9)
psychic powers (9)
michael myers (8)
period (8)
zombies (voodoo) (8)
video game adaptations (7)
animated (6)
val lewton (6)
zombies (fast) (6)
history of horror challenge (5)
gill-man (4)
human animal hybrids (4)
invisible man (4)
killer animals (bugs) (4)
killer dolls (4)
viruses (4)
alien invasion (3)
mutants (3)
prequels (3)
clones (2)
evil clowns (2)
killer animals (apes) (2)
killer animals (cats) (2)
killer animals (giant bugs) (2)
killer animals (giant crocodiles) (2)
killer animals (giant spiders) (2)
killer animals (sharks) (2)
killer animals (snakes) (2)
evil houses (1)
home invasion (1)
hooptober (1)
killer animals (bats) (1)
killer animals (bees) (1)
killer animals (birds) (1)
killer animals (deer) (1)
killer animals (dogs) (1)
killer animals (frogs) (1)
killer animals (giant ants) (1)
killer animals (giant chickens) (1)
killer animals (giant crabs) (1)
killer animals (giant iguanas) (1)
killer animals (giant leeches) (1)
killer animals (giant maggots) (1)
killer animals (giant pigs) (1)
killer animals (giant rabbits) (1)
killer animals (giant rats) (1)
killer animals (giant turtles) (1)
killer animals (giant wasps) (1)
killer animals (lizards) (1)
killer animals (rats) (1)
killer animals (turtles) (1)
killer cars (1)
living statues (1)
mind control (1)
ouija (1)
plant people (1)
rape revenge (1)
survival movies (1)
worst of (1) | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 6,125 |
Hidden Monster The Monsters Among Us Book 1 is available on our site, you can read and see it in full by downloading it directly on our site. Hidden Monster The Monsters Among Us Book 1 is a book that we recommend to you, and you can make Hidden Monster The Monsters Among Us Book 1 as reference for your needs. Another advantage besides you buying this book is that you will get free access services on our library website as long as you subscribe. For you, we provide free access to up to 14 days trial of our book library by subscribing. So you can read other books on our website for free at any time during the subscription. | {
"redpajama_set_name": "RedPajamaC4"
} | 1,078 |
1 Steve: Crikey! That dragon's a bit stroppy!
This comic was made using the Historic Tale Construction Kit, which lets you make your own cool medieval tapestry using bits and pieces of the famous Bayeux Tapestry.
2012-11-29 Rerun commentary: I've replaced the link above to a current website that hosts a recreation of the original Historic Tale Construction Kit, which has long since vanished.
Interestingly, the Wikipedia article on the Bayeux Tapestry as it existed when this comic was originally published contains a link to the original Historic Tale Construction Kit. The current version of the Wikipedia page, while much more detailed, well referenced, and informative, does not, alas, contain anything so whimsically entertaining. | {
"redpajama_set_name": "RedPajamaC4"
} | 4,453 |
Saccorhytus é um gênero de deuterostômio que viveu durante o período Cambriano onde hoje é a China. É conhecido como sendo o ancestral mais antigo do ser humano, também sendo o deuterostômio mais antigo conhecido.
Descrição
Espécimes de Saccorhytus tinham 1mm de comprimento. Segundo os fósseis, esses animais não tinham ânus, provavelmente se alimentando e soltando o excremento pela mesma abertura. Essa boca também era desproporcionalmente grande para o tamanho do animal, o que significa que ele poderia ter comido outros animais. Esses animais também tinham quatro aberturas cônicas de cada lado, que não foram usadas para respirar. Elas provavelmente evoluíram para as brânquias modernas. O corpo do animal era coberto por uma pele e músculos finos, indicando que provavelmente esses animais se moviam "balançando" e contraindo os músculos ao longo de seu corpo.
Referências
Animais do Cambriano
Espécies fósseis descritas em 2017 | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 2,673 |
Back in 2007, then-Mayor Gavin Newsom pledged to keep San Francisco a sanctuary city and to discourage federal authorities from conducting immigration raids. That kind of thing sent (and continues to send) a message — the wrong one — as evidenced by the story of a man who had been deported five times who now stands accused of shooting and killing a San Francisco woman who was walking down on a pier.
Reminder: All Democrats running for president support the idea of "sanctuary cities" — a name that was chosen because "felon magnets" didn't sound politically wise. In other words, Hillary Clinton keeps tighter border security for reporters than she would for the entire country (if Hillary could be convinced all those people crossing were reporters wanting to ask her questions, there would be a rope line at the border in no time). | {
"redpajama_set_name": "RedPajamaC4"
} | 5,026 |
Rev. biol. trop vol.59 n.3 San José Sep. 2011
Influence of Diadema antillarum populations (Echinodermata: Diadematidae) on algal community structure in Jardines de la Reina, Cuba
Félix Martín Blanco1, Lídice Clero Alonso1, Gaspar González Sansón2 & Fabián Pina Amargós1
1. Centro de Investigaciones de Ecosistemas Costeros, Ministerio de Ciencia, Tecnología y Medio Ambiente. Cayo Coco, Morón, Ciego de Ávila, CP 69400, Cuba; felix.martin79@gmail.com, fabian@ciec.fica.inf.cu, lclero@yahoo.es
2. Centro de Investigaciones Marinas, Universidad de la Habana. Calle 16, # 114 e/ 1ra y 3ra, Miramar, Playa, Ciudad de La Habana, CP. 11300, Cuba; gaspargonzalez2001@yahoo.es
Dirección para correspondencia
The 1983-1984 mass mortality of Diadema antillarum produced severe damages on Caribbean reefs contributing to substantial changes in community structure that still persist. Despite the importance of Diadema grazing in structuring coral reefs, available information on current abundances and algal-urchin interactions in Cuba is scarce. We analyzed spatial variations in Diadema abundance and its influence on algal community structure in 22 reef sites in Jardines de la Reina, in June/2004 and April/2005. Urchins were counted in five 30x2m transects per site, and algal coverage was estimated in randomly located 0.25m side quadrats (15 per site). Abundances of Diadema were higher at reef crests (0.013-1.553 ind/m2), while reef slope populations showed values up to three orders of magnitude lower and were overgrown by macroalgae (up to 87%, local values). Algal community structure at reef slopes were dominated by macroalgae, especially Dictyota, Lobophora and Halimeda while the most abundant macroalgae at reef crests were Halimeda and Amphiroa. Urchin densities were negatively and positively correlated with mean coverage of macroalgae and crustose coralline algae, respectively, when analyzing data pooled across all sites, but not with data from separate habitats (specially reef crest), suggesting, along with historical fish biomass, that shallow reef community structure is being shaped by the synergistic action of other factors (e.g. fish grazing) rather than the influence of Diadema alone. However, we observed clear signs of Diadema grazing at reef crests and decreased macroalgal cover according to 2001 data, what suggest that grazing intensity at this habitat increased at the same time that Diadema recruitment began to be noticeable. Furthermore, the excessive abundance of macroalgae at reef slopes and the scarcity of crustose coralline algae seems to be due by the almost complete absence of D. antillarum at mid depth reefs, where local densities of this urchin were predominantly low. Rev. Biol. Trop. 59 (3): 1149-1163. Epub 2011 September 01.
Key words: Diadema antillarum, algal community structure, algal-urchin relationships, hervibory, Jardines de la Reina, Cuba.
A pesar de la importancia del forrageo de Diadema en la estructuración de los arrecifes de coral, la información disponible sobre la actual abundancia de algas y de las interacciones de erizos en Cuba es escasa. Por lo tanto, se analizan las variaciones espaciales en la abundancia de Diadema antillarum y su influencia sobre las algas en 22 arrecifes en Jardines de la Reina, en junio/2004 y abril/2005. Los erizos se muestrearon en recorridos de 30x2m (5/sitio) y las algas en cuadrículas de 0.25m de lado (15/sitio). Las densidades de Diadema fueron mayores en las crestas arrecifales (0.013-1.553ind/m2) mientras que las pendientes mostraron valores hasta tres ordenes de magnitud menor y presentaron un cubrimiento excesivo de macroalgas (hasta 87%), siendo las más abundantes Dictyota, Lobophora y Halimeda. Las densidades de erizos estuvieron correlacionadas negativa y positivamente con el cubrimiento de macroalgas y algas costrosas, respectivamente, en el análisis global, pero no en hábitats separados (especialmente en crestas), sugiriendo, conjuntamente con la biomasa histórica de peces, que la estructura de las comunidades en las crestas está determinada por la acción sinérgica de otros factores (herbivoría de peces) más que por la influencia de Diadema solo. No obstante, se observaron indicios del forrajeo de Diadema, y el cubrimiento de macroalgas disminuyó desde 2001, lo cual sugiere que la intensidad de la herbivoría aumentó al mismo tiempo que el reclutamiento de Diadema.
Palabras clave: Diadema antillarum, estructura de las comunidades de algas, relaciones alga-erizo, herbivoría, Jardines de la Reina, Cuba.
The 1983-1984 mass mortality of Diadema antillarum Philippi, 1845 in the Caribbean produced significant damages on many coral reefs of the region. Several reefs around the wider Caribbean became rapidly overgrown by macroalgae after depletion of this major herbivore (Hughes et al. 1985, Liddell & Ohlhorts 1986, De Ruyter van Steveninck & Breeman 1987, Levitan 1988, Carpenter 1990) and experienced substantial changes in benthic community structure that still persist (Hughes 1994, Hughes et al. 1999, Aronson & Precht 2000, 2006, Edmunds & Carpenter 2001, Knowlton 2001, Bellwood et al. 2004, Carpenter & Edmunds 2006, Mumby et al. 2006). The increasingly decline of reef corals in the absence of D. antilllarum emphasize the impact of limited functional redundancy of Caribbean reef ecosystems (Bellwood et al. 2004) and demonstrate that Caribbean reefs lost a key component of resilience at the time of Diadema die-off. Accordingly, the recovery of D. antillarum populations across the entire Caribbean during the last decade has been associated with decrease macroalgal cover and enhanced coral cover and recruitment (Aronson & Precht 2000, Edmunds & Carpenter 2001, Miller et al. 2003, Weil et al. 2005, Carpenter & Edmunds 2006, Myhre & Acevedo-Gutiérrez 2007) showing that a phase reversal from macroalgal to coral dominance could be possible if former levels of herbivory resume (Carpenter & Edmunds 2006, Mumby 2009).
Although there are no historical records about the status of Diadema populations in Cuban reefs before die-off (only one paper about methodological aspects was published, Herrera-Moreno et al. 1981), and no scientific papers reported the consequences of the mortality in coral reefs, today it is well documented that several Cuban reefs are overgrown by macroalgae, which are generally more abundant than corals at shallow and mid depth reefs (Alcolado et al. 2001, Caballero & Guardia 2003, Guardia et al. 2004a, b, 2006, Caballero et al. 2006, Clero-Alonso et al. 2006, Pina-Amargós et al. 2006). Fore reef habitats from Jardines de la Reina represent a clear example of macroalgal dominated/coral depauperate ecosystems; Pina-Amargós et al. (2006) reported mean cover of macroalgae of 32% and 58% at reef crests and reef slopes respectively and <20% of coral cover at both habitats.
In spite of the importance of Diadema as a keystone species in structuring coral reefs, available information about population abundances and its influence on algal community structure in Cuban reefs is scarce. The most complete data come from surveys of the Atlantic and Gulf Rapid Reef Assessment (AGRRA) carried out at 199 reef sites around the Cuban archipelago from 1999 to 2003 (Alcolado et al. unpublished data), but little is discussed about algal-urchin interactions at surveyed reefs by the authors, which reassessed South Western Cuban sites corresponding to Los Canarreos Archipelago in 2007 (Alcolado et al. 2009) and only focused on the impact of hurricanes and coral diseases affecting studied reefs, neglecting the importance of algal-urchin interactions and the impact of a long period of reduced herbivory (urchins and fishes) despite an apparent recent recovery of Diadema in some reefs, as reported by the authors, and the enforcement of fish protection in Canarreos Marine Reserve. In a broader study, Williams & Polunin (2001) analyzed relationships between algal cover and grazers at seven locations across the Caribbean including two areas in Cuban Western reefs, but their conclusions are limited to mid depth reefs (12-15m), thus urchin grazing effects remain unclear in Cuban shallow reefs though Caballero et al. (2009) contribution, in which benthic community structure and urchin densities were studied closely at shallow and mid depth reefs from the North coast of Havana.
The present report analyzes spatial variations in population abundance of D. antillarum and its influence on algal community structure by exploring algal-urchin relationships (percent cover of algae vs densities of Diadema) and examining linked patterns of abundance of algal functional groups at different spatial scales within and adjacent to a Marine Reserve in Jardines de la Reina Archipelago, Cuba. We therefore expected that densities of D. antillarum would be negatively correlated with macroalgal cover and positively with algal turf and crustose coralline algae at fore reefs habitats, considering that because of Jardines de la Reina is located far from human settlements and two thirds of the archipelago constitute a No-Take Marine Reserve with an effective protection, the study area can be consider as a "quasi-pristine" zone where nutrient concentrations and fish assemblages have been not affected by human impacts, thus they are not responsible for macroalgal overgrowth. This assumption is supported by the results of Pina-Amargós et al. (2006) who reported average fish biomass inside the Marine Reserve of 152g/m2 at reef crests and 118g/m2 at reef slopes with local values of 220-380g/m2 and 240-270g/m2 respectively and those reported by González de Zayas et al. (2006) who pointed out that nutrient concentrations were into conformity with oligotrophic water standards reported for the Caribbean.
Surveys were part of a broader research to evaluate the effectiveness of the Marine Reserve on reef fish assemblages.
Study area: The Archipelago of Jardines de la Reina is one of the four main groups of islands around Cuba and the best conserved of all. Stretching approximately 360km, it is formed by 661 keys, which are located in the South-central part of the Cuban shelf between the Gulf of Ana María and the Gulf of Guacanayabo (Fig. 1). The archipelago has three groups of keys, the most important one is that of "Las Doce Leguas" (The Twelve Leagues) located in its Westernmost end. In 1996 two thirds of the archipelago (about 950km2) were declared as Zone Under Special Regime of Use and Protection (equivalent to the internationally known Marine Reserves, and so termed in this paper) by the Ministry of Fisheries and currently are pending approval as a National Park by the Cuban Government. This is the largest of the Caribbean Marine Reserves and its coral reefs are among the best preserved in the region (Appeldoorn & Lindeman 2003). Several patch reefs exist to the North of the keys while the most important and well developed fringing reefs are found in the Southern side where the most conspicuous are reefs crests (1-3m depth), with large stands of dead Acropora palmata and some interspersed live colonies comprising the main component of three dimmensional structure, and reef slopes (12-15m the shallow reef slope and 20-30m the deep reef slope) with Siderastrea siderea and Agaricia agaricites as dominant species of coral assemblages.
Survey methodology: Surveys were conducted in the Southern fore reefs of Jardines de la Reina, in the group of keys of "Las Doce Leguas", in June 2004 and April 2005. Counts of D. antillarum were performed at each sampling time in five 30x2m transects located parallel to 10 reefs crests (specifically in the front part) and 21 shallow reef slopes, all distributed along 22 sampling sites (Fig. 1; see Martín-Blanco et al. 2010 for GPS references of sites).
Percent cover of algae was estimated in 0.25m side quadrats (n=15) which were randomly located at the same sites and habitats surveyed for urchins densities. Algal functional groups were categorized as macroalgae (fleshy, foliose and filamentous algae with frond >1cm tall plus Halimeda spp.), algal turf (mixed species assemblages of filamentous algae with canopy height <1cm) and crustose coralline algae.
Data collected from sites were grouped in pre-determined zones, three within the Marine Reserve and two (Westward and Eastward) adjacent to the Marine Reserve (Fig. 1). The zone classifying criteria was based on the existing different degrees of protection in the Marine Reserve regarding that protection decreases from RC, RW, RE to NRW and NRE which show a higher human activity. That information was obtained previously to the design of this study, which is part of a broader research (Pina-Amargós 2008) carried out to evaluate the effectiveness of the Marine Reserve as mentioned in the Introduction section. Densities of D. antillarum recorded from reef crests were compared among zones at each sampling time using a one way ANOVA and the Student-Newman-Keuls test for post-hoc comparisons. Density data were transformed using the fourth root transformation as suggested by the log-mean vs log-variance relationship (Taylor's Law) for conformity to the assumptions of normality and variance homogeneity. No statistical analyses were performed with densities recorded from reef slopes to prevent erroneous results caused by a high proportion of zero values. Because of obvious differences in Diadema densities between habitats, statistical comparison was unnecessary.
Percent cover of each algal functional groups was compared among zones and between habitats with a two way balanced ANOVA (reef slope data from RE and NRE were not included in the analysis because comparable reef crests do not exist in shallow depths at corresponding sites from those zones) and the Student-Newman-Keuls test for posthoc comparisons at each sampling time. Data were transformed using the log10(x+1) transformation for conformity to statistical assumptions. An additional one way ANOVA wasperformed with all zones included to compare macroalgal coverage at reef slopes. Pearson's correlation coefficient was used to determine whether mean coverage of algal functional groups were correlated with mean densities of Diadema at each sampling time at two spatial scales (i.e. with data pooled across all reef crest and reef slope sites and data from reef crests and reef slopes by separate). All statistical analyses were performed using STATISTICA 6.0.
Urchin abundance: Abundances of D. antillarum were highest at reef crests during the study. Mean population densities were up to three orders of magnitude higher than those recorded at reef slopes (local values up to 1.553ind/m2 at LP in April 2005). Average densities of Diadema varied significantly among zones at reef crests (F(1,28)=36.434, p<0.01, in June 2004; F(2,46)=36.522, p<0.01, in April 2005; Fig. 2) and were significantly higher within the Marine Reserve at each sampling time (0.741ind/m2 and 0.982ind/m2 at RC in June 2004 and April 2005 respectively and 1.092ind/ m2 at RW in April 2005). Densities from reef slopes ranged from 0.010-0.070ind/m2 in June 2004, while the lowest local value in April 2005 was 0.003ind/m2 (see Table 2 in Martín-Blanco et al. 2010 for detailed information on abundance and distribution patterns). Diadema was found at only six of nine sites surveyed in June 2004 and absent at all in 42% of 19 sites surveyed in April 2005. The maximum site level density (0.133ind/m2) occurred in April 2005, but there was only one site showing this value.
Community structure and algal-urchin relationships: Algal community structure varied significantly between habitats at each sampling time. Percent cover of macroalgae was significantly higher at reef slopes, where densities of D. antillarum were zero or near zero during the study (F(1,146)=200.14, p<0.01, in June 2004; F(1,201)=236.35, p<0.01, in April 2005; Fig. 3 A, B). Mean coverage of macroalgae at reef slopes was 44% in June 2004 and 62% in April 2005, with local values up to 67% and 87% respectively (Table 1). In contrast, the amount of substratum occupied by macroalgae at reef crests averaged 10% at each sampling time (Table 1). Except by percent cover of macroalgae at NRW zone which was higher than value from NRE zone in June 2004 and percent cover of macroalgae at RW zone which was higher than values from NRW and RE zones in April 2005 when comparing all zones at reef slopes (data not shown), no differences were found with any of the two ANOVA tests in macroalgal cover among zones during the study; the zone-habitat interaction was not significant either. Abundances of algal turf differed between habitats (F(1,146)=50.73, p<0.01) and between zones (F(1,146)=62.82, p<0.01) in June 2004, being significantly higher at reef crests (Fig. 3 C), pattern that was held across zones but was stronger at NRW zone in June 2004, as demonstrated by the significant zone-habitat interaction (F(1,146)=30.42, p<0.01). The pattern of higher coverage of algal turf at reef crests held in April 2005 (F(1,201)=12.30, p<0.01; Fig. 3 D) and showed a significant zone-habitat interaction (F(2,201)=10.15, p<0.01) but mean values did not varied among zones. Percent cover of crustose coralline algae varied between habitats at each sampling time (F(1,146)=373.61, p<0.01, in June 2004; F(1,201)=274.59, p<0.01, in April 2005) being higher at reef crests (Fig. 3 E, F). Mean values differed among zones only in June 2004 (F(1,146)=5.95, p<0.05) and the zone-habitat interaction was not significant during the study. Algal community structure at reef crests, where Diadema was more abundant, was dominated by crustose coralline algae (mean values of 30% in June 2004 and 46% in April 2005, Table 1) while macroalgae occupied the major amount of substratum at reef slopes during the study. Macroalgal cover at reef slopes was dominated by Dictyota sp., Lobophora sp. and Halimeda sp. at each sampling time while the most abundant at reef crests were Halimeda sp. and Amphiroa sp. (Table 2).
Correlations between percent cover of algal functional groups and the abundance of D. antillarum indicated a significant association among variables when analyzing data pooled across all sites. Densities of D. antillarum were negatively and positively correlated with mean coverage of macroalgae and crustose coralline algae, respectively, during the study (Fig. 4 A, B, E, F) while mean coverage of algal turfs showed no significant pattern of variation in relation to Diadema abundances at this spatial scale (Fig. 4 C, D). Partial correlations with data from reef crests and reef slopes by separate yielded no significant relationships among algal functional categories and Diadema densities in most cases (Table 3). Only the percent cover of crustose coralline algae showed a significant positive relationship with the abundance of Diadema but Pearson's correlation coefficient was too low (Table 3).
Surveys from shallow and mid depth reefs in Jardines de la Reina showed that patterns of abundance of D. antillarum in the study zone are similar than those reported by Alcolado et al. (unpublished data) around Cuba. Data collected from reef slopes in Jardines de la Reina and those from other Cuban locations indicate a country wide pattern of low population density at mid depth reefs; whereas densities recorded at reef crests (this study) are among the highest reported around the Cuban Archipelago (Martín-Blanco et al. 2010). The pattern of higher population density inside the Marine Reserve at studied reefs contrasts with that reported by Harborne et al. (2009) in The Bahamas, where abundances of Diadema were higher outside the Exuma Cays Land and Sea Park. Observed differences in mean densities at reef crests in Jardines de la Reina seem to be the result of local factors regulating recruitment processes rather than those responsible for inadequate larval supply or post-settlement mortality (see Martín-Blanco et al. 2010 for a detailed discussion on abundances and size structure of D. antillarum in the studied zone at both habitats).
Our results emphasize the importance of Diadema grazing in top-down processes on reef ecosystems. The associations between algal coverage and the abundance of D. antillarum (negative in the case of macroalgae and positive in the case of crustose coralline algae) suggest that algal community structure in Jardines de la Reina depends, in part, on the influence of Diadema in an overall scale. Although correlations do not prove causality, there is some evidence that highlights the role of Diadema in the control of macroalgae at surveyed reefs. Considering that the protection inside the reserve has been enhanced through time and no major disturbances have occurred in the area, thus fish assemblages and nutrient concentrations remain unaltered, our data and those reported by Pina-Amargós et al. (2006) are reliable enough to support our interpretations. However, some manipulative experiments should be done to corroborate our inference that Diadema is, at present, an important factor on macroalgal cover at reef slopes.
The excessive abundance of macroalgae at reef slopes seems to be due by the almost complete absence of D. antillarum at mid depth reefs, where local densities of this urchin were predominantly low (<0.07ind/m2 in 95% of surveyed reef slopes during the study). In addition, the higher dominance of macroalgae (up to 87% cover) and the scarcity of crustose coralline algae (<4% cover as mean value) at this habitat suggest that grazing intensity at reef slopes is under threshold levels required to maintain the algal community in a cropped state. As pointed out by Szmant (2002), when a reef has a high algal standing crop, it can be inferred that in some point in time, the algal production has exceeded the capacity of the heterotrophic community to consume it. In consequence, the level of grazing needed to return to coral dominance would differ dramatically from that needed to maintain the former coral dominated system (Mumby 2009).
Considering values of herbivorous fish biomass (Acanthurids + Scarids) reported by Pina-Amargós et al. (2002) in the studied zone (mean biomass=31.8g/m2 and maximum biomass=56.7g/m2) and that dominant macroalgae from reef slopes (Dictyota, Lobophora and Halimeda) are those readily consumed by Diadema (reviewed in Szmant 2002) and less palatable to herbivorous fishes (Hay 1997; Author's pers. observ.), one likely explanation to the lack of herbivory at mid depth reefs in Jardines de la Reina could be the absence of D. antillarum at this habitat. Furthermore, since macroalgal cover did not vary among zones (two way ANOVA results with balanced data; Fig. 3 A, B) and results from the additional ANOvA, yielded no differences in macroalgal abundances among all zones (except by percent cover from RW zone which was significantly higher than those from NRW and RE) potential higher abundances of herbivorous fish inside the Marine Reserve (author's pers. observ.) appear to make no difference in macroalgal control inside and outside the Marine Reserve. Parrotfishes and surgeonfishes appear to play a critical role in preventing phase shifts to macroalgae but when presented with intact stands of macroalgae, their ability to remove the algae may be limited (Bellwood et al. 2006). In contrast to Mumby et al. (2007) observations about trophic cascades resulting in reductions of macroalgal cover inside Marine Reserves, positive effects expected from reserve-driven trophic interactions in Jardines de la Reina, via the increase of fish grazing, are not strong enough to prevent macroalgal overgrowth and enhance coral recruitment at mid depth reefs in the largest of Caribbean Marine Reserves. Neither highly diverse fish assemblages and mature food webs, nor the presence of abundant herbivorous fish in Jardines de la Reina Marine Reserve appear to increase resilience at surveyed reef slopes without suitable functional redundancy in the absence of D. antillarum at the time of this study.
Similar results have been reported from other Cuban reefs at the same depth; Guardia et al. (2004a) recorded high percentages of macroalgae from diving sites in Maria La Gorda, southwestern end of Cuba (≈50% from spoor and grove and patch reefs sites) and a high dominance of Dictyota and Lobophora at all over the reef; patterns that seem to be associated, as mentioned by the authors, with the significant scarcity of D. antillarum. Present results are also into conformity to that obtained by Williams & Polunin (2001) at several locations in the Caribbean, including two locations from the Isle of Youth, Southwestern Cuba (a Marine Reserve at Punta Francés and a non protected zone at Punta del Este). Their findings indicate that, even in locations where herbivorous fish are abundant (mean biomass=9.3g/m2) there is an upper limit to the amount of substrate that can be grazed with sufficient intensity for upright macroalgae to be excluded in the absence of Diadema; suggesting that those reefs would previously have been dependent on Diadema grazing. The fact that mean biomass of herbivorous fish reported by Pina-Amargós et al. (2002) at the studied zone in Jardines de la Reina was three times higher than average biomass reported by Williams & Polunin (2001) and that coral reefs from Jardines de la Reina still show higher percentages of macroalgae, suggest that the role of D. antillarum in the control of macroalgae needs to be considered when analyzing algal community structure in Jardines de la Reina coral reefs. Results from the North coast of Havana (H.P. Caballero 2007, pers. comm.) reinforce this idea since percent covers of macroalgae (24-67%) recorded from reef slopes, where abundances of Diadema reach up to 0.63ind/ m2 and fish assemblages are highly affected by overfishing (mean overall fish biomass=4g/ m2 and mean herbivorous fish biomass=1.7g/ m2; H.P. Caballero 2007, pers. comm.), are comparatively lower than those recorded in Jardines de la Reina at the same habitat (29-87%; this study). In addition, algal species composition from the North coast of Havana contrasts with that from Jardines de la Reina; as Clero-Alonso 2007 (pers. comm.) the abundance of filamentous algae in Havanan reefs, specially Cladophora and Cladophoropsis, is higher than that observed in Jardines de la Reina, where they are rare, what illustrate different components of herbivory between locations and highlights the higher intensity of Diadema grazing in the North coast of Havana, where not only macroalgal species preferred by this urchin are less abundant, but also the percent cover of the entire macroalgal community. However, different biophysical conditions from northern reefs (e.g. different wave exposure) should be considered for generalizations regarding differential effects on algal communities independently of urchin grazing.
On the other hand, partial correlations with data recorded from reef crests and reef slopes by separate, indicate no significant associations between algal coverage and the abundance of D. antillarum at this spatial scale. Data from reef crests suggest that algal community structure at this habitat is being shaped by the synergistic action of other factors (e.g. fish grazing) rather than the influence of Diadema grazing alone. If we consider average biomass of herbivorous fish (86.6g/m2) reported by Pina-Amargós et al. (2002) from reef crests in Jardines de la Reina and that abundances of upright macroalgae at this habitat are naturally limited by physical factors (e.g. wave action), we cannot discount the role of fish grazing as a key component of herbivory at these sites. Certainly, in shallow reefs, where herbivorous fish are more abundant, grazing by fishes alone can maintain the algal community in a cropped state (Carpenter 1986, Lewis 1986, Bruggemann et al. 1994). Nevertheless, we observed clear signs of Diadema grazing at shallow reefs (large patches of bare substrate around Diadema aggregations and sparse macroalgal cover), where urchin abundances were moderately high (up to 1.553ind/m2) and percent covers of algae preferred by Diadema were very low (<6%). Additionally, current abundances of macroalgae at reef crests in Jardines de la Reina (<10% cover) are comparatively lower than those reported by Pina-Amargós et al. (2006) at the studied area (32% cover; average values from data recorded in 2001), what suggests, together with recent observations of new recruits of A. palmata (F. Pina-Amargós 2010, pers. comm.), that grazing intensity have increased at the same time that Diadema recruitment began to be noticeable (≈3-4 years before our surveys took place; Martín-Blanco et al. 2010).
Although our results cannot explain the relative importance of Diadema grazing and correlation evidence do not prove a cause and effect hypothesis, the recovery of D. antillarum across the Caribbean and its association with reduced macroalgal cover and enhanced coral recruitment at shallow reefs (Miller et al. 2003, Weil et al. 2005, Carpenter & Edmunds 2006, Myhre & Acevedo-Gutiérrez 2007) along with prior experimental studies (Ogden et al. 1973, Sanmarco et al. 1974, Carpenter 1981, 1986, Sanmarco 1980, 1982), support our hypothesis on the functional role of D. antillarum in mediating the removal of macroalgae at surveyed reefs. However, further experimental studies should be addressed to determine the importance of Diadema grazing and fish grazing by separate in order to improve our understanding about the structure and functioning of these ecosystems in which three dimensional structure of coral assemblages still persists. Since assemblages of reef fish and sea urchins are highly dependent on three dimensional structure of reef habitats (Hixon & Beets 1993, Aguilar et al. 1997, González-Sansón et al. 1997, Friedlander & Parrish 1998, Jones et al. 2004, Idjadi & Edmunds 2006, Lee 2006) and fish/urchin grazing reduces macroalgal cover and promotes coral recruitment which in turn can help to maintain three dimensional structure (Aronson & Precht 2000, Bellwood et al. 2004, Carpenter & Edmunds 2006, Mumby 2006, 2009, Mumby et al. 2006, Mumby et al. 2007), positive feed backs resulting in coral community recovery might be expected to occur in Jardines de la Reina as Diadema populations continue to increase and the reserve gets older for cascading interactions to be effective. Considering that conservation driven processes contributing to coral reef ecosystems recovery may take long periods of time to be effective (McClanahan 2000, Rodwell et al. 2003, Russ & Alcala 2004, McClanahan et al. 2005, 2007) and that recovery of D. antillarum is still limited to shallow depths in Jardines de la Reina, additional management actions such as restoration programs should be implemented in favor of those reefs where urchin populations are scarce and macroalgal occupied space limits coral recruitment, specially at reef slopes.
The authors are thankful to the staff of Azulmar for logistical support on Jardines de la Reina, specially to Giuseppe Omegna (Pepe) its manager and Noel López. To WWF Canada for funding this research and to E. Sala, Director of the Center for Marine Biodiversity and Conservation of the Scripps Institution of Oceanography, for partial funding and logistics. We thank the Ministry of Science, Technology and Environment for funds and logistics, especially C. Pazos Alberdi, R. Gómez Fernández, A. Zúñiga Ríos. Infinite thanks to CIEC´s staff for supporting us in doing research on Jardines de la Reina, specially to L. Hernández Fernández, A. Zayas Fernández, W. Acosta de la Red, A. Jiménez del Castillo, M. Lazarte Llanes. We also want to thanks P.M. Alcolado, H.P. Caballero, Y. Lezcano, for assistance in bibliography and especial considerations.
Aguilar, C., G. González-Sanasón, J. Angulo & C. González. 1997. Variación espacial y temporal de la ictiofauna en un arrecife de coral costero de la región noroccidental de Cuba. I: Abundancia total. Rev. Invest. Mar. 18: 223-232. [ Links ]
Alcolado, P.M., R. Claro, B. Martínez-Daranas, G. Menéndez-Macía, P. García-Parrado, K. Cantelar, M. Hernández & R. del valle. 2001. Evaluación ecológica de los arrecifes coralinos del oeste de Cayo Largo del Sur, Cuba: 1998-1999. Bol. Invest. Mar. Costeras 30: 25-32. [ Links ]
Alcolado, P.M., D. Hernández-Muñoz, H.P. Caballero, L. Busutil, S. Perera & G. Hidalgo. 2009. Efectos de un inusual período de alta frecuencia de huracanes sobre el bentos de arrecifes coralinos. Rev. Cienc. Mar. Costeras 1: 73-94. [ Links ]
Appeldoorn, R.C. & K.C. Lindeman. 2003. A Caribbeanwide survey of marine reserves: spatial coverage and attributes of effectiveness. Gulf. Caribb. Res. 14: 139-154. [ Links ]
Aronson, R.B. & W.F. Precht. 2000. Herbivory and algal dynamics on the coral reef at Discovery Bay, Jamaica. Limnol. Oceanogr. 45: 251-255. [ Links ]
Aronson, R.B. & W.F. Precht. 2006. Conservation, precaution, and Caribbean reefs. Coral Reefs 25: 441-450. [ Links ]
Bellwood, D.R., T.P. Hughes, C. Folke & M. Nyström. 2004. Confronting the coral reef crisis. Nature 429: 827-833. [ Links ]
Bellwood, D.R., T.P. Hughes & A.S. Hoey. 2006. Sleeping functional group drives coral-reef recovery. Curr. Biol. 16: 2434-2439. [ Links ]
Bruggemann, J.H., M.J.H. Vanoppen & A.M. Breeman. 1994. Foraging by the stoplight parrotfish Sparisoma viride I. Food selection in different socially determined habitats. Mar. Ecol. Prog. Ser. 106: 41-55. [ Links ]
Caballero, H.P. & E. de la Guardia. 2003. Arrecifes de coral utilizados como zonas de colectas para exhibiciones en el Acuario Nacional de Cuba. I. Costa noroccidental de la Habana, Cuba. Rev. Invest. Mar. 24: 205-220. [ Links ]
Caballero, H.P., D. Rosales & A. Alcalá. 2006. Estudio diagnóstico del arrecife coralino del Rincón de Guanabo, Ciudad de la Habana, Cuba. I. Corales, esponjas y gorgonáceos. Rev. Invest. Mar. 27: 49-59. [ Links ]
Caballero, H.P., P.M. Alcolado & A. Semidey. 2009. Condición de los arrecifes de coral frente a costas con asentamientos humanos y aportes terrígenos: el caso del litoral habanero, Cuba. Rev. Cienc. Mar. Costeras 1: 49-72. [ Links ]
Carpenter, R.C. 1981. Grazing by Diadema antillarum Philippi and its effects on the benthic algal community. J. Mar. Res. 39: 747-765. [ Links ]
Carpenter, R.C. 1986. Partitioning herbivory and its effects on coral reef algal communities. Ecol. Monogr. 56: 345-36. [ Links ]
Carpenter, R.C. 1990. Mass mortality of Diadema antillarum I. Long-term effects on sea urchin populationdynamics and coral reef algal communities. Mar. Biol. 104: 67-77. [ Links ]
Carpenter, R.C. & P.J. Edmunds. 2006. Local and regional scale recovery of Diadema promotes recruitment of scleractinian corals. Ecol. Lett. 9: 271-280. [ Links ]
Clero-Alonso, L., F. Pina-Amargós, L. Hernández-Frenández, F. Martín-Blanco, D. Zúñiga-Ríos, S. Cowling, A.K. Brady & S. Caldwell. 2006. Biota acuática del norte de la provincia de Ciego de Ávila, p. 182-206. In F. Pina-Amargós (ed.). Ecosistemas costeros: biodiversidad y gestión de los recursos naturales. Compilación por el Xv Aniversario del Centro de Investigaciones de Ecosistemas costeros (CIEC). CUJAE, Ciudad de la Habana, Cuba. [ Links ]
De Ruyter van Steveninck, E.D. & A.M. Breeman. 1987. Deep water populations of Lobophora variegate (Phaeophyceae) on the coral reef of Curaçao: influence of grazing and dispersal on distribution patterns. Mar. Ecol. Prog. Ser. 38: 241-250. [ Links ]
Edmunds, P.J. & R.C. Carpenter. 2001. Recovery of Diadema antillarum reduces macroalgal cover and increases abundance of juvenile corals on a Caribbean reef. P. Natl. Acad. Sci. USA. 98: 5057-5071. [ Links ]
Friedlander, A.M. & J.D. Parrish. 1998. Habitat characteristics affecting fish assemblages on a Hawaiian coral reef. J. Exp. Mar. Biol. Ecol. 224: 1-30. [ Links ]
Guardia, E., A.P. valdivia & P. González-Díaz. 2004a. Estructura de las comunidades bentónicas en la zona de buceo de María La Gorda, Ensenada de Corrientes, Sureste de la Península de Guanahacabibes, Cuba. Rev. Invest. Mar. 25: 103-111. [ Links ]
Guardia, E., P. González-Díaz & S. Castellanos-Iglesias. 2004b. Estructura de la comunidad de grupos bentónicos sésiles en la zona de buceo de Punta Francés, Cuba. Rev. Invest. Mar. 25: 81-90. [ Links ]
Guardia, E., P. González-Díaz, A. valdivia & O. González-Ontivero. 2006. Estructura y salud de la comunidad de corales en el arrecife de la zona de buceo de Cayo Levisa, Archipiélago Los Colorados, Cuba. Rev. Invest. Mar. 27: 197-208. [ Links ]
González-Sansón, G., C. Aguilar, J. Angulo & C. González. 1997. variación espacial y estacional de la ictiofauna en un arrecife de coral costero de la region noroccidental de Cuba. II: Diverisdad. Rev. Invest. Mar. 18: 233-240. [ Links ]
González de Zayas, R., A. Zúñiga-Ríos, O. Camejo-Cardoso, L.M. Batista-Tamayo & R. Cárdenas-Murillo. 2006. Atributos físicos del ecosistema Jardines de la Reina, p. 296-351. In F. Pina-Amargós (ed.). Ecosistemas costeros: biodiversidad y gestión de los recursos naturales. Compilación por el XV Aniversario del Centro de Investigaciones de Ecosistemas Costeros (CIEC). CUJAE, Ciudad de la Habana, Cuba. [ Links ]
Harborne, A.R., P.G. Renaud, E.H.M. Tyler & P.J. Mumby. 2009. Reduced density of the herbivorous urchin Diadema antillarum inside a Caribbean marine reserve linked to increased predation pressure by fishes. Coral Reefs 28: 783-791. [ Links ]
Hay, M.E. 1997. The ecology and evolution of seaweedsherbivores interactions on coral reefs. Coral Reefs 16: 67-76. [ Links ]
Herrera-Moreno, A., E. valdés-Muñoz & D. Ibarzábal. 1981. Evaluación poblacional del erizo negro, Diadema antillarum Phillipi, mediante un diseño de muestreo aleatorio estratificado, y algunos aspectos de su biología. Cienc. Biol. 6: 61-79. [ Links ]
Hixon, M.A. & J.P. Beets. 1993. Predation, prey refuges, and the structure of coral-reef fish assemblages. Ecol. Monogr. 63: 77-101. [ Links ]
Hughes, T.P. 1994. Catastrophes, phase shifts and largescale degradation of a Caribbean coral reef. Science 265: 1547-1551. [ Links ]
Hughes, T.P., B.D. Keller, J.B.C. Jackson & M.J. Boyle. 1985. Mass mortality of the echinoid Diadema antillarum Philippi in Jamaica. Bull. Mar. Sci.
36: 377-384. [ Links ]
Hughes, T.P., A.M. Szmant, R. Steneck, R. Carpenter & S. Miller. 1999. Algal blooms on coral reefs: What are the cause? Limnol. Oceanogr. 44: 1583-1586. [ Links ]
Idjadi, J.A. & P.J. Edmunds. 2006. Scleractinian corals as facilitators for other invertebrates on a Caribbean reef. Mar. Ecol. Prog. Ser. 319: 117-127. [ Links ]
Jones, G.P., M.I. McCormick, M. Srinivasan & J.v. Eagle. 2004. Coral decline threatens fish biodiversity in marine reserves. P. Natl. Acad. Sci. USA. 101: 8251-8253. [ Links ]
Knowlton, N. 2001. Sea urchin recovery from mass mortality: New hope for Caribbean coral reefs? P. Natl. Acad. Sci. USA. 98: 4822-4824. [ Links ]
Lee, S.C. 2006. Habitat complexity and consumer-mediated positive feedbacks on a Caribbean coral reef. Oikos 112: 442-447. [ Links ]
Levitan, D.R. 1988. Algal-urchin biomass responses following the mass mortality of Diadema antillarum Philippi at St. John. J. Exp. Mar. Biol. Ecol.
119: 167-178. [ Links ]
Lewis, S.M. 1986. The role of herbivorous fishes in the organization of a Caribbean reef community. Ecol. Monogr. 56: 183-200. [ Links ]
Liddell, W.D. & S.L. Ohlhorst. 1986. Changes in benthic community composition following the mass mortality of Diadema at Jamaica. J. Exp. Mar. Biol. Ecol. 95: 271-278. [ Links ]
Martín-Blanco, F., G. González-Sansón, F. Pina-Amargós & L. Clero-Alonso. 2010. Abundance, distribution and size structure of Diadema antillarum (Echinodermata: Diadematidae) in South Eastern Cuban coral reefs. Rev. Biol. Trop. 58: 663-676. [ Links ]
McClanahan, T.R. 2000. Recovery of the coral reef keystone predator, Balistapus undulatus, in East African marine parks. Biol. Conserv. 94: 191-198. [ Links ]
McClanahan, T.R. & N.A.J. Graham. 2005. Recovery trajectories of coral reef fish assemblages within Kenyan marine protected areas. Mar. Ecol. Prog. Ser. 294: 241-248. [ Links ]
McClanahan, T.R., N.A.J. Graham, J.M. Calnan & M.A. MacNeil. 2007. Toward pristine biomass: Reef fish recovery in coral reef marine protected areas in Kenya. Ecol. Appl. 17: 1055-1067. [ Links ]
Miller, J.R., A.J. Adams, N.B. Ogden, J.C. Ogden & J.P. Ebersole. 2003. Diadema antillarum 17 years after mass mortality: is recovery beginning on St. Croix? Coral Reefs 22: 181-187. [ Links ]
Mumby, P.J. 2006. The impact of exploiting grazers (Scaridae) on the dynamics of caribbean coral reefs. Ecol. Appl. 16: 747-769. [ Links ]
Mumby, P.J. 2009. Phase shifts and the stability of macroalgal communities on Caribbean coral reefs. Coral Reefs 28: 761-773. [ Links ]
Mumby, P.J., J.D. Hedley, K. Zychaluk, A.R. Harborne & P.G. Blackwell. 2006. Revisiting the catastrophic dieoff of the urchin Diadema antillarum on Caribbean coral reefs: Fresh insights on resilience from a simulation model. Ecol. Model. 196: 131-148. [ Links ]
Mumby, P.J., A.R. Harborne, J. Williams, C.v. Kappel, D.R. Brumbaugh, F. Micheli, K.E. Holmes, C.P. Dahlgren, C.B. Paris & P.G. Blackwell. 2007. Trophic cascade facilitates coral recruitment in a marine reserve. P. Natl. Acad. Sci. USA. 104: 8362-8367. [ Links ]
Myhre, S. & A. Acevedo-Gutiérrez. 2007. Recovery of sea urchin Diadema antillarum populations is correlated to increased coral and reduced macroalgal cover. Mar. Ecol. Prog. Ser. 329: 205-210. [ Links ]
Ogden, J.C., R.A. Brown & N. Salesky. 1973. Grazing by the echinoid Diadema antillarum Philippi: formation of halos around West Indian patch reefs. Science 182: 715-717. [ Links ]
Pina-Amargós, F. 2008. Efectividad de la Reserva Marina de Jardines de la Reina en la conservación de la ictiofauna. Tesis de Doctorado, Universidad de La Habana, Ciudad de la Habana, Cuba. [ Links ]
Pina-Amargós, F., P.M. Alcolado, L. Hernández-Fernández, G. González-Sansón, R. González de Zayas, L. Clero- Alonso, K. Cantelar-Ramos & S. González-Ferrer. 2002. Estado de salud de los arrecifes coralinos de Jardines de la Reina. Resultado: Caracterización de los arrecifes coralinos de Jardines de la Reina, p. 1-20. In F. Pina-Amargós (ed.). Caracterización y manejo de los ecosistemas marinos en el archipiélago Jardines de la Reina (Informe Final de Proyecto). Centro de Investigaciones de Ecosistemas Costeros (CIEC), Cayo Coco, Ciego de Ávila, Cuba. [ Links ]
Pina-Amargós, F., L. Clero-Alonso, F. Martín-Blanco, L. Hernández-Frenández, W. Acosta de la Red, L. Cabreja-Ávila, P.M. Alcolado, R.M. Claro, K.R. Cantelar, S.F. González & J.P.G. Artiaga. 2006. Biota marina del ecosistema Jardines de la Reina, p. 396-449. In F. Pina-Amargós (ed.). Ecosistemas costeros: biodiversidad y gestión de los recursos naturales. Compilación por el XV Aniversario del Centro de Investigaciones de Ecosistemas Costeros (CIEC). CUJAE, Ciudad de la Habana, Cuba. [ Links ]
Rodwell, L.D., E.B. Barbier, C.M. Roberts & T.R. McClanahan. 2003. The importance of habitat quality for marine reserve fishery linkages. Can. J. Fish. Aquat. Sci. 60: 171-181. [ Links ]
Russ, G.R. & A.C. Alcala. 2004. Marine reserves: longterm protection is required for full recovery of predatory fish populations. Oecologia 138: 622-627. [ Links ]
Sanmarco, P.W. 1980. Diadema and its relationship to coral spot mortality: grazing, competition and biological disturbance. J. Exp. Mar. Biol. Ecol. 45: 245-272. [ Links ]
Sanmarco, P.W. 1982. Effects of grazing by Diadema antillarum Philippi (Echinodermata: Echinoidea) on algal diversity and community structure. J. Exp. Mar. Biol. Ecol. 65: 83-105. [ Links ]
Sanmarco, P.W., J.S. Levinton & J.C. Ogden. 1974. Grazing and control of coral reef community structure by Diadema antillarum (Echinodermata: Echinoidea): a preliminary study. J. Mar. Res. 32: 47-53. [ Links ]
Szmant, A.M. 2002. Nutrient enrichment on coral reefs: Is it a major cause of coral reef decline? Estuaries 25: 743-766. [ Links ]
Weil, E., J.L. Torres & M. Ashton. 2005. Population characteristics of the sea urchin Diadema antillarum in La Parguera, Puerto Rico, 17 years after the mass mortality event. Rev. Biol. Trop. 53: 219-231. [ Links ]
Williams, I.D. & N.v.C. Polunin. 2001. Large-scale associations between macroalgal cover and grazer biomass on mid-depth reefs in the Caribbean. Coral Reefs 19: 358-366. [ Links ]
Correspondencia a: Félix Martín Blanco, Lídice Clero Alonso, & Fabián Pina Amargós. Centro de Investigaciones de Ecosistemas Costeros, Ministerio de Ciencia, Tecnología y Medio Ambiente. Cayo Coco, Morón, Ciego de Ávila, CP 69400, Cuba; felix.martin79@gmail.com, fabian@ciec.fica.inf.cu, lclero@yahoo.es
Gaspar González Sansón. Centro de Investigaciones Marinas, Universidad de la Habana. Calle 16, # 114 e/ 1ra y 3ra, Miramar, Playa, Ciudad de La Habana, CP. 11300, Cuba; gaspargonzalez2001@yahoo.es
Received 10-VIII-2010. Corrected 09-I-2011. Accepted 08-II-2011. | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,160 |
\section{Introduction}
\label{1}
Diatomic sulfur, S$_2$, has been subject of many theoretical and
spectroscopic investigations for long time \cite{S2spectr,Swope79,Saxon80}.
We can find S$_2$ molecules at various natural and industrial plasmas
containing sulfur compounds. For example, emissions and absorptions of
S$_2$ molecules have been observed in the atmospheres of
Jupiter \cite{S2Jupiter} and its satellite Io \cite{S2Io}.
They are also observed in the atmospheres of some comets \cite{S2Hyakutake}.
In industrial condition, S$_2$ molecules can be seen in reactive ion
etching process using SF$_6$ molecules \cite{S2etching}.
Sulfur lamps contain S$_2$ molecules as an important ingredient \cite{S2Lamp}.
Although electron collision with S$_2$ molecules is an important elementary
process in these plasmas, there has been little work on this subject.
As far as we are aware, no experimental measurement nor theoretical
calculation of electron-S$_2$ elastic cross section have been performed.
Garrett et al. \cite{S2IP} calculated integral cross section for electron
impact excitation of the
S$_2$ B$^3 \Sigma_u^-$, 2$^3 \Sigma_u^-$ and B''$^3 \Pi_u$ states using
the semiclassical impact-parameter (IP) method extended to include
nuclear motion.
Since the IP method is designed to treat optically allowed transitions,
electron impact excitation to the other electronic state was not
investigated.
Le Coat et al. \cite{S2DAexp} performed experimental measurement on dissociative electron
attachment of S$_2$ molecules and identified two resonances, however,
they did not present absolute value of the cross section.
Recently, we have performed the R-matrix calculations on the spin-exchange
effect in electron collision with homo-nuclear open-shell diatomic molecules
including S$_2$ \cite{Tashiro2008}. We have also calculated the integral
cross section of elastic electron collision with S$_2$ molecules
for the first time.
Here, we extend our previous study to the electron
impact excitations of S$_2$ molecules.
Since S$_2$ molecule has a valence electron structure similar to O$_2$,
comparison of the cross sections will be interesting.
Also, the cross section of electron impact excitation of the
S$_2$ B$^3 \Sigma_u^-$ would be important in analyzing sulfur plasma.
As in our previous works on electron impact excitation of O$_2$ and
N$_2$ \cite{tashiroO2ics,tashiroO2DCS,tashiroN2},
we employ the fixed-nuclei R-matrix method using state-averaged complete
active space SCF molecular orbitals.
The size of basis set for the scattering electron is slightly extended
in this work compared to our previous calculation on the spin-exchange
effect \cite{Tashiro2008}.
\section{Theoretical methods}
\label{2}
The details of the R-matrix method has been described in the literature
\cite{Mo98,Bu05,Go05}, thus we do not repeat general explanation of
the method here.
We used a modified version of the polyatomic programs in the UK molecular
R-matrix codes \cite{Mo98} in this work.
These programs utilize the Gaussian type orbitals (GTO) to
represent target electronic states as well as a scattering electron.
In the present R-matrix calculations, we have included 13 target states;
${X}^3\Sigma_{g}^{-}$, ${a}^1\Delta_{g}$, ${b}^1\Sigma_{g}^{+}$,
${c}^1\Sigma_{u}^{-}$, ${A'}^3\Delta_{u}$, ${A}^3\Sigma_{u}^{+}$,
${B'}^3\Pi_{g}$, ${B}^3\Sigma_{u}^{-}$, ${1}^1\Pi_{g}$,
${1}^1\Delta_{u}$, ${B''}^3\Pi_{u}$, ${1}^1\Sigma_{u}^{+}$,
and ${1}^1\Pi_{u}$.
These target states were represented by valence configuration interaction
wave functions constructed by state averaged complete active space SCF
(SA-CASSCF) orbitals.
In this study, the SA-CASSCF orbitals were obtained by calculations with
MOLPRO suites of programs \cite{molpro}.
The target orbitals were constructed from the cc-pVTZ basis
set\cite{1993JChPh..98.1358W}.
Fixed-nuclei approximation was employed with inter-nuclear distance of
3.7 a$_0$.
The radius of the R-matrix sphere was chosen to be 13 a$_0$ in our
calculations.
In order to represent the scattering electron, we included diffuse
Gaussian functions up to $l$ = 5, with 13 functions for $l$ = 0,
11 functions for $l$ = 1, 10 functions for $l$ = 2,
8 functions for $l$ = 3, 6 functions for $l$ = 4 and
5 functions for $l$ = 5.
Exponents of these diffuse Gaussians were taken from Faure
et al. \cite{Fa02}.
In addition to these continuum orbitals, we included 8 extra virtual
orbitals, one for each symmetry.
The construction of the configuration state functions (CSFs) for
the electron-molecule system is the same as in our previous paper\cite{Tashiro2008}.
Note that
The R-matrix calculations were performed for all 8 irreducible
representations of the D$_{2h}$ symmetry,
$A_g$, $B_{2u}$, $B_{3u}$, $B_{1g}$, $B_{1u}$, $B_{3g}$, $B_{2g}$
and $A_u$, in doublet and quartet spin multiplicities
of the whole system.
One of the transitions studied in this work, the excitation of the
${B}^3\Sigma_{u}^{-}$ state from the ground state, is optically allowed.
Thus, we have to consider the effect of transition dipole moment between
these two states.
A lot of $l$ partial-waves has to be included in the R-matrix calculation
to obtain converged cross sections because of the long-range interaction of the dipole,
although it is difficult to include partial waves with $l \geq 7$ in
the usual ab initio R-matrix calculation.
In this work, the R-matrix calculations are performed with partial waves
up to $l = 5$.
The effects of the higher $l$ partial waves are included
by the Born closure approximation as in the previous works \cite{Crawford1971,Gibson87}.
Following Gibson et al.\cite{Gibson87}, we evaluate
the differential cross sections (DCSs) with the Born correction,
${d \sigma^{\rm BC} / d \Omega}$, by the expression,
\begin{equation}
\frac{d \sigma^{\rm BC}}{d \Omega} = \frac{d \sigma^{\rm FBA}}{d \Omega} +
\left[
\frac{d \sigma^{\rm R-matrix}}{d \Omega} - \frac{d \sigma^{\rm FBA}_{\rm FE}}{d \Omega}
\right].
\end{equation}
Here, ${d \sigma^{\rm FBA}/d \Omega}$ is the DCS obtained by the first Born
approximation, ${d \sigma^{\rm R-matrix}/d \Omega}$ is the cross section obtained by
the R-matrix calculation and ${d \sigma^{\rm FBA}_{FE}/d \Omega}$ is the DCS
from the first Born approximation including the same number of partial waves as in
the R-matrix calculation. ${d \sigma^{\rm FBA}_{FE}/d \Omega}$ is evaluated by
the angular momentum representation of the T-matrix elements
for the first Born approximation. These T-matrix elements as well as
${d \sigma^{\rm FBA}/d \Omega}$ are available in close form \cite{Itikawa1969}.
The total cross sections are obtained by the integration of eq.(1).
\section{Results and Discussion}
\label{3}
In table \ref{tab1}, excitation energies of S$_2$ molecule
obtained from the CASSCF calculation in this work
are compared with MRD CI vertical excitation energies of Hess et
al.\cite{ChemPhys.71.79}, MRCI adiabatic excitation energies of Kiljunen
et al.\cite{2000JChPh.112.7475K} and experimental values quoted in
Hess et al.
Our results agree well with the previous calculations and experimental results
for the lowest two excitations.
For excitations to the higher electronic states, deviations in excitation
energies become larger partly because of difference of
adiabatic and vertical excitation energy.
In figure \ref{fig1}, the integral cross sections (ICSs) are shown for
electron S$_2$ elastic collision and excitations of the
${a}^1\Delta_{g}$, ${b}^1\Sigma_{g}^{+}$ and ${c}^1\Sigma_{u}^{-}$ states.
The magnitude of the elastic ICS is about 20 $\times 10^{-16} {\rm cm}^2$ in
low energy region below 3 eV, then it increases to be 30 $\times 10^{-16}
{\rm cm}^2$ at energies above 5 eV.
The ICS of the excitation to the ${a}^1\Delta_{g}$ state increases gradually
from threshold to 8.5 eV, where it takes a maximum value of
0.35 $\times 10^{-16} {\rm cm}^2$, then it decreases again.
The ICSs of the excitation to the ${b}^1\Sigma_{g}^{+}$ and
${c}^1\Sigma_{u}^{-}$ states also increase gradually from threshold.
In both cases, the maximum value of the ICS is about 0.1
$\times 10^{-16} {\rm cm}^2$.
Around 2.7 eV, a sharp resonance peak with width 0.08 eV exists in the ICSs of the
${a}^1\Delta_{g}$ and ${b}^1\Sigma_{g}^{+}$ excitations.
Also, a kink structure is observed in the elastic ICS at the same energy.
All of these structure belongs to the ${}^2 \Pi_u$ symmetry partial cross
sections.
We analyzed the CSFs and found that the kink and peaks at 2.7 eV are likely
related to a resonance with configuration
$({\rm core})^{20}(4\sigma_g)^2(4\sigma_u)^2(5\sigma_g)^2(2\pi_u)^3(2\pi_g)^4$,
which is obtained from an attachment of the scattering electron to the excited
${c}^1 \Sigma_u^-$, ${A'}^3 \Delta_u$ and ${A}^3 \Sigma_u^+$ states of
S$_2$ with configuration
$({\rm core})^{20}(4\sigma_g)^2(4\sigma_u)^2(5\sigma_g)^2(2\pi_u)^3(2\pi_g)^3$.
The width of this resonance is about 0.08 eV at R = 3.7 a$_0$.
We checked the behaviour of this resonance as a function of bond-length,
and found that it approaches the atomic limit ${\rm S}({}^3P)$ +${\rm S}^-({}^2P)$.
Since the location of this resonance is higher than the atomic limit,
dissociative electron attachment may occur through this resonance.
In figure \ref{fig2}, the ICSs for electron S$_2$ collisions
are shown for excitations to the ${A'}^3\Delta_{u}$, ${A}^3\Sigma_{u}^{+}$,
${B'}^3\Pi_{g}$ and ${B}^3\Sigma_{u}^{-}$ states.
The ICS of Garrett et al. \cite{S2IP} obtained by the impact-parameter method is also
compared with our excitation ICS to the ${B}^3\Sigma_{u}^{-}$ state.
In general, the slopes of these ICSs near threshold are steeper than those
in fig.\ref{fig1}.
The maximum values of the ICSs below 15 eV are about 0.3, 0.1, 0.6 and
3.0 for the excitation to the ${A'}^3\Delta_{u}$, ${A}^3\Sigma_{u}^{+}$,
${B'}^3\Pi_{g}$ and ${B}^3\Sigma_{u}^{-}$ states, respectively.
For the optically allowed ${B}^3\Sigma_{u}^{-}$ state excitation,
the effect of the high $l$ partial waves is included by the Born closure approximation
formula given in eq.(1). The magnitude of the Born correction is small
below 10 eV, however, it increases as the scattering energy increases.
The fraction of the correction to the R-matrix cross section becomes about
20$\%$ at 15 eV.
Our ICS with the Born correction and the previous result of Garrett et al. \cite{S2IP}
agree reasonably well above 8 eV. We used the CASSCF value for the ${B}^3\Sigma_{u}^{-}$
excitation energy in this work, whereas Garrett et al. \cite{S2IP} employed the
experimental value for the excitation energy.
In contrast to the fixed-nuclei approximation in our calculation,
Garrett et al. \cite{S2IP} included the effect of S$_2$ vibration in their calculation.
Because of these differences, the results of Garrett et al. \cite{S2IP} and
our ICS do not agree well near the excitation threshold.
A small peak is seen at 14.2 eV in the ICSs of the ${A'}^3\Delta_{u}$ and
${A}^3\Sigma_{u}^{+}$ state excitations, which is originated from the
${}^4 \Pi_g$ symmetry partial cross sections.
Since the location of this peak is higher than the highest energy
S$_2$ electronic state included in the present R-matrix calculation,
we cannot determine whether this peak belongs to the real resonance or
pseudo-resonance.
In figure\ref{fig3}, the differential cross sections (DCSs) are shown for
elastic electron S$_2$ collisions as well as excitations to the
${a}^1\Delta_{g}$, ${b}^1\Sigma_{g}^{+}$ and ${B}^3\Sigma_{u}^{-}$ states.
The elastic DCSs are enhanced in forward direction and tend to be
more forward-enhanced as the scattering energy increases.
In contrast to the elastic DCSs, the excitation DCS to the
${a}^1\Delta_{g}$ state has backward-enhanced character in general.
However, the magnitude of forward scattering cross section
increases as the scattering energy increases from 7 to 13 eV.
Our excitation DCSs to the ${b}^1\Sigma_{g}^{+}$ state approach
zero near 0 and 180 degrees, because of a selection rule associated with
$\Sigma^{+}$-$\Sigma^{-}$ transition \cite{Go71,Ca71}.
Around 90 degrees, the magnitude of the DCS is about 0.06$\sim$0.08
$\times 10^{-17} {\rm cm}^2 {\rm sr}^{-1}$ and does not depend much on
the scattering energy.
The ${B}^3\Sigma_{u}^{-}$ state excitation DCSs are shown
in fig. \ref{fig3} panel (d). In addition to the R-matrix results,
the DCSs with the Born correction obtained by eq.(1) are also shown for scattering
angles below 25 degrees. For larger angles, the magnitude of the correction is
expected to be small and not shown here.
The contribution of the Born correction to the DCS is small for 7 eV, however,
it dominates the total DCS near zero degree at 10 and 13 eV.
Although the magnitude of the R-matrix DCS at forward direction decreases as the
scattering energy increases from 7 to 13 eV, the DCS with the Born correction at
forward direction increases as energy increases.
The elastic and excitation cross sections of the ${a}^1\Delta_{g}$ and
${b}^1\Sigma_{g}^{+}$ states in electron S$_2$ collisions are about two times
larger than corresponding cross sections in electron O$_2$ collisions
studied in our previous paper \cite{tashiroO2ics}.
Although the ${}^2 \Pi_u$ resonance peaks can be observed in the
${a}^1\Delta_{g}$ and ${b}^1\Sigma_{g}^{+}$ excitation cross sections in
both e-O$_2$ and e-S$_2$ collisions, the width of the peak is much broader
in e-O$_2$ case. In e-O$_2$ elastic collision, a narrow ${}^2 \Pi_g$
resonance peak is seen below 1 eV. In e-S$_2$ elastic case, the energy of the
S$_2^-$ ${}^2 \Pi_g$ state is stabilized below the energy of the S$_2$ ground
state and cannot be observed in the cross section.
Other than these resonance features, the profiles of the cross sections are
similar in e-O$_2$ and e-S$_2$ collisions.
In this work, we employed the fix-bond approximation for the R-matrix
calculation. In our previous studies on electron impact excitations of
O$_2$ and N$_2$ molecules\cite{tashiroO2ics,tashiroO2DCS,tashiroN2},
we also used the same fix-bond approximation and
got good agreement with available experimental results, even if the positions
of the potential curve minimum are different between the ground state and
the excited state.
Thus, the results of this study is also expected to be accurate enough.
For more precise comparison of the excitation cross section of the
${B}^3\Sigma_{u}^{-}$ state with the previous results of Garrett et al.
\cite{S2IP}, inclusion of the vibrational effect may be necessary.
Such kind of calculation is possible by the non-adiabatic R-matrix method
or the adiabatic averaging of the T-matrix elements, and will be performed in future.
We have carried out the R-matrix calculations with the maximum $l$ quantum number 4, 5
and 6 to check convergence. Except for the ${B}^3\Sigma_{u}^{-}$ state excitation,
the ICSs and DCSs are converged at $l$=5. For the ${B}^3\Sigma_{u}^{-}$ excitation,
the ICS with the Born correction is also converged at $l$=5.
For the ${B}^3\Sigma_{u}^{-}$ excitation DCSs with the Born correction,
however, the convergence is achieved only below 25 degrees. Note that the similar
situation was observed in Gibson et al.\cite{Gibson87}.
Although the ${B}^3\Sigma_{u}^{-}$ excitation DCS is not converged above 30 degrees,
the effect of the higher $l$ partial waves is expected to be small because
the magnitude of the Born DCS itself is small at larger scattering angles.
In principle, this convergence problem can be solved \cite{Rescigno1992,Sun1992}
by applying the Born correction to T-matrix elements,
where we applied the correction at the R-matrix DCS in this work.
We will calculate this kind of Born correction at T-matrix level when
more accurate excitation DCS is required in future.
\section{Summary}
\label{4}
In this work, we have studied the low-energy electron impact excitations of
S$_2$ molecules using the fixed-bond R-matrix method based on
state-averaged CASSCF molecular orbitals.
Thirteen target electronic states of S$_2$ are included
in the model within a valence configuration interaction
representations of the target states.
Integral cross sections are calculated for elastic electron collision
as well as impact excitation of the 7 lowest electronic states.
Also, differential cross sections are shown for elastic collision
and excitation of the ${a}^1\Delta_{g}$, ${b}^1\Sigma_{g}^{+}$ and
${B}^3\Sigma_{u}^{-}$ states.
For the excitations of the ${a}^1\Delta_{g}$ and ${b}^1\Sigma_{g}^{+}$ states,
a narrow ${}^2 \Pi_u$ resonance peak is observed in the ICSs at 2.7 eV.
For the elastic and the excitation collisions of the ${a}^1\Delta_{g}$ and
${b}^1\Sigma_{g}^{+}$ states, the shapes of the cross sections are similar to
those in electron O$_2$ collisions, however, the magnitudes of the cross
sections are two time larger in electron S$_2$ collisions.
Our ICS of the ${B}^3\Sigma_{u}^{-}$ state excitation agrees reasonably well
with the previous result of Garrett et al. \cite{S2IP}. However,
the ICS near threshold does not agree well, because of difference
in excitation energy employed in calculation as well as the treatment of the
vibrational effect.
\clearpage
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 5,727 |
Q: Temporarily make server file public I have a Joomla! site and for each user I have an image.
What I want is to keep the image private to the user but temporarily make it (well, a copy) public.
My thinking was to have the user click a link which calls a "publish.php" script.
This script would take the user name and create a temporary (30 seconds) folder and copy their private image into that temporary folder.
The script would then generate a random key and build a URL using the username and key i.e. www.site.com/photos/get_photo.php?key=username.*key*
Then when someone goes to that link (via QR scanner) the "get_photo.php" script would check the key was valid and if it was display the image.
I want the photos public in the sense that given the URL anyone can see it but not public in the sense that anyone can keep polling my server and dragging down photos as and when they become available.
I'm stuck with the security of the original photos, if they are private the script can't access them but if they are public, if defeats the purpose of making them temporarily public.
Next problem is generating a key in one script that can be verified by the other script.
Many thanks for any guidance.
A: If you are going to go through the overhead of copying the file, you might as well have a php script read and output the file itself. I'm not sure how you are keeping track of your images, but if its in a database you could add a column for a timestamp which marks when it has been made public. Then have the script check that timestamp to see if it was made public within the last 30 seconds. If it has, do a file_get_contents on the image, set the appropriate image header and output it, if not maybe have it load a default error image.
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 1,509 |
Stats (W)
Stats (M)
Track and field sees five first-place finishes at Twilight Invitational
Derek Ohara (photo by Larry Newman)
ORANGE, Calif. – The Chapman University men's and women's track and field teams made a successful debut appearance at the Whittier Twilight Invitational, filled with multiple top finishes and personal bests. The teams had a combined five first-place finishes and seven individuals who set personal records.
Junior Derek Ohara had two standout races, taking second place in the 100m dash and third place in the 200m dash. Ohara broke the 11-second mark, running a new personal best of 10.99 in the 100m. With this new personal best, Ohara has now ranked sixth overall in the SCIAC with conference championships only three weeks away.
On the field side of the team, junior Lauren Miller had a record-setting day with two personal bests in both the shot put and discus. Miller took second place in the discus overall with a mark of 31.35m and third place overall in the shot put with a mark of 11.45 m. Senior Cedric Cole throws team captain commented, "Lauren has been working hard in the ring this year and I couldn't be prouder her performance," regarding Miller's accomplishments at the meet.
Sophomore Emma Eglington and freshman Davis Carmichael also ran excellent 5000m races. Eglington took first place in the women's 5000m with a time of 18.58. Eglington led the pack of runners from the start to finish of the 12.5 lap race. In the men's 5000m race, Carmichael set a big 74-second personal record running a time of 16.58.
After a positive day at the Twilight Invitational, the team is now getting ready for their final SCIAC multi-dual of the season on Saturday, April 13th held at Occidental College.
by Mia Hernandez
Become a fan of Chapman Athletics on Facebook
Follow Chapman Athletics on Twitter @ChapmanSports
Post your #PantherPic to Instagram @ChapmanSports | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 4,067 |
WB, Odisha See Max Increase in Crimes Against Women; Total Crime Rate Up by 28%
Crimes against women cases declined by 8.3%, from 4,05,326 in 2019 to 3,71,503 cases in 2020, revealed NCRB report.
Updated: 15 Sep 2021, 10:33 PM IST
The overall crimes against women in the country reduced by 8.3% in 2020 compared to 2019, according to the latest National Crime Records Bureau (NCRB) report released on Tuesday, 14 September.
However, West Bengal and Odisha saw the most increase in crimes against women in 2020 compared to 2019. On the other hand, Delhi saw a decline from 13,395 cases in 2019 to 10,093 cases in 2020. Uttar Pradesh was one of the states showing the sharpest decline, with cases going down from 59,853 in 2019 to 49,385 in 2020.
A total of 3,71,503 cases of crime against women were registered in 2020, showing a decline of 8.3% from the 4,05,326 cases in 2019.
The majority of the cases were registered under 'Cruelty by Husband or His Relatives' (30.0%) followed by 'Assault on Women with Intent to Outrage her Modesty' (23.0%), 'Kidnapping & Abduction of Women' (16.8%) and 'Rape' (7.5%), the data showed.
(Graphic: Aroop Mishra)
Sakinaka Rape-Murder: Victim's Daughters Face a Life of Poverty, Trauma, Slander
Meanwhile, a total of 35,331 cases of crime against women were registered in 19 metropolitan cities (those having a population of more than 2 million) during 2020, showing a decrease of 21.1% over 2019 (44,783 cases).
The report also said cases registered under Crimes against Women, Children and Senior Citizens, Theft, Burglary, Robbery and Dacoity had declined since the country was under complete lockdown during the first wave of the pandemic.
Overall Crimes in Delhi Saw a Dip of 16%; Increase in UP
Overall, crimes in Delhi reduced by 16% in 2020 compared to 2019. However, in 2019, the capital had recorded a nearly 20% rise in crime compared to 2018.
A total of 2,49,192 cases were registered in the national capital under various sections of the Indian Penal Code (IPC) in 2020, showing a massive decline of 50,283 than those reported in 2019. In 2018, the total IPC cases in Delhi were 2,49,012.
Crimes such as murder and kidnapping, and crimes against women reduced in 2020 compared to 2019. Murder cases declined by 9% in 2020 compared to 2019.
Meanwhile, cases in UP have been steadily increasing since 2018, which is in contrast to the recent statements made by the state's Chief Minister Yogi Adityanath. A total of 3,42,355 cases were registered under different sections of the IPC in 2018, increasing to 3,53,131 in 2019 and 3,55,110 in 2020.
PM Modi Lauds UP Govt During Aligarh University Foundation Stone Laying Ceremony
Overall Crime Rate Goes Up by 28%
The overall crime rate saw an increase of 28%, from 51,56,158 cognisable crime cases in 2019 to 66,01,285 in 2020.
A significant increase was seen in the cases registered under 'Disobedience to order duly promulgated by Public Servant', where cases went up from 29,469 in 2019 to 6,12,179 cases in 2020.
In March 2020, The Indian Express had reported that those who violate the lockdown orders could face legal action under the "Epidemic Diseases Act, 1897, which lays down punishment as per Section 188 of the Indian Penal Code, 1860, for flouting such orders."
Cases registered under 'Other IPC Crimes' also saw a huge jump, from 2,52,268 cases in 2019 to 10,62,399 cases in 2020.
Murders saw a marginal increase of 1% since 2019, with 'Disputes' being the main motive behind them, followed by 'Personal vendetta or enmity' and 'Gain'. Meanwhile, kidnapping and abduction saw a decrease of 19.3% from 2019.
A total of 71,107 cases of offences against public tranquility were registered under various sections of the IPC during 2020, out of which rioting (51,606 cases) accounted for 72.6% of the total such cases. The cases of offences against public tranquility increased by 12.4% in 2020 compared to 2019 (63,262 cases).
Yogi Adityanath Says UP Safer for Women Now, But How Does the State Really Fare?
Cybercrimes increased 11.8% from 44,735 cases in 2019 to 50,035 cases in 2020. During 2020, 60.2% of such cases were for the motive of Fraud, followed by Sexual exploitation (6.6%) and Extortion (4.9%). The cases of cyber fraud almost doubled in Telangana from 2019 to 2020, with Assam, Gujarat, Bihar, Odisha, Tamil Nadu, Uttarakhand, and West Bengal also showing a significant increase.
Fake Indian Currency Notes seizure saw a huge increase of 190.5%, from 2,87,404 notes worth ₹ 25,39,09,130 in 2019 to a total of 8,34,947 notes worth ₹ 92,17,80,480.
Crimes Against SCs, STs Increase by Over 9%
A total of 50,291 cases were registered for crimes against Scheduled Castes (SCs), showing an increase of 9.4% over 2019 (45,961 cases). The crime rate registered showed an increase from 22.8 in 2019 to 25.0 in 2020. A significant increase was witnessed in states like Bihar, Madhya Pradesh, and Uttar Pradesh.
(Graphic: Arnica Kale)
Meanwhile, a total of 8,272 cases were registered for committing crime against Scheduled Tribes (STs), which increased by 9.3% over 2019's 7,570 cases. The registered crime rate also increased from 7.3 in 2019 to 7.9 in 2020. Madhya Pradesh witnessed the highest rise from the cases in 2019.
(With inputs from The Indian Express.)
Published: 15 Sep 2021, 8:37 AM IST
Edited By :Tejas Harad | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 7,600 |
Q: What is the most important CPU price factor I have two intel CPUS with distinct features.
*
*intel i7 8550U
*intel i5 8300H
Which have big performance difference with the cheaper 8300H being higher in memory bandwidth 41 GB/s vs 37 GB/s, Bus speed of 8 GT/s vs 4 GT/s, TDP 45 W vs 15 W, and crushing the comparison in every single parameter.
Full comparison here
But when we come to the price, the 8550U has a price tag of $409.00 whereas the powerful 8300H has a price tag of $250.00.
Though I tried to get reasons, I couldn't find any. what is the most important price factor for CPUs that is making such huge difference?
A: The most important cost factor of CPU is R&D / IP Licensing and the chip foundry.
Often, a series of processors with different performances actually have the same die implementation. The differences lie mostly in the yield of the manufacturing process.
When the silicon chips are made, there is a yield, some have small defects and while it still produces an operating chip, it will have lower performances or certain functionalities not working.
Thus once manufactured, the chips are tested and binned based on their performances and locked to a specific configuration.
It often happens that the chips on the edges of the wafer yield poorer performance as the quality of the lithographic process lowers at the edges, that coupled with other defects that can happen during manufacturing.
For example, you can have a defect in a bank of L1 cache memory, instead of throwing the chip away, you simply disable a specific memory bank and sell it with a lower L1 cache.
Concerning speed, it can be due to metalization or capacitance effects also linked to the manufacturing processes.
The price difference is simply due to the yield of the high-quality chip, market demand, availability, and what the market is ready to pay for it.
Instead of throwing out chips yielding lower performance or with slight defect, that doesn't hinder the main operation of the chip, a manufacturer prefers to sell them at lower cost, with some functionalities disabled or reduced speed.
To make a parallel to batteries, a manufacturer also has a yield. Energizer only sells the good batteries under their brand and sells lower-performing batteries cheaper under different brand names.
A: DonFusili has the right answer: the consumer price is determined by what people will pay, so "premium" features end up much more expensive, and the same product is sold at gradually decreasing prices throughout its lifetime. The cost you pay bears very little relation to the cost of design and manufacture.
Software is completely dominated by the cost of design. Hardware is somewhere in the middle; the cost of design is huge in terms of engineer-hours, but each wafer full of chips also has a fairly high manufacturing cost (see Damien's answer).
| {
"redpajama_set_name": "RedPajamaStackExchange"
} | 6,888 |
{"url":"https:\/\/www.ossila.com\/pages\/xtralien-scientific-python-loops","text":"# Xtralien Scientific Python: Loops\n\nWhen programming you will often need to run a section of code or perform a certain series of options a number of times.\n\nIn Python you can do this using different types of loops. Nominally you will use both the for and while loops, and both are explained below.\n\n## for loops\n\nfor loops are a common type of loop in Python.\n\nWhen using the for loop in Python you use the format for element in iterable. This is the only form that a for loop takes. It will cycle through each element in an interable and run the code inside the loop scope (The additional indentation after the loop).\n\niterable = [1, 2, 3]\n\nfor element in iterable:\n# Perform operations on the element\nprint(element)\n\nfor loops exist to process data rather than perform a set number of loops, although this behaviour can be forced by using the range function, which produces a list of a set size. A simple example of this can be seen below.\n\nfor i in range(10):\nprint(i)\n\nThis example will print $$10$$ numbers, from $$0$$ to $$9$$ inclusive. While this example is not particulary useful you can use loops like this alongside the built-in enumerate function. This allows you to move through data with an index.\n\ndata = [1, 2, 3, 1, 2, 3]\n\nfor index, value in enumerate(data):\ndata[index] = value * 2\n\nThis example shows the power that you gain by using for with the enumerate function. Using the above you can process and update a list of data.\n\n## while loops\n\nwhile loops are slightly simpler because they are based on a condition. Every time this loop starts a cycle there is a check to ensure that the loop should run. If this check is truthy then the loop will run the code inside the while loop.\n\nWhile loops are useful when monitoring systems due to their intrinsic function of inspecting a condition.\n\ni = 0\n\nwhile i < 10:\nprint(i)\ni += 1\n\nThe example is similar to the example seen in the for loop section. The output will also be the same, printing the numbers $$0$$ to $$9$$ inclusive.\n\n## Breaking out\n\nIt is sometimes useful to change the flow of loops or break out of them entirely. to do this there are two useful keywords, continue and break. The continue keyword ends the current cycle of the loop and moves back to checking the condition, resetting the loop.\n\ni = 0\nwhile i < 10:\ni += 1\nif i % 2 == 0:\ncontinue\n\nprint(\"i is odd\")\n\nThe above example uses this behaviour to only print when numbers are odd, even though the loop will execute 10 times.\n\nConversely, The break keyword will stop the loop in place and then exit the loop, not returning to the start. Commonly this is used with a while loop to perform some action forever, unless a specific condition is met.\n\nwhile True:\nresult = test_something()\nif result == 0:\nbreak\n\nThis will continue running until the function test_something returns 0.\n\nBoth of the above constructs are useful when developing an application that needs to repeat something for a number or times.","date":"2017-03-29 13:12:36","metadata":"{\"extraction_info\": {\"found_math\": true, \"script_math_tex\": 0, \"script_math_asciimath\": 0, \"math_annotations\": 0, \"math_alttext\": 0, \"mathml\": 0, \"mathjax_tag\": 0, \"mathjax_inline_tex\": 0, \"mathjax_display_tex\": 1, \"mathjax_asciimath\": 1, \"img_math\": 0, \"codecogs_latex\": 0, \"wp_latex\": 0, \"mimetex.cgi\": 0, \"\/images\/math\/codecogs\": 0, \"mathtex.cgi\": 0, \"katex\": 0, \"math-container\": 0, \"wp-katex-eq\": 0, \"align\": 0, \"equation\": 0, \"x-ck12\": 0, \"texerror\": 0, \"math_score\": 0.22786064445972443, \"perplexity\": 895.0825975987002}, \"config\": {\"markdown_headings\": true, \"markdown_code\": true, \"boilerplate_config\": {\"ratio_threshold\": 0.18, \"absolute_threshold\": 10, \"end_threshold\": 15, \"enable\": true}, \"remove_buttons\": true, \"remove_image_figures\": true, \"remove_link_clusters\": true, \"table_config\": {\"min_rows\": 2, \"min_cols\": 3, \"format\": \"plain\"}, \"remove_chinese\": true, \"remove_edit_buttons\": true, \"extract_latex\": true}, \"warc_path\": \"s3:\/\/commoncrawl\/crawl-data\/CC-MAIN-2017-13\/segments\/1490218190295.65\/warc\/CC-MAIN-20170322212950-00372-ip-10-233-31-227.ec2.internal.warc.gz\"}"} | null | null |
Hereford College of Arts is one of only four specialist art colleges in the country, providing students with a range of programmes in art, design, arts and music. Two campuses in the area offer courses at foundation, undergraduate and postgraduate level and many of the staff are currently practising artists and designers. Courses at BA (Hons) level include Contemporary Design Crafts, Graphic & Media Design and Illustration, while two postgraduate courses in Contemporary Crafts and Fine Art are also available.
Hereford's Short Course programme offers a host of learning and leisure opportunities, while Businesses regularly contact the College to invite students to design artwork for their products and services, or to take up work placements and internships.
Hereford College of Arts provide a range of services to ensure your stay at the College is as comfortable as possible. These include assistance with health, financial, IT, housing and career questions and issues. In 2015, Hereford College of Arts was accredited with the nationally recognised quality mark for organisations that provide information, advice and guidance – the matrix Standard.
Hereford is an intimate city, close to major hubs such as Birmingham, Cardiff and Bristol. A vibrant arts scene showcases live music and comedy and independent films, while the Borderlines Film Festival and The Hereford Photography Festival will complement your study at the College. Whatever your tastes and interests, you can find something to suit you in Herefordshire. | {
"redpajama_set_name": "RedPajamaC4"
} | 9,604 |
\section{Introduction}
\label{sec:introuction}
The Peccei-Quinn mechanism, accompanied by axions, remains the most compelling resolution of the strong charge-parity (CP) problem
\cite[orignal papers:][]{1977PhRvD..16.1791P,1978PhRvL..40..223W,1978PhRvL..40..279W,KSVZ1,KSVZ2,DFSZ1,DFSZ2}\cite[recent reviews:][]{vanBibber:2006rb, Asztalos:2006kz,Sikivie:2008,Raffelt:2006cw,Sikivie:2009fv,Rosenberg:2015kxa,Marsh:2015xka,Graham:2015ouw,Ringwald:2016yge,Battesti:2018bgc,Irastorza:2018dyq,Safronova:2017xyt}. In this model, conventional dark-matter (DM) axions are produced either by the misalignment mechanism \cite{1983PhLB..120..127P,1983PhLB..120..133A,1983PhLB..120..137D}, when the cosmological field $\theta(t)$ oscillates and emits cold axions before it settles at a minimum, or via the decay of topological objects \cite{Chang:1998tb,2012PhRvD..85j5020H,2012PhRvD..86h9902H,Kawasaki:2014sqa,Fleury:2015aca,Gorghetto:2018myk,Klaer:2017ond}. There are some uncertainties in the estimation of the axion abundance from these two channels and we refer the reader to the original papers for discussions\footnote{\label{DM}According to recent computations \cite{Klaer:2017ond} the axion contribution to $\Omega_{\rm DM}$ as a result of decay of topological objects can saturate the observed DM density today if the axion mass is in the range $m_\mathrm{a}=(2.62\pm0.34)10^{-5} {\rm eV}$, while earlier estimates suggest that saturation occurs at a larger axion mass. There are additional uncertainties in this result, and we refer to the original studies \cite{Gorghetto:2018myk} on this matter. One should also emphasize that the computations \cite{Chang:1998tb,2012PhRvD..85j5020H,2012PhRvD..86h9902H,Kawasaki:2014sqa,Fleury:2015aca,Gorghetto:2018myk,Klaer:2017ond} have been performed with assumption that Peccei-Quinn symmetry was broken after inflation.}. In both production mechanisms, the axions are radiated as non-relativistic particles with typical galactic velocities $v_{\rm axion}/c\sim 10^{-3}$, and their contribution to the cosmological DM density scales as $\Omega_{\rm axion}\sim m_a^{-7/6}$. This scaling implies that the axion mass must be tuned to $m_a\simeq 10^{-5}$ eV in order to saturate the observed cosmological DM density today. Higher axion masses will contribute very little to $\Omega_{\rm DM}$ and lower axion masses will over-close the Universe which would be in strong conflict with cosmological data \cite{Planck2018}. Cavity-type experiments have the potential to discover these non-relativistic axions.
Note that the type of axions being discussed here are conventional Quantum Chromo-Dynamics (QCD) axions with a mass range of ($10^{-6} {\rm eV} \lesssim m_a\lesssim 10^{-3} {\rm eV}$). It should be contrasted with Ultra Light Axions (ULAs) which were suggested as another Dark Matter candidate, also called fuzzy dark matter, but it is not the kind of axions considered in this study. ULAs do not solve the strong CP problem, and their primary motivation is not rooted in QCD.
Axions may also be produced via the Primakoff effect in stellar plasmas at high temperature \cite{Sikivie:1983ip}. These axions are ultra-relativistic; with a typical average energy of axions emitted by the Sun of $\langle E\rangle =4.2$ keV \cite{Andriamonje:2007ew}. Searches for Solar axions are based on helioscope instruments like CAST (CERN Axion Search Telescope) \cite{Andriamonje:2007ew}.
Recent work \cite{Fischer:2018niu} has suggested a fundamentally novel mechanism for axion production in planets and stars, with a mechanism rooted in the so-called axion quark nugget (AQN) dark matter model \cite{Zhitnitsky:2002qa}.
The AQN construction in many respects is
similar to the original quark nugget model suggested by Witten \cite{Witten:1984rs} long ago (refer to \citep{Madsen:1998uh} for a review). This type of DM model is ``cosmologically dark", not because of the weakness of their interactions, but due to their small cross-section-to-mass ratio, which scales down many observable consequences of an otherwise strongly-interacting DM candidate.
There are two additional elements in our AQN model compared to \cite{Witten:1984rs,Madsen:1998uh}. First, there is an additional stabilization factor for the nuggets provided by the axion domain walls which are produced in great quantity during the QCD transition which help to alleviate a number of problems with the original nugget model\footnote{\label{first-order}In particular, a first-order phase transition is not required as the axion domain wall plays the role of the squeezer. Another problem with \cite{Witten:1984rs,Madsen:1998uh} is that nuggets will likely evaporate on a Hubble time-scale even. For the AQN model this argument is not applicable because the vacuum-ground-state energies inside (color-superconducting phase) and outside (hadronic phase) the nugget are drastically different. Therefore, these two systems can coexist only in the presence of an external pressure, provided by the axion domain wall. This contrasts with the original model \cite{Witten:1984rs,Madsen:1998uh}, which must be stable at zero external pressure.}. Another feature of AQNs is that nuggets can be made of {\it matter} as well as {\it antimatter} during the QCD transition. This element of the model completely changes the AQN framework \cite{Zhitnitsky:2002qa} because the DM density, $\Omega_{\rm DM}$, and the baryonic matter density, $\Omega_{\rm visible}$, automatically assume the same order of magnitude $\Omega_{\rm DM}\sim \Omega_{\rm visible}$ without any fine tuning. This is because they have the same QCD origin and are both proportional to the same fundamental dimensional parameter $\Lambda_{\rm QCD}$ which ensures that the relation $\Omega_{\rm DM}\sim \Omega_{\rm visible}$
always holds.
The existence of both AQN species explains the observed asymmetry between matter and antimatter as a result of separation of the baryon charge when some portion of the baryonic charge is hidden in the form of AQNs. Both AQNs made of matter and antimatter serve as dark matter. It should be contrasted with the conventional baryogenesis paradigm when extra baryons (1 part in $10^{10}$) must be produced during the early stages of the evolution of the Universe. While the model was invented to explain the observed relation $\Omega_{\rm DM}\sim \Omega_{\rm visible}$, it may also explain a number of other observed phenomena, such as the excess of diffuse galactic emission in different frequency bands, including the 511 keV line. The AQNs may also offer a resolution to the so-called ``Primordial Lithium Puzzle" \cite{Flambaum:2018ohm} and to the ``The Solar Corona Mystery" \cite{Zhitnitsky:2017rop,Raza:2018gpb} and may also explain the recent EDGES observation \cite{Lawson:2018qkc}, which is in some tension with the standard cosmological model. It may also explain the DAMA/LIBRA annual modulation as argued in \cite{Zhitnitsky:2019tbh}. It is the {\it same set} of physical parameters of the model which were used in aforementioned phenomena that will be adopted for the present studies.
We refer to the original papers \cite{Liang:2016tqc,Ge:2017ttc,Ge:2017idw,Ge:2019voa} on the formation mechanism when the separation of baryon charge phenomenon plays the key role. The AQN framework aims at resolving two fundamental problems at once: the nature of dark matter and the asymmetry between matter and antimatter. This is irrespective of the specific details of the model, such as the axion mass $m_a$ or misalignment angle $\theta_0$.
AQNs are composite objects made out of axion field and quarks and gluons in the color superconducting (CS) phase, squeezed by a domain wall (DW) shell.
It represents a cosmologicaly stable configuration state assuming the lowest energy state for a given baryon charge.
An important point, in the context of the present study, is that the axion portion of the energy contributes to about 1/3 of the total mass in form of the axion DW. This DW is a stable time-independent configuration which kinematically cannot convert its energy to freely propagating (time-dependent) axions. However, any time-dependent perturbation
results in the emission of real propagating axions via DW oscillations. The axion emission happens whenever annihilation events occur between antimatter AQNs with surrounding material.
In particular when AQNs cross the Earth
the corresponding axion energy density is estimated \cite{Fischer:2018niu} as:
\begin{equation}
\label{eq:rho_a intro}
\rho_a^{\rm AQN}
\sim10^{-4}\left(\frac{\Delta B}{B}\right)\rm \frac{GeV}{cm^3} ~~~~~~ [\rm AQN -induced ],
\end{equation}
where $\Delta B/{B}$ is the portion of the baryon charge being annihilated during the passage of the AQN through the Earth.
This portion $\Delta B/{B}$ is estimated on the level $(10\%-30\%)$ depending on the size distribution of the AQNs \cite{Lawson:2019cvy}. If the conventional galactic axions saturate the DM density $\rho_{\rm DM}\simeq0.3\,\rm GeV\,cm^{-3}$ then the estimate (\ref{eq:rho_a intro}) suggests that the AQN-induced axion density is about four orders of magnitude smaller than the conventional galactic axions density.
\exclude{One should comment here that the conventional contribution is highly sensitive to $m_a$
as $\rho_{\rm DM} \sim m_a^{-7/6}$ and may saturate the DM density at $m_a\lesssim 10^{-5} {\rm eV}$, depending on additional assumptions on production mechanism. It should be contrasted with the AQN-induced density (\ref{eq:rho_a intro}) which is not very sensistive to the axion mass $m_a$ assumiong the AQNs saturate the dark matter density. }
The key distinct feature between the conventional galactic axions and AQN-induced axions is the spectrum. In the former case $v_a\sim 10^{-3}c$, while for the latter, the spectrum is very broad and demonstrates a considerable variation in the entire interval $v_a\in(0,c)$
with average velocity $\langle v_a\rangle\simeq 0.6 c$ \cite{Liang:2018ecs}.
This crucial difference in spectrum requires a different type of instruments and drastically different search strategies. A possible broadband detection strategy for the relativistic AQN-induced axions (\ref{eq:rho_a intro}) has been discussed recently in an accompanying paper \cite{Budker:2019zka}, where it is suggested to analyse the annual and daily modulations and different options are proposed in order to discriminate the true signals from spurious signals by using the global network. Appendix \ref{broadband} reviews some of the ideas advocated in \cite{Budker:2019zka}.
The main goal of the present work is the computation of the intensity and time-dependence of all the
effects discussed in \cite{Budker:2019zka}, assuming that the broadband detection strategy will be available in the future.
It is clear that the AQN-induced axion density \eqref{eq:rho_a intro} is very small and the signal will be strongly suppressed in conventional cavity axion search experiments such as ADMX, ADMX-HF \cite{Stern:2016bbw} or HAYSTAC \cite{Zhong:2018rsr}
which explicitly depend on the axion density. However, in other type of experiments such as CASPEr \cite{JacksonKimball:2017elr} or QUAX \cite{Barbieri:2016vwg}
when the observables are proportional to the axion velocity
$\mathbf{v_a}\sim\boldsymbol{\nabla} a$ the AQN-induced relativistic axions will clearly enhance the signal, as shown by Eq. (\ref{H}) in Appendix \ref{broadband}.
In that case, it is the axion flux $\Phi^{\rm AQN}_a$, proportional to axion velocity
$\mathbf{v_a}$, rather than the axion density becomes
the relevant observable. In any case, axion density and flux are closely related: $ v_a \rho_a^{\rm AQN}\approx m_a\Phi^{\rm AQN}_a$, and we present our basic numerical results in the main body of the text in terms of both.
We would like to emphasize that the main result of this work is the computation of the annual, daily modulations of the induced axions, as well as rare bursts-like amplifications. While the annual modulations have been discussed in the literature \cite{Freese:1987wu,Freese:2012xd}, the daily modulations are normally ignored in DM literature because in WIMPs based models the effect is negligible. This is no longer the case with the AQN model when both effects are large, of the order of $10\%$.
More specifically, we computed the AQN-induced axion flux on the Earth's surface, which can be conveniently presented as follows
\begin{eqnarray}
\label{flux}
\langle E_a\rangle \Phi^{\rm AQN}_a(t)\simeq 10^{14}A(t) \left[{\rm\frac{eV}{cm^2s}}\right], ~~~ \langle E_a\rangle\simeq 1.3\,m_a, ~~
\end{eqnarray}
where $A(t)$ is the modulation/amplification time dependent
factor. We normalize the flux such that $\langle A(t)\rangle =1$ if averaged over very long period of time, much longer than few years.
The effect of the annual modulation has been known since \cite{Freese:1987wu,Freese:2012xd}.
For the AQN-model we computed the annual modulation parameter $\kappa_{\rm (a)}$
defined as follows:
\begin{equation}
\label{eq:annual}
A_{\rm (a)}(t)\equiv[1+\kappa_{\rm (a)} \cos\Omega_a (t-t_0)],
\end{equation}
where $\Omega_a=2\pi\,\rm yr^{-1} $ is the angular frequency of the annual modulation
and label $``a"$ in $\Omega_a $ stands for annual. The $\Omega_a t_0$ is the phase shift corresponding to the maximum on June 1 and minimum on December 1 for the standard galactic DM distribution.
We have also computed the daily modulations with parameters defined as follows:
\begin{equation}
\label{eq:daily}
A_{\rm (d)}(t)\equiv[1+\kappa_{\rm (d)} \cos(\Omega_d t-\phi_0)],
\end{equation}
where $\Omega_d=2\pi\,\rm day^{-1}$ is the angular frequency of the daily modulation, while $\phi_0$ is the phase shift similar to $\Omega_at_0$ in (\ref{eq:annual}). It can be assumed to be constant on the scale of days. However, it actually slowly changes with time due to the variation of the direction of DM wind with respect to the Earth. In addition to annual and daily modulations, we also show that the factor $A(t)$
can be numerically large for rare bursts-like events,
the so-called ``local flashes''. These short
bursts resulting from the interaction of the AQN hitting the Earth in a close vicinity of a detector.
\exclude{
The cavity type experiments such as ADMX are to date the only ones to probe the parameter space of the conventional QCD axions with $\langle v_a\rangle \sim 10^{-3} c$, while we are interested in detection of the relativistic axions with $\langle v_a\rangle \sim 0.6 c$. This requires a different type of instruments and drastically different search strategies. We argue below that the daily and annual modulations (\ref{eq:annual}) and
(\ref{eq:daily}) as well as the short bursts-like amplifications with $A\simeq 10^2$ might be the key elements in formulating a novel detection strategy to observe these effects, which is precisely the topic of the present work.
where we review a broadband strategy
to serach such relativistic AQN-induced axions.
\exclude{
Indeed, the axion interaction with a spin-1/2 particles can be described by an effective magnetic field $\mathbf{B}_a$:
\begin{equation}
\label{eq:B_a}
\mathbf{B}_a
\simeq \frac{g_{\rm a}}{\mu_{\rm p}}\sqrt{\rho_a}\mathbf{v}_a\sqrt{A(t)}\,,
\end{equation}
where $g_{\rm a}$ is the axion coupling to the particle and is inversely proportional to the axoin decay constant $f_a$, $\mu$ is magneton of the spin 1/2 particle (electron or nucleon), $\mathbf{v}_a$ is velocity of the axion, and $A(t)$ represents the time-dependent enhancement of the axion density $\rho_a$ to be studied in the present work. In a more general sense, $A(t)$ is interpreted as the factor that characterizes the modulation or amplification of axion intensity defined as follows:
}
\begin{equation}
\label{eq:A(t)}
A(t)\equiv
1+\kappa\cos(\omega t-\phi_0)\,,
\end{equation}
where $\kappa$ characterizes the amplitude of fluctuation, $\omega$ is the angular frequency, and $\phi_0$ is a reference phase. For conventional galactic DM axions, $A(t)$ represents the annual modulation, with $\kappa_{\rm a}\sim{\cal O}(10\%)$ and $\omega_{\rm a}=2\pi\,\rm yr^{-1}$ (with the subscript ``a'' stands for ``annual''). As the time of measurement (up to a few hours) is much shorter than the time of modulation, $A(t)\simeq1$ is usually considered as an adjustment parameter for sufficiently long time of integration. However, in this work we argue the fluctuation of $A(t)$ for the AQN-induced axions is drastically larger than the conventional signals. Rather than serving as adjustment parameter, $A(t)$ may suggest new strategies of axion search, see as follows.
\exclude{
To compare AQN-induced signal with the conventional DM axions, we choose $\Delta B/B=10\%$ in Eq. \eqref{eq:rho_a intro} and the DM axion density to be $0.3\,\rm GeV\,cm^{-3}$:
\begin{equation}
\label{eq:B_a ratio}
\frac{B_a^{\rm(AQN)}}{B_a^{\rm(DM)}}
\simeq 3\sqrt{A(t)}\,,
\end{equation}
where $A(t)$ is the modulation/amplification factor for the AQN-induced axions, a factor much larger than the conventional one as we will show in this work. Hence, for experimental observables proportional to $\boldsymbol{\nabla} a$ the AQN-induced signal is about three times larger even without the additional factor $A(t)$.
We emphasize $A(t)$ is a \textit{time-dependent} factor that characterizes the modulations or amplifications of AQN-induced signals, and it is not the same as the so-called ``quality factor'' $Q$, a \textit{constant} enhancement within range $Q\sim10^2-10^6$ in conventional haloscope experiments (cavity and broadband). The quality factor for AQN-induced axions is about 10, much smaller than the conventional value of $Q$, but it can be further enhanced in many ways. The simplest way is to approximate $A(t)$ as a constant within short time of measurement, and there is an additional enhancement by $10^2-10^4$ due to a special transient amplification (the so-called ``local flashes'') to be studied in this work, also see a brief discussion below. Alternatively, the quality factor can be boosted up to $Q\sim10^{10}$ by probing a bump in the low velocity region of the spectrum $v_a\sim10^{-5}c$ which corresponds to the AQN-induced axions trapped by Earth's gravitation in 4.5 billion years \cite{Lawson:2019cvy}. Similar to suggestion in Ref. \cite{Cao:2017ocv}, the quality factor can be also enlarged\footnote{In the original discussion \cite{Cao:2017ocv}, the amplification is assumed to be proportional to the number $N$ of millimeter-size detectors consisted in the cavity of cubic meter size. However, the efficiency should be $\sim\sqrt{N}$ as the signals are not coherent.} by $\sim(10^4-10^5)$ by packing up millimeter-size detectors, which are sensitive to the typical wavelength of the AQN-induced axions, to form a large detector of cubic meter size.
The enhancements in quality factor discussed above are the same strategy that is universal in axion haloscope experiments: to reduce the background noise by enhancing the coherence time. Rather than following the conventional \textit{coherence} approach, we advocate a fundamentally new strategy by measuring the \textit{correlation} of signals. The correlation approach is powerful when the existing modulation $A(t)$ is much larger than the conventional assumption of the typical cold DM halo, and in particular the AQN-induced signals are best suited to such approach. In what follows, we assume the AQN-induced signals are comparable to the conventional axions as argued above, but with an additional time variation factor $A(t)$.
}
The essential goal of the present work is to conduct a general survey of the time modulations and amplifications of $A(t)$ for the AQN-induced axions, including annual and daily modulations, statistical fluctuation of signals, local flashes (a transient burst-like amplification of axion intensity when an AQN annihilates near the detector), and gravitational lensing. We also comment on the potential advantages of AQN-induced axions in current and future axion experiments. Two typical modulation/amplification are worthwhile to mention as follows, and the details of the broadband detection strategy are referred to the related work \cite{Budker:2019zka}\footnote{For convenience of the readers we highlight the basic ideas of that paper in Appendix \ref{broadband} with emphasize on possible searches of the axions with relativistic velocities $v_a\sim 0.6c$.}.
First, the daily modulation is two orders of magnitude larger than the DM axions, namely $\kappa_{\rm d}\sim{10\%}$ and $\omega_{\rm d}=2\pi\,\rm day^{-1}$. The daily modulation of DM axions is weak (up to $\sim0.1\%$) because the rotational velocity on the surface of the Earth is much smaller than the Earth's orbital velocity. The huge enhancement of the AQN-induced signal is due to the unique production mechanism of axions: The axion density is proportional to mass loss ratio $\Delta B/B$ as given in Eq. \eqref{eq:rho_a intro}. Because $\Delta B/B$ changes on the level $(10\%-30\%)$, the axion density modulates at a similar magnitude as the Earth self-rotates daily.
\exclude{One may also see Fig. \ref{fig:daily modulation} and the corresponding paragraphs in Sec. \ref{subsec:daily modulation} for detailed explanation. Such large daily modulation can be realized by studying the time autocorrelation of the signal
\begin{equation}
\label{eq:corr(t)}
\begin{aligned}
{\rm corr}(t)
&\equiv\langle[B_a(t_0)-B_0][B_a(t_0+t)-B_0]\rangle\,,\\
B_0
&\equiv\langle B_a(t_0)\rangle
=\frac{1}{T}\int_{t_0}^{t_0+T}\mathrm{d} t'\,B_a(t')\,,
\end{aligned}
\end{equation}
where the expectation value is taken by averaging over the time of continuous measurement $T\gg1\rm\,day$, and $t_0$ is the starting time of measurement. Assuming background noise is approximately white, ${\rm corr}(t)$ will appear clearly as a sequence of periodic spikes separated by 24 hours where noise is effectively suppressed by correlation since white noise is uncorrelated to signal. In case of DM axions, analysis on autocorrelation does not elimiate the background noise because the signal is weakly correlated in time. Similar strategy involves building up a global network of axion detectors and study their spatial correlation similar to Eq. \eqref{eq:corr(t)}.
}
Second, a local flash is an instantaneous amplification by factor of $10^2-10^4$ within seconds, a unique feature that is not shared by DM axions and conventional DM candidates. Unlike the daily modulation that has a predicted period of repetition, local flashes are random events that occur from every a few days to every several years depending on the magnitude of amplification, see Table \ref{tab:local flashes estimation} in Sec. \ref{subsec:local flashes}. Due to the nontrivial variation in time, identification of local flashes can follow similar technique of correlation analysis as discussed in the preceding paragraph. Local flashes are more distinguishable from background noise comparing to daily modulation for two reasons: The amplification is at least 3 orders of magnitude larger than any other modulations, and $A(t)$ is a delta function with a predictive bandwidth so that the signals more identifiable from other random noise. Due to the unpredictable periodicity, detection of local flashes are more suitable to studying the spacial correlation from a global network rather than from a single axion detetcor \cite{Budker:2019zka}.
We conclude the AQN-induced axions have comparable or even stronger signals \eqref{eq:B_a ratio} compared to conventional DM aioxns for experimental observables proportional to $\boldsymbol{\nabla} a$. The AQN-induced signals also reveal a strong self-correlation characterized by modulation/amplification factor $A(t)$, a unique feature that is absent in case of DM axions and conventional cold DM candidates. Typical axion experiments rely heavily on long coherence time (usually $\sim10^6m_a^{-1}$) to improve the signal to noise ratio through prolonged time of measurement. This is because the presumed cold DM halo is almost time-invariant so that signals are uncorrelated in time, and therefore analysis of correlation does not help to reduce the background noise. However the AQN-induced axions, as byproduct of AQN annihilation, do not follow the cold DM halo distribution and have strong correlation in time. Thus, background noise can be eliminated by studying the correlation for AQN-induced signals in the axion search.
}
It is important to emphasize that, in the present work, along with the accompanying paper \cite{Budker:2019zka}, we are studying the relativistic axions, $v_a\sim0.6c$, which represent a \emph{direct} manifestation of the AQN model. It should be contrasted with
\emph{indirect} manifestations of the AQN model mentioned above.
An observation of axions with very distinct spectral properties compared to those predicted from conventional galactic axions with $v_a\sim 10^{-3}c$ would be a smoking gun for the AQN framework and this may then answer a fundamental question on the nature of DM.
The presentation is organized as follows.
We start with a brief overview of the axion emission mechanism in the AQN framework in Sec. \ref{sec:the AQN model and its axion emission mechanism}. In Sec. \ref{sec:potential enhancements} we compute the relevant parameters describing the modulations and amplifications as announced in this Introduction. The corresponding derivation of analytical equations and algorithm of numerical simulation are left to Sec. \ref{sec:annihilation modeling} and \ref{sec:algorithm and simulation}, with detailed results presented in \ref{sec:discussion of results}. Finally, we conclude with some thoughts on possible future developments in Sec. \ref{sec:conclusions and future directions}.
\section{The AQN model and its axion emission mechanism}
\label{sec:the AQN model and its axion emission mechanism}
The AQNs hitting the Earth surface is given by \cite{Lawson:2019cvy}:
\begin{eqnarray}
\label{eq:D Nflux 3}
\frac{\langle\dot{N}\rangle}{4\pi R_\oplus^2}
=\frac{0.4}{{\rm {km^{2}}yr }}\left(\frac{10^{24}}{\langle B\rangle}\right)
\left(\frac{\rho_{\rm DM}}{0.3{\rm \frac{GeV}{cm^3}}}\right)
\left(\frac{\langle v_{\rm AQN} \rangle}{\rm 220\,\mathrm{km}\,\mathrm{s}^{-1}}\right).~~~
\end{eqnarray}
Eq. \eqref{eq:D Nflux 3} shows that conventional DM detectors are too small to detect AQNs directly.
However, axions will be emitted when the AQN crosses the Earth interior, due to the annihilation processes that will lead to time-dependent perturbations of the axion DW.
The time-dependent perturbations due to annihilation processes will change the equilibrium configuration of the axion DW shell, and axions will be emitted because the total energy of the system is no longer at its minimum when some portion of the baryon charge in the core is annihilated. To retrieve the ground state, an AQN will therefore lower its domain wall contribution to the total energy by radiating axions. The resulting emitted axions can be detected by conventional haloscope axion search experiments.
The emitted axion velocity spectrum was calculated in \cite{Liang:2018ecs} using the following approach: Consider a general form of a domain wall:
\begin{equation}
\label{eq:2.3 phi soln}
\phi(R_0)=\phi_w(R_0)+\chi
\end{equation}
where $R_0$ is the radius of the AQN, $\phi_w$ is the classical solution of the domain wall, and $\chi$ describes excitation due to the time-dependent perturbation. $\phi_w$ is the DW time-independent classical solution, while $\chi$ describes on-shell propagating axions. Suppose an AQN is travelling in the vacuum where no annihilation events are taking place. The DW solution will remain in its ground (minimum energy) state $\phi(R_0)=\phi_w(R_0)$. Since there is no excitation (i.e. $\chi=0$), no free axion can be produced. When some baryon charge of the AQN is annihilated, the AQN starts loosing mass, its size decreases from $R_0$ to a slightly smaller radius $R_{\rm new}=R_0-\Delta R$. The quantum state $\phi(R_0)=\phi_w(R_0)$ is then no longer the ground state, because a lower energy state $\phi_w(R_{\rm new})$ becomes available. The state of the domain wall then becomes $\phi(R_0)=\phi_w(R_{\rm new})+\phi_w'(R_{\rm new})\Delta R$, and the domain wall acquires a nonzero exciting mode $\chi=\phi_w'(R_{\rm new})\Delta R$ leading to the production of free axions. Thus, whenever the domain wall is excited, corresponding to $\chi\neq0$, freely propagating axions will be produced and emitted by the excited modes.
The emission of axions is therefore an inevitable consequence of the annihilation of antimatter AQNs and of AQNs minimizing their binding energy. We refer the readers to Refs. \cite{Liang:2018ecs} for the technical details of the emission mechanism and the calculation of its axion spectrum. For convenience, we also review the important results from \cite{Liang:2018ecs} in Appendix \ref{app:spectral properties in the rest frame}.
Let $\mathrm{d} N/\mathrm{d} B$ be the number of AQNs which carry the baryon charge [$B$, $B+dB$].
We shall use the same models for $\mathrm{d} N/\mathrm{d} B$ as in \cite{Lawson:2019cvy}, and we refer to that paper for a description of the baryon charge distributions still allowed. Following \cite{Lawson:2019cvy}, the mean value of the baryon charge $\langle B\rangle $ is given by
\begin{equation}
\label{eq:f(B)}
\langle B\rangle
=\int_{B_{\rm min}}^{10^{28}}\mathrm{d} B~B f(B),
\qquad f(B)\propto B^{-\alpha}
\end{equation}
where $f(B)$ is properly normalized distribution and the $\alpha$ is power-law index which assumes the following values:
\begin{equation}
\label{eq:2.2 f(B) ass_alpha}
\alpha=2.5,~2.0,~{\rm or}\left\{
\begin{aligned}
&1.2 &B\lesssim 3\times 10^{26} \\
&2.5 &B\gtrsim 3\times 10^{26}\ .
\end{aligned}\right.
\end{equation}
One should note that that the algebraic scaling (\ref{eq:f(B)}) is a generic feature of the AQN formation mechanism based on percolation theory \cite{Ge:2019voa}. The parameter $\alpha$ is determined by the properties of the domain wall formation during the QCD transition in the early Universe, but it cannot be theoretically computed in strongly coupled QCD. Instead, the parametrization (\ref{eq:2.2 f(B) ass_alpha}) is based on fitting the observations of the Extreme UV emission from the solar corona as discussed in \cite{Raza:2018gpb,Lawson:2019cvy}.
Another parameter that defines the distribution function (\ref{eq:f(B)}) is the minimum baryonic charge $B_{\rm min}$.
We use the same models as discussed in \cite{Raza:2018gpb,Lawson:2019cvy} and take $B_{\rm min}=10^{23}$ and $B_{\rm min}=3\times10^{24}$. Therefore, we have a total of 6 different models for $f(B)$. In Table \ref{tab:mean B} we show the mean baryon charge $\langle B \rangle$ for each of the 6 models.
\begin{table} [h]
\caption{Values of the mean baryon charge $\langle B\rangle$ for different parameters of the AQN mass-distribution function.}
\centering
\begin{tabular}{c|ccc}
\hline\hline
$(B_{\rm min},\alpha)$ & 2.5 & 2.0 & (1.2, 2.5) \\ \hline
$10^{23}$ & $2.99\times10^{23}$ & $1.15\times10^{24}$ & $4.25\times10^{25}$ \\
$3\times10^{24}$ & $8.84\times10^{24}$ & $2.43\times10^{25}$ & $1.05\times10^{26}$ \\ \hline\hline
\end{tabular}
\label{tab:mean B}
\end{table}
For simulations in this work, we will only investigate parameters that give $\langle B\rangle\gtrsim10^{25}$ to be consistent
with IceCube and Antarctic Impulsive Transient Antenna (ANITA) experiments as discussed in \cite{Lawson:2019cvy}.
Therefore, in our numerical studies we exclude two models corresponding $B_{\rm min}\sim10^{23}$ with power-law index $\alpha=2.5$ and $\alpha=2.0$.
\section{modulation and amplifications: WIMPs and the AQN-induced axions}
\label{sec:potential enhancements}
In this section we quantify the time modulations and amplifications of the axion flux that can potentially be realized in the AQN model, and compare it to the conventional DM candidates
such as weakly interacting massive particles
(WIMPs). We examine time modulations and possible enhancements in descending order of importance, from annual to daily modulation effects \cite{Freese:1987wu,Freese:2012xd} specific to the AQN model as well as other new phenomena.
Our results are presented in Table \ref{tab:potential enhancement}, and the resulting comparison between AQN-induced axions and conventional DM enhancements can be summarized as follow:
The annual modulation discussed in Sec. \ref{subsec:annual modulation} has a similar amplitude in both cases, but the daily modulation presented in Sec. \ref{subsec:daily modulation} is much stronger for AQN-induced axions than for conventional WIMP-like models. Sec. \ref{subsec:statistical fluctuation} and \ref{subsec:local flashes} introduce two new, time-dependent phenomena, that are unique to the AQN model, and do not exist in conventional DM: the statistical fluctuations and the ``local flashes" respectively.
The latter effect becomes operational when the axion detector happens to be in the vicinity of the point where AQN enters or exits
the Earth surface. We consider this novel phenomenon as the most promising effect which may drastically enhance the discovery potential for the axion search experiments and provide a decisive test of the AQN model. Gravitational lensing is another modulation effect, originally discussed in \cite{Patla:2013vza,Bertolucci:2017vgz}. We revisit this effect in subsection \ref{subsec:gravitational lensing} assuming a conventional galactic DM distribution (in coordinate and momentum spaces) which explains our result of a negligible effect in comparison with huge enhancement reported in \cite{Patla:2013vza,Bertolucci:2017vgz} where nonconventional streams of DM were considered.
\begin{table}[h]
\captionsetup{justification=raggedright}
\caption{Comparison of potential enhancement: AQN-induced axions vs. WIMPs. Amplifications factors are listed up to order of magnitude estimate.}
\centering
\begin{tabular}{ccc}
\hline\hline
Potential enhancement &WIMPs & \begin{tabular}{@{}c@{}}AQN-induced \\ axions\end{tabular} \\\hline
Annual modulation & $1\%-10\%$ \cite{Freese:1987wu,Freese:2012xd} & $1\%-10\%$ \\
Daily modulation & $\ll1\%$ \cite{Freese:2012xd} & $1\%-10\%$ \\
Statistical fluctuation & 0 & $20\%-60\%$ \\
Local flashes &0 & $10^2-10^3$
\\\hline
Gravitational lensing & $10^4-10^6$ \cite{Patla:2013vza,Bertolucci:2017vgz}
& $\lesssim1\%$ \\\hline \hline
\end{tabular}
\label{tab:potential enhancement}
\end{table}
\subsection{Annual modulation}
\label{subsec:annual modulation}
Conventional DM candidates such as galactic axions and WIMPs are affected by annual modulation with change estimated to be $\mathcal{O}(1\%-10\%)$ based on standard halo model (SHM) of the galactic halo \cite{Freese:1987wu,Freese:2012xd}. To understand this result, we first note the local speed of DM stream is not constant and subject to an annual modulation due to the motion of the Earth \cite{Freese:1987wu,Freese:2012xd}:
\begin{equation}
\label{eq:mu(t)}
\mu(t)\simeq V_\odot+bV_\oplus\cos\omega_{\rm a}(t-t_0)
\end{equation}
where $V_\odot=220\,\mathrm{km}\,\mathrm{s}^{-1}$ is the oribital speed of the Sun around the galactic center, $V_\oplus=29.8\,\mathrm{km}\,\mathrm{s}^{-1}$ is the orbital speed of the Earth around the Sun, $\omega_{\rm a}=2\pi\,\rm yr^{-1}$ is the angular frequency of the annual modulation, and $|b|\leq1$ is a geometrical factor associated with the direction of local velocity $\boldsymbol{\mu}$ relative to the orbital plane of Earth. Hence, it is natural to expect the amplification must be of order $\mathcal{O}(V_\oplus/V_\odot)\sim10\%$, as the incoming flux of particles depends on the incident speed $\mu$.
Similar arguments apply to the AQN-induced axions. We first note the flux of AQN-induced axions (derived in Sec. \ref{subsec:the axion flux density on Earth's surface}) is:
\begin{equation}
\label{eq:m_a Phi_a simeq}
m_a\Phi_a
\simeq
\frac{v_a}{c}\frac{\langle\dot{N}\rangle\langle\Delta m_{\rm AQN}\rangle}{16\pi R_\oplus^2}\ ,
\end{equation}
where $v_a\sim0.6c$ is speed of the emitted axions,
$\langle\dot{N}\rangle$ is the expected hit rate of AQNs on Earth, and $\langle\Delta m_{\rm AQN}\rangle$ is the total average mass loss\footnote{For sake of brevity, in this work we adopt the following terminology: whenever ``per AQN'' is referred, we mean ``per $\langle B\rangle$ baryon charge''.} per single AQN
with baryon charge $B$ such that $\Delta m_{\rm AQN}\approx m_p \Delta B$. Numerically, the corresponding flux
of the AQN-induced axions is
\begin{equation}
\label{eq:E_a Phi_a numerical}
\langle E_a\rangle\Phi_a
\sim 10^{14}\left[\rm\frac{eV}{cm^2s}\right]\,,
\end{equation}
as the presented in Eq. \eqref{flux} with $\langle A(t)\rangle=1$.
We should mention here that the exact formula to be derived in Sec. \ref{subsec:the axion flux density on Earth's surface} contains some additional features (e.g. angular dependence), but it is sufficient to use Eq. \eqref{eq:m_a Phi_a simeq} for qualitative discussion in this section.
The linear relation \eqref{eq:m_a Phi_a simeq} simply states that the
the output axion flux rate $m_a\Phi_a$ is proportional to the amount of AQN flux supplied $\langle\dot{N}\rangle$ and its mass loss $\langle\Delta m_{\rm AQN}\rangle$. Clearly, the hit rate $\langle \dot{N}\rangle$ is, by definition, linearly proportional to the magnitude of incident speed $\mu$, resulting in a modulation up to order $\mathcal{O}(V_\oplus/V_\odot)\sim10\%$. On the other hand, we note the mass loss $\langle\Delta m_{\rm AQN}\rangle$ is a speed independent quantity by its conventional definition:
\begin{equation}
\label{eq:dm_AQN}
\mathrm{d} m_{\rm AQN}
=-\sigma\rho v\mathrm{d} t
=-\sigma\rho \mathrm{d} s\ ,
\end{equation}
where $\sigma$ is the effective cross section of the AQN, $\rho$ is local density of the Earth, $v$ is the speed of the AQN, $t$ and $s$ is propagation time and the path length of the AQN respectively. Thus, the farther an AQN travels underground the more axions emitted due to mass loss, but this is insensitive to the AQN speed.
To illustrate this, we plot the annual modulation fraction, defined as the size of the modulation amplitude relative to its average flux density, as a function of time in Fig. \ref{fig:annual modualation}. In this work, we choose two extreme cases $\mu=V_\odot\pm V_\oplus$ to demonstrate the existence of annual modulation in our numerical simulations.
\begin{figure}
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=1\linewidth]{Annual_Modualation}
\caption{Annual modulation fraction as a function of time $(t-t_0)$, the geometrical factor is chosen to be $b=0.497$ \cite{Freese:2012xd}.}
\label{fig:annual modualation}
\end{figure}
\subsection{Daily modulation}
\label{subsec:daily modulation}
The effect of daily modulation is rarely considered important in conventional discussion of DM candidates because the additional correction (at most $0.5\,\mathrm{km}\,\mathrm{s}^{-1}$ rotational velocity on the surface of the Earth) is much smaller than the Earth's orbital velocity $V_\oplus$. However, the scenario is drastically different in case of axion emission from AQNs. The basic reason is that the AQNs are the composite microscopical objects\footnote{This should be contrasted with conventional DM candidates which are microscopic fundamental particles characterized by a cross section that is independent from orientation and position of the Earth with respect to Sun and galactic centre.} which lose a portion of their material while crossing the Earth. As a result the size of an AQN decreases while it crosses the Earth.
The basic mechanism of the daily modulation of the AQN-induced axions can be describe as follow: Eq. \eqref{eq:dm_AQN} implies that the flux of AQN-induced axions is sensitive to the local mass loss of AQNs. Furthermore, the same equation suggests that the local mass loss is not constant
during the passage of the AQN through Earth as the cross section $\sigma$ decreases along the trajectory. Consequently, the annihilation rate, and therefore the axion production rate, also decreases along the trajectory. Since the AQN cross section decreases as they traverse Earth and lose mass, there is then more axions emitted facing the wind compared to facing away from it. Fig. \ref{fig:daily modulation} illustrates this mechanism: the AQN flux impacts the Earth at a fixed angle $63\degree$ due to the alignment of the celestial equator (the plane of Earth's equator) relative to the Galactic plane. Consider the downward motion as shown in Fig. \ref{fig:daily modulation}. For this case we expect more heat (and therefore more axions) to be emitted in the upper hemisphere (the half sphere facing the AQN wind) than the lower one (the half sphere opposing the AQN wind). The difference can be as large as $\sim10\%$ as we will soon estimate. Then, as the Earth rotates daily, we expect to see a daily modulation of order $10\%$ especially for detectors built in lower latitude regions with respect to the north pole.
In order to estimate the amplitude of this effect, we consider the ratio between the annihilation cross section when an AQN enters and when AQN exits the Earth (assuming the same orientation for the wind $\boldsymbol{\mu}$):
\begin{equation}
\label{eq:dm_AQN m_AQN}
\frac{\sigma_{\rm entry}}{\sigma_{\rm exit}}\simeq \frac{\sigma_{\rm entry}}{(\sigma_{\rm entry}-\Delta\sigma)}
\simeq \left(1+\frac{\Delta\sigma}{\sigma}\right)
\simeq 1+\frac{2}{3}\frac{\Delta B}{B}\ ,
\end{equation}
where we use the relation $\sigma \propto R^2 \propto B^{2/3}$.
Therefore, the total fluctuation of daily modulation deviated from the mean value is half of the above estimation
\eqref{eq:dm_AQN m_AQN}:
\begin{equation}
\label{eq:percetage fluctuation}
{\rm daily~ modulations}\equiv \kappa_{\rm (d)}
\simeq\frac{1}{3}\frac{\langle\Delta B\rangle}{\langle B\rangle}\ ,
\end{equation}
which can be trusted as long as the factor on the right hand side is numerically small and expansion (\ref{eq:dm_AQN m_AQN}) is justified.
From Monte Carlo simulation, we calculated that the typical fraction of total mass loss $\langle\Delta B\rangle/\langle B\rangle$ is about 30\%. Therefore, we expect an amplitude modulation of order 10\% from the mean value in mass loss. The estimate \eqref{eq:percetage fluctuation} is consistent with numerical simulations, later demonstrated in Sec. \ref{sec:discussion of results}, which supports our interpretation in terms of the daily modulation. The corresponding daily modulation can be described with the parameter $A_{\rm (d)}(t)$ as defined in Eq. \eqref{eq:daily}.
$A_{\rm (d)}(t)$ can be assumed to be constant on the scale of days. However, it actually slowly changes with time due to the variation of the direction of DM wind with respect to the Earth's position and orientation.
Lastly, we would like to point out another interesting consequence: there also exists a ``spatial" modulation: axion flux is slightly more intense (the same $10\%$) in the Northern Hemisphere compared to the south, because the DM wind points to the northern portion of the Earth, see Fig. \ref{fig:daily modulation}.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=0.9\linewidth]{Daily_Modulation}
\caption{Mechanism of daily modulation for the AQN-induced axions. The DM wind in form of the AQNs comes at a fixed angle $63\degree$ due to the alignment of the celestial equator relative to the galactic plane. Consequently, about 10\% more (less) axions are emitted in the upper (lower) hemisphere compared to the average value. Due to self-rotation of the Earth, daily modulation of order $10\%$ is expected. The effect is stronger for detectors built in lower latitude region.}
\label{fig:daily modulation}
\end{figure}
\subsection{Statistical fluctuation}
\label{subsec:statistical fluctuation}
In this subsection we study a new type of time-dependent DM signal which has not been discussed before in the context of conventional DM: AQNs are macroscopically large objects with a number density approximately 23 orders of magnitude smaller in comparison to WIMPs with mass $\sim 10^2$ GeV. Therefore Poisson fluctuations, which are completely irrelevant for conventional DM, could potentially be important for the AQN model. The tiny flux (\ref{eq:D Nflux 3}) of AQNs is an explicit manifestation of this unique feature. The details of the AQN statistical fluctuation depend on the AQN size (and mass) distribution, trajectories and velocities.
In order to study the statistical fluctuation of AQN-induced axions, we consider the flux formula \eqref{eq:m_a Phi_a simeq} and conjecture that the two quantities, $\langle\dot{N}\rangle$ and $\langle\Delta m_{\rm AQN}\rangle$, may have large statistical fluctuation due to the low number statistics. The average hit rate of AQNs hitting the Earth is about $1\rm\,s^{-1}$ \cite{Lawson:2019cvy}, while the crossing time of an AQN inside the Earth interior is of order $\Delta t\sim R_\oplus/v_{\rm DM}\sim30\rm\,s$. Hence, we estimate that there are only about 30 AQNs in the Earth interior at any given moment. Statistical fluctuation can therefore be important for AQNs, unlike conventional DM.
We numerically simulate the statistical fluctuations using a two-step Monte Carlo. First, we simulate $N$, the number of AQNs in the Earth interior at a given moment, by Poisson distribution:
\begin{equation}
\label{eq:Prob(N)}
\begin{aligned}
{\rm Prob}(N)
\sim
\frac{\lambda^N}{N!}e^{-\lambda},
\quad\lambda=\langle\dot{N}\rangle\langle\Delta t\rangle\ ,
\end{aligned}
\end{equation}
where $\langle\dot{N}\rangle=0.672{\rm~s}^{-1}$ is the average hit rate of AQNs \cite{Lawson:2019cvy}, and $\langle \Delta t\rangle\sim30$ s is the average time duration of an AQN inside the Earth\footnote{A subtle point is, $\langle\dot{N}\rangle$ is also proportional to $\mu$, the mean speed of AQN. Therefore for some model parameters (e.g. annual modulation) that modify $\mu$, $\langle\dot{N}\rangle$ should be also modified correspondingly.}. And then, we obtain $\Delta m_{\rm AQN}$, the average mass loss per AQN from this sample size $N$. By repeating the above process, we obtain the standard deviation of $\langle\Delta m_{\rm AQN}\rangle$ where fluctuation in $\langle\dot{N}\rangle$ is already accounted.
The results are shown in the last columns of Table \ref{tab:summary of statistical fluctuations}. We find statistical fluctuations of the order the ${\cal O}(20\%-60\%)$, depending on the size distribution model (\ref{eq:f(B)}), (\ref{eq:2.2 f(B) ass_alpha}). Numerically, the effect is greater than the enhancements assessed in the previous subsections for annual and daily modulations.
It is interesting to observe that smaller values of power-law index $\alpha$ corresponds to a larger fluctuation of mass loss $\langle\Delta m_{\rm AQN}\rangle$. Qualitatively this can be explained by the fact that a smaller value of $\alpha$
corresponds to higher AQNS average mass and consequently the rate of AQNs hitting Earth is reduced. This implies a larger dispersion, in agreement with explicit numerical computations presented in Table \ref{tab:summary of statistical fluctuations}. In addition, we note that the statistical fluctuations of $\langle\Delta m_{\rm AQN}\rangle$ are almost insensitive to the AQN mean speed $\mu$ (DM wind).
\begin{table*} [!htp
\captionsetup{justification=raggedright}
\caption{Summary of statistical fluctuations ($B_{\rm min}=3\times10^{24}$ unless specified, $10^3$ trials involved in the two-step Monte Carlo). The uncertainties represent $1\sigma$ significance. $\sigma_m$ is the standard deviation of $\langle \Delta m_{\rm AQN}\rangle$ in the simulation.}
\centering
\begin{tabular}{ccccccc}
\hline\hline
$\langle B\rangle$ &$\alpha$ &Other parameters & $\langle\Delta t\rangle$ [s] & $\langle\dot{N}\rangle\langle\Delta t\rangle$ & $\langle \Delta m_{\rm AQN}\rangle$ [kg] & $\sigma_m/\langle \Delta m_{\rm AQN}\rangle$ \\\hline
$8.84\times10^{24}$ &2.5 &-- & $38.3\pm5.6$ & $25.8\pm5.0$ & $(4.93\pm1.26)\times10^{-3}$ &25.6\% \\
$8.84\times10^{24}$ &2.5 &$\mu=V_\odot - V_\oplus$ & $41.8\pm8.5$ & $25.2\pm5.0$ & $(4.90\pm1.17)\times10^{-3}$ & 23.8\% \\
$8.84\times10^{24}$ &2.5 &$\mu=V_\odot + V_\oplus$ & $35.2\pm4.5$ & $26.1\pm5.1$ & $(4.96\pm1.34)\times10^{-3}$ & 27.1\% \\
$8.84\times10^{24}$ &2.5 &Solar gravitation & $32.5\pm3.8$ & $25.0\pm4.9$ & $(4.97\pm1.61)\times10^{-3}$ & 32.5\% \\
$2.43\times10^{25}$ &2.0 &-- & $37.5\pm4.8$ & $25.2\pm5.0$ & $(8.13\pm4.51)\times10^{-3}$ & 55.5\% \\
$4.25\times10^{25}$ &(1.2, 2.5) & $B_{\rm min}=10^{23}$ & $62.3\pm15.2$ & $41.9\pm6.6$ & $(1.03\pm0.49)\times10^{-2}$ &47.6\% \\
$1.05\times10^{26}$ &(1.2, 2.5) &-- & $35.4\pm4.7$ & $23.8\pm4.9$ & $(2.48\pm0.98)\times10^{-2}$ &39.5\% \\\hline\hline
\end{tabular}
\label{tab:summary of statistical fluctuations}
\end{table*}
\subsection{Local flashes}
\label{subsec:local flashes}
Now we turn to the most interesting and most promising enhancement effect. Sharing a similar origin to the statistical fluctuation, we note that the detection signal of axion flux emitted by AQNs may be greatly amplified via a ``local flash'' on rare occasions when an AQN hits (or exits) the Earth surface in the vicinity of an axion search detector.
To understand the local flash, we first note that the intensity of axion flux is inversely proportional to distance square from the source. As estimated from the preceding section, there are only about 30 AQNs inside the Earth at any moment. Most of these AQNs do not loose much momentum and they travel a distance of order $R_\oplus$ along straight path without changing their original directions. Now, consider a case when an AQN is moving from a distance $d$ close enough to the axion detector. The intensity of the axion flux will be greatly enhanced by factor of $(R_\oplus/d)^2$ for a short period of time. This short enhancement in intensity is called a ``local flash". In the following, we will estimate the signal amplification factor of a local flash compared to the average axion flux induced by AQNs, and we will derive the instrumental requirements for a possible detection.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=0.8\linewidth]{Coord_Local_Flashes}
\caption{Cause of local flashes. Since the mean free path of AQNs in Earth is of order $R_\oplus$, the axion flux is amplified by $R_\oplus^2/d^2$ in short time (within $z_{\rm cut}\sim d$) when an AQN moves close to the detector by distance $d$.}
\label{fig:coord local flashes}
\end{figure}
As shown in Fig. \ref{fig:coord local flashes}, suppose an AQN is moving close to the detector with a minimum distance $d$. The intensity of the emitted axion flux is maximized within $z\lesssim d$. Assuming the time is sufficiently short, the mass loss rate $\dot{m}_{\rm AQN}$ and velocity $\dot{z}\simeq v_{\rm AQN}$ can be treated as constants. We obtain the total number (per surface area) of emitted axions $\Delta N_a$ within $z\in[-z_{\rm cut},z_{\rm cut}]$:
\begin{equation}
\label{eq:d Delta N_a dA}
\begin{aligned}
\frac{\mathrm{d}}{\mathrm{d} S}\Delta N_a
&=\frac{1}{4\pi}\int_{-z_{\rm cut}}^{z_{\rm cut}}
\frac{1}{z^2+d^2}
\frac{\mathrm{d} m_{\rm AQN}(z)}{4m_a} \\
&\simeq\frac{\beta}{2\pi d}\frac{1}{v_{\rm AQN}}\frac{\dot{m}_{\rm AQN}}{4m_a}
\end{aligned}
\end{equation}
where $\beta$ is the angle related to $z_{\rm cut}$ as shown in Fig. \ref{fig:coord local flashes}, and we have implicitly used the relation
\begin{equation}
\label{eq:dN_a}
\mathrm{d} N_a\simeq \frac{1}{4m_a}\mathrm{d} m_{\rm AQN}
=\frac{1}{4m_a}\frac{\dot{m}_{\rm AQN}}{v_{\rm AQN}}\mathrm{d} z\ ,
\end{equation}
when the integration $\mathrm{d} z$ is replaced by integration $\mathrm{d} m_{\rm AQN}$, see
Sec. \ref{subsec:the axion flux density on Earth's surface} for details. Finally, the axion flux density emitted by this AQN is
\begin{equation}
\label{eq:Delta Phi_a(d)}
\begin{aligned}
\Delta\Phi_a(d)
\simeq \frac{v_a}{\tau c}
\frac{\mathrm{d}}{\mathrm{d} S}\Delta N_a
= \beta\frac{v_a}{m_ac}\frac{\dot{m}_{\rm AQN}}{16\pi d^2}\ ,
\end{aligned}
\end{equation}
where $\tau\simeq 2d/v_{\rm AQN}$ is the approximate travel time for an AQN inside the interval $[-z_{\rm cut},z_{\rm cut}]$.
The expression \eqref{eq:Delta Phi_a(d)} represents the axion flux emitted by a single AQN travelling at distance $d\ll R_{\oplus}$ from detector. We want to compare this ``local flash" with the average flux \eqref{eq:m_a Phi_a simeq} by introducing the amplification factor $A$ defined as the ratio:
\begin{equation}
\label{eq:A(d)}
A(d)\equiv\frac{\Delta\Phi_a(d)}{\Phi_a}
\simeq\frac{\beta}{\langle \dot{N}\rangle\langle \Delta t\rangle}
\left(\frac{R_\oplus}{d}\right)^2\ ,
\end{equation}
where we approximated $\dot{m}_{\rm AQN}\simeq\langle \Delta m_{\rm AQN}\rangle/\langle\Delta t\rangle$. Using $\langle \dot{N}\rangle\langle\Delta t\rangle\sim30$ (see Table \ref{tab:summary of statistical fluctuations}), and for $z_{\rm cut}\sim d$, corresponding to $\beta\sim1$, the typical amplification becomes significant if $d\lesssim 0.1 R_\oplus$.
The time duration $\tau$ of a local flash as a function of amplification $A$ is given by:
\begin{equation}
\label{eq:tau}
\tau
\simeq\frac{2d}{v_{\rm AQN}}
\simeq\left(\frac{\langle\Delta t\rangle}{\langle\dot{N}\rangle}\right)^{1/2}
A^{-1/2}\ ,
\end{equation}
where we assumed $v_{\rm AQN}\simeq2R_\oplus/\langle\Delta t\rangle$ and $\beta\sim1$ for simplicity. Table \ref{tab:local flashes estimation} shows various values for the time duration $\tau$ as a function of amplification factor $A$. We see that a standard detection signal without amplification ($A\sim1$) lasts for 10 seconds, while a strongly enhanced signal amplified by $A\sim10^4$ flashes for 0.1 second. However, it is a very rare event as it happens only once in every 5 years. More realistic amplification factors are somewhere between these two limiting cases as presented in Table \ref{tab:local flashes estimation}.
\exclude{
Thus, our conclusion is that any conventional axion search instrument may benefit from the amplification of local flashes if it is able to cover the relevant bandwidth for the typical flash duration. For instance, consider an axion with mass $m_a\simeq 10^{-4}{\rm eV}$ corresponding to the frequency $f=\frac{m_a}{2\pi}\simeq 20 ~{\rm GHz}$. The cavity factor is normally $Q_c\simeq 10^5$, while the axion factor $Q_a\simeq 10^6$
such that $Q_a^{-1}$ corresponds to the axion coherence time while $Q_c^{-1}$ counts the cavity storage time.
The bandwidth for conventional cavities is of order $\Delta f\simeq Q_a^{-1} f\sim 20~{\rm kHz}$. Therefore, the typical axion coherence time is $ (\Delta f)^{-1}\sim 10^{-4}{\rm s}$.
These estimates suggest that a typical cavity haloscope is capable of detecting such local flash which lasts $0.3$s with amplification $A\sim 10^3$ according to Table \ref{tab:local flashes estimation}. A required time-length of collecting the signal can be achieved with the adequate optimization of the instrument.
}
Let us now estimate the event rate of a local flash for a given amplification $A$.
The probability of observing an AQN for $z\leq d$ is given by:
\begin{equation}
\label{eq:Prob(z_min=d)}
{\rm Prob}(z \leq d)
\simeq\left(\frac{d}{R_\oplus}\right)^2
\simeq\frac{A^{-1}}{\langle \dot{N}\rangle\langle \Delta t\rangle}, \ .
\end{equation}
where we use Eq. (\ref{eq:A(d)}) to express $d$ in terms of $A$.
The event rate can be expressed in terms of amplification parameter $A$,
\begin{equation}
\label{eq:Event rate}
\begin{aligned}
{\rm Event~rate}
&=\dot{N}\frac{\tau}{\Delta t}
\cdot{\rm Prob}(z \leq d) \\
&\simeq\frac{A^{-3/2}}{\sqrt{\langle\dot{N}\rangle\langle\Delta t\rangle^3}},\ .
\end{aligned}
\end{equation}
where averages $\langle\dot{N}\rangle$ and $\Delta t$ have been numerically computed for different size distribution models, and can be found in Table \ref{tab:summary of statistical fluctuations}.
Table \ref{tab:local flashes estimation} shows the event rate calculated for a few values of the amplification factor $A$. Specifically, we conclude there is about one event every two days for local flash amplified by $\sim10^2$ if the detector has a time resolution of 1 second.
In conclusion, the amplification by local flashes is a unique feature of the AQN-induced axions. Moreover, these relativistic axions, with $v_a\sim 0.6c$, have very different spectral properties in comparison to the conventional DM candidates when $v_a\sim 10^{-3}c$. Therefore, even with an AQN-induced density (\ref{eq:rho_a intro}) smaller than galactic DM axions the amplification could be sufficiently large because the AQN-induced flux could produce stronger signal when observables of the experiments is proportional to the axion velocity, see Eq. \eqref{H} in Appendix \ref{broadband} and corresponding discussion in the Introduction. In addition, studying the time correlation of the local flashes can effectively distinguish the true signals from background noise as they are uncorrelated, while such approach does not apply to the conventional axion experiment and most cold DM searches because the distribution of cold DM halo is always uncorrelated and featureless in time. We refer the detailed study of correlation and broadband detection to Ref. \cite{Budker:2019zka}.
\begin{table}
\captionsetup{justification=raggedright}
\caption{Estimation of local flashes: the time duration, and the corresponding event rate as a function of amplification factor $A$. Here we choose $\beta=1$, $\langle\dot{N}\rangle=0.672\rm\,s^{-1}$ and $\langle\Delta t\rangle=40\rm\, s$.}
\centering
\begin{tabular}{ccc}
\hline \hline
$A$ & Time Span & Event rate \\
\hline
1 & 10 s & 0.3 $\rm min^{-1}$ \\
$10$ & 3 s & 0.5 $\rm hr^{-1}$ \\
$10^2$ & 1 s & 0.4 $\rm day^{-1}$ \\
$10^3$ & 0.3 s & 5 $\rm yr^{-1}$ \\
$10^4$ & 0.1 s & 0.2 $\rm yr^{-1}$ \\
\hline
\end{tabular}
\label{tab:local flashes estimation}
\end{table}
\subsection{Gravitational lensing}
\label{subsec:gravitational lensing}
This subsection is partly motivated by Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} where it has been claimed that the Sun or Jupiter can focus the flux of DM particles with speed $\sim(10^{-3}-10^{-1})c$ by an amplification factor up to $\sim10^6$. The claim was based on two key assumptions:
\begin{enumerate}
\item The deflection angle $\gamma$ due to gravitational focusing is small, namely $\gamma\ll1$;
\item The DM flux is colinear.
\end{enumerate}
Assumption 1 requires that the bending angle caused by stars and planets is always very small. Assumption 2 strongly enforces the gravitational focusing as a result of (assumed) high level of coherency of the DM flux when all particles move in a highly colinear way with the same direction. To strengthen the focusing effect, Ref. \cite{Patla:2013vza} additionally assumed the DM particles are non-interacting and can pass through opaque objects such as the Sun and planets, because a transparent Sun has a shorter focal length by one order of magnitude compared to the case of opaque Sun (i.e. for interacting particles) and this results in a correspondingly stronger gravitational focusing correspondingly.
Under these assumptions, calculations are greatly simplified and can be carried out analytically.
It is important to point out that the two assumptions are not well justified in SHM due to the misalignment of the ecliptic plane in the Milky Way. Therefore to satisfy the requirements of perfect focusing alignment and high coherency in propagating direction, Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} considered special streams of slow-moving particles originating from distant point-like sources, such as stars, distant galaxies, and cluster of galaxies, etc..
One can imagine that these two assumptions also apply to the case of AQN-induced axions as conjectured in the work \cite{Fischer:2018niu}: Assuming the existence of special emitting source of AQNs for ideal gravitational focusing, one could suspect that the stream of AQNs gains enhancement (up to $\sim10^6$) by gravitational lensing\footnote{In Ref. \cite{Fischer:2018niu}, it is discussed the amplification factor can even go up to $\sim10^{11}$ given the Sun as gravitational lens for source at a very specific distance.}, and consequently the flux of emitted axions is enhanced by the same amplification factor when the AQN stream impacts the Earth. However, the existence of such special emitting source is not of interest in the present work because a SHM is already assumed and implemented. Further investigations carried out in this work shows that in SHM the two assumptions are invalid for AQNs, and therefore the AQN-induced axions. Similarly, the two assumptions are also strongly violated for conventional WIMPs. Therefore, our conclusion is that amplification by gravitational focusing generally do not apply to DM particles in SHM, but the ideas advocated in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} are not excluded because nonconventional streams of DM were considered.
In what follows, we clarify the reasons that the two assumptions are violated for SHM. First, assumption 1 is invalid because of the inclination of the ecliptic plane relative to the DM wind: there is a $60\degree$ angle between the ecliptic plane and the Galactic plane, facing the DM wind direction. Consequently, for DM particles to be gravitationally focused to Earth, the deflection angle will have to be of the same order of magnitude. This is illustrated on Fig. \ref{fig:assumption1}. Such large deflection angle are impossible to obtain with lenses like normal stars and planets for the large majority of incoming DM particles, consequently, calculation in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} is no longer applied as the gravitational lensing is strong. Next, assumption 2 is violated because AQNs (and in fact most DM candidates) have a large velocity dispersion $\sim110\,\mathrm{km}\,\mathrm{s}^{-1}$ that is comparable to their mean galactic velocity. This large velocity dispersion is requirement of the Virial theorem. Thus, the enhancement of DM flux by gravitational lensing as advocated in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} has a very narrow window for applicability, even for conventional DM candidates like WIMPs, for which both assumptions becomes invalid in the present framework of SHM.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=0.8\linewidth]{assumption1}
\caption{Realistic gravitational deflection of AQN flux. AQN flux is deflected by an angle $\gamma$ due to the gravity of the Sun (or its planet). Since the angle between the ecliptic plane and the galactic equator is always fixed at $60\degree$. The deflection angle $\gamma$ has to be large $\sim60\degree$ in order to make gravitational lensing possible.}
\label{fig:assumption1}
\end{figure}
The above arguments have been verified by analytical and numerical calculations, and it is discussed in Appendix \ref{app:detailed calculation of strong gravitational lensing}. Fig. \ref{fig:A_max} shows the resulting enhancement factor $A$ caused by gravitational lensing, where $A$ is plotted as a function of the velocity spectrum of AQN flux. Noting that $A$ implicitly depends on $\theta$ and $\sigma$: the angle between its incident direction and the plane of the Solar system, and the dispersion in velocity respectively.
In the realistic case $(\theta=60\degree,\sigma=110\,\mathrm{km}\,\mathrm{s}^{-1})$ such that both assumptions are violated, the amplification factor never exceeds $10^{-2}$, so the actual enhancement by gravitational lensing is small and can be neglected in the current study. In addition, we observe the existence of a resonance in the parameter space, namely when $\log_{10}(v/c)\sim -2.7$, the amplification is maximized. This is because the deflection angle is very large and only velocity within a specific range will be deflected within such narrow window $\gamma\simeq60\degree$.
Note that if we considered an ideal case when the assumption 1 is externally enforced $(\theta=0\degree,\sigma=110\,\mathrm{km}\,\mathrm{s}^{-1})$ we indeed see some amplification. This happens because the DM wind-solar system alignment is perfect and the amplification indeed becomes much stronger (and grows as a power law of $v$), see orange line on Fig. \ref{fig:A_max}. Furthermore, if assumption 2 is also enforced
$(\theta=0\degree,\sigma=1\,\mathrm{km}\,\mathrm{s}^{-1})$ which is precisely the case considered in \cite{Patla:2013vza,Bertolucci:2017vgz}, the AQN flux is perfectly aligned and highly colinear, see green line on Fig. \ref{fig:A_max}. In this case we indeed find a strong amplification $\sim 10^4$, in agreement with computations of \cite{Patla:2013vza,Bertolucci:2017vgz}. However, it is very hard to imagine how such conditions can be justified, and how a colinear stream of DM could be formed in realistic (not ideal) galactic environment at least in SHM.
The results of the present subsection \ref{subsec:gravitational lensing} were discussed in \cite{Bertolucci:2019jsd}, referring to the amplification $\sim 10^{11}$ mentioned in \cite{Fischer:2018niu}. This factor is well above the enhancement $10^4$ derived in the present work. There is no contradiction: \cite{Fischer:2018niu} did not derive the factor $10^{11}$, but it was mentioned as a possible strong enhancement motivated by the analogy with monochromatic coherent electromagnetic emission with $\lambda\simeq 1\,\mu\rm m$ from a distance source.
This case of a monochromatic EM radiation emitted by a distance source has drastically different physics from the smooth distribution of ordinary DM assumed in present work.
Furthermore, the authors of \cite{Bertolucci:2017vgz,Bertolucci:2019jsd} specifically distinguish ``invisible DM" from ``ordinary DM", the latter being the subject of the present work. This difference is reflected in the assumptions 1 and 2 formulated above.
To conclude this subsection: we do not expect any substantial amplifications due to the gravitational lensing, at least within SHM. It is quite possible that future studies accounting for a number of other effects which are ignored in the present SHM (such as accounting for planets) may modify our conclusion. However, this topic is well beyond of the present studies.
\exclude{
This subsection is partly motivated by Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} where it has been claimed that the Sun or Jupiter can focus the flux of DM particles with speed $\sim(10^{-3}-10^{-1})c$ by an amplification factor up to $\sim10^6$. The claim was based on three key assumptions:
\begin{enumerate}
\item The deflection angle $\gamma$ due to gravitational focusing is small, namely $\gamma\ll1$;
\item The DM flux has no dispersion in velocity;
\item The DM particles are non-interacting and can pass through opaque objects such as the Sun and planets.
\end{enumerate}
Assumption 1 requires that the bending angle caused by stars and planets is always very small. Assumption 2 strongly enforces the gravitational focusing as a result of (assumed) high level of coherency of the DM flux when all particles move in a highly colinear way with the same direction. Similar reason applied to assumption 3, a transparent Sun has a shorter focal length by one order of magnitude compared to the case of opaque Sun (i.e. for interacting particles), and this results in a correspondingly stronger gravitational focusing correspondingly. Under these assumptions, calculations are greatly simplified and can be carried out analytically.
One can imagine that these three assumptions also apply to the case of AQN-induced axions as conjectured in the work \cite{Fischer:2018niu}: Galactic AQNs move with the typical speed $220\,\mathrm{km}\,\mathrm{s}^{-1}\sim10^{-3}c$. Hence, one could suspect that the stream of AQNs gains enhancement (up to $\sim10^6$) by gravitational lensing, and consequently the flux of emitted axions is enhanced by the same amplification factor when the AQN stream impacts the Earth. However, further investigations carried out in this work shows that the three assumptions are invalid for AQNs, and
therefore the AQN-induced axions. The
first two assumptions are also strongly violated for conventional WIMP's particles. Therefore, our conclusion is that the ideas advocated in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} generally do not apply to DM particles.
First, assumption 1 is invalid because of the inclination of the ecliptic plane relative to the DM wind: there is a $60\degree$ angle between the ecliptic plane and the Galactic plane, facing the DM wind direction. Consequently, for DM particles to be gravitationally focused to Earth, the deflection angle will have to be of the same order of magnitude. This is illustrated on Fig. \ref{fig:assumption1}. Such large deflection angle are impossible to obtain with lenses like normal stars and planets for the large majority of incoming DM particles, consequently, calculation in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} is no longer applied as the gravitational lensing is strong. Next, assumption 2 is violated because AQNs (and in fact most DM candidates) have a large velocity dispersion $\sim110\,\mathrm{km}\,\mathrm{s}^{-1}$ that is comparable to their mean galactic velocity. This large velocity dispersion is requirement of the Virial theorem. Finally, assumption 3 is invalid in the context of AQNs because they are strongly interacting with normal matter. This leads to an additional suppression to the effect of gravitational lensing even if such focusing is available. Thus, the enhancement of DM flux by gravitational lensing as advocated in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} has a very narrow window for applicability, even for conventional DM candidates like WIMPs, for which assumptions 1 and 2 are also incorrect.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=0.8\linewidth]{assumption1}
\caption{Realistic gravitational deflection of AQN flux. AQN flux is deflected by an angle $\gamma$ due to the gravity of the Sun (or its planet). Since the angle between the ecliptic plane and the galactic equator is always fixed at $60\degree$. The deflection angle $\gamma$ has to be large $\sim60\degree$ in order to make gravitational lensing possible.}
\label{fig:assumption1}
\end{figure}
The above arguments have been verified by analytical and numerical calculations, and it is discussed in Appendix \ref{app:detailed calculation of strong gravitational lensing}. Fig. \ref{fig:A_max} shows the resulting enhancement factor $A$ caused by gravitational lensing, where $A$ is plotted as a function of the velocity spectrum of AQN flux. Noting that $A$ implicitly depends on $\theta$ and $\sigma$: the angle between its incident direction and the plane of the Solar system, and the dispersion in velocity respectively.
In the realistic case $(\theta=60\degree,\sigma=110\,\mathrm{km}\,\mathrm{s}^{-1})$ such that all three assumptions are violated, the amplification factor never exceeds $10^{-2}$, so the actual enhancement by gravitational lensing is small and can be neglected in the current study. In addition, we observe the existence of a resonance in the parameter space, namely when $\log_{10}(v/c)\sim -2.7$, the amplification is maximized. This is because the deflection angle is very large and only velocity within a specific range will be deflected within such narrow window $\gamma\simeq60\degree$.
Note that if we considered an ideal case when the assumption 1 is externally enforced $(\theta=0\degree,\sigma=110\,\mathrm{km}\,\mathrm{s}^{-1})$ we indeed see some amplification. This happens because the DM wind-solar system alignment is perfect and the amplification indeed becomes much stronger (and grows as a power law of $v$), see orange line on Fig. \ref{fig:A_max}. Furthermore, if assumption 2 is also enforced
$(\theta=0\degree,\sigma=1\,\mathrm{km}\,\mathrm{s}^{-1})$ which is precisely the case considered in \cite{Patla:2013vza,Bertolucci:2017vgz}, the AQN flux is perfectly aligned and highly coherent in velocity, see green line on Fig. \ref{fig:A_max}. In this case we indeed find a strong amplification $\sim 10^4$, in agreement with computations of \cite{Patla:2013vza,Bertolucci:2017vgz}. However, it is very hard to imagine how such conditions can be justified, and how a perfectly coherent stream of DM could be formed in realistic (not ideal) galactic environment.
}
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=\linewidth]{A_max}
\caption{Amplification factor $A(v)$ as a function of AQN velocity spectra. The amplification factor has implicit dependence on $\theta$ and $\sigma$: the angle between its incident direction and the plane of the solar system, and the dispersion in velocity respectively. The mean galactic speed is chosen to be $220\,\mathrm{km}\,\mathrm{s}^{-1}$ with different combination of $(\theta,\sigma)$: (1) $(60\degree,110\,\mathrm{km}\,\mathrm{s}^{-1})$ in blue, (2) $(0\degree,110\,\mathrm{km}\,\mathrm{s}^{-1})$ in orange, and (3) $(0\degree,1\,\mathrm{km}\,\mathrm{s}^{-1})$ in green. The amplification gradually reaches a consistent value estimated in Refs. \cite{Patla:2013vza,Bertolucci:2017vgz} in more idealized conditions.}
\label{fig:A_max}
\end{figure}
\section{Annihilation modeling}
\label{sec:annihilation modeling}
In this section we present all the equations that will be used in our simulations and calculations of the axion-density distribution around the Earth and the flux spectrum of axions passing through the interior of the Earth.
\subsection{Annihilation of AQNs impacting the Earth}
\label{subsec:annihilation of AQNs impacting the Earth}
The equations of motion describing the AQNs impacting the Earth are derived in Ref. \cite{Lawson:2019cvy}. We give a brief overview here.
The energy loss due to the collision of AQNs with the Earth can be expressed as follows \cite{DeRujula:1984axn}
\begin{equation}
\label{eq:dE ds}
\frac{\mathrm{d} E}{\mathrm{d} s}=\frac{1}{v}\frac{\mathrm{d} E}{\mathrm{d} t}=-\sigma\rho v^2\ ,
\end{equation}
where $E=mv^2/2$ is the kinetic energy, $s$ is the path length, $\rho$ is the density of the local environment, $v$ is the AQN velocity, and $\sigma$ is the effective cross section of the AQN. In case of AQN annihilation within the Earth, the surrounding material is very rigid. Therefore, the cross section is the geometrical cross section,
\begin{equation}
\label{eq:sigma}
\sigma\simeq\pi R^2\ ,
\end{equation}
where $R$ is the radius of the AQN. Equation (\ref{eq:sigma}) implies that all nuclei which are on the AQN's path will get annihilated while the AQN traverses the Earth. We refer readers to Ref. \cite{Lawson:2019cvy} for technical details and justification of this argument.
To proceed, following from the definition, we can express the time derivative of $E$ in the form
\begin{equation}
\label{eq:dE dt}
\frac{\mathrm{d} E}{\mathrm{d} t}
=mv\frac{\mathrm{d} v}{\mathrm{d} t}+\frac{1}{2}v^2\frac{\mathrm{d} m}{\mathrm{d} t}
=mv\frac{\mathrm{d} v}{\mathrm{d} t}-\frac{1}{2}\sigma\rho v^3\ ,
\end{equation}
where in the last step, we utilize the conventional rate of mass loss \eqref{eq:dm_AQN}. Comparing Eqs. \eqref{eq:dE ds} and \eqref{eq:dE dt}, we conclude that the mass loss acts like a friction term in the equation of motion
\begin{equation}
\label{eq:m dv dt}
m\frac{\mathrm{d} v}{\mathrm{d} t}
=-\frac{1}{2}\sigma\rho v^2
\simeq-\frac{1}{2}\pi R^2\rho v^2\ .
\end{equation}
The complete dynamical equations of motion in vector form are:
\begin{subequations}
\label{eq:dr dt and dv dt}
\begin{equation}
\label{eq:dr dt}
\frac{\mathrm{d} \mathbf{r}}{\mathrm{d} t}=\mathbf{v}\ ;
\quad r=|\mathbf{r}|\ ;
\quad v=|\mathbf{v}|\ ;
\end{equation}
\begin{equation}
\label{eq:3.1 AQN DEs_v}
\frac{\mathrm{d} \mathbf{v}}{\mathrm{d} t}
=-\frac{1}{2}\pi R^2\frac{\rho(r)}{m}v^2\mathbf{\hat{v}}
-\frac{GM_{\rm eff}(r)}{r^2}\mathbf{\hat{r}}\ ,
\end{equation}
\end{subequations}
where $G$ is the gravitational constant, and we define
\begin{subequations}
\label{eq:R and M_eff(r)}
\begin{equation}
\label{eq:R}
R=\left(\frac{3m}{4\pi\rho_\mathrm{n}}\right)^{1/3}
\simeq1.045\times10^{-13}B^{1/3}\,{\rm cm}\ ,
\end{equation}
\begin{equation}
\label{eq:M_eff(r)}
\begin{aligned}
&M_{\rm eff}(r)
=\sum_{i=1}^{j}\frac{4\pi}{3}\rho_i(r_i^3-r_{i-1}^3)
+\frac{4\pi}{3}\rho_{j+1}(r^3-r_j^3), \\
&(r_j\leq r< r_{j+1},~~{\rm with~} j=1, 2... 5~
{\rm and~} r_0\equiv0)\ .
\end{aligned}
\end{equation}
\end{subequations}
In Eq. \eqref{eq:R}, we adopt the parameters in \cite{Raza:2018gpb,Lawson:2019cvy}, in which $\rho_\mathrm{n}=3.5\times10^{17}$\,kg\,m$^{-3}$ is the nuclear density and $m=m_p B$ is the AQN mass. In Eq. \eqref{eq:M_eff(r)}, we approximate the local environmental density $\rho(r)$ as discrete step functions due to the discontinuous geological structure of the Earth. The labels $i,j=1, ..., 5$ correspond to layers, summarized in Table \ref{tab:labels for each layers}. The parameter $r_i$ is the radius of the start of the layer as measured from the center of the Earth. $\rho_i$ is the average density of the corresponding shell. We make the approximation that the density within each layer is uniform, and therefore take the mean value from density at the top/bottom of the shell as the local density. The data in Table \ref{tab:labels for each layers} is taken from Ref. \cite{Anderson:1989}.
\begin{table}[h]
\captionsetup{justification=raggedright}
\caption{Our model for the density structure of the Earth. We consider the Earth to be made from 5 distinct layers, each of which we model as a constant-density shell, with density $\rho_i$. We show the outer radius for each shell, $r_i$, as well as the thickness of the shell.}
\centering
\begin{tabular}{ccccc}
\hline\hline
Label & Layer & Thickness [km] & $r_i$ [km] & $\rho_i$ [$\rm g\,cm^{-3}$] \\
\hline
1 & Inner core &1221 & 1221 & 12.95 \\
2 & Outer core & 2259 &3480 & 11.05 \\
3 & Lower mantle & 2171 &5651 & ~5.00 \\
4 & Upper mantle & \, 720 &6371 & ~3.90 \\
5 & Crust & \,\,~~30 & 6401
& ~2.55 \\
\hline\hline
\end{tabular}
\label{tab:labels for each layers}
\end{table}
\subsection{Axion-emission spectrum in the observer frame}
\label{subsec:axion-emission spectrum in laboratory frame}
We assume that the emission of AQN-induced axions is relativistic with velocity $v_a\sim0.6c$ and dominantly spherically symmetric in the AQN frame \cite{Fischer:2018niu,Liang:2018ecs}. In fact, spherical symmetry is well preserved even in the observer frame due to the relatively slow speed of AQNs $v_{\rm AQN}\sim 10^{-3}c\ll v_a$. To demonstrate this, we analyze the modification in the angular distribution due to the frame change.
In general, an annihilating AQN will emit axions in a frame moving with respect to an observer on Earth. We introduce the notation $\tilde{K}$ and $K$ for the rest frame of the AQN and the frame of the observer respectively. The axion-emission velocity spectrum in the AQN rest frame is calculated in Ref. \cite{Liang:2018ecs} and we refer the reader to that paper for the calculation details. The velocity spectrum in the rest frame is, by definition, the derivative of the radiated flux $\Phi_{\rm rad}(\tilde{v}_a)$:
\begin{equation}
\label{eq:rho_rest(v_a)}
\begin{aligned}
\rho_{\rm rest}(\tilde{v}_a)
&\equiv
\frac{1}{\Phi_{\rm rad}^{\rm tot}}\frac{\mathrm{d}}{\mathrm{d}\tilde{v}_a}
\Phi_{\rm rad}(\tilde{v}_a) \\
&\simeq\frac{\tilde{v}_a^3}{N(\delta)}
\left(\frac{\tilde{E}_a}{m_a}\right)^6|H_0(\tilde{p},\delta)|^2,
\end{aligned}
\end{equation}
where $\tilde{v}_a$ and $\tilde{E}_a$ are the rest frame axion velocity and energy respectively. The function $H_l(\tilde{p},\delta)$ corresponds to partial wave expansion in the approximate solutions, as derived in \cite{Liang:2018ecs}. As claimed in the beginning, annihilation of AQN is assumed to preserve spherical symmetry in the AQN rest frame, therefore only the $l=0$ mode is considered in Eq. \eqref{eq:rho_rest(v_a)}. The parameter $\delta\in (0,1)$ is a convenient factor introduced in Ref. \cite{Liang:2018ecs} as a result of approximations due to absence of simple analytic solutions of the general expressions. Tuning $\delta\in (0,1)$ leads to changes in the velocity spectrum \eqref{eq:rho_rest(v_a)} that do not exceed $\sim20\%$. The velocity spectrum is not known to better precision (see Appendix \ref{app:spectral properties in the rest frame}). The normalization factor $N(\delta)$, depending on the parameter $\delta$, is also known and presented in Appendix \ref{app:spectral properties in the rest frame}.
In the frame of the observer, an AQN is moving with a velocity $v_{\rm AQN}\lesssim10^{-3}c$. Thus, we need only to consider a non-relativistic transformation of frames, with relations as follows:
\begin{subequations}
\label{eq:frame transformation}
\begin{equation}
\label{eq:frame transformation_vp}
\mathbf{\tilde{v}}_a=\mathbf{v}_a-\mathbf{v}_{\rm AQN}\ ;
\quad\mathbf{\tilde{p}}=\mathbf{p}-m_a\mathbf{v}_{\rm AQN}\ ;
\end{equation}
\begin{equation}
\label{eq:frame transformation_v}
\tilde{v}_a
=\sqrt{v_a^2+v_{\rm AQN}^2-2\mathbf{v}_a\cdot\mathbf{v}_{\rm AQN}}
\simeq v_a+{\cal O}(\frac{v_{\rm AQN}}{v_a})\ ;
\end{equation}
\begin{equation}
\label{eq:frame transformation_p}
\tilde{p}
=\sqrt{p^2+m_a^2v_{\rm AQN}^2
-2m_a\mathbf{p}\cdot\mathbf{v}_{\rm AQN}}\ ;
\end{equation}
\begin{equation}
\label{eq:frame transformation_E}
\tilde{E}_a
=\sqrt{E_a^2
+m_a^2v_{\rm AQN}^2
-2m_a\mathbf{p}\cdot\mathbf{v}_{\rm AQN}}\ .
\end{equation}
\end{subequations}
Working in the manifold of $\mathbf{v}_a$, we know $\rho(v_a)$ is normalized within a unit 3-ball $B^3$
\begin{equation}
\label{eq:rho transform}
1
=\int_{B^3} \mathrm{d}^3\mathbf{\tilde{v}}_a
\frac{\rho_{\rm rest}(\tilde{v}_a)}{4\pi \tilde{v}_a^2}
=\int_{B^3} \mathrm{d}^3\mathbf{v}_a
\frac{\rho_{\rm rest}[\tilde{v}_a(v_a)]}{4\pi (\tilde{v}_a(v_a))^2}\ ,
\end{equation}
where in the second step, we transform our coordinate from $\tilde{v}_a$ to $v_a$ using Eqs. \eqref{eq:frame transformation}. Note that such transformation produces a small error related to a slight shift of spherical center by $\sim10^{-3}c$. However, this inconsistency is negligible comparing to the uncertainty of approximation in terms of $\delta$. Noting that the last equality in Eq. \eqref{eq:rho transform} is completely expressed in terms of $v_a$, the velocity in the frame of the observer. Therefore, we read off the emission spectrum in the frame of the observer
\begin{equation}
\label{eq:rho_obs(v_a)}
\rho_{\rm obs}(v_a)
=\int \mathrm{d}\Omega~v_a^2
\frac{\rho_{\rm rest}(\tilde{v}_a)}{4\pi \tilde{v}_a^2}\ ,
\end{equation}
where $\Omega$ is the solid angle made by $\langle\hat{\mathbf{v}}_a,\hat{\mathbf{v}}_{\rm AQN}\rangle$. From Eq. \eqref{eq:frame transformation_v}, we expand Eq. \eqref{eq:rho_obs(v_a)} as
\begin{equation}
\label{eq:rho_obs(v_a) 2}
\begin{aligned}
\rho_{\rm obs}(v_a)
&\simeq\frac{v_a^3}{N(\delta)}\left(\frac{E_a}{m_a}\right)^6
|H_0(p,\delta)|+{\cal O}(\frac{v_{\rm AQN}}{v_a}) \\
&\simeq\rho_{\rm rest}(v_a)\ ,
\end{aligned}
\end{equation}
where ${\cal O}(\frac{v_{\rm AQN}}{v_a})\sim0.1\%$, the correction is negligible (comparing to the uncertainty of $\delta$) as claimed at the beginning of this subsection.
To summarize: the emission spectrum in frame of the observer \eqref{eq:rho_obs(v_a) 2} has an identical form, up to negligible correction, to the spherically symmetric spectrum in the rest frame \eqref{eq:rho_rest(v_a)} and computed in \cite{Liang:2018ecs}. This is expressed in terms $H_0(p,\delta)$ given in Appendix \ref{app:spectral properties in the rest frame}. One important fact to emphasize is, although spherical symmetry is well preserved in velocity spectrum of axion emission, the symmetry does not extend to the flux profile on Earth's surface due to asymmetric effects such as the daily modulation (see Sec. \ref{subsec:daily modulation}). In the next subsection, we introduce azimuthally symmetric function $P_a(\theta)$ to account for such effect.
\subsection{The axion flux density on Earth's surface}
\label{subsec:the axion flux density on Earth's surface}
The trajectory of an axion can be approximated as free motion because the gravity of the Earth is too weak to modify the relativistic axions: $v_a\sim 0.6c\gg v_{\rm esc}=11\,\mathrm{km}\,\mathrm{s}^{-1}$. The axion flux density on the surface of Earth is
\begin{equation}
\label{eq:Phi_a(theta)}
\Phi_a(\theta)
=\frac{\langle v_a\rangle}{c}\langle\dot{N}\rangle\langle N_a\rangle
\frac{P_a(\theta)}{2\pi R_\oplus^2}\ ,
\end{equation}
where $\langle v_a\rangle\simeq0.6c$ is the average speed of emitted axion flux (see Appendix \ref{app:spectral properties in the rest frame} for numerical estimation), $\langle \dot{N}\rangle$ is the total hit rate of AQNs to surface of Earth, $\langle N_a\rangle$ is the total number of axions emitted per AQN, and $P_a(\theta)$ is the azimuthal distribution of the axion flux due to daily modulation (see Sec. \ref{subsec:daily modulation}). The first quantity is already estimated in \cite{Lawson:2019cvy}:
\begin{equation}
\label{eq:__dot(N)__}
\langle\dot{N}\rangle
=0.672 {\rm\, s}^{-1}
\left(\frac{\mu}{220\,\mathrm{km}\,\mathrm{s}^{-1}}\right)
\left(\frac{10^{25}}{\langle B\rangle}\right)\ .
\end{equation}
The second quantity is proportional to the average mass loss per AQN $\langle \Delta m_{\rm AQN}\rangle$:
\begin{equation}
\label{eq:__N_a__}
\langle N_a\rangle
\simeq\frac{1}{3}\frac{\langle\Delta m_{\rm AQN}\rangle\,c^2}{\langle E_a\rangle}
\simeq\frac{\langle\Delta m_{\rm AQN}\rangle\,c^2}{4m_a}\ ,
\end{equation}
where $\langle E_a\rangle\simeq1.3m_a c^2$ is the average energy of axion emitted given by the spectrum \eqref{eq:rho_obs(v_a) 2}, also see Ref. \cite{Liang:2018ecs}. The last quantity assumes an azimuthal symmetry of system and is defined by the normalization condition:
\begin{equation}
\label{eq:P_a}
1=\int_0^\pi\mathrm{d}\theta\sin\theta\cdot P_a(\theta)\ .
\end{equation}
Lastly, the energy flux on Earth's surface is
\begin{equation}
\label{eq:E_a Phi_a(theta)}
\langle E_a\rangle\Phi_a(\theta)
=\frac{\langle v_a\rangle\langle\dot{N}\rangle\langle \Delta m_{\rm AQN}\rangle\,c}{6\pi R_\oplus^2}P_a(\theta)\,.
\end{equation}
Note that both the energy flux and energy density of the AQN-induced axions is independent of axion mass $m_a$, as the $m_a$ dependence in $\langle E_a\rangle$ and $\langle N_a\rangle$ cancels. This is a distinct feature comparing to conventional galactic axions which are $m_a$-sensitive.
\section{algorithm and simulation}
\label{sec:algorithm and simulation}
\subsection{Simulating initial conditions of AQNs for the heat emission profile}
\label{subsec:simulating initial conditions of AQNs for the heat emission profile}
The flux of relativistic axions is emitted instantaneously once an AQN looses mass through baryonic annihilation with matter on Earth. As shown in Fig. \ref{fig:FluxCoord}, to simulate the trajectories of AQNs through Earth we use the \textit{flux} distribution function of AQNs in the vicinity of Earth with wind coming at fixed direction \cite{Lawson:2019cvy}:
\begin{equation}
\label{eq:d dot(N) dv}
\begin{aligned}
\frac{\mathrm{d}}{\mathrm{d} v}\dot{N}
&=C\int_0^{\pi}\mathrm{d}\theta\int_{\frac{\pi}{2}}^\pi\mathrm{d}\psi
\int_0^{2\pi}\mathrm{d}\varphi\, v^3 e^{-\frac{v^2}{2\sigma^2}}\sin\theta\sin\psi\cos\psi \\
&\quad\times\exp\left[
-\frac{v\mu}{\sigma^2}(\cos\psi\cos\theta-\sin\psi\cos\varphi\sin\theta)
\right]\ ,
\end{aligned}
\end{equation}
where $C$ is a normalization constant, $\mu$ is the mean speed of AQN wind as defined in \eqref{eq:mu(t)}, the notation of angles ($\theta$, $\psi$, and $\varphi$) is presented in Fig. \ref{fig:FluxCoord}.
To generate AQN initial conditions, we pick a point on the Earth's surface determined by the flux distribution function - the integrand of \eqref{eq:d dot(N) dv}. We sample initial conditions $v$, $\theta$, $\psi$ and $\varphi$ from the function defined on a 4D space of $v$, $\theta$, $\psi$ and $\varphi$. The function has no dependence on $\phi$ due to our approximation of the Earth as a sphere, so we set it to 0 for our simulation. We remove AQNs with initial velocities pointing away from the Earth as these correspond to AQNs that would have already experienced an Earth interaction. Following this sampling scheme, we generate $2\times10^5$ AQNs and compute $q(r,\theta)$, the heat emission profile of axions at a given location within the Earth $(r,\theta)$, subject to the following normalization condition
\begin{equation}
\label{eq:q(r,theta)}
\langle \Delta m_{\rm AQN}\rangle
=\int_0^{R_{\oplus}}dr\int_0^\pi d\theta~q(r,\theta)\ ,
\end{equation}
$\theta$ is the angle between $\mathbf{r}$ and the (opposite-direction) galactic wind $\boldsymbol{\mu}$, see Fig. \ref{fig:FluxCoord}. Note that the normalization condition of $q(r,\theta)$ is not defined in a standard way where the solid angle term $\sin\theta$ is implicitly absorbed into $q(r,\theta)$ for simplicity.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\captionsetup{justification=raggedright}
\includegraphics[width=0.7\linewidth]{FluxCoord}
\caption{Coordinate system used in flux distribution of the AQN wind.}
\label{fig:FluxCoord}
\end{figure}
We also present a few AQN trajectories in Fig. \ref{fig:AQN trajectories}. In the plot the AQNs are seen to be entering the Earth from one point on the Earth's surface for plotting purposes. However, the initial entering velocities of the AQNs, and their positions on the Earth's surface are determined by the flux distribution function and have been accounted for in our simulations. Their trajectories are determined by Eqs. \eqref{eq:dr dt and dv dt}. As expected, the vast majority of AQNs penetrate and escape from the Earth in linear motions due to the weakness of gravitation compared to the kinetic energy of AQNs ($v_{\rm esc}/v_{\rm AQN}\sim0.1$). We also present a few trajectories of trapped AQNs (up to negligible portion) for illustrative purpose.
\begin{figure}
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=0.7\linewidth]{AQN_trajectories}
\caption{Some sample trajectories of AQNs (shown here to emanate from a single point on the Earth's surface for aesthetic purposes). The trajectories that have a star symbol at the end escape, while those that end in dots have been trapped. Most AQNs pass through the Earth and escape, whilst those that get trapped either never exit the Earth after entering, or leave the Earth and circle back into the Earth (or circle a few times, losing mass and velocity each time as they go through the Earth) and annihilate inside. The fraction of AQNs that are captured, and end up annihilating inside the Earth is dependent on the model $(\alpha,B_{\rm min})$, however the vast majority of AQNs escape.}
\label{fig:AQN trajectories}
\end{figure}
\subsection{Computations of the surface axion flux density}
\label{subsec:computations of the surface axion flux density}
As shown in Eq. \eqref{eq:E_a Phi_a(theta)} the magnitude of axion flux on the surface of Earth is determined by the mass loss $\langle m_{\rm AQN}\rangle$ simulated in the preceding subsection. However, the azimuthal component is directly related to $P_a(\theta)$, the surface probability of finding an axion at a given azimuthal angle $\theta$, given by Eq. \eqref{eq:P_a}. To obtain $P_a(\theta)$, we use Monte Carlo simulations based on the heat profile $q(r,\theta)$. First, it is clear that the number of axions to simulate at a given point at position $(r,\theta)$ is proportional to the rate of axion production [i.e. the heat emission profile function $q(r,\theta)$]. Therefore, we sample axion initial conditions from the distribution within the integral
\begin{equation}
\label{eq:P_a(theta)}
\begin{aligned}
P_a(\theta)
\sim\langle N_a\rangle
\propto\int_0^{R_{\oplus}}\mathrm{d} r\int_{0}^{\pi}\mathrm{d} \theta~
\frac{q(r,\theta)}{4m_a} \ .
\end{aligned}
\end{equation}
As shown in Fig. \ref{fig:axion simulate}, we choose the initial position vector of emitted axion to be on the $y$-$z$ plane by azimuthal symmetry of $q(r,\theta)$. In addition, we know gravitation of Earth is negligible because axion has relativistic speed $v_a\sim0.6c$ and largely exceeds the escape velocity $\sim10^{-5}c$. Therefore given an emitted axion starting at $(r_0,\theta_0)$, its trajectory is simply a straight line of uniform motion
\begin{subequations}
\label{eq:r and v0, r0}
\begin{equation}
\label{eq:r(t)}
\mathbf{r}(t)
=\mathbf{v}t+\mathbf{r}_0
\equiv v_at\hat{\mathbf{v}}+r_0\hat{\mathbf{r}}_0\ ,
\end{equation}
\begin{equation}
\label{eq:v0, r0}
\hat{\mathbf{v}}
=(\sin\psi\cos\varphi,\sin\psi\sin\varphi,\cos\psi),\,
\hat{\mathbf{r}}_0
=(0,\sin\theta_0,\cos\theta_0),
\end{equation}
\end{subequations}
where the initial velocity vector is sampling as follows:
\begin{equation}
\label{eq:v_a, cos psi, varphi}
\begin{aligned}
v_a\sim\rho_{\rm obs}(v_a);~
\cos\psi\sim{\rm Unif}[-1,1];~
\varphi\sim{\rm Unif}[0,2\pi]\, .
\end{aligned}
\end{equation}
Here `Unif' stands for uniform distribution. Note that the equation of motion \eqref{eq:r and v0, r0} gives the intercept point(s) at the Earth surface $r=R_\oplus$ and hence the angle $\theta$ in the azimuthal distribution $P_a(\theta)$. Therefore solving for
\begin{equation}
\label{eq:R_oplus2}
R_\oplus^2=\mathbf{r}^2\ ,
\end{equation}
we find the angle $\theta$ on surface of the Earth:
\begin{equation}
\label{eq:R_oplus cos(theta)}
\begin{aligned}
\cos\theta
&=\frac{r_0}{R_\oplus}\cos\theta_0 \\
&\quad-\frac{r_0}{R_\oplus}\cos\psi\left[
\hat{\mathbf{v}}\cdot\hat{\mathbf{r}}_0
\pm\sqrt{(\hat{\mathbf{v}}\cdot\hat{\mathbf{r}}_0)^2
+\left(\frac{R_\oplus^2}{r^2}-1\right)}
\right]\, .
\end{aligned}
\end{equation}
Note that the solution gives two roots in Eq. \eqref{eq:R_oplus2}: one positive and one negative solution of $t$ in Eq. \eqref{eq:r and v0, r0}. By simulating sufficient numbers of axions based on initial conditions \eqref{eq:r and v0, r0} and \eqref{eq:v_a, cos psi, varphi}, we obtain the the azimuthal distribution $P_a(\theta)$.
As an additional note, the simulation is not efficient by picking out the positive-time solution only each time from the sampling array. In practice, we do not distinguish the two solutions and put both equally into statistics. In other words, we launch a pair of axions, instead of one only, with opposite initial velocity at position $(r_0,\theta_0)$ in the simulation code.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=0.7\linewidth]{Coord_axion_simulate}
\caption{Monte Carlo simulation of axion flux. The initial position is chosen on the $y$-$z$ plane (by azimuthal symmetry) drawn from heat emission profile $q(r,\theta)$. Then an axion is launched at a random 3D solid angle $(\psi,\varphi)$, and with magnitude $v_a$.}
\label{fig:axion simulate}
\end{figure}
\section{Discussion of results}
\label{sec:discussion of results}
\subsection{Heat emission profile}
\label{subsec:heat emission profile}
We first discuss the results of the simulation ($2\times10^5$ samples) for the heat-emission profiles of axions $q(r,\theta)$. In our simulations we use a number of parameters such as the AQN baryon-charge distribution (parameters $\alpha$ and $B_{\rm min}$) and flux distribution of incoming AQNs (e.g. the annual/daily modulation and solar gravitation). Surprisingly, we find that our results are quite insensitive to these parameters. Therefore, in the main body of the paper we only present the case with $(\alpha,B_{\rm min})=(2.5,3\times10^{24})$ shown in
Fig. \ref{fig:q(r,theta)_alpha25}, while leaving other cases with different parameters to Appendix \ref{app:on sensitivity of the main results to the AQN's parameters}.
From Fig. \ref{fig:q(r,theta)_alpha25}, we observe the profile is in general as like a typical collection set of linearly moving trajectories in polar coordinate. This is as expected because the gravitational force is weak compared to the kinetic energy of AQNs.
\exclude{Our next comment goes as follows.} The heat emission is greater near the upper pole $\theta=0$ with respect to the wind direction, despite of the fact that every annihilation event is assumed to be spherically symmetric. This is the cause of daily modulation explained in Sec. \ref{subsec:daily modulation}: the AQN emits more heat when it enters Earth compared to when it leaves due to a larger initial cross section.
In addition, we observe abrupt changes of heat emission at some specific distance (e.g. $r\sim0.9R_\oplus$ and $0.5R_\oplus$). One can see, from Table \ref{tab:labels for each layers}, that these jumps precisely correspond to the successive layers of the Earth interior. Whenever an AQN moves into a new layer with an abrupt change of local density, the mass loss drastically changes.
Another observation is that very few AQNs reach the core of the Earth, as the dominant portion of the AQNs propagate at the distances $r\geq0.5R_\oplus$. This is a geometrical effect that stems from the fact that
very few AQNs hit the surface with zero incident angle.
In Appendix \ref{app:on sensitivity of the main results to the AQN's parameters} we study the
sensitivity of our results to the parameters of the system.
We observe that almost all the effects discussed in the paper are insensitive to specific choices for the parameters of the model such as the baryon-charge distribution of AQN models and the velocity distribution of incoming DM flux. Numerical simulations confirm this behavior.
\begin{figure}[h]
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=\linewidth]{June1_AlexDist2_BMin3e24_Alpha25_Epsilon1_200kAQN_q_r_cos_theta}
\caption{Probability density for the heat-emission profile of axions within the Earth: $q(r,\theta)$ for $(\alpha,B_{\rm min})=(2.5,3\times10^{24})$. The coordinates are with respect to the DM wind direction at $\theta=0$. The profile is very similar to a typical collection set of linearly moving trajectories in polar coordinate because of the weakness of gravitational effect comparing to kinetic momentum. The azimuthal asymmetry corresponds to the daily modulation explained in Sec. \ref{subsec:daily modulation}. The abrupt jumps at some specific radii are due to discontinuous change of local density between successive layers of the Earth interior. $2\times10^5$ samples were used for the simulation.}
\label{fig:q(r,theta)_alpha25}
\end{figure}
\subsection{Axion flux density}
\label{subsec:axion flux density}
The key results of our simulations are summarized in Table \ref{tab:summary of some results}. The axion flux $\langle E_a\rangle\Phi_a$ is obtianed from Eq. \eqref{eq:E_a Phi_a(theta)} and the energy density $\langle\rho_a\rangle$ is the axion flux divided by $\langle v_a\rangle\simeq0.6c$. We also present the azimuthal distribution $P_a(\theta)$ as defined in Eq. \eqref{eq:P_a} for $(\alpha,B_{\rm min})=(2.5,3\times10^{24})$. Similar to the conclusion in the preceding subsection, we find that the results are not sensitive to the modeling parameters: the axion flux $\langle E_a\rangle\Phi_a$ in general constrains within $(10^{13}-10^{14})\,\rm eV\,cm^{-2}s^{-1}$ depending on the size distribution, similar result applies for the density $\langle\rho_a\rangle\sim(10^{-6}-10^{-5})\,\rm GeV\,cm^{-3}$. While the main effect of modulations and enhancements on the axion flux have been discussed in Section \ref{sec:potential enhancements}, here we want to make few additional comments on these results (we refer the reader to Appendix \ref{app:on sensitivity of the main results to the AQN's parameters} for further technical details on the sensitivity to the parameters of the system).
Regarding the annual modulation, we explored two extreme cases of mean galactic velocity $\mu$ with $\mu=V_\odot\pm V_\oplus$ [see Eq. \eqref{eq:mu(t)} and Table \ref{tab:summary of some results}]. We find the flux is modulated by ${\cal O}(10\%)$ as expected from discussion in Sec. \ref{subsec:annual modulation}. Regarding the daily modulations, the results are shown in Table \ref{tab:summary of some results} as the fluctuations $\pm$ in the last column. We find that the magnitude of daily modulation is of order ${\cal O}(10\%)$ and proportional to the ratio of average mass loss $\langle \Delta B\rangle/\langle B\rangle$, which is
consistent with our simplified estimate \eqref{eq:percetage fluctuation}.
We also studied the related effect on the azimuthal distribution $P_a(\theta)$ plotted on Fig. \ref{fig:P_a(r,theta)_alpha25}. It shows nearly linear dependence on $\cos\theta$ which is consistent
with our interpretation because the mass loss is indeed proportional to the path length $s$ and therefore to $\cos\theta$, according to Eq. \eqref{eq:dm_AQN}.
We also note there is a noticeable jump near the upside pole ($\cos\theta=1$). This is interpreted as a sharp impact caused by the initial stage of the annihilation process.
Finally, it is instructive to compare the result from Table \ref{tab:summary of some results} to the order of magnitude estimate \eqref{eq:rho_a intro} presented in Ref. \cite{Fischer:2018niu}. There is approximately two orders of magnitude deviation in numerical factor from that naive estimate. The reason for the discrepancy can be understood as follow: First, the estimate in Ref. \cite{Fischer:2018niu} assumed that $\Delta B/B\sim 1$ (i.e., most incident AQN are completely annihilated). However, our simulations show that $\Delta B/B\sim 0.1$ in most cases, see Table \ref{tab:summary of some results}. Similarly there is a numerical factor of 3/5 that is neglected in Ref. \cite{Fischer:2018niu} as only the AQNs made out of antiquarks will be annihilated underground. Finally, there is a geometrical suppression factor related to averaging over inclination angles between the AQN velocity and the surface of the Earth that was ignored in \cite{Fischer:2018niu}.
\begin{table*} [!htp
\caption{Summary of some results ($B_{\rm min}=3\times10^{24}$, $\epsilon=1$ unless specified, $10^8$ samples), the uncertainties in axion flux $\langle E_a\rangle\Phi_a$ and density $\langle \rho_a\rangle$ describe the maximum daily modulation. Note that the AQN-induced energy flux and energy density are independent of axion mass in contrast to the conventional galactic axion models, see discussion at the end of Sec. \ref{subsec:the axion flux density on Earth's surface}.}
\centering
\captionsetup{justification=raggedright}
\begin{tabular}{ccccccc}
\hline\hline
$\langle B\rangle$ &$\alpha$ &Other parameters & $\langle \Delta m_{\rm AQN}\rangle$ [kg] & ${\langle\Delta B\rangle}/{\langle B\rangle}$ & $\langle E_a\rangle\Phi_a~\rm[10^{13}\frac{eV}{cm^2s}]$
& $\langle\rho_a\rangle~\rm[10^{-6}\frac{GeV}{cm^{3}}]$ \\\hline
$8.84\times10^{24}$ &2.5 &-- & $4.96\times10^{-3}$ & $33.5\% $ & $8.12\pm0.93$ & $4.51\pm0.52$ \\
$8.84\times10^{24}$ &2.5 &$\mu=V_\odot - V_\oplus$ & $4.93\times10^{-3}$ & $33.4\% $ & $6.99\pm0.72$ & $3.88\pm0.40$ \\
$8.84\times10^{24}$ &2.5 &$\mu=V_\odot + V_\oplus$ & $5.00\times10^{-3}$ & $33.8\% $ & $9.30\pm1.17$ & $5.17\pm0.65$ \\
$8.84\times10^{24}$ &2.5 &Solar gravitation\footnote{We consider an additional $42.1\,\mathrm{km}\,\mathrm{s}^{-1}$ AQN impact velocity from AQN falling to Earth from infinity in the gravitational well of the Sun, this gives an additional velocity to the AQN that is always in the direction of travel. See Appendix \ref{app:on sensitivity of the main results to the AQN's parameters} for more details.} & $4.94\times10^{-3}$ & $33.4\% $ & $9.67\pm1.05$ & $5.37\pm0.58$ \\
$2.43\times10^{25}$ &2.0 &-- & $8.16\times10^{-3}$ & $20.1\%$ & $4.91\pm0.43$ & $2.73\pm0.24$ \\
$4.25\times10^{25}$ &(1.2, 2.5) & $B_{\rm min}=10^{23}$ & $1.04\times10^{-2}$ & $14.7\%$ & $3.60\pm0.20$ & $2.00\pm0.11$ \\
$1.05\times10^{26}$ &(1.2, 2.5) &-- & $2.48\times10^{-2}$ & $14.1\%$ & $3.46\pm0.16$ & $1.92\pm0.09$ \\\hline\hline
\end{tabular}
\label{tab:summary of some results}
\end{table*}
\begin{figure}
\centering
\captionsetup{justification=raggedright}
\includegraphics[width=\linewidth]{Pa_theta_1e8axions_BMin3e24_Alpha25_dist2}
\caption{The azimuthal distribution of axion flux on the surface of the Earth: $P_a(\theta)$ for $(\alpha,B_{\rm min})=(2.5,3\times10^{24})$. The shape of $P_a(\theta)$ is in general a linear function of $\cos\theta$. The magnitude of asymmetry is well consistent with the estimation \eqref{eq:percetage fluctuation}. The existence of such azimuthal asymmetry is the key to daily modulation. $10^8$ samples were used for the simulation.}
\label{fig:P_a(r,theta)_alpha25}
\end{figure}
\section{Conclusions and future directions}
\label{sec:conclusions and future directions}
\exclude{We investigate the axion density $\rho_a$ and the corresponding time modulations and amplifications $A(t)$ on the Earth surface in framework of the AQN model. These axions are produced when the antimatter AQNs annihilate with the rocky material in the Earth interior. The main results are presented in Table \ref{tab:summary of some results}.
Comparing to the conventional DM axions, we find the density, $\rho_a\sim10^{-6}-10^{-5}\rm\,GeV\,cm^{-3}$, is about four orders of magnitude lower than the DM density $0.3\rm\,GeV\,cm^{-3}$. Despite such suppression in density, we expect the AQN-induced signal is still comparable to the one of DM axions for experimental observables proportional to the axion velocity according to the estimate \eqref{eq:B_a ratio} and the following discussion in the Introduction. In this case, inspecting the time correlation of $A(t)$ is more efficient than improvement on the coherence time of signals as adopted in the conventional approach, see related work \cite{Budker:2019zka}, if $A(t)$ has much stronger time modulations or amplifications comparing to the cold DM halo model. Hence, we examine various potential enhancements such as annual and daily modulations, statistical fluctuation of signals, local flashes, and gravitational lensing with results summarized in Table \ref{tab:potential enhancement}. Specifically, we find daily modulations and amplification by local flashes are many orders of magnitude larger than the DM axion halo, therefore are best suited to the correlation analysis, see as follows.
In additional to the short discussion on axion search in Introduction, one can use broadband strategy \cite{Budker:2019zka} to probe the QCD axion using the daily or annual modulation computed in the present work to select some specific frequency bin where modulation is observed. The noise can be effectively removed by fitting the data to the expected modulation pattern. As the next step one can use a resonance based cavity experiment to scan a single frequency bin where modulation is observed to pinpoint the axion mass with high precision.
The most interesting result is the amplification by local flash that can be enormous $(10^2-10^4)$. This strong enhancement occurs when AQN hits the Earth close enough from the position of the axion search detector, see Table \ref{tab:local flashes estimation}. A hope is that these unique features of the AQN model can, in principle, study such shortly lasting local flashes which represent the unique feature of the AQN framework may be a very powerful tool in the axion searches by using a synchronized global network as recently suggested in \cite{Budker:2019zka}.
The results are obtained with numerical simulations when analytic calculations could not capture all realistic aspects. The effects we discussed depend weakly on the incident AQN distribution model, and this rigidity in the predictions leads to very limited freedom and flexibility for any modification of the basic results presented in Tables \ref{tab:summary of some results} and \ref{tab:local flashes estimation}.
Why should we consider the AQN model seriously? The present study shows that the model makes specific predictions that future axion direct detection experiments should be able to see. The direct observation of relativistic axions, together with the gravitationally trapped axions studied in our previous work \cite{Lawson:2019cvy}, with their very distinct density and velocity-spectral properties would be the smoking gun supporting the entire AQN framework.
From an observational cosmology angle, this model is consistent with all available cosmological, astrophysical, satellite and ground based constraints, where AQNs could leave a detectable electromagnetic signature. It provides a simple explanation to the observed relation $\Omega_{\rm DM}\sim \Omega_{\rm visible}$ and the baryon asymmetry that does not require deep fundamental changes or extensions of the standard model. The baryogenesis is replaced by ``charge separation" effect. Furthermore, it is shown that the AQNs can form and survive the very early epochs of the evolution of the Universe, such that they may serve as the DM candidates. The same AQN framework may also explain a number of other (naively unrelated) phenomena, such as the excess of galactic emission in different frequency bands; it may also offer resolutions to some other astrophysical mysteries such as ``Primordial Lithium Puzzle" \cite{Flambaum:2018ohm}, so-called ``The Solar Corona Mystery" \cite{Zhitnitsky:2017rop,Raza:2018gpb}, the DAMA/LIBRA observed annual modulation \cite{Zhitnitsky:2019tbh}, as well as the recent EDGES observations of a stronger than anticipated 21 cm absorption features \cite{Lawson:2018qkc}.
==== original text below, to be removed ====
}
The goal of the present work was to perform the Monte Carlo simulations describing the distributions of the AQN trajectories and annihilation events in the Earth's interior in order to calculate the AQN-induced axions with $\langle v_a\rangle\simeq 0.6c$.
This allowed us to compute a number of time dependent modulation and amplification effects which have been heavily used in \cite{Budker:2019zka}. Our goal was not to discuss the detection of these AQN-induced axions with a specific instrumentation, we refer to \cite{Budker:2019zka} where the detection issues were addressed.
The main results of the present work can be summarized as follow:\\
{\bf a}. We computed the axion flux, the spectrum and the angular distribution of the axions generated by antimatter AQNs crossing the Earth using Monte Carlo simulations. These axions are produced when the antimatter AQNs annihilate with the rocky material in the Earth interior. The main results are presented in Table \ref{tab:summary of some results}.
{\bf b}. We computed the time-dependent the annual and daily modulations in the axion intensity, see Table \ref{tab:potential enhancement}. Some of the predicted effects are unique to the AQN framework and constitute a decisive test of the model. The corresponding results have been heavily used in accompanying paper \cite{Budker:2019zka} where the broadband detection strategy has been proposed.
{\bf c}. We also computed the time-dependent burst like enhancement, which we coined as the ``local flash". This amplification could be enormous $(10^2-10^4)$, see Table \ref{tab:local flashes estimation}. This strong enhancement occurs when AQN hits the earth close enough from the position of the axion search detector.
This effect has been heavily used in accompanying paper \cite{Budker:2019zka}
where a powerful test to discriminate the true axion signal from a spurious background noise, has been suggested.
The effects discussed in items {\bf a-c} depend very weakly on the parameters of the model such as the nuggets size-distribution, consequently, there is little to no flexibility in the predictions presented in Tables \ref{tab:potential enhancement}, \ref{tab:local flashes estimation} and \ref{tab:summary of some results}.
Why should we consider the AQN model seriously?
From an observational cosmology angle, this model is consistent with all available cosmological, astrophysical, satellite and ground based constraints, where AQNs could leave a detectable electromagnetic signature. It provides a simple explanation for the observed relation $\Omega_{\rm DM}\sim \Omega_{\rm visible}$ and the baryon asymmetry without the need for fundamental changes or extensions of the standard model. The baryogenesis is replaced by ``charge separation" effect. It was also showed that the AQNs can form and survive the very early epochs of the evolution of the Universe, such that they may serve as the DM candidates today. The same AQN framework may also explain a number of other (naively unrelated) phenomena, such as the excess of galactic emission in different frequency bands; it may also offer resolutions to some other astrophysical mysteries such as ``Primordial Lithium Puzzle", so-called ``The Solar Corona Mystery", the DAMA/LIBRA observed annual modulation, as well as the recent EDGES observations of a stronger than anticipated 21 cm absorption features, see Introduction for references and details.
Interestingly, the results of the present work could also be used for different purposes, not directly related to the axion searches, such as analysis of the annual modulation in the AQN-induced neutrino intensity. Such a study could be a key element in explanation \cite{Zhitnitsky:2019tbh} of the 20 years old DAMA/LIBRA puzzling observation of the annual modulation.
\section*{Acknowledgments}
This work was supported in part by the National Science and Engineering Research Council of Canada.
AZ thanks Yannis Semertzidis for explaining the role of different time scales (cavity storage time, axion coherence time etc) in axion search experiments. AZ also thanks many participants of the workshop ``Axion Experiments in Germany", August 19-22, 2019 and the ``IBS Conference on Dark World", Daejeon, Korea, November 4-7, 2019 where this work has been presented, for discussions and large number of good questions. AM acknowledges support from the Horizon 2020 research and innovation programme of the European Union under the Marie Sk\l{}odowska-Curie grant agreement No. 702971. We thank the authors of ref. \cite{Bertolucci:2019jsd} for correspondence which resulted in clarification of our claims in Section \ref{subsec:gravitational lensing}.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 9,097 |
\section{Introduction}
Across many areas of combinatorial optimisation, semidefinite programming (SDP) \cite{MR1778223,anjos2011handbook}
has made it possible to derive strong lower bounds \cite{MR1778234},
as well as to obtain very good solutions using randomised rounding \cite{lau2011iterative}.
Nevertheless, there seem to be only few applications to practical scheduling, timetabling, or rostering problems.
In scheduling and timetabling problems, one encounters extensions of the mutual-exclusion constraint, which stipulates that certain pairs of tasks or events cannot be executed at the same time.
This corresponds to the graph colouring problem in graph theory, for which there are well-known semidefinite programming (SDP) relaxations.
The SDP representability of combinations of the mutual-exclusion constraint with other constraints has been an open problem.
Clearly, the work on graph colouring provides a test of infeasibility for timetabling and scheduling problems incorporating the mutual exclusion problem.
Such an infeasibility test compares a lower bound on the optimum of bounded vertex colouring of the conflict graph
against the number of periods available.
Lower bounds obtained in ignorance of the extensions, especially the bound on the number of uses of each colour,
are still perfectly valid, but generally weak.
In this paper, we set out to explore applicability of semidefinite programming in scheduling and timetabling problems, which extend graph colouring.
In educational timetabling, this corresponds to considering room sizes, room features, room stability, and pre-allocated assignments.
In transportation timetabling, these correspond to considering vehicle capacity, line-vehicle compatibility, etc.
We show that semidefinite programming relaxations of
a variety of such problems can be formulated, starting with
bounded vertex colouring of the conflict graph.
Our paper is organised as follows: Following some preliminaries, we present our relaxations in Section~\ref{sec:problems}.
In Section~\ref{sec:algo} we specialise a well-known first-order method to solving the relaxations and showcase two algorithms for rounding in the relaxations.
In Section~\ref{sec:analysis}, we analyse some properties of the relaxations and the performance of algorithms applied to them.
In Section~\ref{sec:computational}, we present results of extensive computational tests.
On conflict graphs from the International Timetabling Competition 2007, the Toronto benchmark,
as well as on random graphs, we show the relaxations often provide the best possible lower bound and make it possible to
obtain very good solutions by randomised rounding.
On ``forbidden intersections'' graphs, we show the strength and weakness of the bound.
Further avenues for research are suggested in Section~\ref{sec:conclusions}.
\section{Notation and Related Work}
\label{sec:related}
\subsection{Semidefinite Programming}
\label{sec:sdp-def}
Firstly, let us revisit the definition of semidefinite programming,
which is a popular extension of linear programming.
In linear programming (LP), the task is to optimise a linear combination $c^T x$ subject to $m$ linear constraints
$Ax = b$ subject to the element-wise restriction of variable $x$ to non-negative real numbers. Notice $c$ is an $n$-vector,
$x$ is a compatible vector variable, $b$ is an $m$-vector, and $A$ is $m \times n$ matrix.
One can state the problem also as:
\begin{align}
z = \min_{x} c^T x \s.t. \ensuremath {\mathcal A}_A(x) = b \mbox{ and } x \ge 0 \tag{P LP} \label{lp-p} \\
z = \max_{y} b^T y \s.t. \ensuremath {\mathcal A}_A^*(y) \le c \tag{D LP} \label{lp-d}
\end{align}
where linear operator $\ensuremath {\mathcal A}_A(x)$ (parametrised by matrix $A$) maps vector $x$ to a vector $A x$, and $x \ge 0$ denotes the element-wise non-negativity of $x$, $x \in (\ensuremath{\mathbbm{R}}^+)^n$.
The element-wise non-negativity of $x$ should be seen as a restriction of vector $x$ to the positive orthant,
which is a convex cone, as all linear combinations with non-negative coefficients of element-wise non-negative vectors
are element-wise non-negative vectors.
Using a variety of methods, linear programming can be solved to any fixed precision in polynomial time.
These methods work for other symmetric convex cones as well.
Semidefinite programming (SDP, \citeNP{Bellman1963,MR1315703,MR1778223,MR1778223,anjos2011handbook}) is a convex optimisation problem,
which generalises linear programming.
It replaces the vector variable with a square symmetric matrix variable and the polyhedral symmetric convex cone of
the positive orthant with the non-polyhedral symmetric convex cone of positive semidefinite matrices. The primal-dual pair in the standard form is:
\begin{align}
z_p = \min_{X \in \S^n} \scal{C}{X}
\s.t.\; \ensuremath {\mathcal A}_A(X) = b \mbox{ and } X \succeq 0 \tag{P STD} \label{std-p} \\
z_d = \max_{y \in \ensuremath{\mathbbm{R}}^m, S \in \S^n} b^T y
\s.t. \; \ensuremath {\mathcal A}_A^*(y) + S = C \mbox{ and } S \succeq 0 \label{std-d} \tag{D STD}
\end{align}
where $X$ is a primal variable in the set of $n \times n$ symmetric matrices $\S^n$, $y$ and $S$ are the corresponding dual variables,
$b$ is an $m$-vector, $C$, $A_i$ are compatible matrices, and linear operator $\ensuremath {\mathcal A}_A(X)$ (parametrised by a symmetric matrix $A$) maps a symmetric matrix $X$ to vectors in $\ensuremath{\mathbbm{R}}^m$,
wherein the $i$th element $\ensuremath {\mathcal A}_A(X)_i = \scal{A_i}{X}$.
$\ensuremath {\mathcal A}_A^*(y)$ is again the adjoint operator.
$M \succeq N$ or $M - N \succeq 0$ denotes $M - N$ is positive semidefinite.
Note that an $n \times n$ matrix, $M$, is positive semidefinite if and only if $y^T M y \ge 0$ for all $y \in \ensuremath{\mathbbm{R}}^n$.
One can also treat inequalities explicitly in the primal-dual pair:
\begin{align}
z_p = \min_{X \in \S^n} \scal{C}{X}
\s.t.\; \ensuremath {\mathcal A}_A(X) = b \mbox{ and } \ensuremath {\mathcal A}_B(X) \ge d \mbox{ and } X \succeq 0
\tag{P SDP} \label{sdp-p} \\
z_d = \max_{y \in \ensuremath{\mathbbm{R}}^m, v \in \ensuremath{\mathbbm{R}}^q, S \in \S^n} b^T y + d^T v
\s.t. \; \ensuremath {\mathcal A}_A^*(y) + \ensuremath {\mathcal A}_B^*(v) + S = C \mbox{ and } S \succeq 0 \mbox{ and } v \ge 0
\label{sdp-d} \tag{D SDP}
\end{align}
where $d$ is a $q$-vector and linear operator $\ensuremath {\mathcal A}_B(X)$ maps $n \times n$ matrices to $q$-vectors similarly to $\ensuremath {\mathcal A}_A$ above.
As all linear combinations with non-negative coefficients of positive semidefinite matrices
are positive semidefinite, $X \succeq 0$ should again be seen as a restriction to a convex cone.
\subsection{Semidefinite Programming Relaxations of Graph Colouring}
Graph colouring, also known as vertex colouring, or partition into independent sets, is the problem of:
\begin{problem}{\sc Graph Colouring}
Given an undirected graph $G = (V, E)$ with vertices $V = {1, 2, \ldots, n}$ and edges $E \subset \{ (u, v) \s.t. 1 \le u < v \le n \}$,
return a partition $P = (P_i)$ of $V$ of the smallest possible cardinality $|P|$ so that for each partition $P_i$, for no edge $(u, v) \in E$, there are both $u$ and $v$ in $P_i$.
As in any partition, $\cup_i P_i = V$ and for all $1 \le i < j \le |P|$, we have $P_i \cap P_j = \emptyset$.
\end{problem}
The partitions are known as ``colour classes'' or ``independent sets'' in graph colouring, or (assignment to) ``time periods'' in timetabling and scheduling.
The optimum, i.e., the smallest possible number $|P|$ of colour classes, is denoted the ``chromatic number'' in graph colouring
or minimum number of required time periods in timetabling,
or ``makespan'' in connection with certain mutual-exclusion problems (cf. Section \ref{sec:prob:mutualex}) in
the scheduling literature.
The decision version of graph colouring appears on Karp's original list \cite{MR0378476} of NP-Complete problems.
In polynomial time, one can obtain lower bounds on the chromatic number,
for instance using linear or semidefinite programming.
Just as there are a number of ways of formulating a lower bound on the chromatic number in linear programming,
there are a number of ways of formulating a lower bound on the chromatic number using SDP.
All are, in some sense, related to the inequality of Wilf \cite{wilf1967eigenvalues},
wherein the largest eigenvalue of an adjacency matrix of a graph incremented by one bounds the chromatic number of a graph from the above.
By considering the semi-definite programming lower bound on the largest-eigenvalue upper-bound, one obtains a parameter of a graph, sometimes known as `theta', $\theta$, \cite{Lovasz1979}, which is at least as large as the clique number and no more than the chromatic number, yet is computable in polynomial time using SDP.
The known bounds for colouring form a hierarchy \cite{1399025}:
\begin{align}
\alpha(G) \le \ensuremath {\mathcal X}'(G) \le \ensuremath {\mathcal X}(G) \le \ensuremath {\mathcal X}^+(G) \le \ensuremath {\mathcal X}^{+\bigtriangleup}(G) \le \chi(\overline G), & \mbox{ or } \hfill \\
\omega(G) \le \ensuremath {\mathcal X}'(\overline G) \le \ensuremath {\mathcal X}(\overline G) \le \ensuremath {\mathcal X}^+(\overline G) \le \ensuremath {\mathcal X}^{+\bigtriangleup}(\overline G) \le \chi(G), & \notag
\end{align}
where $\alpha$ is the size of the largest independent set,
$\omega$ is the size of the largest clique,
$\chi$ is the chromatic number,
$\ensuremath {\mathcal X}(G) = \theta(\bar G)$ is the vector chromatic number \cite{Lovasz1979,Karger1998},
$\ensuremath {\mathcal X}'(G) = \theta_{1/2}(\bar G)$ is the strict vector chromatic number \cite{Kleinberg1998},
$\ensuremath {\mathcal X}^+(G) = \theta_{2}(\bar G)$ is the strong vector chromatic number \cite{1399025}, and bar indicates complementation of a graph.
In Figure~\ref{over1}, we summarise all three formulations for all three lower bounds in the vector programming notation.
None of the formulatons has, however, been extended to bounded colouring, up to the best of our knowledge.
\begin{landscape}
\begin{figure}
\caption{An overview of known vector programming (VP) and semidefinite programming (SDP) relaxations of vertex colouring,\\
$\alpha(G)\le \ensuremath {\mathcal X}'(G) \le \ensuremath {\mathcal X}(G) \le \ensuremath {\mathcal X}^+(G) \le \chi(\overline G)$ or
$\omega(G)\le \ensuremath {\mathcal X}'(\overline G) \le \ensuremath {\mathcal X}(\overline G) \le \ensuremath {\mathcal X}^+(\overline G) \le \chi(G)$. }
\label{over1}
\begin{minipage}[t]{0.3\linewidth}\centering
Lov{\'a}sz's Bound as VP\\
\begin{align}
\ensuremath {\mathcal X}(G) = & \min t = \theta(\bar G) \label{theta-vp1} \\
\st: & \norm{v_i}_2 = 1 & \forall i \in V \notag \\
& \scal{v_i}{v_j} = - \frac{1}{t - 1} \quad \forall \{i,j\} \in E \notag
\end{align}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.3\linewidth}
\centering
Primal SDP for Lov{\'a}sz's Bound\\
\begin{align}
\ensuremath {\mathcal X}(G) = & \max \scal{J}{X} = \theta(\bar G)\label{theta-sdp1p} \\
\st: & \trace(X) = 1 \notag \\
& X_{uv} = 0 \quad \forall \{u, v\} \in E \notag \\
& X \succeq 0 \notag
\end{align}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.3\linewidth}
\centering
Dual SDP of Lov{\'a}sz's Bound\\
\begin{align}
\ensuremath {\mathcal X}(G) = & \min t = \theta(\bar G)\label{theta-sdp1d} \\
\st: & U_{uu} = 1 \quad \forall u \in V \notag \\
& U_{uv} = -\frac{1}{t-1} \quad \forall \{u, v\} \in \bar E \notag \\
& U \succeq 0, t \ge 2 \notag
\end{align}
\end{minipage}
\vskip 6mm
\begin{minipage}[t]{0.3\linewidth}\centering
Kleinberg's Bound as VP\\
\begin{align}
\ensuremath {\mathcal X}'(G) = & \min t = \theta_{1,2}(\bar G) \label{theta-vp2} \\
\st: & \norm{v_i}_2 = 1 & \forall i \in V \notag \\
& \scal{v_i}{v_j} \le - \frac{1}{t - 1} \forall \{i,j\} \in E \notag
\end{align}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.3\linewidth}
\centering
Primal SDP for Kleinberg's Bound\\
\begin{align}
\ensuremath {\mathcal X}'(G) = & \max \scal{J}{X} = \theta_{1,2}(\bar G)\label{theta-sdp2p} \\
\st: & \trace(X) = 1 \notag \\
& X_{uv} = 0 \quad \forall \{u, v\} \in E \notag \\
& X_{uv} \ge 0 \quad \forall \{u, v\} \in \bar E \notag \\
& X \succeq 0 \notag
\end{align}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.3\linewidth}
\centering
Dual SDP of Kleinberg's Bound\\
\begin{align}
\ensuremath {\mathcal X}'(G) = & \min t = \theta_{1,2}(\bar G)\label{theta-sdp2d} \\
\st: & U_{uu} = t \quad \forall u \in V \notag \\
& U_{uv} \le - \frac{1}{t - 1} \quad \forall \{u, v\} \in \bar E \notag \\
& U \succeq 0, t \ge 2 \notag
\end{align}
\end{minipage}
\vskip 6mm
\begin{minipage}[t]{0.3\linewidth}\centering
Szegedy's Bound as VP
\begin{align}
\ensuremath {\mathcal X}^+(G) = & \min t = \theta_2(\bar G)\label{theta-vp2-2} \\
\st: & \norm{v_i}_2 = 1 & \forall i \in V \notag \\
& \scal{v_i}{v_j} = - \frac{1}{t - 1} \quad \forall \{i,j\} \in E \notag \\
& \scal{v_i}{v_j} \geq - \frac{1}{t - 1} \quad \forall \{i,j\} \in \bar E \notag
\end{align}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.3\linewidth}
\centering
Primal SDP of Szegedy's Bound\\
\begin{align}
\ensuremath {\mathcal X}^+(G) = & \max \scal{J}{X} = \theta_2(\bar G) \label{theta-sdp3p} \\
\st: & \trace(X) = 1 \notag \\
& X_{uv} \le 0 \quad \forall \{u, v\} \in E \notag \\
& X \succeq 0 \notag
\end{align}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[t]{0.3\linewidth}
\centering
Dual SDP of Szegedy's Bound\\
\begin{align}
\ensuremath {\mathcal X}^+(G) = & \min t = \theta_2(\bar G)\label{theta-sdp3d} \\
\st: & U_{uu} = t \quad \forall u \in V \notag \\
& U_{uv} = - \frac{1}{t - 1} \quad \forall \{u, v\} \in \bar E \notag \\
& U_{uv} \ge - \frac{1}{t - 1} \quad \forall \{u, v\} \in E \notag \\
& U \succeq 0, t \ge 2 \notag
\end{align}
\end{minipage}
\end{figure}
\end{landscape}
There are a number of ways of deriving and thinking about the SDP relaxations.
In any case, the primal $n \times n$ matrix variable can be seen
as
\begin{align}
M_{u,v} = \begin{cases}
\; 1 & \text{ if vertex $u$ is in the same colour class as $v$ } \\
\; 0 & \text{ otherwise. }
\end{cases}
\end{align}
Notice matrix $M$ has the ``hidden block diagonal''property:
\begin{prop}
For any value of $M$, there exists a permutation matrix $P$, such that
\begin{align}
M^{bd} = P^T MP =
\left[ {\begin{aligned}
J_{c_1} \; & \; 0 \; & {} & 0 \\
0 \; & \; J_{c_2} \; & {} & 0 \\
{} & {} & \ddots & {} \\
0 \; & \; 0 \; & {} & \; J_{c_s}
\end{aligned} } \right]
\label{eqn:blockdiagonal}
\end{align}
where $J_c$ is the $c \times c$ matrix of all ones and $\sum_{i =1}^{s} c_i = n$. Such $P^T MP$ is denoted a direct sum of $J_c$.
\end{prop}
One can hence derive the semidefinite programming relaxation from:
\begin{prop}[\citeA{Dukanovic2004-patat}]
For any symmetric 0-1 matrix $M$ there exists a permutation matrix $P$ such that $P^T M P$ is the direct sum of $s$ all-ones matrices
if and only if there is a vector of all-ones on the diagonal and the rank of $M$ is $s$ and $M$ is positive semidefinite.
\end{prop}
by relaxing the rank constraint, as usual \cite{Fazel2004}.
Alternatively, one can see theta as an eigenvalue bound, where the largest eigenvalue $\lambda_{\max}(A) = \min \{ t \st tI - A \succeq 0 \}$ for an identity matrix $I$.
Perhaps most ``fundamentally'', one could see theta as a relaxation of the co-positive programming formulation
of graph colouring, recently proposed by \citeA{Bomze2010}.
A number of other derivations have been surveyed by \citeA{Knuth1994}.
\subsection{Related Applications}
Within the job-shop scheduling, SDP relaxations of the maximum cut problem (MAXCUT, \citeNP{MR1412228}) have been adapted to
scheduling workload on two machines \cite{MR1868715,MR1999701} and home-away patterns in sports scheduling \cite{MR2294048}.
\cite{Bansal2016} extended this to scheduling with weighted completion time objectives on any number of unrelated machines,
using a clever rounding technique in a lift-and-project relaxations.
They have also shown that the relaxation of \cite{MR1868715}
is in some sense weak (has 3/2 integrality gap).
We are not aware of any applications of semidefinite programming to mutual-exclusion scheduling or timetabling, excepting two abstracts of the present authors \cite{Marecek2010-patat,Marecek2012-patat}, which we build upon in this paper.
\section{Old Problems and Novel Relaxations}
\label{sec:problems}
\subsection{Mutual-Exclusion Scheduling}
\label{sec:prob:mutualex}
In one of the prototypical problems in timetabling, scheduling, and staff rostering \cite{Welsh1967,Burke2004,MR1403900},
one needs to assign $n$ unit-time events, classes, tasks, or jobs (``vertices''),
some of which must not be run, executed, or taught at the same time (``the mutual-exclusion constraint''), perhaps due to the use to some shared, renewable resource,
to $m$ rooms, processors, machines, or employees (``uses of a colour''),
so that the number of units of time required (``makespan'', ``number of colours'') is as small as possible.
It is natural to represent the elements being assigned by the elements of set $V = {1, 2, \ldots, n}$,
and to represent the mutual-exclusion constraint by a set of pairs of elements of $V$,
which are not to be assigned to disjoint time-units (``conflict graph'').
Let us now consider:
\begin{problem}{\sc $m$-Bounded Colouring}
Given an undirected graph $G = (V, E)$ with vertices $V = {1, 2, \ldots, n}$ and edges $E \subset \{ (u, v) \s.t. 1 \le u < v \le n \}$,
and an integer $m \le |V|$,
return a partition $P = (P_i)$ of $V$ of the smallest possible cardinality $|P|$ so that for each partition $P_i$, $|P_i| \le m$ and for no edge $(u, v) \in E$ there are both $u$ and $v$ in $P_i$.
\end{problem}
Terminology varies.
In the scheduling community, the problem is known as
scheduling of unit-length tasks on $m$ parallel machines with renewable resources \cite[Chapter 12]{blazewicz2007handbook},
{\sc Mutual-Exclusion Scheduling} \cite{MR1403900},
scheduling with incompatible objects \cite{leighton1979graph}, or P$m$ | res,$p_j=1$ | C$_{\max}$ in the notation of \cite{graham1979optimization}.
In discrete mathematics \cite{KRARUP19821}, some authors \cite{MR1265071} refer to the problem as {\sc Partition into Bounded Independent Sets}, while others use {\sc $m$-Bounded Colouring} \cite{MR1210106} or just Bounded Graph Colouring.
There is a simple transformation to {\sc Equitable Colouring} \cite{MR2183465},
where the cardinality of colour classes can differ by at most one.
In terms of complexity theory, $m$-Bounded Colouring is in P on trees \cite{MR1275266},
but NP-Hard on co-graphs, interval graphs, and bipartite graphs \cite{MR1265071}.
From the block-diagonal property of the matrix variable (\ref{eqn:blockdiagonal}), it seems clear that we expect row-sums and column-sums in the binary-valued variable to be bounded from above by $m$:
\begin{align}
& \min \; t \\
\st: \qquad\qquad
& X_{vv} = 1 \quad \forall v \in V \label{eqn:X-linear-eq1} \tag{E1} \\
& X_{uv} = 0 \quad \forall \{u, v\} \in E \label{eqn:X-linear-eq2} \tag{E2} \\
& \rank(X) = t \label{eqn:rankt} \tag{rank-$t$} \\
& \sum_{u \in V } X_{uv} \le m \quad \forall v \in V \label{eqn:linear-ineq1} \tag{IN} \\
& X\succeq 0 \label{eqn:X-psd} \tag{PSD} \\
& X_{uv} \in \{ 0, 1 \} \label{eqn:X-range} \tag{Binary}
\end{align}
where $X$ is an $n \times n$ matrix variable and $t$ is a scalar variable.
By dropping the element-wise integrality,
relaxing a non-convex bound on rank($X$) to a convex bound on the trace($X$), and algebraic manipulations,
we obtain the relaxation:
\begin{align}
& \min \; t& \label{eqn:OUR-SDP-Simple} \\
\st \qquad Y_{vv} & = t & \quad \forall v \in V \label{eqn:linear-eq1} \tag{E1} \\
Y_{uv} & = 0 & \quad \forall \{u, v\} \in E \label{eqn:linear-eq2} \tag{E2} \\
\sum_{u \in V } Y_{uv} & \le tm & \quad \forall v \in V \tag{IN} \\
Y - J & \succeq 0 \label{eqn:psd} \tag{PSD} & \\
Y_{uv} & \ge 0 & \quad \forall \{u, v\} \label{eqn:nonneg-bound} \tag{N}
\end{align}
where $Y$ is an $n \times n$ matrix variable and $t$ is a scalar variable.
This can be seen as a spectahedron (\ref{eqn:linear-eq1}--\ref{eqn:psd}) being intersected by a polyhedron given by
the linear inequalities (\ref{eqn:linear-ineq1}).
Notice that additional inequalities $\sum_{v \in V } Y_{uv} \le tm \quad \forall u \in V$ are not required due to symmetry.
Notice also that the usual theta-like relaxations ($\ensuremath {\mathcal X}(\overline G), \ensuremath {\mathcal X}'(\overline G), \ensuremath {\mathcal X}^+(\overline G)$) cannot be used easily,
as one cannot easily work with a graph's complement, both due to its density and due to the constraints on the representability of our extensions.
The complication is the relaxation above is not a semidefinite program in the standard form (\ref{std-p}, \ref{std-d}).
Notice scalar variable $t$ has been introduced only for clarity.
As long as the entries on the diagonal of the matrix variable are constrained to be equal, any one of them can be used instead.
One can either introduce new scalar slack variables and convert inequalities to equalities,
or one can design solvers treating inequalities explicitly.
There remains the constraint $Y - J \succeq 0$ to deal with,
as the standard form only allows to require a matrix, rather than expression, to be psd.
The mechanistic approach, employed by automated model transformation tools \cite{YALMIP}, for instance,
is to double the dimension by introducing new variable $X$, set $Y - J = Z, Z \succeq 0$. For an arbitrary vertex $w \in V$, one obtains:
\begin{align}
& \max Y_{w,w} \label{eqn:Rewritten} \\
\st \qquad & Z_{u,v} = -1 \quad \forall \{u, v\} \in E \label{eqn:A1} \tag{A1} \\
& Z_{v,v} = Z_{w,w} \quad \forall v \in V \setminus \{ w \} \label{eqn:A2} \tag{A2} \\
& Y_{u,v} - Z_{u,v} = 1 \quad \forall u, v \in V \label{eqn:W} \tag{W} \\
& \sum_{u \in V } Y_{uv} \le tm \quad \forall v \in V \label{eqn:B} \tag{B} \\
& Z \succeq 0 \notag
\end{align}
An alternative approach is to optimise:
\begin{align}
& \min X_{w,w} + 1\label{eqn:Scaled} \\
\st \qquad & X_{u,v} = -1 \quad \forall \{u, v\} \in E \tag{A1} \\
& X_{v,v} = X_{w,w} \quad \forall v \in V \setminus \{ w \} \tag{A2} \\
& |V| - m X_{w,w} - m - 1 + \sum_{u \in V } X_{uv} \le 0 \quad \forall v \in V \tag{B} \\
& X \succeq 0 \notag
\end{align}
Any formulation involving $Y - J \succeq$ in this paper can be easily transformed in this fashion.
\subsection{Initial Assignment}
In many applications, one has to deal with complicating constraints.
In graph-theoretic terms,
the most common complicating constraints are pre-existing assignments.
Pre-existing assignments can be represented as subsets of $V$, which need to be assigned to the same unit of time.
This corresponds to:
\begin{problem}{\sc $m$-Bounded Colouring with Pre-Colouring}
Given an undirected graph $G = (V, E)$ with vertices $V = {1, 2, \ldots, n}$ and edges $E \subset \{ (u, v) \s.t. 1 \le u < v \le n \}$,
an integer $m \le |V|$,
and a family $C = (C_i)$ of disjoint subsets of $V$ with $|C_i| \le m$,
return a partition $P = (P_i)$ of $V$ of the smallest possible cardinality $|P|$ so that for each partition $P_i$, $|P_i| \le m$ and for no edge $(u, v) \in E$ there are both $u$ and $v$ in $P_i$
and for each set $C_i \in C$, there is a partition in $C_i \subseteq P_j \in P$.
The graph $G$ is called ``conflict graph'' and family $C$ is called ``pre-colouring''.
The partition $P$ corresponds to the ``same-colour equivalence'' and $P_i$ are called ``colour classes'' or ``independent sets''.
\end{problem}
In terms of complexity theory, $m$-Bounded Colouring with Pre-Colouring is NP-Hard even on trees \cite{MR2183465}.
Even in the case of trees, however, there are fixed parameter tractable algorithms \cite{MR1265071,MR2183465}.
In terms of SDP representability,
given a pre-colouring $C = (C_i), C_i \subseteq V$, it suffices to set the corresponding elements of matrix variable $Y$ to $t$:
\begin{align}
\ensuremath {\mathcal Y}(G, m) = & \max t \label{OUR-SDP} \\
\st: & Y_{vv} = t \quad \forall v \in V \label{eqn:linear-eq1-2} \tag{E1} \\
& Y_{uv} = 0 \quad \forall \{u, v\} \in E \tag{E2} \\
& Y_{uv} = t \quad \forall u, v \in C_i, u \ne v, C_i \in X \label{eqn:linear-eq3-2} \tag{E3} \\
& Y_{uv} = 0 \quad \forall u \in C_i \in C, v \in C_j \in C, C_i \ne C_j \label{eqn:linear-eq4-2} \tag{E4} \\
& \sum_{u} Y_{uv} \le tm \quad \forall v \in V \label{eqn:ineq1} \tag{L1} \\
& \sum_{v} Y_{uv} \le tm \quad \forall u \in V \label{eqn:ineq2} \tag{L2} \\
& Y_{uv} \ge 0 \quad \forall u, v \in V, u \ne v, \{u, v\} \not\in E \tag{L3} \\
& \scal{J}{X} - n m t \le 0 \label{eqn:weird} \tag{L4} \\
& Y - J \succeq 0. \notag
\end{align}
\subsection{A Reformulation}
As an aside, notice that {\sc $m$-Bounded Colouring with Pre-Colouring} can be easily transformed into a problem without pre-colouring, but with certain
weights on vertices:
\begin{problem}{\sc $c$-Weighted $m$-Bounded Colouring}
Given an undirected graph $G = (V, E)$ with vertices $V = {1, 2, \ldots, n}$ and edges $E \subset \{ (u, v) \s.t. 1 \le u < v \le n \}$,
a vector of positive integers $c$ of dimension $|V|$,
and an integer $m \le |V|$,
return a partition $P = (P_i)$ of $V$ of the smallest possible cardinality $|P|$ so that for each partition $P_i$, $c p_i \le m$, where $p_i$ is the $0-1$ index vector corresponding to $P_i$, and for no edge $(u, v) \in E$ there are both $u$ and $v$ in $P_i$.
\end{problem}
For any non-empty $C$, this leads to a reduction in the dimension of the matrix variable,
compared to the simple relaxation (\ref{OUR-SDP}):
\begin{align}
\dot \ensuremath {\mathcal Y}(G, m) = & \max t \label{OUR-SDP-Weighted} \\
\st \qquad & Y_{vv} = t \quad \forall v \in V \tag{E1} \\
& Y_{uv} = 0 \quad \forall \{u, v\} \in E \tag{E2} \\
& \sum_{u \in V} c_u Y_{uv} \le t m \quad \forall v \in V \tag{L1} \\
& \sum_{v \in V} c_v Y_{uv} \le t m \quad \forall u \in V \tag{L2} \\
& Y - J \succeq 0 \notag
\end{align}
While the reduction improves computational performance, when used with off-the-shelf solvers, it may render both the design of custom solvers and their analysis (cf. Section \ref{sec:analysis}) more challenging.
\subsection{Simple Laminar Timetabling}
In timetabling applications, it is often necessary to consider assignment of events to both periods and rooms.
In the relaxations above, vertices within a single colour class correspond to events taking place at the same time,
but rooms are represented only by the $m$-bound, which corresponds to the number of room available.
This may be insufficient: Consider, for example, a situation with two large lecture rooms, twenty periods per week,
and forty large lectures.
One could formulate this problem as a binary linear program with a variable with three indices (events, rooms, and periods)
and apply the operators of \citeA{MR1098425} or \citeA{MR2041934} to obtain semidefinite programming relaxations.
We present a number of alternatives, where the matrix variable has a considerably lower dimension.
In particular, one can extend {\sc $m$-Bounded Colouring with Pre-Colouring} to consider not only the number $m$ of available rooms (processors, machines, employees, or similar),
but also their capacities and features.
This corresponds to:
\begin{problem}{\sc Simple Timetabling}
Given an undirected conflict graph $G = (V, E)$ where vertices $V$ are also denoted events,
a vector of capacity-requirements $p \in \ensuremath{\mathbbm{R}}^{|V|}$,
an integer $m \le |V|$,
a vector of capacities $r \in \ensuremath{\mathbbm{R}}^{m}$,
a number of features $f \in \ensuremath{\mathbbm{N}}$,
set $F \subseteq V \times F$ detailing feature-requirements of events,
set $G \subseteq \{1, 2, \ldots, m \} \times F$ detailing feature availability,
and a family $C = (C_i)$ of disjoint subsets of $V$ with $|C_i| \le m$,
return a partition $P = (P_i)$ of $V$ of the smallest possible cardinality $|P|$ so that
\begin{itemize}
\item for each partition $P_i$, $|P_i| \le m$
\item for each partition $P_i$ and for no edge $(u, v) \in E$ there are both $u$ and $v$ in $P_i$
\item for each partition $P_i$ and for each distinct capacity $c$ in $r$,
the subset of $P_i$ with capacity greater or equal than $c$, according to $p$,
is less than the number of elements in $r$ greater or equal to $c$
\item for each partition $P_i$ and for each feature $1, 2, \ldots, f$,
the subset of $P_i$ requiring the feature, according to $F$,
is less than the number of rooms where it is available, according to $G$
\item for each set $C_i \in C$, there is a partition in $C_i \subseteq P_j \in P$.
\end{itemize}
\end{problem}
In an important special case, which we denote {\sc Simple Laminar Timetabling},
sets of events and rooms with certain feature-requirements and feature-availability are ``laminar''.
A collection of sets $F$ is called ``laminar'' if $A, B \in F$ implies that $A \subseteq B, B \subseteq A$ or $A \cap B = \emptyset$.
The subsets of rooms requiring capacities larger than a certain value are naturally laminar,
but naturally occurring features need not be.
As $m$-Bounded Colouring with Pre-Colouring is a special case of Simple Laminar Timetabling,
hardness results cited above apply also to Simple (Laminar) Timetabling.
Such laminar timetabling and associated bounds can be of interest, for example, in planning the capacities of rooms cf. \cite{BeyrouthyEtal2010:space-profiles}.
Initially, we restrict ourselves to the Simple Laminar Timetabling and extend the $c$-weighted relaxation above (\ref{OUR-SDP-Weighted}).
Let us suppose $n$ vertices $V$ of the conflict graph correspond to $n$ events attended
by $p_1, p_2, \ldots, p_n$ persons each, whereas the $m$-bound corresponds to rooms
of capacities $r_1, r_2, \ldots, r_m$. Let us denote distinct
distinct numbers of persons attending an event $P$,
$L(p)$ the events of size $s > p$ and
$R(p)$ the rooms of capacity $r > p$.
Clearly, one can add two constraints (\ref{eqn:LPR1}, \ref{eqn:LPR2}) for each element of $P$:
\begin{align}
\dot \ensuremath {\mathcal R}(G, p, r) = & \max t \label{OUR-SDP-Timetabling} \\
\st \qquad & Y_{vv} = t \quad \forall v \in V \notag \\
& Y_{uv} = 0 \quad \forall \{u, v\} \in E \notag \\
& \sum_{u \in L(p) } Y_{uv} \le t |R(p)| \quad \forall p \in P \quad \forall v \in L(p) \label{eqn:LPR1} \tag{PR1} \\
& \sum_{v \in L(p) } Y_{uv} \le t |R(p)| \quad \forall p \in P \quad \forall u \in L(p) \label{eqn:LPR2} \tag{PR2} \\
& Y - J \succeq 0 \notag
\end{align}
Notice the newly added constraints (\ref{eqn:LPR1}, \ref{eqn:LPR2}) subsume the linear inequalities
(\ref{eqn:ineq1}, \ref{eqn:ineq2}) of the relaxations above.
There is always a feasible solution,
and as will be shown in Section~\ref{sec:recovery}, one can efficiently produce
feasible timetables satisfying those constraints from the value of the matrix variable.
Considering there is always a permutation matrix such that the matrix variable is block-diagonal (\ref{eqn:blockdiagonal}),
one can also add bounds obtained by counting arguments. The simple counting bound is $\sum_{u, v \in V} Y_{uv} \le m |V|$.
Indeed, there are at most $|V| / m$ blocks of $m^2$ non-zeros each.
One can generalise the bound to subsets $P$ of events:
\begin{align}
\ddot \ensuremath {\mathcal R}(G, p, r) = & \max t \label{OUR-SDP-WithCounting} \\
\st \qquad & Y_{vv} = t \quad \forall v \in V \notag \\
& Y_{uv} = 0 \quad \forall \{u, v\} \in E \notag \\
& \sum_{u \in L(p)} Y_{uv} \le t |R(p)| \quad \forall p \in P \quad \forall v \in L(p) \label{eqn:count:PR1} \tag{PR1} \\
& \sum_{v \in L(p)} Y_{uv} \le t |R(p)| \quad \forall p \in P \quad \forall u \in L(p) \label{eqn:count:PR2} \tag{PR2} \\
& \sum_{u \in L(p)} \sum_{ v \in V } Y_{uv} \le m t |R(p)| \quad \forall p \in P \label{eqn:count:CB1} \tag{CB1} \\
& \sum_{v \in L(p)} \sum_{ u \in V } Y_{uv} \le m t |R(p)| \quad \forall p \in P \label{eqn:count:CB2} \tag{CB2} \\
& Y - J \succeq 0 \notag
\end{align}
In {\sc Simple Laminar Timetabling}, one can include feature considerations similarly to capacity considerations. In a slight abuse of notation,
we use $F(f)$ to denote the set of events requiring feature $f$ and $G(f)$ the set of rooms with feature $f$.
\begin{align}
\ensuremath {\mathcal R}(G, p, r, f_{\max}, F, G) = & \max t \label{OUR-SDP-WithFeatures} \\
\st \qquad & Y_{vv} = t \quad \forall v \in V \notag \\
& Y_{uv} = 0 \quad \forall \{u, v\} \in E \notag \\
& \sum_{u \in L(p) } Y_{uv} \le t |R(p)| \quad \forall p \in P \quad \forall v \in L(p) \label{eqn:feat:PR1} \tag{PR1} \\
& \sum_{v \in L(p) } Y_{uv} \le t |R(p)| \quad \forall p \in P \quad \forall u \in L(p) \label{eqn:feat:PR2} \tag{PR2} \\
& \sum_{u \in L(p)} \sum_{ v \in V } Y_{uv} \le m t |R(p)| \quad \forall p \in P \label{eqn:feat:CB1} \tag{CB1} \\
& \sum_{v \in L(p)} \sum_{ u \in V } Y_{uv} \le m t |R(p)| \quad \forall p \in P \label{eqn:feat:CB2} \tag{CB2} \\
& \sum_{u \in F(f)} Y_{uv} \le t |G(f)| \quad \forall 1 \le f \le f_{\max} \quad \forall v \in F(f) \label{eqn:feat:FR1} \tag{FR1} \\
& \sum_{v \in F(f)} Y_{uv} \le t |G(f)| \quad \forall 1 \le f \le f_{\max} \quad \forall u \in F(f) \label{eqn:feat:FR2} \tag{FR2} \\
& \sum_{u \in F(f)} \sum_{ v \in V} Y_{uv} \le m t |G(f)| \quad \forall 1 \le f \le f_{\max} \label{eqn:feat:FC1} \tag{FC1} \\
& \sum_{v \in F(f)} \sum_{ u \in V} Y_{uv} \le m t |G(f)| \quad \forall 1 \le f \le f_{\max} \label{eqn:feat:FC2} \tag{FC2} \\
& Y - J \succeq 0 \notag
\end{align}
Notice, however, the limitation to the laminar special case.
\subsection{Simple Timetabling}
A natural approach to formulating the Simple Timetabling Problem without laminarity requirements uses the additional variables:
\begin{align}
Z_{u,v,r} = \begin{cases}
\; 1 & \text{ if vertex $u$ is in the same colour class as $v$ and $v$ is assigned (room) $r$} \\
\; 0 & \text{ otherwise. }
\end{cases}
\end{align}
The additional constraints follow. In timetabling language: an event $v$ is assigned a room in $Z_{u,v,r}$ for some $r$
if and only if it is assigned time in $Y_{u,v}$ (\ref{eqn:rooms1:iff}),
no event is assigned to two rooms (\ref{eqn:rooms1:exclusive}),
no two events share a room (\ref{eqn:rooms1:exclusive2})
and $Z_{u,v,r} = 0$ if the event-room combination does not match the event's room-feature or capacity requirements (\ref{eqn:rooms1:capacity},\ref{eqn:rooms1:feature}).
\begin{align}
\sum_{1 \le r \le m} Z_{u,v,r} = Y_{u,v} & \quad \forall u, v \in V \label{eqn:rooms1:iff} \\
Z_{u,v,r} + Z_{u,v,r'} \le t & \quad \forall u,v \in V \forall 1 \le r \le m \forall r' \neq r \label{eqn:rooms1:exclusive} \\
Z_{u,v,r} + Z_{u,w,r} \le t & \quad \forall u,v \in V \forall w \in V \setminus \{v\} \label{eqn:rooms1:exclusive2} \\
Z_{u,v,r} = 0 & \quad \forall v \in V \quad \forall 1 \le r \le m, p_v \ge r_r \label{eqn:rooms1:capacity} \\
Z_{u,v,r} = 0 & \quad \forall v \in V \quad \forall 1 \le f \le f_{\max}, (v, f) \in F \quad \forall 1 \le r \le r, (r, f) \not\in G \label{eqn:rooms1:feature} \\
Z_{u,v,r} \ge 0 & \quad \forall v \in V \quad \forall 1 \le f \le f_{\max}
\label{eqn:rooms1:nonnegative}
\end{align}
This results, however, in relaxations too large to be handled by solvers currently available.
An alternative approach uses fewer additional variables:
\begin{align}
R_{v,r} = \begin{cases}
\; 1 & \text{ if vertex $v$ is assigned (room) $r$} \\
\; 0 & \text{ otherwise. }
\end{cases}
\end{align}
The additional constraints follow. In timetabling language: each event is in exactly one room (\ref{eqn:rooms2:iff1}, \ref{eqn:rooms2:iff2}),
events in the same timeslot do not share rooms (\ref{eqn:rooms2:exclusive}),
and $R_{v,r} = 0$ if the event-room combination does not match the event's room-feature or capacity requirements (\ref{eqn:rooms2:capacity},\ref{eqn:rooms2:feature}).
\begin{align}
\sum_{1 \le r \le m} R_{v,r} = t & \quad \forall v \in V \label{eqn:rooms2:iff1} \\
R_{v,r} + R_{v,r'} \le t & \quad \forall v \in V \quad \forall 1 \le r, r' \le m, r \neq r' \label{eqn:rooms2:iff2} \\
R_{u,r} + R_{v,r} + Y_{u,v} \le 2t & \quad \forall u,v \in V, u \neq v \quad \forall 1 \le r \le m \ \label{eqn:rooms2:exclusive} \\
R_{v,r} = 0 & \quad \forall v \in V \quad \forall 1 \le r \le m, p_v \ge r_r \label{eqn:rooms2:capacity} \\
R_{v,r} = 0 & \quad \forall v \in V \quad \forall 1 \le f \le f_{\max}, (v, f) \in F \quad \forall 1 \le r \le r, (r, f) \not\in G \label{eqn:rooms2:feature} \\
R_{v,r} \ge 0 & \quad \forall v \in V \quad \forall 1 \le r \le m
\end{align}
Notice that the encoding makes it possible to formulate room stability constraints and penalties,
as it is invariant to ``timeslot permutations''. For example, the hard constraint reads
$R_{v,r} + R_{v',r'} \le t$ for all suitable $v \neq v'$ and all $r \neq r'$.
\section{Algorithms}
\label{sec:algo}
While our key contribution are the actual relaxations, we showcase how these can be used in state-of-the-art algorithms.
Such algorithmic applications of the relaxations underlie not only our computational results, but also our analytical results in Section \ref{sec:analysis}.
\subsection{Solving the Relaxations}
First, let us consider a first-order method based on the alternating-direction method of multipliers (ADMM) on an augmented Lagrangian, following the extensive literature
\cite{MR2507127,MR2197554,MR2600237,MR2266705,WenGoldfarbYin2010,GoldfarbMa2010,Yang2015}.
In order to distinguish between equality constraints reflecting the structure of the conflict graph ($A_1$) and the remainder of the equality constraints ($A_2$), let us consider the primal-dual pair:
\begin{align}
z_p = \min_{X \in \S^n} \scal{C}{X} \s.t.\; \ensuremath {\mathcal A}_{A_1}(X) = b_1 \mbox{ and } \ensuremath {\mathcal A}_{A_2}(X) = b_2 \mbox{ and } \ensuremath {\mathcal A}_B(X) \ge d \mbox{ and } X \succeq 0 \notag \\
z_d = \max_{y_1 \in \ensuremath{\mathbbm{R}}^m, y_2 \in \ensuremath{\mathbbm{R}}^p, v \in \ensuremath{\mathbbm{R}}^q, S \in \S^n} b_1^T y_1 + b_2^T y_2 + d^T v \notag \\
\s.t. \; \ensuremath {\mathcal A}_{A_1}^*(y_1) + \ensuremath {\mathcal A}_{A_2}^*(y_2) + \ensuremath {\mathcal A}_B^*(v) + S = C \mbox{ and } S \succeq 0 \mbox{ and } v \ge 0. \label{eqn:reprinted}
\end{align}
with the linear operator $\ensuremath {\mathcal A}_A(X)$ mapping matrix $X$ and matrix $A$ to vector as in the definition of SDPs in Section \ref{sec:sdp-def}.
The augmented Lagrangian of the dual (\ref{eqn:reprinted}) is then:
\begin{align}
L_{\mu}(X, y_1, y_2, v, S) = & - b_1^T y_1 - b_2^T y_2 - d^T v \\
& + \scal{X}{\ensuremath {\mathcal A}_{A_1}^*(y_1) + \ensuremath {\mathcal A}_{A_2}^*(y_2) + \ensuremath {\mathcal A}_B^*(v) + S - C} \notag \\
& + \frac{1}{2\mu} ||\ensuremath {\mathcal A}_{A_1}^*(y_1) + \ensuremath {\mathcal A}_{A_2}^*(y_2) + \ensuremath {\mathcal A}_B^*(v) + S - C||^2_F. \notag
\end{align}
In an alternating direction method of multipliers, one minimises the augmented Lagrangian in $v, S$, and $(y_1, y_2)$, in turns, as suggested in Algorithm Schema~\ref{algo:bpm}.
\begin{algorithm}[t!]
\caption{{\tt AugmentedLagrangianMethod}($A_1, A_2, B, C, b_1, b_2, d$) }
\label{algo:bpm}
\begin{algorithmic}[1]
\STATE \textbf{Input:} Instance I = ($A_1, A_2, B, C, b_1, b_2, d$) of SDP, precision $\epsilon$(\ref{eqn:reprinted})
\STATE \textbf{Output:} Primal solution $Y$, computed up to $\epsilon$-precision \rule{0pt}{2.5ex}
\vspace{1ex}
\STATE Set iteration counter $k = 0$
\STATE Initialise $X^{k} \succeq 0$ with a heuristically obtained colouring
\STATE Compute matching values of dual variables $y_1^{k}, y_2^{k}, v^{k} \ge 0$, and $S^{k} \succeq 0$
\WHILE{ the precision is insufficient } \label{line:loop}
\STATE \begin{tabular}{l} Increase iteration counter $k$ \label{line:inc} \end{tabular}
\STATE \begin{tabular}{ll}
Update $v^{k+1}$ & = $\argmin_{v \in \ensuremath{\mathbbm{R}}^q, v \ge 0} L_{\mu}(X^{k}, y_1^{k+1}, y_2^{k+1}, v, S^{k})$
\end{tabular}
\label{line:QP}
\STATE \begin{tabular}{ll}
Update $S^{k+1}$ & = $\argmin_{S \succeq 0} L_{\mu}(X^{k}, y_1^{k+1}, y_2^{k+1}, v^{k+1}, S)$
\end{tabular} \label{line:eig}
\STATE \label{line:closed-form}
\begin{tabular}{ll}
$(y_1^{k+1}, y_2^{k+1})$ & = $\argmin_{y_1 \in \ensuremath{\mathbbm{R}}^m, y_2 \in \ensuremath{\mathbbm{R}}^m} L_{\mu}(X^{k}, y_1, y_2^{k}, v^{k}, S^{k})$
\end{tabular}
\STATE \begin{tabular}{l} Choose any step-length $\mu \ge 0$ \end{tabular}
\STATE \begin{tabular}{ll} Update $X^{k+1}$ & = $X^{k} + \frac{A_1^T(y_1^{k+1}) + A_2^T(y_2^{k+1}) + B^T(v^{k+1}) + S^{k+1} - C)}{\mu}$ \end{tabular}
\ENDWHILE
\STATE Return $X$
\end{algorithmic}
\end{algorithm}
In general, Algorithm Schema~\ref{algo:bpm} reduces the minimisation of one moderately
complicated convex optimisation problem to solving three simpler convex optimisation sub-problems.
In Line \ref{line:QP}, one can solve the linear system given by first-order Karush–Kuhn–Tucker optimality conditions of
\begin{align}
\argmin_{v \in \ensuremath{\mathbbm{R}}^q, v \ge 0} \left( \left( {B\left( {X^k + \frac{1}{{\mu}}\left( {A_1^T (y_1^{k + 1} ) + A_2^T (y_2^{k + 1} ) + S^k - C} \right)} \right) - d} \right)^T v + \frac{1}{{2\mu}}v^T (BB^T ) v \right).
\end{align}
In Line \ref{line:eig},
it is important to realise that
\begin{align}
\argmin_{S \in \S^n, S \succeq 0 } \norm{S - \left(C - A_1^T(y_1^{k+1}) - A_2^T(y_2^{k+1}) - B^T(v^{k+1}) - \mu X^k \right)}_F^2
\end{align}
can be solved by spectral decomposition of the term subtracted from $S$ \cite{MR1247916}.
Finally, in Line \ref{line:closed-form}, one can initialise the computation with:
\begin{align}
y_1^{k+1} = & -(A_1 A_1^T)^{-1} (\mu(A_1(X^k) - b_1) + A_1(A_2^T(y_2^k) + B^T(v^k) + S^k - C))\\
y_2^{k+1} = & -(A_2 A_2^T)^{-1} (\mu(A_2(X^k) - b_2) + A_2(A_1^T(y_1^{k+1}) + B^T(v^k) + S^k -C)).
\end{align}
We refer to \cite{Yang2015} for a some excellent suggestions as to the implementation of the linear solver and spectral decomposition, as well as convergence properties
of such as method.
\begin{algorithm}[t!]
\caption{{\tt Rounding}($X$) based on Karger, Motwani, and Sudan}
\label{algo:rounding}
\begin{algorithmic}[1]
\STATE \textbf{Input:} Matrix variable $X$ of the solution to the SDP (\ref{OUR-SDP}) of dimensions $n \times n$,
bound $m$, number $a_{\max}$ of randomisations to test,
plus the input to Simple Timetabling, if required
\STATE \textbf{Output:} Partition $P$ of the set $V = {1, 2, \ldots, n}$ \rule{0pt}{2.5ex}
\vspace{1ex}
\STATE Compute vector $v, X = v^T v$ using Cholesky decomposition
\FOR{ Each attempted randomisation $a = 1, \ldots, a_{\max}$}
\STATE Initialise $P_a = \emptyset, i=1, X = V$
\WHILE{ There are uncoloured vertices in $X$ }
\STATE Pick a suitable $c = \sqrt{ \frac{2(k - 2)}{k \log_e \Delta} }$ for $\Delta$ being the maximum degree of the vertices in $X$
\STATE Generate a random vector $r$ of dimension $|X|$
\STATE Pick $R_i \subseteq X$ of at most $m$ elements in the descending order of $v_i r_i$,
where (1) positive and (2) independent of previously chosen and, in Simple Timetabling,
(3) the respective events fit within the rooms and (4) require only features available
\STATE Update $P_a = P_a \cup \{ \{ R_i \} \}, X = X \setminus R_i$, $i = i + 1$
\ENDWHILE
\ENDFOR
\STATE Return $P_a$ of minimum cardinality
\end{algorithmic}
\end{algorithm}
\subsection{Recovering an Assignment}
\label{sec:recoveryAlg}
Let us comment on the recovery of an upper bound from the lower bound provided by SDP.
Since the seminal paper of Karger, Motwani, and Sudan \cite{Karger1998},
there has been a continuing interest in algorithms recovering a colouring from
semidefinite relaxations.
Typically, such algorithms are based on simple randomised
iterative rounding of the semidefinite programming relaxation. One such algorithm, specialised to simple timetabling is displayed in Algorithm Schema~\ref{algo:rounding}.
Alternatively, one can consider methods solving a sequence of smaller semidefinite programming relaxations, inspired by the so-called iterated rounding in linear programming \cite{lau2011iterative}.
When applied to linear programming, the method fixes variables, whose values in the relaxation are close to $0$ or $1$, to 0 or 1, respectively, and resolves the smaller residual linear program.
When applied to semidefinite programming, the method
fixes eigenvectors whose corresponding eigenvalues are close to zero or one.
Let us consider the example of \cite{morgenstern2019fair} starting from:
\begin{align}
& \min \langle C, X\rangle & \label{eq:suitable1} \\
\st \quad & \langle A_i , X\rangle \geq b_i & \;\; \forall \; 1\leq i\leq m \notag \\
& \trace(X) \leq d & \notag \\
& 0\preceq X \preceq I_n, & \notag
\end{align}
which can accommodate many of the SDP relaxations we have seen so far.
There, \cite{morgenstern2019fair} initialise $F_0=F_1=\emptyset$ and $F=I_n$.
In each iteration, subspaces spanned by eigenvectors corresponding to eigenvalues $0$ or $1$ are fixed and the corresponding standard basis vectors are moved from $F$ to $F_0$ and $F_1$, respectively.
Thus, one increases the subspaces spanned by columns of $F_0$ and $F_1$, while maintaining pairwise orthogonality.
To obtain new $F$, one solves a smaller semidefinite program in $r\times r$ symmetric matrix $X(r)$:
\begin{align}
\label{eq:smallersdp}
\max \, & \, \langle F^TCF, X(r)\rangle \\
\langle F^T A_i F, X(r)\rangle & \ge b_i- F_1^T A_i F_1 \quad i \in S \notag \\
\trace(X(r)) & \le d-\rank(F_1) \notag \\
0 \preceq \, X(r) &\preceq I_r, \notag
\end{align}
which assures that, eventually, we can recover $X$ that is orthogonal to all vectors in subspace spanned by vectors in $F_0$,
and whose eigenvectors corresponding to eigenvalue $1$
will be the columns of $F_1$.
This is summarised in Algorithm Schema~\ref{algo:rounding2}.
As we will see in Section~\ref{sec:recovery}, this allows for non-trivial performance guarantees.
\begin{algorithm}[t!]
\caption{{\tt IterativeRounding}($X$) based on Morgenstern et al.}
\label{algo:rounding2}
\begin{algorithmic}[1]
\STATE \textbf{Input:} An $n \times n$ matrix $X$ of the solution to the SDP (\ref{eq:suitable1}),
which has $m$ inequalities, alongside with the corresponding matrices $A_i$ for $i = 1, \ldots, m$
\STATE \textbf{Output:} Partition $P$ of the set $V = {1, 2, \ldots, n}$ \rule{0pt}{2.5ex}
\vspace{1ex}
\STATE Initialize $F_0, F_1$ to be empty matrices and $F=I_n$, $S\gets \{1,\ldots, m\}$.
\STATE Initialise $\delta > 0$ to be a threshold for rounding
\WHILE{ $F$ is non-empty }
\STATE Solve \eqref{eq:smallersdp} to obtain extreme point $X^*(r)=\sum_{j=1}^r \lambda_j v_j v_j^T$ where $\lambda_j$ are the eigenvalues and $v_j\in \ensuremath{\mathbbm{R}}^r$ are the corresponding eigenvectors.
\STATE For any eigenvector $v$ of $X^*(r)$ with eigenvalue less than $\delta$, let $F_0\gets F_0\cup \{Fv\}.$
\STATE For any eigenvector $v$ of $X^*(r)$ with eigenvalue of more than $1 - \delta$, let $F_1\gets F_1\cup \{Fv\}.$
\STATE Let $X_f=\sum_{j: 0<\lambda_j<1} \lambda_j v_j v_j^T$. If there exists a constraint $i\in S$ such that $\langle F^T A_i F, X_f\rangle < \delta$, then
$S\gets S\setminus \{i\}.$
\STATE Update $F$ by taking every eigenvector $v$ of $X^*(r)$ with eigenvalue within $[\delta, 1-\delta]$, and taking $Fv$ to be the columns of $F$.
\ENDWHILE
\STATE From rank-$t$ matrix $F_1F_1^T$ reconstruct partition $P$ by Cholesky decomposition
\end{algorithmic}
\end{algorithm}
As a remark, we note that there are many other alternative rounding approaches within the Theoretical Computer Science literature. We refer to \cite{6108208,Raghavendra2012,Bansal2016,abbasi2018sticky} for notable examples. While they may not be directly applicable, they are based on important insights that would be applicable.
\section{An Analysis}
\label{sec:analysis}
Next, let us analyse the strength of the bound and the complexity of computing it, both of which affect its practicality.
\subsection{The Strength of the Bound}
In terms of strength of the bound, one can extend a number of properties of relaxations of graph colouring to bounded colouring. For the sake of completeness, we reiterate some of them.
For instance, one can show the sandwich-like:
\begin{prop}
\label{prop:sandwich}
For every graph $G$, there is an $m \ge 0$, such that
\begin{align}
\omega(G) \le \ensuremath {\mathcal X}'(\overline G)
\le \chi(G)
\le \mathcal{C}(G, m)
\le \ensuremath {\mathcal Y}'(G, m)
\le \ensuremath {\mathcal Y}(G, m) \\
\ensuremath {\mathcal Y}(G, m)
\le \ensuremath {\mathcal Y}^+(G, m)
\le \ensuremath {\mathcal Y}^{+\bigtriangleup}(G, m)
\le \chi(G, m),
\end{align}
\end{prop}
where $\omega$ is the size of the largest clique,
$\chi$ is the chromatic number,
$\mathcal C$ is a bound obtained by counting,
$\chi^m$ is the $m$-bounded chromatic number,
the values of SDP relaxations follow the notation of Figure~\ref{over1} and
$\ensuremath {\mathcal Y}^{+\bigtriangleup}$ is the strengthening of $\ensuremath {\mathcal Y}^+(G,m)$ with triangle inequalities.
\begin{sketch}
The relationship between the values of the successive relaxations of bounded colouring is clear.
To show there is $m$, such that $\chi(G) \le \mathcal C(G, m)$, let us study two cases:
If there is $r \ge 1$ such that $r$-bounded
graph colouring of $G$ requires a strictly larger number of colour classes than the chromatic number, take $m = r$.
Otherwise, the graph cannot have independent sets larger than one, hence is a clique, and $\omega(G) = \chi(G) = \chi(G, m)$ for any $m$.
\end{sketch}
To see that (non-bounded) graph colouring relaxations
($\ensuremath {\mathcal X}(\overline G), \ensuremath {\mathcal X}'(\overline G), \ensuremath {\mathcal X}^+(\overline G)$)
provide only very weak bounded graph colouring relaxations,
consider empty graphs on $n$ vertices and the constant function $f(n) = 1$:
\begin{prop}
There is an infinite family of graphs and $f(n)$, where the chromatic number is $O(1)$,
the $f(n)$-bounded chromatic number is $O(n)$.
\end{prop}
In contrast, the value of the semidefinite programming relaxation of bounded colouring
may match the bounded chromatic number on such graphs.
On random graphs where an edge between each pair of distinct vertices appears with probability $p$, independent of any other edge, which are known as Erd\H{o}s-R{\' e}nyi $G(n,p)$:
\begin{prop}
\label{prop:Juhasz}
With probability $1 - o(n)$, graph $G$ drawn randomly from $G_{n,p}$ has
\begin{align}
\ensuremath {\mathcal Y}(G) \ge \frac{\sqrt{n} }{2} \sqrt{\frac{1 - p}{p}} + O(n^{\frac{1}{3}} \log n),
\end{align}
where the big-$O$ notation hides lower-order terms.
\end{prop}
\begin{sketch}
The proof combines the sandwich-like Property~\ref{prop:sandwich} and the impressive result of \citeA{MR685042}.
\end{sketch}
Computationally, this bound seems to be rather tight, as we show in Section \ref{sec:computational}.
\subsection{The Structure of the Relaxations}
\label{sec:structure}
For example, let us consider the formulation of bounded graph colouring (\ref{eqn:Rewritten}) for a graph on $n$ vertices
and $m$ edges. There equality constraints reflecting the structure of the conflict graph ($A_1$) have the cardinality of their support (number of non-zero elements) equal to the number of edges in the conflict graph and the remainder of the equality constraints ($A_2$) also have a very simple structure:
\begin{prop}
\label{prop:a1a1t}
First $m$ equalities (\ref{eqn:A1}) correspond to $m \times n^2$ matrix $A_1$.
$A_1 A_1^T = I_m$, where $I_m$ is the $m \times m$ identity matrix.
\end{prop}
\begin{prop}
\label{prop:a2a2t}
Further $n-1$ equalities (\ref{eqn:A2}) correspond to $n-1 \times n^2$ matrix $A_2$.
$A_2 A_2^T = J_{n-1} + I_{n-1}$, where $I_{n-1}$ and $J_{n-1}$ are $(n-1) \times (n-1)$ identity and all-ones matrices, respectively.
$(A_2 A_2^T)^{-1}$ is $- \frac{1}{n} J_{n-1} + I_{n-1}$.
For $(n-1)$-vector $y$, $A_2^T y$ is
an $n \times n$ matrix, with $\left[\left(\sum_i y_i\right) (-y_1) (-y_2) \cdots (-y_{n-1})\right]$ on the diagonal and zeros elsewhere.
For positive $X$, $\ensuremath {\mathcal A}_{A_2}(X) = \left[ 2, 4, \cdots, 2(n-1) \right]$ of dimension $(n - 1)$.
\end{prop}
\begin{prop}
\label{prop:btv}
Inequalities (\ref{eqn:B}) correspond to $n \times n^2$ matrix $B = I \kron j$,
where $j$ is the row-vector of $n$ ones. Hence, $BB^T = n I_n$,
where $I_n$ is the $n \times n$ identity matrix.
For an $n$-element column-vector $v$, $B^T v = (v \kron j)^T = \left[v_1 j \; v_2 j \; \cdots \; v_n j \right]^T$,
where $j$ is the row-vector of $n$ ones.
\end{prop}
\begin{prop}
The elements of the objective matrix $C$ are zeros except for $C_{1,1} = 1$.
Hence $\ensuremath {\mathcal A}_{A_1}(C) = 0$, where $0$ is the $m$-vector of zeros.
$\ensuremath {\mathcal A}_{A_2}(C) = j$, where $j$ is the $(n - 1)$-vector of ones.
\end{prop}
Across both:
\begin{itemize}
\item custom solvers, such as Algorithm Schema \ref{algo:bpm} and the three sub-problems in Lines \ref{line:QP}--\ref{line:closed-form}, in particular, and
\item general-purpose solvers allowing for the input of block-structured matrices with sparse and identity blocks, such as \cite{Fujisawa2000,Gondzio2009},
\end{itemize}
it is possible to exploit Properties~\ref{prop:a1a1t}--\ref{prop:btv} so as to:
\begin{itemize}
\item not compute $(A_1 A_1^T)^{-1}$
\item compute $A_1^T y_1$ in time $O(m)$
\item compute $(A_2 A_2^T)^{-1}$ in time $O(n^2)$
\item compute $A_2^T y_2$ in time $O(n)$
\item compute $(A B^T)^{-1}$ in time $O(n)$
\item compute $B^T v$ in time $O(n)$
\item evaluate the augmented Lagrangian and its gradient at a given $v$ in time $n^2$
\end{itemize}
in relaxations of bounded graph colouring of a graph on $n$ vertices,
compared to $O(n^6)$ run-time of methods not exploiting the structure.
\subsection{The Recovery}
\label{sec:recovery}
Due to the hardness of approximation of colouring in a graph with large enough a chromatic
number within the factor of $n^\epsilon$ for some fixed $\epsilon$ \cite{MR2403018},
one cannot hope to guarantee reconstruction of a solution close to optimality in the worst case.
Having said that, as we will illustrate in the next section, however, Algorithm Schema~\ref{algo:rounding} performs rather well in practice.
One can also provide weaker guarantees.
In particular, one could consider the so-called \(\epsilon\)-solution,
which satisfies linear constraints within an additive error of $\epsilon$, while being at most $\epsilon$ from the optimal objective.
Notice that the fact that an \(\epsilon\)-solution is obtainable in
time polynomial in $n$ and $\log \frac{1}{\epsilon}$
does not contradict the hardness of approximation results \cite{MR2403018}, which consider the objective of solutions satisfying the constraints exactly.
\begin{prop}
There exists an $\epsilon > 0$ and an algorithm implementing Algorithm Schema \ref{algo:rounding2}
that, given any feasible solution
to the SDP relaxation \eqref{OUR-SDP-WithFeatures} of {\sc Simple Laminar Timetabling},
runs in time
polynomial in $n$ and $\log \frac{1}{\epsilon}$
and returns an $\epsilon$-feasible and \(\epsilon\)-optimal solution to the SDP relaxation \eqref{OUR-SDP-WithFeatures} of {\sc Simple Laminar Timetabling}.
\end{prop}
\begin{sketch}
The proof extends the work of \cite{morgenstern2019fair} on the number of fractional eigenvalues in any extreme point $X$ of a suitable form of a semidefinite program with $m$ linear inequalities and trace bounded by $t$, which is
\begin{align}
t + \floor*{ \sqrt{2m+\frac{9}{4}}-\frac{3}{2}
}.
\end{align}
Based on this bound, one can formulate a generic result on iterative rounding of SDPs, which we present in Proposition \ref{thm:SDProunding} below.
The result applies to the
SDP relaxation \eqref{OUR-SDP-WithFeatures} of {\sc Simple Laminar Timetabling}, because it can be cast into the suitable form \eqref{eq:suitable1}.
The bound on the run-time follows from the fact we solve at most $n$ semidefinite programs in matrices at most $n \times n$ and standard results on interior-point methods \cite{MR1315703}.
\end{sketch}
\begin{prop}[Theorem 7 of \cite{morgenstern2019fair}]
\label{thm:SDProunding}
Let $C$ be a $n\times n$ matrix and $\{A_1,\ldots, A_m\}$ be a collection of $n \times n$ real matrices, $d \leq n$, and $b_1,\ldots, b_m\in\ensuremath{\mathbbm{R}}$. Suppose the semi-definite program \eqref{eq:suitable1}
with a trace bounded by $d$ and $m$ other constraints has a nonempty feasible set and let $X^*$ denote an optimal solution. There is an algorithm
that given a matrix $X_0$ that is a strictly feasible solution,
returns a matrix $\tilde{X}$ such that
\begin{enumerate}
\item rank of $\tilde{X}$ is at most $d$,
\item $\langle C, \tilde{X}\rangle \leq \langle C, X^* \rangle $, and
\item for each index $1\leq i\leq m$ of a constraint we have \begin{align}
\label{eq:violation-bound}
\langle A_i , \tilde{X}\rangle \geq b_i- \max_{S\subseteq [m]} \sum_{i=1}^{\floor*{ \sqrt{2|S|}+1 }} \sigma_i(S),\end{align}
where $\sigma_i(S)$ is the $i^{th}$ largest singular of the average of matrices $\frac{1}{|S|} \sum_{i\in S} A_i$ for any subset of matrices defining the constraints, $S\subseteq \{1,\ldots, m\}$.
\end{enumerate}
\end{prop}
In the violation bound \eqref{eq:violation-bound}, the quantity $\sigma_i(S)$ is non-trivial to reason about, but it is clear that it is rather modest, because the singular values are at most 1 and the summation goes over at most $\sqrt{2m}+1$ values.
\section{Computational Experience}
\label{sec:computational}
To corroborate our analytical results in Section \ref{sec:analysis}, we have conducted a variety of computational tests.
Most of these have been driven by YALMIP \cite{YALMIP}
scripts running within MathWorks Matlab R2017b on a laptop with
Intel Core Duo i5 at 2.7~GHz with 8~GB of RAM,
which also had
IBM ILOG CPLEX 12.8 and
SeDuMi 1.3 \cite{SEDUMI} installed. Let us refer to it as a laptop.
When explicitly mentioned, we also present results
obtained on a machine equipped
with 80 cores of Intel Xeon E7-8850 at 2.00~GHz
and 700~GB of RAM, which had
MathWorks Matlab R2016b,
IBM ILOG CPLEX 12.6.1,
and SeDuMi 1.3 \cite{SEDUMI}
installed.
Let us refer to it as a large-memory machine.
\subsection{A Motivating Example}
As a first concrete computational example, we consider a small conflict graph from a standard collection of benchmark problems in timetabling. Specifically, we take the instance {\tt sta-f-83} from the Toronto examination timetabling benchmarks \footnote{See \texttt{ftp://ftp.mie.utoronto.ca/pub/carter/testprob/} and \texttt{http://www.cs.nott.ac.uk/$\sim$rxq/data.htm}}. There are 139 events, but the conflict graph has three connected components of 30, 47 and 62 vertices. Here, we use the 47-vertex component.
The results are given in Table~\ref{tab:bounded},
with bounded chromatic numbers obtained using the most straightforward integer linear programming formulation
solved using the default settings of IBM ILOG CPLEX on a laptop.
\begin{table}[t!]
\caption{
An illustration of the effects of bounding the $m$-bounded chromatic number of the instance {\tt sta-f-83}:
Column $\chi^{m}$ lists the $m$-bounded chromatic number obtained using integer linear programming, within time listed under ``$\chi^{m}$ Runtime'' in seconds.
Column $\ensuremath {\mathcal Y}^{m}$ lists the bounds obtained using semidefinite programming and rounding up, within time listed under ``$\ensuremath {\mathcal Y}^{m}$ Runtime'' in seconds.
Column $|V|/m$ lists the lower bound on the colours obtained by simple counting arguments and rounding up.
Dash denotes the the omission of the $m$-bounding constraint, giving $\ensuremath {\mathcal X}$ instead of $\ensuremath {\mathcal Y}^{m}$.
}
\label{tab:bounded}
\begin{tabular}{l|ll|ll|l}
$m$ &
$\chi^{m}$ & $\chi^{m}$ Runtime &
$\ensuremath {\mathcal Y}^{m}$ & $\ensuremath {\mathcal Y}^{m}$ Runtime &
$|V|/m$ \\
\hline
1 & 47 & 0.09 & 47 & 3.46 &47 \\
2 & 26 & 2.88 & 26 & 2.92 & 24\\
3 & 20 & 2.67 & 20 & 3.34 & 16 \\
4 & 16 & 7.22 & 16 & 3.70 & 12 \\
5 & 14 & 11.10 & 14 & 3.24 & 10 \\
6 & 13 & 2.67 & 13 & 3.12 & 8 \\
7 & 12 & 8.77 & 12 & 3.26 & 7 \\
8 & 11 & 2.89 & 11 & 3.40 & 6\\
9 & 11 & 3.39 & 11 & 3.14 & 6\\
47 & 11 & 0.35 & 11 & 3.92 & 1 \\ \hline
--- & 11 & 0.34 & 11 & 3.45 & --- \\ \hline
\end{tabular}
\end{table}
Firstly, note that $m=1$ gives precisely the number of nodes, as would be expected.
Secondly, note that $\ensuremath {\mathcal Y}^m$ is generally much tighter than the lower bound $|V|/m$ obtained by simple counting arguments.
Accidentally, $\ensuremath {\mathcal Y}^m$ lower bounds actually happen to match the optima in this particular instance.
For example, at $m=5$, counting cannot rule out a 10-colouring, but the SDP bound shows that at least 14 colours are required.
As far as we know, SDP relaxations are the only way to get such information in polynomial time, considering that
the 14-colouring together with a certificate of its optimality can be obtained using CPLEX, but not in polynomial time.
\subsection{Random Graphs}
Next, we show that the same behaviour can be observed on a large sample of random graphs.
First, we demonstrate the improved strength of the lower bound obtained from semidefinite programming
as the restriction on the number of uses of a colour is tightened (i.e., cardinality of a colour class is bounded from above by progressively smaller numbers).
In general, we compute the best possible vertex colouring, without any bound on the number of uses of a colour,
and take the size of the largest colour class to be $C$.
Subsequently, we obtain lower bounds, upper bounds, and optima for $(C-1)$-bounded colouring, $(C-2)$-bounded colouring, etc., of the same graph.
In particular, we use random graphs with constant probability 0.5 of an edge appearing between a pair of distinct vertices and varying numbers $n$ of vertices, which are known as $G(n, \frac{1}{2})$.
For each number $n$ of vertices, we have generated 100 random graphs, computed the true chromatic numbers and
the size of the largest colour class
$C$ using CPLEX,
lower bounds on the bounded colouring using SeDuMi,
and upper bounds by rounding the semidefinite programming relaxation, all running on a laptop.
In Figure~\ref{fig:random1},
the true value is plotted in a solid line, while a semi-transparent region spans the lower and upper bounds.
Notice that:
In Figure~\ref{fig:random1},
the true value is plotted in a solid line, while a semi-transparent region spans the lower and upper bounds.
Notice that:
\begin{itemize}
\item the upper bounds obtained by rounding the semidefinite programming relaxation coincides with the true value obtained by ILOG
\item for unbounded and $(C-1)$-bounded colouring, there is a considerable gap between the SDP-based lower bound and the true value
\item for $(C-3)$-bounded colouring, the SDP-based lower bound and the true value coincide in the majority of cases. (That is: One can round the upper bound up, as it has to be integral. The average over 100 samples need not be integral, though.)
\item for $(C-3)$-bounded colouring, the SDP-based lower bound is essentially tight.
\end{itemize}
Second, we illustrate the practicality of the approach by illustrating the dependence of the run-time on dimensions of the graph.
Figure~\ref{fig:random3} presents the results on instances, which fit within the memory of a laptop.
It suggests that run-time
of commonly used
first-order methods for solving semidefinite-programming relaxations increases linearly with the number of vertices of the graph, while the run-time of commonly used
second-order methods for solving semidefinite-programming relaxations increases quadratically with the number of vertices of the graph.
This is surprising. Consider the fact that the dimension of the matrix variable increases quadratically with the number of vertices and the number of elements in the Hessian matrix considered in second-order methods increases quadratically in the dimension.
In both cases, the observed run-time is due to the ability of the respective methods to exploit the structure of Section~\ref{sec:structure}.
Figure~\ref{fig:random4} presents the corresponding results on instances, which no longer fit within the memory of a laptop,
as run on a large-memory machine.
We note that already on a random graph on 200 vertices, $G(200, 0.5)$, SeDuMi
regularly consumes over 24 GB physical memory, with further
13 GB in swap,
in solving the SDP relaxation of bounded graph colouring.
Although the run-times are longer, considering the sheer amounts of data processed, the evolution of run-time as a function of the number of vertices seems similar to Figure~\ref{fig:random3}.
\begin{figure}[t!]
\caption{The effects of tightening the bound on the number of uses of a colour on the strength of the lower bound:
For a random graph $G(n, 0.5)$, where the size of the largest colour class in an optimal colouring is $C$,
the mean lower bounds, upper bounds, and optima for
unbounded colouring,
$(C-1)$-bounded colouring, $(C-2)$-bounded colouring, etc.,
are computed from a sample of $N = 100$ for each number of vertices $n$ and restriction on the size of the colour class.}
\label{fig:random1}
\centering
\includegraphics[width=0.9\textwidth]{gfx/random-plots-n5-pretty-solid.pdf}
\end{figure}
\begin{figure}[t!]
\caption{The run-time of the presented methods on a laptop as a function of the number of vertices:
Sample mean run-times of
an interior point method (IPM) and an
augmented Lagrangian (AugLag) method on relaxations for $G(n, 0.5)$ on a laptop
for $N = 100$ samples per each number $n$ of vertices.}
\label{fig:random3}
\centering
\includegraphics[width=0.9\textwidth]{gfx/random-runtimes-p05-pretty-solid.pdf}
\end{figure}
\begin{figure}[t!]
\caption{The run-time of the augmented Lagrangian (AugLag) method on a large-memory machine, as a function of the number of vertices $n$ in $G(n, 0.5)$. We restrict ourselves to $N = 1$ sample per each number $n$ of vertices, due to the run-time of YALMIP constructing the SDP instances.}
\label{fig:random4}
\centering
\includegraphics[width=0.9\textwidth]{gfx/random-large-p05-pretty-solid.pdf}
\end{figure}
\begin{figure}[t!]
\caption{The run-time of the presented methods on a laptop, as a function of graph's density:
For random graphs $G(25, p)$, sample mean run-times of
an interior point (IPM), possibly with a
with dimension reduction (DimRed) and exploitation of sparsity (SparseCoLo), compared against the run-times of an
augmented Lagrangian (AugLag) method,
for $N = 100$ samples per each density $p = 0.1, 0.2, \ldots, 0.9$.}
\label{fig:random2}
\centering
\includegraphics[width=0.9\textwidth]{gfx/random-runtimes-n25-pretty-solid.pdf}
\end{figure}
Figure~\ref{fig:random2} illustrates that commonly used
methods do not exhibit a major increase in run-time as the density of the graph increases, due to their ability to exploit the structure of Section~\ref{sec:structure}. Again, this is surprising. Consider that the number of edges in the conflict graph asymptotically approaches the square of the number of vertices in a dense graph. If there were no structure, the cubic increase of run-time with each of the quadratic number of constraints may render the approach impractical.
In particular, we use random graphs
of varying densities, all on 100 vertices. The data are again available on-line.
For each of the densities $p = 0.1, 0.2, $\ldots$, 0.9 \%$, we have generated 100
graphs $G(40, p)$.
Subsequently, we have obtained SDP-based lower bounds using 4 different methods:
\begin{itemize}
\item[IPM]
a standard implementation of a primal-dual interior point method (IPM) by \cite{SEDUMI}
\item[DimRed] a dimension-reduction procedure of \cite{YALMIP} followed by the IPM of \cite{SEDUMI}
\item[SparseCoLo] a sparsity-exploiting procedure of \cite{kim2011} followed by the IPM of \cite{SEDUMI}
\item[AugLag]
an implementation of a first-order method considering the augmented Lagrangian, based on \cite{MR2600237,Yang2015}
\end{itemize}
For each of the methods, and each of the densities $p$, we report the average run-time over 100 graphs.
\begin{table}[t!]
\caption{Results for instances from
Track 3 (comp) of the International Timetabling Competition 2007.
}
\label{tab:ITC}
\include{gfx/itc-overview}
\end{table}
\subsection{Conflict Graphs from Timetabling Benchmarks}
As a further illustration of the strength of SDP lower bounds, we present lower bounds for conflict graphs from two timetabling benchmarks.
From instances used in Track 3 of International Timetabling Competition 2007, we have extracted course-based conflict graphs,
where there is edge between two vertices, if there is a curriculum prescribing the enrollment in both corresponding courses,
or if a single teacher teaches both courses.
For details, please see \cite{Bonutti2010} or \cite{Marecek2008Patat}.
From Toronto Examination Timetabling Benchmark, we have extracted exam-based conflict graphs,
where there is edge between two vertices, if there is a student who should sit both corresponding exams.
For details, please see \cite{Qu2009}.
For each graph, we have computed the best possible vertex colouring, without any bound on the number of uses of a colour,
and took the size of the largest colour class to be $C$.
Subsequently, we have obtained lower bounds, upper bounds, and optima for $(C-1)$-bounded colouring, $(C-2)$-bounded colouring, etc.
\begin{table}[t!]
\caption{For Knesser graphs $K(n, 2)$ and forbidden intersection graphs $F(n, \gamma)$,
where the size of the largest colour class in an optimal colouring is $C$,
lower bounds $\ensuremath {\mathcal Y}^{m}$ and optima $\chi^{m}$ for $(C - m)$-bounded colouring are shown. For $m = 0$, no bounds were applied.}
\label{tab:Knesser}
\include{gfx/Knesser-overview}
\end{table}
\subsection{Two Examples of Theoretical Interest}
To illustrate the weakness of the bound on certain graphs, we present the results for Knesser graphs of Lov{\'a}sz \cite{MR514625}
and the ``forbidden intersections'' graphs of Frankl and R{\"o}dl \cite{MR871675}.
Knesser graph $K(n,k)$, $n > k > 1$, has
$\binom{n}{k}$ vertices, corresponding to subsets of $\{1, 2, \ldots ,n\}$ of cardinality $k$.
Two vertices are adjacent if the corresponding subsets are disjoint.
Lov{\'a}sz has shown \cite{MR514625} the chromatic number of $K(n,k)$ is exactly $n - 2k + 2$,
despite the fact $K(n, k)$ has no triangle for $n > 3k$.
Similarly, forbidden intersections graph $F(m, \gamma)$, $m \ge 1, 0 < \gamma < 1$, such that $(1-\gamma)m$ is an even integer,
has $2^m$ vertices, corresponding
to sequences of $m$ bits (zeros and ones). Two vertices are adjacent, if the
corresponding sequences differ in precisely $(1 - \gamma) m$ bits.
It is known the theta bound of {L}ov\'asz and related semidefinite programming
relaxations of graph colouring perform poorly on both ``forbidden intersections'' \cite{545462}
and Knesser graphs \cite{Karger1998}: the lower bound
is $O(1)$ as $n$ grows, whereas the actual chromatic number grow $O(n)$ with $n$.
Table~\ref{tab:Knesser} shows the lower bound gets tighter as the bound on the number of
uses of a colour gets tighter.
It should be noted that there is a large difference between clique and chromatic numbers in both Knesser and forbidden intersection graphs,
which makes them quite unlike conflict graphs encountered in timetabling applications.
Although semidefinite programming lower bounds for graph colouring are weak on these graphs, they do tighten,
as the bound on the number of uses of colours tightens.
Nevertheless, the proposed lower bound is far from tight, in the worst case.
\section{Conclusions}
\label{sec:conclusions}
This paper has explored the limits of representability of extensions of graph colouring in semidefinite programming (SDP).
SDP clearly provides some of the strongest known relaxations in timetabling.
In particular, relaxations of simple timetabling problems related to Lov{\'a}sz theta provide useful lower bounds on the number of periods
required in the timetable, considering the conflict graph, the number of rooms,
the capacities of rooms and special equipment available therein,
and a pre-assignment of certain events to certain periods.
In such low-dimensional SDP relaxations, the colour assignment is not represented directly,
but only in terms of the classes of equivalence of nodes assigned the same colour.
This is sufficient for simple timetabling problems as described above, and makes the representation naturally invariant under the permutation of the colours.
In contrast, many objectives in timetabling refer to time-based patterns of activities, e.g., whether events should be on the same day or not.
These are not invariant under ``colour permutations'' and so the ``same colour'' representation is no longer sufficient.
The matrix variable will need to capture the assignment of events to rooms as well as periods, and hence be constrained
so that there is only a single event in each room-period pair. This gives a constraint on the rank of the matrix variable,
which can be relaxed in a SDP. Despite the higher dimension of such relaxations, relaxations of rank-minimisation have proven very successful in many other fields \cite{Fazel2004},
and may turn out to be applicable also in timetabling.
Modelling further and progressively more complex problems in
semidefinite programming, with particular focus on relaxations one can solve fast,
offers ample space for future work.
In theory, one may wonder whether the relaxations as the best one can obtain in polynomial time assuming the unique games conjecture \cite{Khot2005}.
One could also seek approximation results for the problems we describe, either for the relaxations and rounding procedures of this paper, or for novel ones. For example, one could obtain so-called lifted relaxations, e.g., using the method of moments of \cite{lasserre2015introduction} applied to the copositive formulation, and to analyse the rounding therein, as \cite{Bansal2016} have done for job-shop scheduling.
These would be an important advances in our understanding of scheduling and timetabling.
| {
"redpajama_set_name": "RedPajamaArXiv"
} | 7,341 |
UN Arms Trade Treaty opens for signature
Gilles Giacca - 3rd June 2013
The United Nations Arms Trade Treaty (ATT), adopted by the UN General Assembly on 2 April 2013, was opened for signature today at the UN in New York in accordance with its Article 21. The ATT will enter into force 90 days after the day on which the 50th state deposits its instrument of ratification, acceptance, or approval with the UN Secretary-General.
The road to the ATT was long and, at times, somewhat difficult. Preparatory Committee meetings began in New York in 2010–2012, culminating in a diplomatic conference in July 2012 that failed to agree to adopt an Arms Trade Treaty. A renewed effort at a 'final' diplomatic conference in March 2013, again convened under UN auspices, was not able to achieve consensus but nonetheless led to the successful adoption of the ATT by the UN General Assembly on 2 April 2013, by 154 votes to 3, with 23 abstentions. The three negative votes were Syria, the Democratic People's Republic of Korea, and Iran.
As expected a total of 61 states signed the ATT at the signature ceremony, which represent a concrete start as well as a clear indication of the worldwide commitment to the ATT. The following signatory states are: Albania, Antigua and Barbuda, Argentina, Australia, Austria, the Bahamas, Belgium, Benin, Brazil, Burkina Faso, Burundi, Chile, Costa Rica, Côte d'Ivoire, Croatia, Cyprus, the Czech Republic, Denmark, Djibouti, the Dominican Republic, Estonia, Finland, France, Grenada, Greece, Guyana, Hungary, Iceland, Ireland, Italy, Jamaica, Japan, the Republic of Korea, Latvia, Liechtenstein, Lithuania, Luxembourg, Mali, Malta, Mexico, Montenegro, Mozambique, the Netherlands, New Zealand, Norway, Palau, Panama, Portugal, Romania, St Lucia, St Vincent and the Grenadines, Senegal, the Seychelles, Slovenia, Spain, Sweden, Switzerland, Tanzania, Trinidad and Tobago, Uruguay, and the United Kingdom.
This signing ceremony opens the door for the process of ratification. Initial estimates suggest that the 50 ratifications could be secured within less than two years. One should remember, however, that under Article 18 of the 1969 Vienna Convention on the Law of Treaties, a state is obliged to refrain from acts that would defeat the object and purpose of a treaty when it has signed the treaty or has expressed its consent to be bound by the treaty, pending the treaty's entry into force.
The ATT is now the blueprint for the regulation of international arms trade. It ties any transfer of conventional arms — or their ammunition/munitions, parts or components— to the human rights records of a purchasing country. As noted in earlier posts, several provisions relate to human rights and humanitarian law, notably the criteria governing denials of proposed arms transfer – Articles 6 and 7 – which represent what has been called the 'heart' of the treaty. In fact, this is not really an instrument about disarmament or prohibiting weapons, nor is it a trade treaty; as Andrew Clapham has noted, it is a treaty about human rights, a treaty about preventing violations of international humanitarian law, and a treaty which aims at halting terrorist acts, transnational organized crimes and the worst international crimes: genocide, crimes against humanity and war crimes.
This signature of the treaty is of course only the beginning; the hard work starts now in terms of strict interpretation and full and effective implementation of the instrument. Although the ATT will certainly change how arms transfer decisions will be made, it is important to remind ourselves that the true measure of success will be the way it changes people's lives in the years to come.
Dr Gilles Giacca (Programme Co-ordinator of the Oxford Martin School Programme on Human Rights for Future Generations) closely followed the United Nations Conference on the Arms Trade Treaty in New York. Further insights can be found on the Arms Trade Treaty legal blog. He also initiated the drafting of a detailed legal commentary, which will be issued by a leading academic publisher in 2014.
Pingback: UN Arms Trade Treaty opens for signature | International Law Observer | A blog dedicated to reports, commentary and the discussion of topical issues of international law | {
"redpajama_set_name": "RedPajamaCommonCrawl"
} | 3,518 |
Lost to Apathy is the fifth EP by Swedish melodic death metal band Dark Tranquillity. It was released on 15 November 2004 through Century Media Records. All songs were recorded from the Character album, except the live version of "Undo Control" which is from the previously released Live Damage DVD. The album also includes the video for "Lost to Apathy", produced by Roger Johansson (who worked with other bands such as The Haunted, In Flames, and HammerFall) and a Dark Tranquillity screensaver.
"Lost to Apathy" is on the Alone in the Dark (see Page) soundtrack. "Derivation TNB" is a joint remix of some clean riffs from "The New Build", "Mind Matters" and "Dry Run", songs from Character. A shorter version (only the "New Build" riff) can be found at the end of "Through Smudged Lenses", also in the Character album. The EP also includes an industrial remix of "The Endless Feed".
Track listing
Multimedia enhancements
Credits
Dark Tranquillity
Mikael Stanne − vocals
Martin Henriksson − Guitar
Niklas Sundin − Guitar
Michael Nicklasson − Bass guitar
Martin Brändström − keyboards and electronics
Anders Jivarp − drums
Guests
All tracks mastered by Peter In de Betou at Tailor maid
Artwork design by Cabin Fever Media
References
External links
Lost to Apathy at Dark Tranquillity's official site
Dark Tranquillity albums
2004 EPs
Century Media Records EPs | {
"redpajama_set_name": "RedPajamaWikipedia"
} | 9,601 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.