\documentclass[twocolumn]{article}
\usepackage{booktabs}
\usepackage{marginnote}
\usepackage{textcomp}
\usepackage[T1]{fontenc}

\begin{document}

\title{PsimagLite Feature Proposal:
Input System}
\author{G.A.}
\maketitle

\section{Lexical}
ASCII.
Define EOF, whitespace, and EOL.
Comments: \verb!#! until EOL

Tokens + Strings Literals + Other literals

Keywords: Types: integer, real, complex, char, string, function, vector, matrix. 
Attributes: require const. Properties: defined, typeof.
\begin{verbatim}
require integer a;
# declare pi, make pi value constant
const real pi = 3.1415927;
pi = 3.14; # ERROR, pi constant
#
integer b = 3;
b = 4; # OK
b = 3.5; # ERROR, not integer
#
c = 3.5; # ERROR c undefined
\end{verbatim}

\subsection{Strings and Characters} 
\begin{verbatim}
string s="Hello, ";
char c = 'W';
s = s + c + "orld!";
string d = "'";
char e = '"';
\end{verbatim}
Properties: \verb!s.length! \verb!s[0]!

\subsection{Scalars} 
\begin{verbatim}
integer a=1; # defines int scalar
complex b=3*i + 1.2; # defines complex scalar
a = a + 1.5; # OK, a promoted to real
a = a + 1.5*i; # ERROR
b = b + 1.5*i; # OK
\end{verbatim}

\subsection{Vectors} 
\begin{verbatim}
vector.integer v=[ 1, 2, 3 ];
vector w=[ 1, a, 3*a ];
vector x=v+w;
vector y = [];
y.size = 4;
# equivalent to y = [ 1, 1 ,1, 1]
y = [1, ... ]; 
\end{verbatim}
Properties: \verb!v.size! \verb!v[0]!
Vectors values: scalars, strings, and characters.

\subsection{Matrices} 
\begin{verbatim}
matrix m = [[0, 1], [1, 0]];
# As vector of vectors
vector v1 = [0,1];
vector v2 = [1,0];
matrix m2 = [v1, v2];
# As a hash
hash m2 = ({ rows : 4, cols : 2, data :
[0, 1, 1, 0, 0, 1, 1, 0] });
matrix m3 = 3.5*m;
\end{verbatim}
Properties: \verb!rows! \verb!cols! \verb!data!. 
Matrix values: scalars.

\subsection{Groups} 
\begin{verbatim}
groupName={ name="chain";
Connections=[ 1, 1 ];
string a = "my local value"; };
#The above would be lowered to
groupName.name="chain";
groupName.Connections=[ 1, 1 ];
string groupName.a = "my local value";
# Groups can be nested
# Unnamed groups?
\end{verbatim}

\section{Operators and Functions}
\begin{tabular}{lll}\toprule
Op. & Type & Description\\\midrule
$+,-$ & 3, [], [[]] & scalar, vector, matrix\\
$+$ & ``''& str. + str. or str. + char\\
$*,/$ & 3*3, 3/3 & scalar $*$ and $/$\\
$*$ & various & 3*[], 3*[[]], [[]]*[]\\
$*$ & [[]]*[[]] & matrix*matrix = matrix\\
$*$ & []*[] & vector*vector = scalar\\
$**$ & 3$**$2 & $=9$\\
$\%$ & 3\%2 & modulus\\
$[]$ & vectors & entry\\
{[}\textquotedbl\textquotedbl{]} & hashes & value given key\\
(,) & matrices & matrix element\\
\bottomrule\\
\end{tabular}

Operators for binary numbers? User defined operators are not allowed.
User defined functions must be entered as a string in prefix notation.
\begin{verbatim}
# f(t) = 3.5*cos(t)
function f = "*,cos,%t,3.5";
real a = f(0.25); # = 3.3911...
\end{verbatim}
Mathematical functions for scalars:
\texttt{abs, conj, sqrt, exp, log, sin, cos, atan}.
Functions for complex numbers \verb!abs! \verb!real! \verb!imag! \verb!arg! 
Example \texttt{real a = 3.5*sin(b);}

Inputs 52 from the TestSuite follows.
\begin{tiny}
\begin{verbatim}
##1.0
TotalNumberOfSites=8;
NumberOfTerms=1;
DegreesOfFreedom=1;
GeometryKind="ladder";
GeometryOptions="ConstantValues";
dir0:Connectors = [1.0];
dir1:Connectors = [0.5];
LadderLeg=2;
Model="HubbardOneBand";
hubbardU = [10, ... ];
potentialV = [0, ...];
SolverOptions="TimeStepTargetting";
Version="4.52";
OutputFile="data52.txt";
InfiniteLoopKeptStates=200;
FiniteLoops = [
[ 3, 400, 0],
[-6, 400, 0],
[ 6, 200, 0]
];
RepeatFiniteLoopsFrom=1;
RepeatFiniteLoopsTimes=5;

TargetElectronsUp=4;
TargetElectronsDown=4;
GsWeight=0.1;
TSPTau=0.1;
TSPTimeSteps=5;
TSPAdvanceEach=6;
TSPAlgorithm="Krylov";
TSPSites = [4, 2];
TSPLoops = [1, 1];
TSPProductOrSum="product";

TSPOperator="expression";
OperatorExpression="c+(-1.0)*c*c?1*c?1'+c?1+(-1.0)*c?1*c*c'";

TSPOperator="expression";
OperatorExpression="c'*c?1*c?1'+c?1'*c*c'";


#ci getTimeObservablesInSitu 2 '<P0|nup|P0>'
#ci getTimeObservablesInSitu 4 '<P0|nup|P0>'
#ci getTimeObservablesInSitu 5 '<P0|nup|P0>'
#ci getTimeObservablesInSitu 2 '<P0|doubleOcc|P0>'
#ci getTimeObservablesInSitu 4 '<P0|doubleOcc|P0>'
#ci getTimeObservablesInSitu 5 '<P0|doubleOcc|P0>'
\end{verbatim}
\end{tiny}

Inputs 340 from the TestSuite follows.
\begin{tiny}
\begin{verbatim}
##1.0
TotalNumberOfSites=8;
Orbitals=2;
NumberOfTerms=3;

gt0={ # gt means geometry term
  DegreesOfFreedom=Orbitals;
  GeometryKind="ladderx";
  GeometryOptions="ConstantValues";
  LadderLeg=2;
  dir0:Connectors = [ # x-dir
    [-0.058, 0],
    [0, -0.2196]];
  dir1:Connectors = [ # y-dir
    [-0.2196, 0],
    [0, -0.058]];
  dir2:Connectors = [ # x+y
    [0.20828, 0.079],
    [0.079, 0.20828]];
  dir3:Connectors = [ # x-y
    [0.20828, -0.079]
    [-0.079, 0.20828]];
};

gt1={
  DegreesOfFreedom=1;
  GeometryKind="ladderx";
  GeometryOptions="ConstantValues";
  LadderLeg=2;
  dir0:Connectors = [0.1];
  dir1:Connectors = [0.1];
  dir2:Connectors = [0.02];
  dir3:Connectors = [0.02];
};

gt2={ # gt means geometry term
  DegreesOfFreedom=Orbitals;
  GeometryKind="ladderx";
  GeometryOptions="ConstantValues";
  LadderLeg=2;
  dir0:Connectors = [ # x-dir
    [-0.058, 0],
    [0, -0.2196]];
  dir1:Connectors = [ # y-dir
    [-0.2196, 0],
    [0, -0.058]];
  dir2:Connectors = [ # x+y
    [0.20828, 0.079],
    [0.079, 0.20828]];
  dir3:Connectors = [ # x-y
    [0.20828, -0.079]
    [-0.079, 0.20828]];
};

hubbardU	 = [0.0, 0.0, 0.0, 0.0];
potentialV = [0, ...32];

Model="FeAsBasedScExtended";
FeAsMode="INT_PAPER33";
SolverOptions="none";
Version="61289987cdd32b8485213ac0415baf4e9cd16432";
OutputFile="data340.txt";
InfiniteLoopKeptStates=60;
FiniteLoops = [
[ 3, 100, 0],
[-3, 100, 0],
[-3, 100, 0],
[ 3, 100, 0]]; # note the abbreviation here
TargetElectronsUp=8;
TargetElectronsDown=TargetElectronsUp;
\end{verbatim}
\end{tiny}
\end{document}
