Skip to content

Commit

Permalink
Removed XC (histcounts) and its associated predefined literals (`…
Browse files Browse the repository at this point in the history
…X7`)

The reasons, as stated in the doc, are as follows. `histc`.  would be a
little redundant; compare histc(x,unique(x)) with 8\#u or SY'; or
compare histc(x,y) with !=s. Besides, MATLAB's histc is deprecated and
replaced by histcounts. The latter works differently; and I preferred
the old histc behaviour: given x = [10 20 30 20 30],
histcounts(x,unique(x)) gives [1 4] whereas histc(x,unique(x)) gives [1
2 2].
  • Loading branch information
lmendo committed Jul 19, 2017
1 parent 10ee866 commit 40b4559
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 36 deletions.
Binary file modified funDef.mat
Binary file not shown.
2 changes: 1 addition & 1 deletion funDef.txt
Expand Up @@ -611,7 +611,7 @@ XB 1 1 1 1 1 1 true true true true if ~iscell(in{1}) convert from binary to de
YB 1 2 1 2 1 1 1 true true true true out{1} = dec2bin(in{:}); convert decimal number to binary string \matlab|dec2bin|. \sa \matl|B|
ZB 1 1 1 1 1 1 true true true true out{1} = bin2dec(in{1}); convert binary string to decimal number \matlab|bin2dec|. \sa \matl|XB|
C
XC 1 7 2 1 3 1 true true true true [out{:}] = histcounts(in{:}); histogram bin counts \matlab+histcounts+
XC
YC 2 4 2 1 1 1 true true true true if numel(in{2})==1, if size(in{1},1)==1, in{2} = [1 in{2}]; else in{2} = [in{2} 1]; end; end rearrange array blocks into columns \matlab+im2col+. If the second input is a scalar \matlab+n+, it is transformed into \matlab+[1 n]+ if the first input is a row vector, or to \matlab+[n 1]+ otherwise. First input can also be a cell array. \sa \matl+ZC+
if iscell(in{1})
x = reshape(1:numel(in{1}), size(in{1}));
Expand Down
Binary file modified help.mat
Binary file not shown.
3 changes: 2 additions & 1 deletion outtakes/funDef_Outtakes.txt
Expand Up @@ -137,4 +137,5 @@ U 1 1 1 1 1 1 true true true true if ~ischar(in{1}), in{1} = char(in{1}); end
y = [];
end
out{1} = y; clear ok r valid
Z= 3 3 3 1 1 1 true true true true if isnumeric(in{1}), in{1} = char(in{1}); end; if isnumeric(in{2}), in{2} = char(in{2}); end; out{1} = strncmp(in{:}); compare first characters of strings \matlab+strncmp+. If first or second inputs are numeric they are converted to char
Z= 3 3 3 1 1 1 true true true true if isnumeric(in{1}), in{1} = char(in{1}); end; if isnumeric(in{2}), in{2} = char(in{2}); end; out{1} = strncmp(in{:}); compare first characters of strings \matlab+strncmp+. If first or second inputs are numeric they are converted to char
XC 1 7 2 1 3 1 true true true true [out{:}] = histcounts(in{:}); histogram bin counts \matlab+histcounts+
20 changes: 20 additions & 0 deletions outtakes/preLit_Outtakes.txt
@@ -1,3 +1,23 @@
X7

1 'BinWidth'
2 'BinLimits'
3 'Normalization'
4 'count'
5 'probability'
6 'countdensity'
7 'pdf'
8 'cumcount'
9 'cdf'
10 'BinMethod'
11 'auto'
12 'scott'
13 'fd'
14 'integers'
15 'sturges'
16 'sqrt'


X9

1 'shuffle'
Expand Down
Binary file modified preLit.mat
Binary file not shown.
20 changes: 0 additions & 20 deletions preLit.txt
Expand Up @@ -127,26 +127,6 @@ X6
35 'notpacked'


X7

1 'BinWidth'
2 'BinLimits'
3 'Normalization'
4 'count'
5 'probability'
6 'countdensity'
7 'pdf'
8 'cumcount'
9 'cdf'
10 'BinMethod'
11 'auto'
12 'scott'
13 'fd'
14 'integers'
15 'sturges'
16 'sqrt'


X8

1 'cityblock'
Expand Down
16 changes: 8 additions & 8 deletions spec/MATL_spec.aux
Expand Up @@ -83,10 +83,10 @@
\newlabel{case: 2nd input: help}{{3}{37}{Usage\relax }{Item.11}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Example of parsed code with automatic comments\relax }}{38}{figure.caption.6}}
\newlabel{fig: code with automatic comments}{{1}{38}{Example of parsed code with automatic comments\relax \relax }{figure.caption.6}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {9.2}Structure}{38}{subsection.9.2}}
\newlabel{parte: compiler structure}{{9.2}{38}{Structure\relax }{subsection.9.2}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Example of command-line help\relax }}{39}{figure.caption.7}}
\newlabel{fig: help}{{2}{39}{Example of command-line help\relax \relax }{figure.caption.7}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {9.2}Structure}{39}{subsection.9.2}}
\newlabel{parte: compiler structure}{{9.2}{39}{Structure\relax }{subsection.9.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {10}Compatibility with Octave}{41}{section.10}}
\newlabel{parte: compatibility with Octave}{{10}{41}{Compatibility with Octave\relax }{section.10}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {10.1}Compiler}{41}{subsection.10.1}}
Expand All @@ -95,13 +95,13 @@
\newlabel{parte: online}{{11}{46}{Running MATL online\relax }{section.11}{}}
\@writefile{toc}{\contentsline {section}{\numberline {12}Example programs explained}{46}{section.12}}
\newlabel{parte: example programs explained}{{12}{46}{Example programs explained\relax }{section.12}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {12.1}Example 1: infinite loop}{46}{subsection.12.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {12.1}Example 1: infinite loop}{47}{subsection.12.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {12.2}Example 2: first 10 Fibonacci numbers}{47}{subsection.12.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {12.3}Example 3: unique characters from string in original order}{47}{subsection.12.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {12.4}Example 4: unique characters from string in original order, manual approach}{47}{subsection.12.4}}
\@writefile{toc}{\contentsline {subsection}{\numberline {12.4}Example 4: unique characters from string in original order, manual approach}{48}{subsection.12.4}}
\@writefile{toc}{\contentsline {section}{\numberline {13}Acknowledgments}{48}{section.13}}
\@writefile{toc}{\contentsline {section}{Appendix \numberline {A}Detailed function definitions}{49}{Appendix.a.A}}
\newlabel{parte: list of functions}{{A}{49}{Detailed function definitions\relax }{Appendix.a.A}{}}
\@writefile{toc}{\contentsline {section}{Appendix \numberline {A}Detailed function definitions}{50}{Appendix.a.A}}
\newlabel{parte: list of functions}{{A}{50}{Detailed function definitions\relax }{Appendix.a.A}{}}
\@writefile{lot}{\contentsline {table}{\numberline {6}{\ignorespaces Function definitions}}{50}{table.6}}
\newlabel{tab: funDef}{{6}{50}{Detailed function definitions\relax }{table.6}{}}
\gdef \LT@i {\LT@entry
Expand Down Expand Up @@ -221,5 +221,5 @@
{1}{127.09738pt}\LT@entry
{1}{23.69952pt}\LT@entry
{1}{125.09738pt}}
\@writefile{lot}{\contentsline {table}{\numberline {7}{\ignorespaces Output of predefined literal functions\relax }}{69}{table.caption.8}}
\newlabel{tab: preLit}{{7}{69}{Output of predefined literal functions\relax \relax }{table.caption.8}{}}
\@writefile{lot}{\contentsline {table}{\numberline {7}{\ignorespaces Output of predefined literal functions\relax }}{70}{table.caption.8}}
\newlabel{tab: preLit}{{7}{70}{Output of predefined literal functions\relax \relax }{table.caption.8}{}}
Binary file modified spec/MATL_spec.pdf
Binary file not shown.
4 changes: 3 additions & 1 deletion spec/MATL_spec.tex
Expand Up @@ -1044,7 +1044,7 @@ \section{Table of functions}
\item
\matlab+issorted+: it can be easily realized by comparing with the result of \matlab+sort+. Of course \matlab+issorted+ would be more time-efficient, but time efficiency is not the main purpose of code golf.
\item
\matlab+rem+: probably having \matlab+mod+ is enough.
\matlab+rem+: having \matlab+mod+ is probably enough.
\item
matrix inverse: not used very often; and can be done with \matlab+eye+ and matrix division
\item
Expand All @@ -1061,6 +1061,8 @@ \section{Table of functions}
\matlab+strcmpi+: there's \matlab+strcmp+.
\item
\matlab+convmtx+: \matlab+convmtx(x,n)+ can be realized as \matlab+conv2(x, eye(n))+.
\item
\matlab+histcounts+ / \matlab+histc+: \matlab+histc+ would be a little redundant; compare \matlab+histc(x,unique(x))+ with \matl{8\#u} or \matl{SY'}; or compare \matlab+histc(x,y)+ with \matl{!=s}. Besides, MATLAB's \matlab+histc+ is deprecated and replaced by \matlab+histcounts+. The latter works differently; and I preferred the old \matlab+histc+'s behaviour: given \matlab+x = [10 20 30 20 30]+, \matlab+histcounts(x,unique(x))+ gives \matlab+[1 4]+ whereas \matlab+histc(x,unique(x))+ gives \matlab+[1 2 2]+.
\end{itemize}

%Remove these?
Expand Down
1 change: 0 additions & 1 deletion spec/funDefTable/funDefTable.tex
Expand Up @@ -91,7 +91,6 @@
\matl{XB} & 1 & 1 & \matlab|bin2dec(char(logical(...)+'0'))|. Works also for cell array input. \sa \matl{ZB} \\
\matl{YB} & 1--2 (1 / 2) & 1 & \matlab|dec2bin|. \sa \matl{B} \\
\matl{ZB} & 1 & 1 & \matlab|bin2dec|. \sa \matl{XB} \\
\matl{XC} & 1--7 (2) & 1--3 (1) & \matlab+histcounts+ \\
\matl{YC} & 2--4 (2) & 1 & \matlab+im2col+. If the second input is a scalar \matlab+n+, it is transformed into \matlab+[1 n]+ if the first input is a row vector, or to \matlab+[n 1]+ otherwise. First input can also be a cell array. \sa \matl{ZC} \\
\matl{ZC} & 2--3 (2) & 1 & \matlab+im2col(..., 'distinct')+. If the second input is a scalar n, it is transformed into [1 n] if the first input is a row vector, or to [n 1] otherwise. First input can also be a cell array. \sa \matl{YC} \\
\matl{D} & 0-- (1) & 0--1 (0 / 1) & (i) With $0$ outputs: If $1$ input: \matlab+disp(num2str(..., '%.15g '))+. If several inputs: \matlab+disp(num2str(eachInput,lastInput))+, where \matlab+eachInput+ loops over all inputs but the last. In either case, (nested) cell arrays are (recursively) unboxed in linear order. Most characters below 32 are replaced by space. (ii) With $1$ output: \matlab+mat2str+. Empty arrays are always shown as \matlab+[]+, \matlab+''+ or \matlab+{}+. Most input characters below 32 are replaced by space. Cell arrays are converted to string representation too. Optional second, third and fourth inputs respectively specify column separator, row separator and whether the separators should be used for non-cell arrays too. Second and third output are converted to char is needed. \sa \matl{XD}, \matl{YD}, \matl{ZD} \\
Expand Down
Binary file modified spec/functionTable/MATL.xlsx
Binary file not shown.
6 changes: 2 additions & 4 deletions spec/functionTable/function_table.eps

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified spec/functionTable/function_table.pdf
Binary file not shown.

0 comments on commit 40b4559

Please sign in to comment.