Skip to content

Commit

Permalink
Still little collateral damage in sparse tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
vermaseren committed May 10, 2016
1 parent c7aa583 commit 3754ebb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
36 changes: 20 additions & 16 deletions doc/manual/statements.tex
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,12 @@ \section{bracket}
(see \ref{brackets}). \vspace{4mm}

\noindent The list of names can contain names of symbols, vectors,
functions and tensors. In addition it can contain dotproducts. There should
be only one bracket or antibracket (see \ref{substaabrackets}) statement
in each module. If there is more than one, only the last one has an effect.
\vspace{4mm}
functions, tensors and sets. In addition it can contain dotproducts. There
should be only one bracket or antibracket (see \ref{substaabrackets})
statement in each module. If there is more than one, only the last one has
an effect. The presence of a set has the same effect as having all the
symbolic elements of the set declared in the (anti)bracket
statement.\vspace{4mm}

\noindent The presence of a $+$ or $-$ after the bracket (or anti bracket)
refers to potential indexing of the brackets\index{brackets!indexing}.
Expand Down Expand Up @@ -5285,18 +5287,20 @@ \section{table}
very special instance of a function. Hence it can be either
commuting\index{commuting} or noncommuting\index{noncommuting}. The table
statement declares its function to be commuting. A noncommuting table is
declared with the ntable\index{ntable} statement (see \ref{substantable}). A
table has a number of table\index{table indices} indices (at least one!)
and after that it can have a number of regular function arguments with or
without wildcarding. The table indices can come in two varieties:
matrix\index{matrix like} like or sparse\index{sparse}. In the case of a
matrix like table\index{table!matrix like}, for each of the indices a range
has to be specified. \FORM\ then reserves a location for each of the
potential elements. For a sparse table\index{table!sparse} one only
specifies the number of indices. Sparse tables take less space, but they
require more time searching whether an element has been defined. For a
matrix like table \FORM\ can look directly whether an element has been
defined. Hence one has a tradeoff between space and speed.\vspace{4mm}
declared with the ntable\index{ntable} statement (see \ref{substantable}).
A table has a number of table\index{table indices} indices (in the case of
zero indices the table has to be sparse) and after that it can have a
number of regular function arguments with or without wildcarding. The table
indices can come in two varieties: matrix\index{matrix like} like or
sparse\index{sparse}. In the case of a matrix like table\index{table!matrix
like}, for each of the indices a range has to be specified. \FORM\ then
reserves a location for each of the potential elements. For a sparse
table\index{table!sparse} one only specifies the number of indices. Sparse
tables take less space, but they require more time searching whether an
element has been defined. For a matrix like table \FORM\ can look directly
whether an element has been defined. Hence one has a tradeoff between space
and speed. A zero-dimensional (sparse) table has of course only a single
element.\vspace{4mm}

\noindent Table elements are defined with the fill\index{fill} statement (see
\ref{substafill}). Fill statements for table elements cannot be used before
Expand Down
1 change: 1 addition & 0 deletions sources/comexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ int CoFill(UBYTE *inp)
}
else { p--; }
sum = 0;
p3 = p;
goto andagain;
}
for ( sum = 0, i = 0, w = oldwp; i < T->numind; i++ ) {
Expand Down
15 changes: 5 additions & 10 deletions sources/proces.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,15 +1180,13 @@ Important: we may not have enough spots here
if ( functions[funnum-FUNCTION].spec == 0
|| ( t[2] & (DIRTYFLAG|CLEANPRF) ) != 0 ) { funflag = 1; }
if ( *t <= MAXBUILTINFUNCTION ) {
if ( *t <= DELTAP && *t >= THETA ) { /* Speeds up by 2 or 3 compares */
if ( *t == THETA || *t == THETA2 ) {
WORD *tstop, *tt2, kk;
tstop = t + t[1];
tt2 = t + FUNHEAD;
while ( tt2 < tstop ) {
if ( *tt2 > 0 && tt2[1] != 0 ) {
/* funflag = 2; */
goto DoSpec;
}
if ( *tt2 > 0 && tt2[1] != 0 ) goto DoSpec;
NEXTARG(tt2)
}
if ( !AT.RecFlag ) {
Expand All @@ -1210,10 +1208,7 @@ Important: we may not have enough spots here
tstop = t + t[1];
tt2 = t + FUNHEAD;
while ( tt2 < tstop ) {
if ( *tt2 > 0 && tt2[1] != 0 ) {
/* funflag = 2; */
goto DoSpec;
}
if ( *tt2 > 0 && tt2[1] != 0 ) goto DoSpec;
NEXTARG(tt2)
}
if ( !AT.RecFlag ) {
Expand All @@ -1229,7 +1224,7 @@ Important: we may not have enough spots here
goto ReStart;
}
}
}
} }
else if ( *t == DISTRIBUTION && t[FUNHEAD] == -SNUMBER
&& t[FUNHEAD+1] >= -2 && t[FUNHEAD+1] <= 2
&& t[FUNHEAD+2] == -SNUMBER
Expand Down Expand Up @@ -1670,7 +1665,7 @@ Important: we may not have enough spots here
mm = T->mm;
if ( T->sparse ) {
t = t1+FUNHEAD;
if ( T->numind ) { isp = 0; }
if ( T->numind == 0 ) { isp = 0; }
else {
for ( i = 0; i < T->numind; i++, t += 2 ) {
if ( *t != -SNUMBER ) break;
Expand Down

0 comments on commit 3754ebb

Please sign in to comment.