C++ template, linking error I have a problem in calling a template class I have. I declared a new type name Array, which is a template;  In the .hpp file:  template &lt;typename T&gt; class Array { public:    Array(); };   In the .cpp file:  template &lt;typename T&gt; Array&lt;T&gt;::Array() { //Do something }   In main:  Array&lt;int&gt; arr;   I get Linkage error: unresolved external symbol to the ctor.  Any Idea?
Why can templates only be implemented in the header file? Quote from :     The only portable way of using templates at the moment is to implement them in header files by using inline functions.   Why is this?  (Clarification: header files are not the only portable solution. But they are the most convenient portable solution.)
Converting the beta coefficient from matrix to scalar notation in OLS regression If GCD $(a_1,\ldots, a_n)=1$ then there's a matrix in $SL_n(\mathbb{Z})$ with first row $(a_1,\ldots, a_n)$ Let $n \geq 2$. Let $a_1, a_2, \ldots, a_n$ be $n$ integers such that $\gcd\left(a_1, a_2, \ldots, a_n\right) = 1$. Prove that there exists a matrix in $\operatorname{SL}_n\left(\mathbb{Z}\right)$ whose first row is $\left(a_1, a_2, \ldots, a_n\right)$.   Since the gcd of the integers $a_1,\ldots, a_n$ is $1$, there exists weights $x_i \in \mathbb{Z}$ such that $a_1x_1+\cdots+ a_nx_n=1$. My two ideas are (a) to brute force construct an $n\times n$ matrix with first row $a_1,\ldots ,a_n$ and to construct the remaining rows such that the determinant is $\sum a_ix_i=1$ or (b) to use induction.  (a) (Constructive) This is tedious since once I find a way to construct the remaining $n-1$ rows to ensure that $a_1x_1$ appears in the determinant, I am not sure how to modify these $n-1$ rows to ensure  that only the terms $a_ix_i$ appear in the cofactor expansion. If such a matrix exists, I'd like to see it.  (ii) (Non-constructive) If I proceed by induction then the base case $n=2$ is settled since I can choose the 2nd row to be $-x_2, x_1$ so that the determinant is $a_1x_1-a_2(-x_2)=1$. However, I'm not sure how to use the inductive hypothesis to show that if I can construct such an $n\times n$-matrix then I can construct an $\left(n+1\right) \times \left(n+1\right)$-matrix with the desired property. In particular, if the gcd $(a_1,\ldots ,a_{n+1})$ is $1$, it is not necesarry that the gcd of any $n$ of these terms is $1$, so induction may not even apply here.  How can I construct such a matrix or prove that one exists (without necessarily constructing it)? Quantum mechanics - how can the energy be complex? In section 134 of Vol. 3 (Quantum Mechanics), Landau and Lifshitz make the energy complex in order to describe a particle that can decay:  $$ E = E_0 - \frac{1}{2}i \Gamma. $$  The propagator $U(t) = \exp(-i H t)$ then makes the wavefunction die exponentially with time.  But also, $H$ is non-Hermitian.  My question: Do we have to modify the basic postulates of quantum mechanics (as described by Shankar, say, or the earlier sections of Landau &amp; Lifshitz) to describe unstable particles? Exercise 12 from SEC. 82 of Finite-Dimensional Vector Spaces - 2nd Edition by Paul R. Halmos.  If $A$ and $B$ are linear transformations on a finite-dimensional inner product space, and if $\textbf{0} \le A \leq B$, then $\det A \leq \det B$.  Notation: $0 \le A$ means that $A$ is positive.  If $\det B = 0$, choose $x \in \ker B$, then $0 \le ((B-A)x,x) = (Bx, x) - (Ax, x) = -(Ax, x) \le 0$. Therefore $\ker B \subseteq \ker A$ and $0 = det A \le det B = 0$. How to prove for the case when $B$ is invertible? Intuitively, I feel that since both $A$ and $B$ are positive their proper values are also positive and $B$'s proper values should be greater the $A$'s and same for determinants. CK2 is a big game with lots of variables, so I'll stick to adding them upon being requested to minimize the hassle.  Anyway, let's say that you have a lot of children and the oldest one claims all the land according to laws of succession. After the father dies, the circumstances will obviously piss off a lot of people (in my case that would be 6 out of 8 vassals and 4 siblings with an opinion of -50 and below one of which is a sister married to the Basileus of the Byzantine friggin' Empire, a case of excommunication, 4 failed assassination attempts under 3 years... and lots and lots of vikings). Let's also say that the current playable character is completely incompetent compare to the next sibling in line.  So, what would be the most optimal methods to off myself without further screwing over the countryside so the next heir in line has to fix it (if we assume that said heir is actually capable of doing so)?  This is my list of DLCs (not including music and unit packs):   Charlemange Legacy of Rome Sword of Islam The Republic Way of Life I want to keep Ubuntu but remove Windows. What are some useful, undocumented Mathematica functions? Left alignment in TikZ I know that for every $n\in\mathbb{N}$, $n\ge 1$, there exists $p(x)\in\mathbb{F}_p[x]$ s.t. $\deg p(x)=n$ and $p(x)$ is irreducible over $\mathbb{F}_p$.     I am interested in counting how many such $p(x)$ there exist (that is, given $n\in\mathbb{N}$, $n\ge 1$, how many irreducible polynomials of degree $n$ exist over $\mathbb{F}_p$).   I don't have a counting strategy and I don't expect a closed formula, but maybe we can find something like "there exist $X$ irreducible polynomials of degree $n$ where $X$ is the number of...".  What are your thoughts ? What are the differences between a bridge camera and a DSLR? How do I force TeX to completely use the 1st column? How do I force TeX to completely use the 1st column before writing to the second column?  Right now I dont have enough content to fill one whole page. So the left and right columns are equally filled, leaving 25% symmetrical empty page at bottom. How do I fill the left column first, and then the right?  \documentclass{article}  \usepackage{multicol} \usepackage[scale=0.9]{geometry} \usepackage{amssymb} \renewcommand{\labelitemi}{\tiny$\blacksquare$} \begin{document} \begin{multicols}{2}      %lots of text goes here  \end{multicols} \end{document} Are all limits solvable without L'Hôpital Rule or Series Expansion Let $F$ be a field and let $a \neq 0$ be a zero of the polynomial $a_0 + a_1x + . . . +a_nx^n$ in $F[x]$.  I want to show that $\frac{1}{a}$ is a zero of the polynomial $a_n + a_{n-1}x + . . . + a_0x^n$  How can I do this? Number of $(0,1)$ $m\times n$ matrices with no empty rows or columns I'm building a quick csv from a mysql table with a query like:  select DATE(date),count(date) from table group by DATE(date) order by date asc;   and just dumping them to a file in perl over a:  while(my($date,$sum) = $sth-&gt;fetchrow) {     print CSV "$date,$sum\n" }   There are date gaps in the data, though:  | 2008-08-05 |           4 |  | 2008-08-07 |          23 |    I would like to pad the data to fill in the missing days with zero-count entries to end up with:  | 2008-08-05 |           4 |  | 2008-08-06 |           0 |  | 2008-08-07 |          23 |    I slapped together a really awkward (and almost certainly buggy) workaround with an array of days-per-month and some math, but there has to be something more straightforward either on the mysql or perl side.   Any genius ideas/slaps in the face for why me am being so dumb?    I ended up going with a stored procedure which generated a temp table for the date range in question for a couple of reasons:   I know the date range I'll be looking for every time The server in question unfortunately was not one that I can install perl modules on atm, and the state of it was decrepit enough that it didn't have anything remotely Date::-y installed   The perl Date/DateTime-iterating answers were also very good, I wish I could select multiple answers! When I view most glass from the side it's green which I've found out is due to impurities in the glass specifically from iron oxide. Why is it when I view the larger face from an oblique angle, it isn't nearly as green? I cannot personally notice any different on the piece I have next to me even when I hold it at an angle that would be almost looking at the edge of the glass. It is pretty small (about 2.5" x 5" x .0625" or about 61mm x 127mm x 2mm, l x w x h) but I feel like it's big enough that I'd be looking through enough glass to get the green. An .mov video that is upside down in Windows appears right side up in OSX Custom Tools not Saving in Toolbar on Startup/ Normal.mxt? I am trying to save some tools that I have created into the default toolbar layout that is present when ArcMap 10.1 is launched.  It is possible to change the arrangement of toolbars, add new ones and even add in existing tools, but any custom tools I set in the commands category "geoprocessing tools" are gone and do not appear in the toolbar. How can I save these custom tools to the default layout that appears on startup?  Update:  Saving a document with the custom tools added and reopening it preserves the tools, but opening a template (10.1 mxd) containing the tools, then opening and older document will cause the tools to disappear. Oddly enough, any other changes made after the custom tools were added are preseved.  Update (03/18/2014):  I have upgraded to 10.2 and this has still not been fixed. I did not see this issue in the 10.21 changelog so I doubt it will address it. For those interested in this issue, I have started a forum post on the ESRI forums . I found this math "problem" on the internet, and I'm wondering if it has an answer:     Question: If you choose an answer to this question at random, what is the probability that you will be correct?      a. $25\%$      b. $50\%$      c. $0\%$      d. $25\%$   Does this question have a correct answer? How is missing data calculated on Likert Scale?