As well-known, a Hadamard matrix is a square matrix with all coefficients $\pm 1$
and pairwise orthogonal rows or columns. Such matrices exist conjecturally 
in every dimension divisible by $4$. Call a matrix with an odd number $n$ of columns an "almost Hadamard matrix" if all its coefficients are $\pm 1$ and if all scalar products between distinct rows are $\pm 1$. We want to maximize the
number of rows in almost Hadamard matrices: If $n\equiv 3\pmod 4$ this is easy:
erase the last column of a Hadamard matrix of size $n+1$ (provided such a matrix exists). This yields a matrix with $n+1$ rows which is best possible. If $n\equiv 1\pmod 4$ the number of rows cannot exceed $n$ (argument: up to replacing rows by their opposites, we can suppose that all rows have an even 
number of coefficients $-1$. All scalar products between rows are now 
equivalent to $n$ modulo $4$ and a rank computation of the corresponding Gram matrix gives the result). 


A solution with $n-1$ rows in the case $n\equiv 1\pmod 4$
is obtained by adding an arbitrary last column 
(with coefficients $\pm 1$) to a Hadamard matrix of size $n-1$.


For $n=5$ (and of course for $n=1$) there is a solution with $n$ rows but I am
unaware of the existence of solutions with $n$ rows for any $n\equiv 1\pmod 4$
greater than $5$. Are there any?


Is there any literature on such almost Hadamard matrices (perhaps under a different terminology, they are for example related to systems of equiangular lines)?



Almost Hadamard matrices
You can find most useful information on [this](http://www.indiana.edu/~maxdet/) page, which however has not been updated since 2012. The initial question is different, but the partial solution they have found is relevant here. 


Quote:  

**The *Hadamard maximal determinant problem* asks when a matrix of a given order with entries -1 and +1 has the largest possible determinant.** 


If the determinant of such an extremal matrix $M=M\_n$ for $n\equiv1\pmod4$ attains [Barba's bound](http://www.indiana.edu/~maxdet/bounds.html) $$\sqrt{ (2n-1) (n-1)^{n-1}},$$ which obviously needs $(2n-1)$ to be a perfect square, then $$M^TM=MM^T=J\_n+(n-1)I\_n$$ where $J\_n$ is the all-$1$-matrix. So this matrix is an "almost Hadamard" (a.H.) matrix. (Moreover, all scalar products are $+1$.)  

Examples are given for $n=5,13,25,41,61,113$.  

If $2n-1=(2q+1)^2$ and $q$ is a prime power (note that the examples correspond to $q=1,2,3,4,5,7$), there is an explicit construction according to the paper  

*A. E. Brouwer, An infinite series of symmetric designs, Math. Centrum
 Amsterdam Report ZW 202/83 (1983)*.


If $(2n-1)$ is *not* a perfect square at all, we cannot conclude inversely that no square a.H. matrix exists, though I have a (kind of) heuristic argument against its existence:  

What we can conclude is that $M^TM$ must have a determinant smaller than Barba's bound because it must be a square. This means that the set of column vectors cannot be split in two sets $V$ and $W$ such that $v^T\_iv\_j=w\_i^Tw\_j=+1$ and $v^T\_iw\_j=-1$. (Nor, similarly, for the rows.)  

Before explaining why, here is an illustration of what I mean with those two sets. Take for instance the matrix $M$ given for $n=13$ in [Gottfried Helms' comment](https://mathoverflow.net/questions/156735/almost-hadamard-matrices/314923#comment784094_156735). After some row and column permutations we have 
 $$MM^T=-J\_{13}+2J\_5\oplus J\_8+12I\_{13}$$ and $$M^TM=-J\_{13}+2J\_3\oplus J\_{10}+12I\_{13},$$ written in compact form: $MM^T=$



```
n 1 1 1 1 - - - - - - - -
1 n 1 1 1 - - - - - - - -
1 1 n 1 1 - - - - - - - -
1 1 1 n 1 - - - - - - - -
1 1 1 1 n - - - - - - - -
- - - - - n 1 1 1 1 1 1 1
- - - - - 1 n 1 1 1 1 1 1
- - - - - 1 1 n 1 1 1 1 1
- - - - - 1 1 1 n 1 1 1 1
- - - - - 1 1 1 1 n 1 1 1
- - - - - 1 1 1 1 1 n 1 1
- - - - - 1 1 1 1 1 1 n 1
- - - - - 1 1 1 1 1 1 1 n

```

and similarly for $M^TM$. That is, the rows of $M$ come in two sets of sizes $5$ and $8$, while the columns of $M$ form two sets of sizes $3$ and $10$.  

Now *the determinant of such a block matrix is always $(2n-1) (n-1)^{n-1}$, independently of the block sizes.* So if $(2n-1)$ is not a square, the rows and columns cannot be partitioned in such a way, which means that an $n\times n$ a.H. matrix cannot have this kind of "symmetries". And heuristically, the existence of such a matrix seems to me about as improbable as the existence of a projective plane of non prime-power order...


BUT based on the data of the above site, e.g. [the $n=93$ example](http://www.indiana.edu/~maxdet/d93.html), I would conjecture that $n-1$ almost orthogonal vectors always exist. 


